INNER CODE UNIT · Python

_apply_patch

althonos/pyhmmer · src/scripts/apply_patch.py:8

def _apply_patch(s, patch, revert=False):
    # see https://stackoverflow.com/a/40967337
    s = s.splitlines(keepends=True)
    p = patch.splitlines(keepends=True)
    
    i = 0
    while not p[i].startswith(("---", "+++")):
        i += 1
    p = p[i:]
    
    t = []
    i = 0
    sl = 0
    midx, sign = (1, "+") if not revert else (3, "-")
    while i < len(p) and p[i].startswith(("---", "+++")):
        i += 1  # skip header lines

    while i < len(p):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…