Skip to content

[pre-commit.ci] pre-commit autoupdate#21

Open
pre-commit-ci[bot] wants to merge 2 commits intomainfrom
pre-commit-ci-update-config
Open

[pre-commit.ci] pre-commit autoupdate#21
pre-commit-ci[bot] wants to merge 2 commits intomainfrom
pre-commit-ci-update-config

Conversation

@pre-commit-ci
Copy link
Copy Markdown
Contributor

@pre-commit-ci pre-commit-ci bot commented Feb 23, 2026

@bfi-bot
Copy link
Copy Markdown

bfi-bot commented Feb 23, 2026

Automated Pylint Report 🧑‍💻

Here is the formatted Pylint report:

************* Module bfi_dagster_project.assets.archiving
bfi_dagster_project/assets/archiving.py:255:0: 🎨 C0301: Line too long (114/100) (line-too-long)
bfi_dagster_project/assets/archiving.py:307:0: 🎨 C0301: Line too long (124/100) (line-too-long)
bfi_dagster_project/assets/archiving.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/archiving.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0914: Too many local variables (29/15) (too-many-locals)
bfi_dagster_project/assets/archiving.py:253:19: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/archiving.py:278:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/archiving.py:296:60: 🚨 E0606: Possibly using variable 'tar_file' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0912: Too many branches (21/12) (too-many-branches)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0915: Too many statements (90/50) (too-many-statements)
bfi_dagster_project/assets/archiving.py:249:22: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0914: Too many local variables (19/15) (too-many-locals)
bfi_dagster_project/assets/archiving.py:351:32: 🚨 E0601: Using variable 'log' before assignment (used-before-assignment)
bfi_dagster_project/assets/archiving.py:352:47: 🚨 E0601: Using variable 'dpath' before assignment (used-before-assignment)
bfi_dagster_project/assets/archiving.py:406:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0912: Too many branches (15/12) (too-many-branches)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0915: Too many statements (68/50) (too-many-statements)
************* Module bfi_dagster_project.assets.get_sequences
bfi_dagster_project/assets/get_sequences.py:74:0: 🎨 C0301: Line too long (118/100) (line-too-long)
bfi_dagster_project/assets/get_sequences.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/get_sequences.py:4:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/get_sequences.py:16:4: ⚠️ W0621: Redefining name 'target_sequences' from outer scope (line 113) (redefined-outer-name)
************* Module bfi_dagster_project.assets.transcode_retry
bfi_dagster_project/assets/transcode_retry.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/transcode_retry.py:10:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/transcode_retry.py:38:4: ⚠️ W0621: Redefining name 'reencode_failed_asset' from outer scope (line 460) (redefined-outer-name)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0914: Too many local variables (38/15) (too-many-locals)
bfi_dagster_project/assets/transcode_retry.py:150:8: ⚠️ W0621: Redefining name 'cmd' from outer scope (line 1) (redefined-outer-name)
bfi_dagster_project/assets/transcode_retry.py:99:12: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcode_retry.py:200:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0912: Too many branches (39/12) (too-many-branches)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0915: Too many statements (139/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:15:0: ♻️ R0915: Too many statements (144/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0914: Too many local variables (18/15) (too-many-locals)
bfi_dagster_project/assets/transcode_retry.py:394:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0912: Too many branches (17/12) (too-many-branches)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0915: Too many statements (82/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:1:0: ⚠️ W0611: Unused import cmd (unused-import)
bfi_dagster_project/assets/transcode_retry.py:8:0: ⚠️ W0611: Unused List imported from typing (unused-import)
************* Module bfi_dagster_project.assets.transcoding
bfi_dagster_project/assets/transcoding.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/transcoding.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/transcoding.py:29:4: ♻️ R0914: Too many local variables (21/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:29:4: ♻️ R0912: Too many branches (15/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:14:0: ♻️ R0915: Too many statements (53/50) (too-many-statements)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0914: Too many local variables (28/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:229:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0912: Too many branches (24/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0915: Too many statements (93/50) (too-many-statements)
bfi_dagster_project/assets/transcoding.py:237:8: ⚠️ W0612: Unused variable 'err' (unused-variable)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0914: Too many local variables (19/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:304:26: 🚨 E0606: Possibly using variable 'spath' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/transcoding.py:396:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0912: Too many branches (19/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0915: Too many statements (86/50) (too-many-statements)
************* Module bfi_dagster_project.assets.utils
bfi_dagster_project/assets/utils.py:625:0: 🎨 C0301: Line too long (152/100) (line-too-long)
bfi_dagster_project/assets/utils.py:633:0: 🎨 C0301: Line too long (141/100) (line-too-long)
bfi_dagster_project/assets/utils.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/utils.py:14:0: 🚨 E0401: Unable to import 'ffmpeg' (import-error)
bfi_dagster_project/assets/utils.py:15:0: 🚨 E0401: Unable to import 'tenacity' (import-error)
bfi_dagster_project/assets/utils.py:20:0: 🚨 E0401: Unable to import 'adlib_v3' (import-error)
bfi_dagster_project/assets/utils.py:20:0: 🎨 C0413: Import "import adlib_v3 as ad" should be placed at the top of the module (wrong-import-position)
bfi_dagster_project/assets/utils.py:38:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:69:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:128:8: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/utils.py:152:8: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/utils.py:103:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:170:42: 🚨 E0606: Possibly using variable 'policy' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/utils.py:174:8: ♻️ R1720: Unnecessary "elif" after "raise", remove the leading "el" from "elif" (no-else-raise)
bfi_dagster_project/assets/utils.py:175:12: ⚠️ W0719: Raising too general exception: Exception (broad-exception-raised)
bfi_dagster_project/assets/utils.py:195:8: ♻️ R1720: Unnecessary "elif" after "raise", remove the leading "el" from "elif" (no-else-raise)
bfi_dagster_project/assets/utils.py:196:12: ⚠️ W0719: Raising too general exception: Exception (broad-exception-raised)
bfi_dagster_project/assets/utils.py:264:8: 🎨 C0200: Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
bfi_dagster_project/assets/utils.py:225:0: ♻️ R0911: Too many return statements (9/6) (too-many-return-statements)
bfi_dagster_project/assets/utils.py:225:0: ♻️ R0912: Too many branches (17/12) (too-many-branches)
bfi_dagster_project/assets/utils.py:294:14: 🎨 C0207: Use subprocess.check_output(cmd, shell=False).decode().rsplit(': ', maxsplit=1)[-1] instead (use-maxsplit-arg)
bfi_dagster_project/assets/utils.py:424:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:445:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:449:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:472:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:507:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:502:18: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/utils.py:535:15: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:540:34: ⚠️ W0640: Cell variable f defined in loop (cell-var-from-loop)
bfi_dagster_project/assets/utils.py:519:10: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/utils.py:580:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:577:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:570:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:598:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:609:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:612:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:665:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:690:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:709:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:728:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:739:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module bfi_dagster_project.resources.__init__
bfi_dagster_project/resources/__init__.py:73:0: 🎨 C0301: Line too long (103/100) (line-too-long)
************* Module bfi_dagster_project.resources
bfi_dagster_project/resources/__init__.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/resources/__init__.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/resources/__init__.py:12:0: 🎨 C0115: Missing class docstring (missing-class-docstring)
bfi_dagster_project/resources/__init__.py:18:4: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:26:4: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:32:0: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:96:0: 🎨 C0115: Missing class docstring (missing-class-docstring)
bfi_dagster_project/resources/__init__.py:199:4: ♻️ R0913: Too many arguments (6/5) (too-many-arguments)
bfi_dagster_project/resources/__init__.py:199:4: ♻️ R0917: Too many positional arguments (6/5) (too-many-positional-arguments)
************* Module bfi_dagster_project.sensors
bfi_dagster_project/sensors/__init__.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/sensors/__init__.py:4:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/sensors/__init__.py:34:4: ⚠️ W0621: Redefining name 'failed_encoding_retry_sensor' from outer scope (line 123) (redefined-outer-name)
bfi_dagster_project/sensors/__init__.py:34:4: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
************* Module app
encoding_ui/app.py:13:0: 🚨 E0401: Unable to import 'flask' (import-error)
encoding_ui/app.py:20:0: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
encoding_ui/app.py:322:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[318:459]
==bfi_dagster_project.assets.transcoding:[320:458]
    dpath = os.path.join(str(Path(spath).parents[1]), "processing/", seq)
    log_data.append(f"Paths to work with:\n{dpath}\n{spath}")
    folder_size = utils.get_folder_size(dpath)
    file_size = utils.get_folder_size(spath)
    log_data.append(
        f"Found sizes in bytes:\n{folder_size} {dpath}\n{file_size} {spath}"
    )
    log = f"{spath}.txt"

    # Run chmod on MKV
    try:
        utils.recursive_chmod(spath, 0o777)
    except PermissionError as err:
        print(err)

    validation = True
    if not os.path.isfile(spath):
        log_data.append(f"WARNING: Filepath not found: {spath}")
        validation = False
        error_message = "RAWcook file not found"

    result = utils.mediaconch_mkv(spath)
    if result[0] != "Pass":
        log_data.append(result[1])
        log_data.append(f"WARNING: MKV file failed Mediaconch policy: {result[-1]}")
        validation = False
        error_message = "MKV policy failed, see validation log for details."
    log_data.append(f"MKV passed policy check: \n{result[1]}")

    # Check log for success statement
    success = utils.check_mkv_log(log)
    if success is False:
        validation = False
        log_data.append("WARNING: MKV log file returned Error warning")
        error_message = "Error found in RAWcooked log"
    log_data.append("Log for MKV passed checks")

    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass
    success = utils.check_file(spath)
    if success is False:
        validation = False
        log_data.append("WARNING: Matroska failed --check pass")
        error_message = "FFV1 MKV failed --check pass"
    log_data.append("MKV file passed --check test")

    # Check MKV not smaller than source folder
    if file_size > folder_size:
        log_data.append(
            f"WARNING: Directory size is not smaller that folder: {file_size} <= {folder_size}"
        )
        validation = False
        error_message = "MKV file larger than original folder size"

    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    else:
        # Move image sequence and delete
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}")

        success = utils.delete_sequence(os.path.join(cpath, seq))
        seq_del = "Deletion failed"
        if success:
            log_data.append("Image sequence deleted")
            seq_del = "Sequence deleted"

        # Move file to ingest
        success = utils.move_to_autoingest(spath)
        if not success:
            auto_move = "No"
        else:
            auto_move = "Yes"

        log_data.append("RAWcooked validation completed.")
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "transcode_logs")

        arguments = (
            ["status", "MKV validation complete"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["validation_success", "Yes"],
            ["error_message", "None"],
            ["sequence_deleted", seq_del],
            ["moved_to_autoingest", auto_move],
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }


# Import note (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[148:184]
==bfi_dagster_project.assets.transcoding:[187:223]
        output_v2 = utils.check_for_version_two(log_path)
        cmd = ["rawcooked", "-y", "--all"]

        if gaps is False:
            cmd.append("--no-accept-gaps")

        if output_v2 is True:
            cmd.extend(["--output-version", "2"])

        if fps16 is True:
            cmd.extend(["-framerate", "16"])
        if fps18 is True:
            cmd.extend(["-framerate", "18"])
        if fps24 is True:
            cmd.extend(["-framerate", "24"])
        if fps25 is True:
            cmd.extend(["-framerate", "25"])
        if fps30 is True:
            cmd.extend(["-framerate", "30"])
        if fps48 is True:
            cmd.extend(["-framerate", "48"])
        if fps50 is True:
            cmd.extend(["-framerate", "50"])
        if fps60 is True:
            cmd.extend(["-framerate", "60"])

        cmd.extend(
            [
                "-s",
                "5281680",
                f"{fullpath}",
                "-o",
                f"{ffv1_path}",
            ]
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==app:[31:55]
==bfi_dagster_project.resources.__init__:[167:191]
                    first_image TEXT,
                    last_image TEXT,
                    gaps_in_sequence TEXT,
                    assessment_pass TEXT,
                    assessment_complete TIMESTAMP,
                    colourspace TEXT,
                    seq_size INTEGER,
                    bitdepth INTEGER,
                    image_width TEXT,
                    image_height TEXT,
                    process_start TIMESTAMP,
                    encoding_choice TEXT,
                    encoding_log TEXT,
                    encoding_retry TEXT,
                    encoding_complete TIMESTAMP,
                    derivative_path TEXT,
                    derivative_size INTEGER,
                    derivative_md5 TEXT,
                    validation_complete TIMESTAMP,
                    validation_success TEXT,
                    error_message TEXT,
                    last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                    sequence_deleted TEXT,
                    moved_to_autoingest TEXT, (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[355:378]
==bfi_dagster_project.assets.transcoding:[395:417]
    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[393:415]
==bfi_dagster_project.assets.transcoding:[357:380]
    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[81:111]
==bfi_dagster_project.assets.transcoding:[94:124]
            "invalid": [r["sequence"] for r in results if r["success"] is False],
        }
        context.log.info(
            f"{log_prefix}Validation results: Valid={len(validated_files['valid'])}, "
            f"Invalid={len(validated_files['invalid'])}"
        )

        # Write data to log / db
        for data in results:
            seq = data["sequence"]
            args = data["db_arguments"]
            entry = context.resources.database.append_to_database(context, seq, args)
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log:
                    context.log.warning(f"{log_prefix}{log}")
                else:
                    context.log.info(f"{log_prefix}{log}")

        return dg.Output(
            value={
                "validated_files": validated_files["valid"],
                "invalid_files": validated_files["invalid"],
            },
            metadata={
                "successfully_complete": len(validated_files["valid"]),
                "failed_items": len(validated_files["invalid"]),
            },
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[357:370]
==bfi_dagster_project.assets.transcoding:[310:324]
        )
        return {
            "sequence": None,
            "success": False,
            "db_arguments": arguments,
            "logs": log_data,
        }

    fname = os.path.basename(spath)
    seq = fname.split(".")[0]
    dpath = os.path.join(str(Path(spath).parents[1]), "processing/", seq)
    log_data.append(f"Paths to work with:\n{dpath}\n{spath}")
    folder_size = utils.get_folder_size(dpath)
    file_size = utils.get_folder_size(spath) (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:436]
==bfi_dagster_project.assets.transcoding:[409:425]
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }
    else:
        # Delete source sequence
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}") (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[100:111]
==bfi_dagster_project.assets.transcode_retry:[279:290]
        return dg.Output(
            value={
                "validated_files": validated_files["valid"],
                "invalid_files": validated_files["invalid"],
            },
            metadata={
                "successfully_complete": len(validated_files["valid"]),
                "failed_items": len(validated_files["invalid"]),
            },
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[455:468]
==bfi_dagster_project.assets.transcode_retry:[443:459]
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["validation_success", "Yes"],
            ["error_message", "None"],
            ["sequence_deleted", seq_del],
            ["moved_to_autoingest", auto_move],
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }


# Import note (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:436]
==bfi_dagster_project.assets.transcode_retry:[407:423]
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }
    else:
        # Delete source sequence
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}") (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[303:312]
==bfi_dagster_project.assets.transcoding:[303:312]
    if not os.path.exists(spath):
        log_data.append(f"WARNING: Failed to find path {spath}. Exiting.")
        log_data.append(utils.move_to_failures(spath))

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
        )
        return { (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:429]
==bfi_dagster_project.assets.transcode_retry:[369:378]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[460:468]
==bfi_dagster_project.assets.transcode_retry:[407:415]
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        } (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[448:459]
==bfi_dagster_project.assets.transcoding:[371:380]
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }


# Import note (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[93:100]
==bfi_dagster_project.assets.transcoding:[79:87]
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log:
                    context.log.warning(f"{log_prefix}{log}")
                else:
                    context.log.info(f"{log_prefix}{log}")

        # Validate in function (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[197:204]
==bfi_dagster_project.assets.transcoding:[226:233]
        tic = time.perf_counter()
        # Alternative method for stderr stdout capture for RAWcooked/FFmpeg command
        with open(log_path, "a") as log_file:
            try:
                result = subprocess.run(
                    cmd, shell=False, check=True, stdout=log_file, stderr=log_file
                ) (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[442:448]
==bfi_dagster_project.assets.transcode_retry:[430:436]
        success = utils.move_to_autoingest(spath)
        if not success:
            auto_move = "No"
        else:
            auto_move = "Yes"
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[65:70]
==bfi_dagster_project.assets.transcoding:[104:109]
            args = data["db_arguments"]
            entry = context.resources.database.append_to_database(context, seq, args)
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log: (duplicate-code)

-----------------------------------
Your code has been rated at 8.73/10

Note: 🚨 Errors need immediate attention! ⚠️ Warnings should be reviewed, but are less critical. ℹ️ Information messages are for your reference.

@bfi-bot
Copy link
Copy Markdown

bfi-bot commented Feb 23, 2026

Automated Pylint Report 🧑‍💻

Here is the formatted Pylint report:

************* Module bfi_dagster_project.assets.archiving
bfi_dagster_project/assets/archiving.py:255:0: 🎨 C0301: Line too long (114/100) (line-too-long)
bfi_dagster_project/assets/archiving.py:307:0: 🎨 C0301: Line too long (124/100) (line-too-long)
bfi_dagster_project/assets/archiving.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/archiving.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0914: Too many local variables (29/15) (too-many-locals)
bfi_dagster_project/assets/archiving.py:253:19: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/archiving.py:278:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/archiving.py:296:60: 🚨 E0606: Possibly using variable 'tar_file' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0912: Too many branches (21/12) (too-many-branches)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0915: Too many statements (90/50) (too-many-statements)
bfi_dagster_project/assets/archiving.py:249:22: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0914: Too many local variables (19/15) (too-many-locals)
bfi_dagster_project/assets/archiving.py:351:32: 🚨 E0601: Using variable 'log' before assignment (used-before-assignment)
bfi_dagster_project/assets/archiving.py:352:47: 🚨 E0601: Using variable 'dpath' before assignment (used-before-assignment)
bfi_dagster_project/assets/archiving.py:406:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0912: Too many branches (15/12) (too-many-branches)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0915: Too many statements (68/50) (too-many-statements)
************* Module bfi_dagster_project.assets.get_sequences
bfi_dagster_project/assets/get_sequences.py:74:0: 🎨 C0301: Line too long (118/100) (line-too-long)
bfi_dagster_project/assets/get_sequences.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/get_sequences.py:4:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/get_sequences.py:16:4: ⚠️ W0621: Redefining name 'target_sequences' from outer scope (line 113) (redefined-outer-name)
************* Module bfi_dagster_project.assets.transcode_retry
bfi_dagster_project/assets/transcode_retry.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/transcode_retry.py:10:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/transcode_retry.py:38:4: ⚠️ W0621: Redefining name 'reencode_failed_asset' from outer scope (line 460) (redefined-outer-name)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0914: Too many local variables (38/15) (too-many-locals)
bfi_dagster_project/assets/transcode_retry.py:150:8: ⚠️ W0621: Redefining name 'cmd' from outer scope (line 1) (redefined-outer-name)
bfi_dagster_project/assets/transcode_retry.py:99:12: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcode_retry.py:200:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0912: Too many branches (39/12) (too-many-branches)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0915: Too many statements (139/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:15:0: ♻️ R0915: Too many statements (144/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0914: Too many local variables (18/15) (too-many-locals)
bfi_dagster_project/assets/transcode_retry.py:394:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0912: Too many branches (17/12) (too-many-branches)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0915: Too many statements (82/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:1:0: ⚠️ W0611: Unused import cmd (unused-import)
bfi_dagster_project/assets/transcode_retry.py:8:0: ⚠️ W0611: Unused List imported from typing (unused-import)
************* Module bfi_dagster_project.assets.transcoding
bfi_dagster_project/assets/transcoding.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/transcoding.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/transcoding.py:29:4: ♻️ R0914: Too many local variables (21/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:29:4: ♻️ R0912: Too many branches (15/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:14:0: ♻️ R0915: Too many statements (53/50) (too-many-statements)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0914: Too many local variables (28/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:229:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0912: Too many branches (24/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0915: Too many statements (93/50) (too-many-statements)
bfi_dagster_project/assets/transcoding.py:237:8: ⚠️ W0612: Unused variable 'err' (unused-variable)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0914: Too many local variables (19/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:304:26: 🚨 E0606: Possibly using variable 'spath' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/transcoding.py:396:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0912: Too many branches (19/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0915: Too many statements (86/50) (too-many-statements)
************* Module bfi_dagster_project.assets.utils
bfi_dagster_project/assets/utils.py:625:0: 🎨 C0301: Line too long (152/100) (line-too-long)
bfi_dagster_project/assets/utils.py:633:0: 🎨 C0301: Line too long (141/100) (line-too-long)
bfi_dagster_project/assets/utils.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/utils.py:14:0: 🚨 E0401: Unable to import 'ffmpeg' (import-error)
bfi_dagster_project/assets/utils.py:15:0: 🚨 E0401: Unable to import 'tenacity' (import-error)
bfi_dagster_project/assets/utils.py:20:0: 🚨 E0401: Unable to import 'adlib_v3' (import-error)
bfi_dagster_project/assets/utils.py:20:0: 🎨 C0413: Import "import adlib_v3 as ad" should be placed at the top of the module (wrong-import-position)
bfi_dagster_project/assets/utils.py:38:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:69:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:128:8: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/utils.py:152:8: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/utils.py:103:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:170:42: 🚨 E0606: Possibly using variable 'policy' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/utils.py:174:8: ♻️ R1720: Unnecessary "elif" after "raise", remove the leading "el" from "elif" (no-else-raise)
bfi_dagster_project/assets/utils.py:175:12: ⚠️ W0719: Raising too general exception: Exception (broad-exception-raised)
bfi_dagster_project/assets/utils.py:195:8: ♻️ R1720: Unnecessary "elif" after "raise", remove the leading "el" from "elif" (no-else-raise)
bfi_dagster_project/assets/utils.py:196:12: ⚠️ W0719: Raising too general exception: Exception (broad-exception-raised)
bfi_dagster_project/assets/utils.py:264:8: 🎨 C0200: Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
bfi_dagster_project/assets/utils.py:225:0: ♻️ R0911: Too many return statements (9/6) (too-many-return-statements)
bfi_dagster_project/assets/utils.py:225:0: ♻️ R0912: Too many branches (17/12) (too-many-branches)
bfi_dagster_project/assets/utils.py:294:14: 🎨 C0207: Use subprocess.check_output(cmd, shell=False).decode().rsplit(': ', maxsplit=1)[-1] instead (use-maxsplit-arg)
bfi_dagster_project/assets/utils.py:424:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:445:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:449:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:472:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:507:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:502:18: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/utils.py:535:15: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:540:34: ⚠️ W0640: Cell variable f defined in loop (cell-var-from-loop)
bfi_dagster_project/assets/utils.py:519:10: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/utils.py:580:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:577:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:570:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:598:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:609:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:612:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:665:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:690:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:709:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:728:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:739:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module bfi_dagster_project.resources.__init__
bfi_dagster_project/resources/__init__.py:73:0: 🎨 C0301: Line too long (103/100) (line-too-long)
************* Module bfi_dagster_project.resources
bfi_dagster_project/resources/__init__.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/resources/__init__.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/resources/__init__.py:12:0: 🎨 C0115: Missing class docstring (missing-class-docstring)
bfi_dagster_project/resources/__init__.py:18:4: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:26:4: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:32:0: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:96:0: 🎨 C0115: Missing class docstring (missing-class-docstring)
bfi_dagster_project/resources/__init__.py:199:4: ♻️ R0913: Too many arguments (6/5) (too-many-arguments)
bfi_dagster_project/resources/__init__.py:199:4: ♻️ R0917: Too many positional arguments (6/5) (too-many-positional-arguments)
************* Module bfi_dagster_project.sensors
bfi_dagster_project/sensors/__init__.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/sensors/__init__.py:4:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/sensors/__init__.py:34:4: ⚠️ W0621: Redefining name 'failed_encoding_retry_sensor' from outer scope (line 123) (redefined-outer-name)
bfi_dagster_project/sensors/__init__.py:34:4: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
************* Module app
encoding_ui/app.py:13:0: 🚨 E0401: Unable to import 'flask' (import-error)
encoding_ui/app.py:20:0: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
encoding_ui/app.py:322:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[318:459]
==bfi_dagster_project.assets.transcoding:[320:458]
    dpath = os.path.join(str(Path(spath).parents[1]), "processing/", seq)
    log_data.append(f"Paths to work with:\n{dpath}\n{spath}")
    folder_size = utils.get_folder_size(dpath)
    file_size = utils.get_folder_size(spath)
    log_data.append(
        f"Found sizes in bytes:\n{folder_size} {dpath}\n{file_size} {spath}"
    )
    log = f"{spath}.txt"

    # Run chmod on MKV
    try:
        utils.recursive_chmod(spath, 0o777)
    except PermissionError as err:
        print(err)

    validation = True
    if not os.path.isfile(spath):
        log_data.append(f"WARNING: Filepath not found: {spath}")
        validation = False
        error_message = "RAWcook file not found"

    result = utils.mediaconch_mkv(spath)
    if result[0] != "Pass":
        log_data.append(result[1])
        log_data.append(f"WARNING: MKV file failed Mediaconch policy: {result[-1]}")
        validation = False
        error_message = "MKV policy failed, see validation log for details."
    log_data.append(f"MKV passed policy check: \n{result[1]}")

    # Check log for success statement
    success = utils.check_mkv_log(log)
    if success is False:
        validation = False
        log_data.append("WARNING: MKV log file returned Error warning")
        error_message = "Error found in RAWcooked log"
    log_data.append("Log for MKV passed checks")

    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass
    success = utils.check_file(spath)
    if success is False:
        validation = False
        log_data.append("WARNING: Matroska failed --check pass")
        error_message = "FFV1 MKV failed --check pass"
    log_data.append("MKV file passed --check test")

    # Check MKV not smaller than source folder
    if file_size > folder_size:
        log_data.append(
            f"WARNING: Directory size is not smaller that folder: {file_size} <= {folder_size}"
        )
        validation = False
        error_message = "MKV file larger than original folder size"

    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    else:
        # Delete image sequence
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}")

        success = utils.delete_sequence(os.path.join(cpath, seq))
        seq_del = "Deletion failed"
        if success:
            log_data.append("Image sequence deleted")
            seq_del = "Sequence deleted"

        # Move file to ingest
        success = utils.move_to_autoingest(spath)
        if not success:
            auto_move = "No"
        else:
            auto_move = "Yes"

        log_data.append("RAWcooked validation completed.")
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "transcode_logs")

        arguments = (
            ["status", "MKV validation complete"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["validation_success", "Yes"],
            ["error_message", "None"],
            ["sequence_deleted", seq_del],
            ["moved_to_autoingest", auto_move],
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        } (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[148:184]
==bfi_dagster_project.assets.transcoding:[187:223]
        output_v2 = utils.check_for_version_two(log_path)
        cmd = ["rawcooked", "-y", "--all"]

        if gaps is False:
            cmd.append("--no-accept-gaps")

        if output_v2 is True:
            cmd.extend(["--output-version", "2"])

        if fps16 is True:
            cmd.extend(["-framerate", "16"])
        if fps18 is True:
            cmd.extend(["-framerate", "18"])
        if fps24 is True:
            cmd.extend(["-framerate", "24"])
        if fps25 is True:
            cmd.extend(["-framerate", "25"])
        if fps30 is True:
            cmd.extend(["-framerate", "30"])
        if fps48 is True:
            cmd.extend(["-framerate", "48"])
        if fps50 is True:
            cmd.extend(["-framerate", "50"])
        if fps60 is True:
            cmd.extend(["-framerate", "60"])

        cmd.extend(
            [
                "-s",
                "5281680",
                f"{fullpath}",
                "-o",
                f"{ffv1_path}",
            ]
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==app:[31:55]
==bfi_dagster_project.resources.__init__:[167:191]
                    first_image TEXT,
                    last_image TEXT,
                    gaps_in_sequence TEXT,
                    assessment_pass TEXT,
                    assessment_complete TIMESTAMP,
                    colourspace TEXT,
                    seq_size INTEGER,
                    bitdepth INTEGER,
                    image_width TEXT,
                    image_height TEXT,
                    process_start TIMESTAMP,
                    encoding_choice TEXT,
                    encoding_log TEXT,
                    encoding_retry TEXT,
                    encoding_complete TIMESTAMP,
                    derivative_path TEXT,
                    derivative_size INTEGER,
                    derivative_md5 TEXT,
                    validation_complete TIMESTAMP,
                    validation_success TEXT,
                    error_message TEXT,
                    last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                    sequence_deleted TEXT,
                    moved_to_autoingest TEXT, (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[355:378]
==bfi_dagster_project.assets.transcoding:[395:417]
    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[393:415]
==bfi_dagster_project.assets.transcoding:[357:380]
    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[81:111]
==bfi_dagster_project.assets.transcoding:[94:124]
            "invalid": [r["sequence"] for r in results if r["success"] is False],
        }
        context.log.info(
            f"{log_prefix}Validation results: Valid={len(validated_files['valid'])}, "
            f"Invalid={len(validated_files['invalid'])}"
        )

        # Write data to log / db
        for data in results:
            seq = data["sequence"]
            args = data["db_arguments"]
            entry = context.resources.database.append_to_database(context, seq, args)
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log:
                    context.log.warning(f"{log_prefix}{log}")
                else:
                    context.log.info(f"{log_prefix}{log}")

        return dg.Output(
            value={
                "validated_files": validated_files["valid"],
                "invalid_files": validated_files["invalid"],
            },
            metadata={
                "successfully_complete": len(validated_files["valid"]),
                "failed_items": len(validated_files["invalid"]),
            },
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[357:370]
==bfi_dagster_project.assets.transcoding:[310:324]
        )
        return {
            "sequence": None,
            "success": False,
            "db_arguments": arguments,
            "logs": log_data,
        }
    fname = os.path.basename(spath)
    seq = fname.split(".")[0]
    dpath = os.path.join(str(Path(spath).parents[1]), "processing/", seq)
    log_data.append(f"Paths to work with:\n{dpath}\n{spath}")
    folder_size = utils.get_folder_size(dpath)
    file_size = utils.get_folder_size(spath) (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:436]
==bfi_dagster_project.assets.transcoding:[409:425]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    else:
        # Delete image sequence
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}")
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[100:111]
==bfi_dagster_project.assets.transcode_retry:[279:290]
        return dg.Output(
            value={
                "validated_files": validated_files["valid"],
                "invalid_files": validated_files["invalid"],
            },
            metadata={
                "successfully_complete": len(validated_files["valid"]),
                "failed_items": len(validated_files["invalid"]),
            },
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[455:468]
==bfi_dagster_project.assets.transcode_retry:[443:459]
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["validation_success", "Yes"],
            ["error_message", "None"],
            ["sequence_deleted", seq_del],
            ["moved_to_autoingest", auto_move],
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }


# Import note (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:436]
==bfi_dagster_project.assets.transcode_retry:[407:423]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    else:
        # Move image sequence and delete
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}")
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[303:312]
==bfi_dagster_project.assets.transcoding:[303:312]
    if not os.path.exists(spath):
        log_data.append(f"WARNING: Failed to find path {spath}. Exiting.")
        log_data.append(utils.move_to_failures(spath))

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
        )
        return { (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:429]
==bfi_dagster_project.assets.transcode_retry:[369:378]
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        } (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[460:468]
==bfi_dagster_project.assets.transcode_retry:[407:415]
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        } (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[448:459]
==bfi_dagster_project.assets.transcoding:[371:380]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[93:100]
==bfi_dagster_project.assets.transcoding:[79:87]
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log:
                    context.log.warning(f"{log_prefix}{log}")
                else:
                    context.log.info(f"{log_prefix}{log}")
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[197:204]
==bfi_dagster_project.assets.transcoding:[226:233]
        tic = time.perf_counter()
        # Alternative method for stderr stdout capture for RAWcooked/FFmpeg command
        with open(log_path, "a") as log_file:
            try:
                result = subprocess.run(
                    cmd, shell=False, check=True, stdout=log_file, stderr=log_file
                ) (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[442:448]
==bfi_dagster_project.assets.transcode_retry:[430:436]
        success = utils.move_to_autoingest(spath)
        if not success:
            auto_move = "No"
        else:
            auto_move = "Yes"
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[65:70]
==bfi_dagster_project.assets.transcoding:[104:109]
            args = data["db_arguments"]
            entry = context.resources.database.append_to_database(context, seq, args)
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log: (duplicate-code)

-----------------------------------
Your code has been rated at 8.73/10

Note: 🚨 Errors need immediate attention! ⚠️ Warnings should be reviewed, but are less critical. ℹ️ Information messages are for your reference.

@bfi-bot
Copy link
Copy Markdown

bfi-bot commented Feb 23, 2026

Automated Pylint Report 🧑‍💻

Here is the formatted Pylint report:

************* Module bfi_dagster_project.assets.archiving
bfi_dagster_project/assets/archiving.py:255:0: 🎨 C0301: Line too long (114/100) (line-too-long)
bfi_dagster_project/assets/archiving.py:307:0: 🎨 C0301: Line too long (124/100) (line-too-long)
bfi_dagster_project/assets/archiving.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/archiving.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0914: Too many local variables (29/15) (too-many-locals)
bfi_dagster_project/assets/archiving.py:253:19: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/archiving.py:278:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/archiving.py:296:60: 🚨 E0606: Possibly using variable 'tar_file' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0912: Too many branches (21/12) (too-many-branches)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0915: Too many statements (90/50) (too-many-statements)
bfi_dagster_project/assets/archiving.py:249:22: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0914: Too many local variables (19/15) (too-many-locals)
bfi_dagster_project/assets/archiving.py:351:32: 🚨 E0601: Using variable 'log' before assignment (used-before-assignment)
bfi_dagster_project/assets/archiving.py:352:47: 🚨 E0601: Using variable 'dpath' before assignment (used-before-assignment)
bfi_dagster_project/assets/archiving.py:406:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0912: Too many branches (15/12) (too-many-branches)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0915: Too many statements (68/50) (too-many-statements)
************* Module bfi_dagster_project.assets.get_sequences
bfi_dagster_project/assets/get_sequences.py:74:0: 🎨 C0301: Line too long (118/100) (line-too-long)
bfi_dagster_project/assets/get_sequences.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/get_sequences.py:4:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/get_sequences.py:16:4: ⚠️ W0621: Redefining name 'target_sequences' from outer scope (line 113) (redefined-outer-name)
************* Module bfi_dagster_project.assets.transcode_retry
bfi_dagster_project/assets/transcode_retry.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/transcode_retry.py:10:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/transcode_retry.py:38:4: ⚠️ W0621: Redefining name 'reencode_failed_asset' from outer scope (line 460) (redefined-outer-name)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0914: Too many local variables (38/15) (too-many-locals)
bfi_dagster_project/assets/transcode_retry.py:150:8: ⚠️ W0621: Redefining name 'cmd' from outer scope (line 1) (redefined-outer-name)
bfi_dagster_project/assets/transcode_retry.py:99:12: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcode_retry.py:200:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0912: Too many branches (39/12) (too-many-branches)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0915: Too many statements (139/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:15:0: ♻️ R0915: Too many statements (144/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0914: Too many local variables (18/15) (too-many-locals)
bfi_dagster_project/assets/transcode_retry.py:394:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0912: Too many branches (17/12) (too-many-branches)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0915: Too many statements (82/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:1:0: ⚠️ W0611: Unused import cmd (unused-import)
bfi_dagster_project/assets/transcode_retry.py:8:0: ⚠️ W0611: Unused List imported from typing (unused-import)
************* Module bfi_dagster_project.assets.transcoding
bfi_dagster_project/assets/transcoding.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/transcoding.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/transcoding.py:29:4: ♻️ R0914: Too many local variables (21/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:29:4: ♻️ R0912: Too many branches (15/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:14:0: ♻️ R0915: Too many statements (53/50) (too-many-statements)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0914: Too many local variables (28/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:229:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0912: Too many branches (24/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0915: Too many statements (93/50) (too-many-statements)
bfi_dagster_project/assets/transcoding.py:237:8: ⚠️ W0612: Unused variable 'err' (unused-variable)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0914: Too many local variables (19/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:304:26: 🚨 E0606: Possibly using variable 'spath' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/transcoding.py:396:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0912: Too many branches (19/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0915: Too many statements (86/50) (too-many-statements)
************* Module bfi_dagster_project.assets.utils
bfi_dagster_project/assets/utils.py:625:0: 🎨 C0301: Line too long (152/100) (line-too-long)
bfi_dagster_project/assets/utils.py:633:0: 🎨 C0301: Line too long (141/100) (line-too-long)
bfi_dagster_project/assets/utils.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/utils.py:14:0: 🚨 E0401: Unable to import 'ffmpeg' (import-error)
bfi_dagster_project/assets/utils.py:15:0: 🚨 E0401: Unable to import 'tenacity' (import-error)
bfi_dagster_project/assets/utils.py:20:0: 🚨 E0401: Unable to import 'adlib_v3' (import-error)
bfi_dagster_project/assets/utils.py:20:0: 🎨 C0413: Import "import adlib_v3 as ad" should be placed at the top of the module (wrong-import-position)
bfi_dagster_project/assets/utils.py:38:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:69:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:128:8: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/utils.py:152:8: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/utils.py:103:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:170:42: 🚨 E0606: Possibly using variable 'policy' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/utils.py:174:8: ♻️ R1720: Unnecessary "elif" after "raise", remove the leading "el" from "elif" (no-else-raise)
bfi_dagster_project/assets/utils.py:175:12: ⚠️ W0719: Raising too general exception: Exception (broad-exception-raised)
bfi_dagster_project/assets/utils.py:195:8: ♻️ R1720: Unnecessary "elif" after "raise", remove the leading "el" from "elif" (no-else-raise)
bfi_dagster_project/assets/utils.py:196:12: ⚠️ W0719: Raising too general exception: Exception (broad-exception-raised)
bfi_dagster_project/assets/utils.py:264:8: 🎨 C0200: Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
bfi_dagster_project/assets/utils.py:225:0: ♻️ R0911: Too many return statements (9/6) (too-many-return-statements)
bfi_dagster_project/assets/utils.py:225:0: ♻️ R0912: Too many branches (17/12) (too-many-branches)
bfi_dagster_project/assets/utils.py:294:14: 🎨 C0207: Use subprocess.check_output(cmd, shell=False).decode().rsplit(': ', maxsplit=1)[-1] instead (use-maxsplit-arg)
bfi_dagster_project/assets/utils.py:424:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:445:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:449:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:472:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:507:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:502:18: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/utils.py:535:15: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:540:34: ⚠️ W0640: Cell variable f defined in loop (cell-var-from-loop)
bfi_dagster_project/assets/utils.py:519:10: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/utils.py:580:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:577:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:570:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:598:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:609:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:612:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:665:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:690:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:709:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:728:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:739:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module bfi_dagster_project.resources.__init__
bfi_dagster_project/resources/__init__.py:73:0: 🎨 C0301: Line too long (103/100) (line-too-long)
************* Module bfi_dagster_project.resources
bfi_dagster_project/resources/__init__.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/resources/__init__.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/resources/__init__.py:12:0: 🎨 C0115: Missing class docstring (missing-class-docstring)
bfi_dagster_project/resources/__init__.py:18:4: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:26:4: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:32:0: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:96:0: 🎨 C0115: Missing class docstring (missing-class-docstring)
bfi_dagster_project/resources/__init__.py:199:4: ♻️ R0913: Too many arguments (6/5) (too-many-arguments)
bfi_dagster_project/resources/__init__.py:199:4: ♻️ R0917: Too many positional arguments (6/5) (too-many-positional-arguments)
************* Module bfi_dagster_project.sensors
bfi_dagster_project/sensors/__init__.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/sensors/__init__.py:4:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/sensors/__init__.py:34:4: ⚠️ W0621: Redefining name 'failed_encoding_retry_sensor' from outer scope (line 123) (redefined-outer-name)
bfi_dagster_project/sensors/__init__.py:34:4: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
************* Module app
encoding_ui/app.py:13:0: 🚨 E0401: Unable to import 'flask' (import-error)
encoding_ui/app.py:20:0: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
encoding_ui/app.py:322:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[318:459]
==bfi_dagster_project.assets.transcoding:[320:458]
    dpath = os.path.join(str(Path(spath).parents[1]), "processing/", seq)
    log_data.append(f"Paths to work with:\n{dpath}\n{spath}")
    folder_size = utils.get_folder_size(dpath)
    file_size = utils.get_folder_size(spath)
    log_data.append(
        f"Found sizes in bytes:\n{folder_size} {dpath}\n{file_size} {spath}"
    )
    log = f"{spath}.txt"

    # Run chmod on MKV
    try:
        utils.recursive_chmod(spath, 0o777)
    except PermissionError as err:
        print(err)

    validation = True
    if not os.path.isfile(spath):
        log_data.append(f"WARNING: Filepath not found: {spath}")
        validation = False
        error_message = "RAWcook file not found"

    result = utils.mediaconch_mkv(spath)
    if result[0] != "Pass":
        log_data.append(result[1])
        log_data.append(f"WARNING: MKV file failed Mediaconch policy: {result[-1]}")
        validation = False
        error_message = "MKV policy failed, see validation log for details."
    log_data.append(f"MKV passed policy check: \n{result[1]}")

    # Check log for success statement
    success = utils.check_mkv_log(log)
    if success is False:
        validation = False
        log_data.append("WARNING: MKV log file returned Error warning")
        error_message = "Error found in RAWcooked log"
    log_data.append("Log for MKV passed checks")

    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass
    success = utils.check_file(spath)
    if success is False:
        validation = False
        log_data.append("WARNING: Matroska failed --check pass")
        error_message = "FFV1 MKV failed --check pass"
    log_data.append("MKV file passed --check test")

    # Check MKV not smaller than source folder
    if file_size > folder_size:
        log_data.append(
            f"WARNING: Directory size is not smaller that folder: {file_size} <= {folder_size}"
        )
        validation = False
        error_message = "MKV file larger than original folder size"

    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    else:
        # Move image sequence and delete
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}")

        success = utils.delete_sequence(os.path.join(cpath, seq))
        seq_del = "Deletion failed"
        if success:
            log_data.append("Image sequence deleted")
            seq_del = "Sequence deleted"

        # Move file to ingest
        success = utils.move_to_autoingest(spath)
        if not success:
            auto_move = "No"
        else:
            auto_move = "Yes"

        log_data.append("RAWcooked validation completed.")
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "transcode_logs")

        arguments = (
            ["status", "MKV validation complete"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["validation_success", "Yes"],
            ["error_message", "None"],
            ["sequence_deleted", seq_del],
            ["moved_to_autoingest", auto_move],
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }


# Import note (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[148:184]
==bfi_dagster_project.assets.transcoding:[187:223]
        output_v2 = utils.check_for_version_two(log_path)
        cmd = ["rawcooked", "-y", "--all"]

        if gaps is False:
            cmd.append("--no-accept-gaps")

        if output_v2 is True:
            cmd.extend(["--output-version", "2"])

        if fps16 is True:
            cmd.extend(["-framerate", "16"])
        if fps18 is True:
            cmd.extend(["-framerate", "18"])
        if fps24 is True:
            cmd.extend(["-framerate", "24"])
        if fps25 is True:
            cmd.extend(["-framerate", "25"])
        if fps30 is True:
            cmd.extend(["-framerate", "30"])
        if fps48 is True:
            cmd.extend(["-framerate", "48"])
        if fps50 is True:
            cmd.extend(["-framerate", "50"])
        if fps60 is True:
            cmd.extend(["-framerate", "60"])

        cmd.extend(
            [
                "-s",
                "5281680",
                f"{fullpath}",
                "-o",
                f"{ffv1_path}",
            ]
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==app:[31:55]
==bfi_dagster_project.resources.__init__:[167:191]
                    first_image TEXT,
                    last_image TEXT,
                    gaps_in_sequence TEXT,
                    assessment_pass TEXT,
                    assessment_complete TIMESTAMP,
                    colourspace TEXT,
                    seq_size INTEGER,
                    bitdepth INTEGER,
                    image_width TEXT,
                    image_height TEXT,
                    process_start TIMESTAMP,
                    encoding_choice TEXT,
                    encoding_log TEXT,
                    encoding_retry TEXT,
                    encoding_complete TIMESTAMP,
                    derivative_path TEXT,
                    derivative_size INTEGER,
                    derivative_md5 TEXT,
                    validation_complete TIMESTAMP,
                    validation_success TEXT,
                    error_message TEXT,
                    last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                    sequence_deleted TEXT,
                    moved_to_autoingest TEXT, (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[355:378]
==bfi_dagster_project.assets.transcoding:[395:417]
    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[393:415]
==bfi_dagster_project.assets.transcoding:[357:380]
    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[81:111]
==bfi_dagster_project.assets.transcoding:[94:124]
            "invalid": [r["sequence"] for r in results if r["success"] is False],
        }
        context.log.info(
            f"{log_prefix}Validation results: Valid={len(validated_files['valid'])}, "
            f"Invalid={len(validated_files['invalid'])}"
        )

        # Write data to log / db
        for data in results:
            seq = data["sequence"]
            args = data["db_arguments"]
            entry = context.resources.database.append_to_database(context, seq, args)
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log:
                    context.log.warning(f"{log_prefix}{log}")
                else:
                    context.log.info(f"{log_prefix}{log}")

        return dg.Output(
            value={
                "validated_files": validated_files["valid"],
                "invalid_files": validated_files["invalid"],
            },
            metadata={
                "successfully_complete": len(validated_files["valid"]),
                "failed_items": len(validated_files["invalid"]),
            },
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[357:370]
==bfi_dagster_project.assets.transcoding:[310:324]
        )
        return {
            "sequence": None,
            "success": False,
            "db_arguments": arguments,
            "logs": log_data,
        }
    fname = os.path.basename(spath)
    seq = fname.split(".")[0]
    dpath = os.path.join(str(Path(spath).parents[1]), "processing/", seq)
    log_data.append(f"Paths to work with:\n{dpath}\n{spath}")
    folder_size = utils.get_folder_size(dpath)
    file_size = utils.get_folder_size(spath) (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:436]
==bfi_dagster_project.assets.transcoding:[409:425]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    else:
        # Delete image sequence
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}")
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[100:111]
==bfi_dagster_project.assets.transcode_retry:[279:290]
        return dg.Output(
            value={
                "validated_files": validated_files["valid"],
                "invalid_files": validated_files["invalid"],
            },
            metadata={
                "successfully_complete": len(validated_files["valid"]),
                "failed_items": len(validated_files["invalid"]),
            },
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[455:468]
==bfi_dagster_project.assets.transcode_retry:[443:459]
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["validation_success", "Yes"],
            ["error_message", "None"],
            ["sequence_deleted", seq_del],
            ["moved_to_autoingest", auto_move],
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        } (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:436]
==bfi_dagster_project.assets.transcode_retry:[407:423]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    else:
        # Move image sequence and delete
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}")
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[303:312]
==bfi_dagster_project.assets.transcoding:[303:312]
    if not os.path.exists(spath):
        log_data.append(f"WARNING: Failed to find path {spath}. Exiting.")
        log_data.append(utils.move_to_failures(spath))

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
        )
        return { (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:429]
==bfi_dagster_project.assets.transcode_retry:[369:378]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[460:468]
==bfi_dagster_project.assets.transcode_retry:[407:415]
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        } (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[448:459]
==bfi_dagster_project.assets.transcoding:[371:380]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[93:100]
==bfi_dagster_project.assets.transcoding:[79:87]
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log:
                    context.log.warning(f"{log_prefix}{log}")
                else:
                    context.log.info(f"{log_prefix}{log}")
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[197:204]
==bfi_dagster_project.assets.transcoding:[226:233]
        tic = time.perf_counter()
        # Alternative method for stderr stdout capture for RAWcooked/FFmpeg command
        with open(log_path, "a") as log_file:
            try:
                result = subprocess.run(
                    cmd, shell=False, check=True, stdout=log_file, stderr=log_file
                ) (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[442:448]
==bfi_dagster_project.assets.transcode_retry:[430:436]
        success = utils.move_to_autoingest(spath)
        if not success:
            auto_move = "No"
        else:
            auto_move = "Yes"
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[65:70]
==bfi_dagster_project.assets.transcoding:[104:109]
            args = data["db_arguments"]
            entry = context.resources.database.append_to_database(context, seq, args)
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log: (duplicate-code)

-----------------------------------
Your code has been rated at 8.73/10

Note: 🚨 Errors need immediate attention! ⚠️ Warnings should be reviewed, but are less critical. ℹ️ Information messages are for your reference.

@bfi-bot
Copy link
Copy Markdown

bfi-bot commented Feb 23, 2026

Automated Pylint Report 🧑‍💻

Here is the formatted Pylint report:

************* Module bfi_dagster_project.assets.archiving
bfi_dagster_project/assets/archiving.py:255:0: 🎨 C0301: Line too long (114/100) (line-too-long)
bfi_dagster_project/assets/archiving.py:307:0: 🎨 C0301: Line too long (124/100) (line-too-long)
bfi_dagster_project/assets/archiving.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/archiving.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0914: Too many local variables (29/15) (too-many-locals)
bfi_dagster_project/assets/archiving.py:253:19: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/archiving.py:278:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/archiving.py:296:60: 🚨 E0606: Possibly using variable 'tar_file' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0912: Too many branches (21/12) (too-many-branches)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0915: Too many statements (90/50) (too-many-statements)
bfi_dagster_project/assets/archiving.py:249:22: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0914: Too many local variables (19/15) (too-many-locals)
bfi_dagster_project/assets/archiving.py:351:32: 🚨 E0601: Using variable 'log' before assignment (used-before-assignment)
bfi_dagster_project/assets/archiving.py:352:47: 🚨 E0601: Using variable 'dpath' before assignment (used-before-assignment)
bfi_dagster_project/assets/archiving.py:406:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0912: Too many branches (15/12) (too-many-branches)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0915: Too many statements (68/50) (too-many-statements)
************* Module bfi_dagster_project.assets.get_sequences
bfi_dagster_project/assets/get_sequences.py:74:0: 🎨 C0301: Line too long (118/100) (line-too-long)
bfi_dagster_project/assets/get_sequences.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/get_sequences.py:4:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/get_sequences.py:16:4: ⚠️ W0621: Redefining name 'target_sequences' from outer scope (line 113) (redefined-outer-name)
************* Module bfi_dagster_project.assets.transcode_retry
bfi_dagster_project/assets/transcode_retry.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/transcode_retry.py:10:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/transcode_retry.py:38:4: ⚠️ W0621: Redefining name 'reencode_failed_asset' from outer scope (line 460) (redefined-outer-name)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0914: Too many local variables (38/15) (too-many-locals)
bfi_dagster_project/assets/transcode_retry.py:150:8: ⚠️ W0621: Redefining name 'cmd' from outer scope (line 1) (redefined-outer-name)
bfi_dagster_project/assets/transcode_retry.py:99:12: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcode_retry.py:200:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0912: Too many branches (39/12) (too-many-branches)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0915: Too many statements (139/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:15:0: ♻️ R0915: Too many statements (144/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0914: Too many local variables (18/15) (too-many-locals)
bfi_dagster_project/assets/transcode_retry.py:394:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0912: Too many branches (17/12) (too-many-branches)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0915: Too many statements (82/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:1:0: ⚠️ W0611: Unused import cmd (unused-import)
bfi_dagster_project/assets/transcode_retry.py:8:0: ⚠️ W0611: Unused List imported from typing (unused-import)
************* Module bfi_dagster_project.assets.transcoding
bfi_dagster_project/assets/transcoding.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/transcoding.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/transcoding.py:29:4: ♻️ R0914: Too many local variables (21/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:29:4: ♻️ R0912: Too many branches (15/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:14:0: ♻️ R0915: Too many statements (53/50) (too-many-statements)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0914: Too many local variables (28/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:229:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0912: Too many branches (24/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0915: Too many statements (93/50) (too-many-statements)
bfi_dagster_project/assets/transcoding.py:237:8: ⚠️ W0612: Unused variable 'err' (unused-variable)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0914: Too many local variables (19/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:304:26: 🚨 E0606: Possibly using variable 'spath' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/transcoding.py:396:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0912: Too many branches (19/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0915: Too many statements (86/50) (too-many-statements)
************* Module bfi_dagster_project.assets.utils
bfi_dagster_project/assets/utils.py:625:0: 🎨 C0301: Line too long (152/100) (line-too-long)
bfi_dagster_project/assets/utils.py:633:0: 🎨 C0301: Line too long (141/100) (line-too-long)
bfi_dagster_project/assets/utils.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/utils.py:14:0: 🚨 E0401: Unable to import 'ffmpeg' (import-error)
bfi_dagster_project/assets/utils.py:15:0: 🚨 E0401: Unable to import 'tenacity' (import-error)
bfi_dagster_project/assets/utils.py:20:0: 🚨 E0401: Unable to import 'adlib_v3' (import-error)
bfi_dagster_project/assets/utils.py:20:0: 🎨 C0413: Import "import adlib_v3 as ad" should be placed at the top of the module (wrong-import-position)
bfi_dagster_project/assets/utils.py:38:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:69:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:128:8: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/utils.py:152:8: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/utils.py:103:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:170:42: 🚨 E0606: Possibly using variable 'policy' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/utils.py:174:8: ♻️ R1720: Unnecessary "elif" after "raise", remove the leading "el" from "elif" (no-else-raise)
bfi_dagster_project/assets/utils.py:175:12: ⚠️ W0719: Raising too general exception: Exception (broad-exception-raised)
bfi_dagster_project/assets/utils.py:195:8: ♻️ R1720: Unnecessary "elif" after "raise", remove the leading "el" from "elif" (no-else-raise)
bfi_dagster_project/assets/utils.py:196:12: ⚠️ W0719: Raising too general exception: Exception (broad-exception-raised)
bfi_dagster_project/assets/utils.py:264:8: 🎨 C0200: Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
bfi_dagster_project/assets/utils.py:225:0: ♻️ R0911: Too many return statements (9/6) (too-many-return-statements)
bfi_dagster_project/assets/utils.py:225:0: ♻️ R0912: Too many branches (17/12) (too-many-branches)
bfi_dagster_project/assets/utils.py:294:14: 🎨 C0207: Use subprocess.check_output(cmd, shell=False).decode().rsplit(': ', maxsplit=1)[-1] instead (use-maxsplit-arg)
bfi_dagster_project/assets/utils.py:424:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:445:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:449:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:472:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:507:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:502:18: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/utils.py:535:15: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:540:34: ⚠️ W0640: Cell variable f defined in loop (cell-var-from-loop)
bfi_dagster_project/assets/utils.py:519:10: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/utils.py:580:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:577:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:570:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:598:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:609:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:612:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:665:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:690:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:709:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:728:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:739:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module bfi_dagster_project.resources.__init__
bfi_dagster_project/resources/__init__.py:73:0: 🎨 C0301: Line too long (103/100) (line-too-long)
************* Module bfi_dagster_project.resources
bfi_dagster_project/resources/__init__.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/resources/__init__.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/resources/__init__.py:12:0: 🎨 C0115: Missing class docstring (missing-class-docstring)
bfi_dagster_project/resources/__init__.py:18:4: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:26:4: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:32:0: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:96:0: 🎨 C0115: Missing class docstring (missing-class-docstring)
bfi_dagster_project/resources/__init__.py:199:4: ♻️ R0913: Too many arguments (6/5) (too-many-arguments)
bfi_dagster_project/resources/__init__.py:199:4: ♻️ R0917: Too many positional arguments (6/5) (too-many-positional-arguments)
************* Module bfi_dagster_project.sensors
bfi_dagster_project/sensors/__init__.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/sensors/__init__.py:4:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/sensors/__init__.py:34:4: ⚠️ W0621: Redefining name 'failed_encoding_retry_sensor' from outer scope (line 123) (redefined-outer-name)
bfi_dagster_project/sensors/__init__.py:34:4: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
************* Module app
encoding_ui/app.py:13:0: 🚨 E0401: Unable to import 'flask' (import-error)
encoding_ui/app.py:20:0: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
encoding_ui/app.py:322:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[318:459]
==bfi_dagster_project.assets.transcoding:[320:458]
    dpath = os.path.join(str(Path(spath).parents[1]), "processing/", seq)
    log_data.append(f"Paths to work with:\n{dpath}\n{spath}")
    folder_size = utils.get_folder_size(dpath)
    file_size = utils.get_folder_size(spath)
    log_data.append(
        f"Found sizes in bytes:\n{folder_size} {dpath}\n{file_size} {spath}"
    )
    log = f"{spath}.txt"

    # Run chmod on MKV
    try:
        utils.recursive_chmod(spath, 0o777)
    except PermissionError as err:
        print(err)

    validation = True
    if not os.path.isfile(spath):
        log_data.append(f"WARNING: Filepath not found: {spath}")
        validation = False
        error_message = "RAWcook file not found"

    result = utils.mediaconch_mkv(spath)
    if result[0] != "Pass":
        log_data.append(result[1])
        log_data.append(f"WARNING: MKV file failed Mediaconch policy: {result[-1]}")
        validation = False
        error_message = "MKV policy failed, see validation log for details."
    log_data.append(f"MKV passed policy check: \n{result[1]}")

    # Check log for success statement
    success = utils.check_mkv_log(log)
    if success is False:
        validation = False
        log_data.append("WARNING: MKV log file returned Error warning")
        error_message = "Error found in RAWcooked log"
    log_data.append("Log for MKV passed checks")

    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass
    success = utils.check_file(spath)
    if success is False:
        validation = False
        log_data.append("WARNING: Matroska failed --check pass")
        error_message = "FFV1 MKV failed --check pass"
    log_data.append("MKV file passed --check test")

    # Check MKV not smaller than source folder
    if file_size > folder_size:
        log_data.append(
            f"WARNING: Directory size is not smaller that folder: {file_size} <= {folder_size}"
        )
        validation = False
        error_message = "MKV file larger than original folder size"

    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    else:
        # Delete image sequence
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}")

        success = utils.delete_sequence(os.path.join(cpath, seq))
        seq_del = "Deletion failed"
        if success:
            log_data.append("Image sequence deleted")
            seq_del = "Sequence deleted"

        # Move file to ingest
        success = utils.move_to_autoingest(spath)
        if not success:
            auto_move = "No"
        else:
            auto_move = "Yes"

        log_data.append("RAWcooked validation completed.")
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "transcode_logs")

        arguments = (
            ["status", "MKV validation complete"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["validation_success", "Yes"],
            ["error_message", "None"],
            ["sequence_deleted", seq_del],
            ["moved_to_autoingest", auto_move],
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        } (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[148:184]
==bfi_dagster_project.assets.transcoding:[187:223]
    output_v2 = utils.check_for_version_two(log_path)
    cmd = ["rawcooked", "-y", "--all"]

    if gaps is False:
        cmd.append("--no-accept-gaps")

    if output_v2 is True:
        cmd.extend(["--output-version", "2"])

    if fps16 is True:
        cmd.extend(["-framerate", "16"])
    if fps18 is True:
        cmd.extend(["-framerate", "18"])
    if fps24 is True:
        cmd.extend(["-framerate", "24"])
    if fps25 is True:
        cmd.extend(["-framerate", "25"])
    if fps30 is True:
        cmd.extend(["-framerate", "30"])
    if fps48 is True:
        cmd.extend(["-framerate", "48"])
    if fps50 is True:
        cmd.extend(["-framerate", "50"])
    if fps60 is True:
        cmd.extend(["-framerate", "60"])

    cmd.extend(
        [
            "-s",
            "5281680",
            f"{fullpath}",
            "-o",
            f"{ffv1_path}",
        ]
    )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==app:[31:55]
==bfi_dagster_project.resources.__init__:[167:191]
                    first_image TEXT,
                    last_image TEXT,
                    gaps_in_sequence TEXT,
                    assessment_pass TEXT,
                    assessment_complete TIMESTAMP,
                    colourspace TEXT,
                    seq_size INTEGER,
                    bitdepth INTEGER,
                    image_width TEXT,
                    image_height TEXT,
                    process_start TIMESTAMP,
                    encoding_choice TEXT,
                    encoding_log TEXT,
                    encoding_retry TEXT,
                    encoding_complete TIMESTAMP,
                    derivative_path TEXT,
                    derivative_size INTEGER,
                    derivative_md5 TEXT,
                    validation_complete TIMESTAMP,
                    validation_success TEXT,
                    error_message TEXT,
                    last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                    sequence_deleted TEXT,
                    moved_to_autoingest TEXT, (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[355:378]
==bfi_dagster_project.assets.transcoding:[395:417]
    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[393:415]
==bfi_dagster_project.assets.transcoding:[357:380]
    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[81:111]
==bfi_dagster_project.assets.transcoding:[94:124]
            "invalid": [r["sequence"] for r in results if r["success"] is False],
        }
        context.log.info(
            f"{log_prefix}Validation results: Valid={len(validated_files['valid'])}, "
            f"Invalid={len(validated_files['invalid'])}"
        )

        # Write data to log / db
        for data in results:
            seq = data["sequence"]
            args = data["db_arguments"]
            entry = context.resources.database.append_to_database(context, seq, args)
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log:
                    context.log.warning(f"{log_prefix}{log}")
                else:
                    context.log.info(f"{log_prefix}{log}")

        return dg.Output(
            value={
                "validated_files": validated_files["valid"],
                "invalid_files": validated_files["invalid"],
            },
            metadata={
                "successfully_complete": len(validated_files["valid"]),
                "failed_items": len(validated_files["invalid"]),
            },
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[357:370]
==bfi_dagster_project.assets.transcoding:[310:324]
        )
        return {
            "sequence": None,
            "success": False,
            "db_arguments": arguments,
            "logs": log_data,
        }
    fname = os.path.basename(spath)
    seq = fname.split(".")[0]
    dpath = os.path.join(str(Path(spath).parents[1]), "processing/", seq)
    log_data.append(f"Paths to work with:\n{dpath}\n{spath}")
    folder_size = utils.get_folder_size(dpath)
    file_size = utils.get_folder_size(spath) (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:436]
==bfi_dagster_project.assets.transcoding:[409:425]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    else:
        # Delete image sequence
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}")
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[100:111]
==bfi_dagster_project.assets.transcode_retry:[279:290]
        return dg.Output(
            value={
                "validated_files": validated_files["valid"],
                "invalid_files": validated_files["invalid"],
            },
            metadata={
                "successfully_complete": len(validated_files["valid"]),
                "failed_items": len(validated_files["invalid"]),
            },
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[455:468]
==bfi_dagster_project.assets.transcode_retry:[443:459]
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["validation_success", "Yes"],
            ["error_message", "None"],
            ["sequence_deleted", seq_del],
            ["moved_to_autoingest", auto_move],
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }


# Import note (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:436]
==bfi_dagster_project.assets.transcode_retry:[407:423]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    else:
        # Move image sequence and delete
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}")
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[303:312]
==bfi_dagster_project.assets.transcoding:[303:312]
    if not os.path.exists(spath):
        log_data.append(f"WARNING: Failed to find path {spath}. Exiting.")
        log_data.append(utils.move_to_failures(spath))

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
        )
        return { (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:429]
==bfi_dagster_project.assets.transcode_retry:[369:378]
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        } (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[460:468]
==bfi_dagster_project.assets.transcode_retry:[407:415]
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        } (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[448:459]
==bfi_dagster_project.assets.transcoding:[371:380]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[93:100]
==bfi_dagster_project.assets.transcoding:[79:87]
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log:
                    context.log.warning(f"{log_prefix}{log}")
                else:
                    context.log.info(f"{log_prefix}{log}")
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[197:204]
==bfi_dagster_project.assets.transcoding:[226:233]
        tic = time.perf_counter()
        # Alternative method for stderr stdout capture for RAWcooked/FFmpeg command
        with open(log_path, "a") as log_file:
            try:
                result = subprocess.run(
                    cmd, shell=False, check=True, stdout=log_file, stderr=log_file
                ) (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[442:448]
==bfi_dagster_project.assets.transcode_retry:[430:436]
        success = utils.move_to_autoingest(spath)
        if not success:
            auto_move = "No"
        else:
            auto_move = "Yes"
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[65:70]
==bfi_dagster_project.assets.transcoding:[104:109]
            args = data["db_arguments"]
            entry = context.resources.database.append_to_database(context, seq, args)
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log: (duplicate-code)

-----------------------------------
Your code has been rated at 8.73/10

Note: 🚨 Errors need immediate attention! ⚠️ Warnings should be reviewed, but are less critical. ℹ️ Information messages are for your reference.

@pre-commit-ci pre-commit-ci bot force-pushed the pre-commit-ci-update-config branch from d8203a2 to 7f4242c Compare March 2, 2026 20:19
@bfi-bot
Copy link
Copy Markdown

bfi-bot commented Mar 2, 2026

Automated Pylint Report 🧑‍💻

Here is the formatted Pylint report:

************* Module bfi_dagster_project.assets.archiving
bfi_dagster_project/assets/archiving.py:255:0: 🎨 C0301: Line too long (114/100) (line-too-long)
bfi_dagster_project/assets/archiving.py:307:0: 🎨 C0301: Line too long (124/100) (line-too-long)
bfi_dagster_project/assets/archiving.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/archiving.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0914: Too many local variables (29/15) (too-many-locals)
bfi_dagster_project/assets/archiving.py:253:19: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/archiving.py:278:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/archiving.py:296:60: 🚨 E0606: Possibly using variable 'tar_file' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0912: Too many branches (21/12) (too-many-branches)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0915: Too many statements (90/50) (too-many-statements)
bfi_dagster_project/assets/archiving.py:249:22: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0914: Too many local variables (19/15) (too-many-locals)
bfi_dagster_project/assets/archiving.py:351:32: 🚨 E0601: Using variable 'log' before assignment (used-before-assignment)
bfi_dagster_project/assets/archiving.py:352:47: 🚨 E0601: Using variable 'dpath' before assignment (used-before-assignment)
bfi_dagster_project/assets/archiving.py:406:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0912: Too many branches (15/12) (too-many-branches)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0915: Too many statements (68/50) (too-many-statements)
************* Module bfi_dagster_project.assets.get_sequences
bfi_dagster_project/assets/get_sequences.py:74:0: 🎨 C0301: Line too long (118/100) (line-too-long)
bfi_dagster_project/assets/get_sequences.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/get_sequences.py:4:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/get_sequences.py:16:4: ⚠️ W0621: Redefining name 'target_sequences' from outer scope (line 113) (redefined-outer-name)
************* Module bfi_dagster_project.assets.transcode_retry
bfi_dagster_project/assets/transcode_retry.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/transcode_retry.py:10:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/transcode_retry.py:38:4: ⚠️ W0621: Redefining name 'reencode_failed_asset' from outer scope (line 460) (redefined-outer-name)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0914: Too many local variables (38/15) (too-many-locals)
bfi_dagster_project/assets/transcode_retry.py:150:8: ⚠️ W0621: Redefining name 'cmd' from outer scope (line 1) (redefined-outer-name)
bfi_dagster_project/assets/transcode_retry.py:99:12: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcode_retry.py:200:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0912: Too many branches (39/12) (too-many-branches)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0915: Too many statements (139/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:15:0: ♻️ R0915: Too many statements (144/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0914: Too many local variables (18/15) (too-many-locals)
bfi_dagster_project/assets/transcode_retry.py:394:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0912: Too many branches (17/12) (too-many-branches)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0915: Too many statements (82/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:1:0: ⚠️ W0611: Unused import cmd (unused-import)
bfi_dagster_project/assets/transcode_retry.py:8:0: ⚠️ W0611: Unused List imported from typing (unused-import)
************* Module bfi_dagster_project.assets.transcoding
bfi_dagster_project/assets/transcoding.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/transcoding.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/transcoding.py:29:4: ♻️ R0914: Too many local variables (21/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:29:4: ♻️ R0912: Too many branches (15/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:14:0: ♻️ R0915: Too many statements (53/50) (too-many-statements)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0914: Too many local variables (28/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:229:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0912: Too many branches (24/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0915: Too many statements (93/50) (too-many-statements)
bfi_dagster_project/assets/transcoding.py:237:8: ⚠️ W0612: Unused variable 'err' (unused-variable)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0914: Too many local variables (19/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:304:26: 🚨 E0606: Possibly using variable 'spath' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/transcoding.py:396:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0912: Too many branches (19/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0915: Too many statements (86/50) (too-many-statements)
************* Module bfi_dagster_project.assets.utils
bfi_dagster_project/assets/utils.py:625:0: 🎨 C0301: Line too long (152/100) (line-too-long)
bfi_dagster_project/assets/utils.py:633:0: 🎨 C0301: Line too long (141/100) (line-too-long)
bfi_dagster_project/assets/utils.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/utils.py:14:0: 🚨 E0401: Unable to import 'ffmpeg' (import-error)
bfi_dagster_project/assets/utils.py:15:0: 🚨 E0401: Unable to import 'tenacity' (import-error)
bfi_dagster_project/assets/utils.py:20:0: 🚨 E0401: Unable to import 'adlib_v3' (import-error)
bfi_dagster_project/assets/utils.py:20:0: 🎨 C0413: Import "import adlib_v3 as ad" should be placed at the top of the module (wrong-import-position)
bfi_dagster_project/assets/utils.py:38:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:69:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:128:8: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/utils.py:152:8: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/utils.py:103:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:170:42: 🚨 E0606: Possibly using variable 'policy' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/utils.py:174:8: ♻️ R1720: Unnecessary "elif" after "raise", remove the leading "el" from "elif" (no-else-raise)
bfi_dagster_project/assets/utils.py:175:12: ⚠️ W0719: Raising too general exception: Exception (broad-exception-raised)
bfi_dagster_project/assets/utils.py:195:8: ♻️ R1720: Unnecessary "elif" after "raise", remove the leading "el" from "elif" (no-else-raise)
bfi_dagster_project/assets/utils.py:196:12: ⚠️ W0719: Raising too general exception: Exception (broad-exception-raised)
bfi_dagster_project/assets/utils.py:264:8: 🎨 C0200: Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
bfi_dagster_project/assets/utils.py:225:0: ♻️ R0911: Too many return statements (9/6) (too-many-return-statements)
bfi_dagster_project/assets/utils.py:225:0: ♻️ R0912: Too many branches (17/12) (too-many-branches)
bfi_dagster_project/assets/utils.py:294:14: 🎨 C0207: Use subprocess.check_output(cmd, shell=False).decode().rsplit(': ', maxsplit=1)[-1] instead (use-maxsplit-arg)
bfi_dagster_project/assets/utils.py:424:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:445:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:449:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:472:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:507:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:502:18: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/utils.py:535:15: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:540:34: ⚠️ W0640: Cell variable f defined in loop (cell-var-from-loop)
bfi_dagster_project/assets/utils.py:519:10: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/utils.py:580:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:577:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:570:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:598:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:609:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:612:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:665:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:690:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:709:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:728:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:739:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module bfi_dagster_project.resources.__init__
bfi_dagster_project/resources/__init__.py:73:0: 🎨 C0301: Line too long (103/100) (line-too-long)
************* Module bfi_dagster_project.resources
bfi_dagster_project/resources/__init__.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/resources/__init__.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/resources/__init__.py:12:0: 🎨 C0115: Missing class docstring (missing-class-docstring)
bfi_dagster_project/resources/__init__.py:18:4: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:26:4: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:32:0: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:96:0: 🎨 C0115: Missing class docstring (missing-class-docstring)
bfi_dagster_project/resources/__init__.py:199:4: ♻️ R0913: Too many arguments (6/5) (too-many-arguments)
bfi_dagster_project/resources/__init__.py:199:4: ♻️ R0917: Too many positional arguments (6/5) (too-many-positional-arguments)
************* Module bfi_dagster_project.sensors
bfi_dagster_project/sensors/__init__.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/sensors/__init__.py:4:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/sensors/__init__.py:34:4: ⚠️ W0621: Redefining name 'failed_encoding_retry_sensor' from outer scope (line 123) (redefined-outer-name)
bfi_dagster_project/sensors/__init__.py:34:4: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
************* Module app
encoding_ui/app.py:13:0: 🚨 E0401: Unable to import 'flask' (import-error)
encoding_ui/app.py:20:0: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
encoding_ui/app.py:322:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[318:459]
==bfi_dagster_project.assets.transcoding:[320:458]
    dpath = os.path.join(str(Path(spath).parents[1]), "processing/", seq)
    log_data.append(f"Paths to work with:\n{dpath}\n{spath}")
    folder_size = utils.get_folder_size(dpath)
    file_size = utils.get_folder_size(spath)
    log_data.append(
        f"Found sizes in bytes:\n{folder_size} {dpath}\n{file_size} {spath}"
    )
    log = f"{spath}.txt"

    # Run chmod on MKV
    try:
        utils.recursive_chmod(spath, 0o777)
    except PermissionError as err:
        print(err)

    validation = True
    if not os.path.isfile(spath):
        log_data.append(f"WARNING: Filepath not found: {spath}")
        validation = False
        error_message = "RAWcook file not found"

    result = utils.mediaconch_mkv(spath)
    if result[0] != "Pass":
        log_data.append(result[1])
        log_data.append(f"WARNING: MKV file failed Mediaconch policy: {result[-1]}")
        validation = False
        error_message = "MKV policy failed, see validation log for details."
    log_data.append(f"MKV passed policy check: \n{result[1]}")

    # Check log for success statement
    success = utils.check_mkv_log(log)
    if success is False:
        validation = False
        log_data.append("WARNING: MKV log file returned Error warning")
        error_message = "Error found in RAWcooked log"
    log_data.append("Log for MKV passed checks")

    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass
    success = utils.check_file(spath)
    if success is False:
        validation = False
        log_data.append("WARNING: Matroska failed --check pass")
        error_message = "FFV1 MKV failed --check pass"
    log_data.append("MKV file passed --check test")

    # Check MKV not smaller than source folder
    if file_size > folder_size:
        log_data.append(
            f"WARNING: Directory size is not smaller that folder: {file_size} <= {folder_size}"
        )
        validation = False
        error_message = "MKV file larger than original folder size"

    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    else:
        # Delete image sequence
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}")

        success = utils.delete_sequence(os.path.join(cpath, seq))
        seq_del = "Deletion failed"
        if success:
            log_data.append("Image sequence deleted")
            seq_del = "Sequence deleted"

        # Move file to ingest
        success = utils.move_to_autoingest(spath)
        if not success:
            auto_move = "No"
        else:
            auto_move = "Yes"

        log_data.append("RAWcooked validation completed.")
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "transcode_logs")

        arguments = (
            ["status", "MKV validation complete"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["validation_success", "Yes"],
            ["error_message", "None"],
            ["sequence_deleted", seq_del],
            ["moved_to_autoingest", auto_move],
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        } (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[148:184]
==bfi_dagster_project.assets.transcoding:[187:223]
        output_v2 = utils.check_for_version_two(log_path)
        cmd = ["rawcooked", "-y", "--all"]

        if gaps is False:
            cmd.append("--no-accept-gaps")

        if output_v2 is True:
            cmd.extend(["--output-version", "2"])

        if fps16 is True:
            cmd.extend(["-framerate", "16"])
        if fps18 is True:
            cmd.extend(["-framerate", "18"])
        if fps24 is True:
            cmd.extend(["-framerate", "24"])
        if fps25 is True:
            cmd.extend(["-framerate", "25"])
        if fps30 is True:
            cmd.extend(["-framerate", "30"])
        if fps48 is True:
            cmd.extend(["-framerate", "48"])
        if fps50 is True:
            cmd.extend(["-framerate", "50"])
        if fps60 is True:
            cmd.extend(["-framerate", "60"])

        cmd.extend(
            [
                "-s",
                "5281680",
                f"{fullpath}",
                "-o",
                f"{ffv1_path}",
            ]
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==app:[31:55]
==bfi_dagster_project.resources.__init__:[167:191]
                    first_image TEXT,
                    last_image TEXT,
                    gaps_in_sequence TEXT,
                    assessment_pass TEXT,
                    assessment_complete TIMESTAMP,
                    colourspace TEXT,
                    seq_size INTEGER,
                    bitdepth INTEGER,
                    image_width TEXT,
                    image_height TEXT,
                    process_start TIMESTAMP,
                    encoding_choice TEXT,
                    encoding_log TEXT,
                    encoding_retry TEXT,
                    encoding_complete TIMESTAMP,
                    derivative_path TEXT,
                    derivative_size INTEGER,
                    derivative_md5 TEXT,
                    validation_complete TIMESTAMP,
                    validation_success TEXT,
                    error_message TEXT,
                    last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                    sequence_deleted TEXT,
                    moved_to_autoingest TEXT, (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[355:378]
==bfi_dagster_project.assets.transcoding:[395:417]
    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[393:415]
==bfi_dagster_project.assets.transcoding:[357:380]
    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[81:111]
==bfi_dagster_project.assets.transcoding:[94:124]
            "invalid": [r["sequence"] for r in results if r["success"] is False],
        }
        context.log.info(
            f"{log_prefix}Validation results: Valid={len(validated_files['valid'])}, "
            f"Invalid={len(validated_files['invalid'])}"
        )

        # Write data to log / db
        for data in results:
            seq = data["sequence"]
            args = data["db_arguments"]
            entry = context.resources.database.append_to_database(context, seq, args)
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log:
                    context.log.warning(f"{log_prefix}{log}")
                else:
                    context.log.info(f"{log_prefix}{log}")

        return dg.Output(
            value={
                "validated_files": validated_files["valid"],
                "invalid_files": validated_files["invalid"],
            },
            metadata={
                "successfully_complete": len(validated_files["valid"]),
                "failed_items": len(validated_files["invalid"]),
            },
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[357:370]
==bfi_dagster_project.assets.transcoding:[310:324]
        )
        return {
            "sequence": None,
            "success": False,
            "db_arguments": arguments,
            "logs": log_data,
        }
    fname = os.path.basename(spath)
    seq = fname.split(".")[0]
    dpath = os.path.join(str(Path(spath).parents[1]), "processing/", seq)
    log_data.append(f"Paths to work with:\n{dpath}\n{spath}")
    folder_size = utils.get_folder_size(dpath)
    file_size = utils.get_folder_size(spath) (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:436]
==bfi_dagster_project.assets.transcoding:[409:425]
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }
    else:
        # Delete source sequence
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}") (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[100:111]
==bfi_dagster_project.assets.transcode_retry:[279:290]
        return dg.Output(
            value={
                "validated_files": validated_files["valid"],
                "invalid_files": validated_files["invalid"],
            },
            metadata={
                "successfully_complete": len(validated_files["valid"]),
                "failed_items": len(validated_files["invalid"]),
            },
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[455:468]
==bfi_dagster_project.assets.transcode_retry:[443:459]
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["validation_success", "Yes"],
            ["error_message", "None"],
            ["sequence_deleted", seq_del],
            ["moved_to_autoingest", auto_move],
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        } (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:436]
==bfi_dagster_project.assets.transcode_retry:[407:423]
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }
    else:
        # Delete source sequence
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}") (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[303:312]
==bfi_dagster_project.assets.transcoding:[303:312]
    if not os.path.exists(spath):
        log_data.append(f"WARNING: Failed to find path {spath}. Exiting.")
        log_data.append(utils.move_to_failures(spath))

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
        )
        return { (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:429]
==bfi_dagster_project.assets.transcode_retry:[369:378]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[460:468]
==bfi_dagster_project.assets.transcode_retry:[407:415]
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        } (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[448:459]
==bfi_dagster_project.assets.transcoding:[371:380]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[93:100]
==bfi_dagster_project.assets.transcoding:[79:87]
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log:
                    context.log.warning(f"{log_prefix}{log}")
                else:
                    context.log.info(f"{log_prefix}{log}")

        # Validate in function (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[197:204]
==bfi_dagster_project.assets.transcoding:[226:233]
        tic = time.perf_counter()
        # Alternative method for stderr stdout capture for RAWcooked/FFmpeg command
        with open(log_path, "a") as log_file:
            try:
                result = subprocess.run(
                    cmd, shell=False, check=True, stdout=log_file, stderr=log_file
                ) (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[442:448]
==bfi_dagster_project.assets.transcode_retry:[430:436]
        success = utils.move_to_autoingest(spath)
        if not success:
            auto_move = "No"
        else:
            auto_move = "Yes"
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[65:70]
==bfi_dagster_project.assets.transcoding:[104:109]
            args = data["db_arguments"]
            entry = context.resources.database.append_to_database(context, seq, args)
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log: (duplicate-code)

-----------------------------------
Your code has been rated at 8.73/10

Note: 🚨 Errors need immediate attention! ⚠️ Warnings should be reviewed, but are less critical. ℹ️ Information messages are for your reference.

@bfi-bot
Copy link
Copy Markdown

bfi-bot commented Mar 2, 2026

Automated Pylint Report 🧑‍💻

Here is the formatted Pylint report:

************* Module bfi_dagster_project.assets.archiving
bfi_dagster_project/assets/archiving.py:255:0: 🎨 C0301: Line too long (114/100) (line-too-long)
bfi_dagster_project/assets/archiving.py:307:0: 🎨 C0301: Line too long (124/100) (line-too-long)
bfi_dagster_project/assets/archiving.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/archiving.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0914: Too many local variables (29/15) (too-many-locals)
bfi_dagster_project/assets/archiving.py:253:19: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/archiving.py:278:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/archiving.py:296:60: 🚨 E0606: Possibly using variable 'tar_file' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0912: Too many branches (21/12) (too-many-branches)
bfi_dagster_project/assets/archiving.py:115:0: ♻️ R0915: Too many statements (90/50) (too-many-statements)
bfi_dagster_project/assets/archiving.py:249:22: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0914: Too many local variables (19/15) (too-many-locals)
bfi_dagster_project/assets/archiving.py:351:32: 🚨 E0601: Using variable 'log' before assignment (used-before-assignment)
bfi_dagster_project/assets/archiving.py:352:47: 🚨 E0601: Using variable 'dpath' before assignment (used-before-assignment)
bfi_dagster_project/assets/archiving.py:406:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0912: Too many branches (15/12) (too-many-branches)
bfi_dagster_project/assets/archiving.py:339:0: ♻️ R0915: Too many statements (68/50) (too-many-statements)
************* Module bfi_dagster_project.assets.get_sequences
bfi_dagster_project/assets/get_sequences.py:74:0: 🎨 C0301: Line too long (118/100) (line-too-long)
bfi_dagster_project/assets/get_sequences.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/get_sequences.py:4:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/get_sequences.py:16:4: ⚠️ W0621: Redefining name 'target_sequences' from outer scope (line 113) (redefined-outer-name)
************* Module bfi_dagster_project.assets.transcode_retry
bfi_dagster_project/assets/transcode_retry.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/transcode_retry.py:10:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/transcode_retry.py:38:4: ⚠️ W0621: Redefining name 'reencode_failed_asset' from outer scope (line 460) (redefined-outer-name)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0914: Too many local variables (38/15) (too-many-locals)
bfi_dagster_project/assets/transcode_retry.py:150:8: ⚠️ W0621: Redefining name 'cmd' from outer scope (line 1) (redefined-outer-name)
bfi_dagster_project/assets/transcode_retry.py:99:12: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcode_retry.py:200:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0912: Too many branches (39/12) (too-many-branches)
bfi_dagster_project/assets/transcode_retry.py:38:4: ♻️ R0915: Too many statements (139/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:15:0: ♻️ R0915: Too many statements (144/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0914: Too many local variables (18/15) (too-many-locals)
bfi_dagster_project/assets/transcode_retry.py:394:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0912: Too many branches (17/12) (too-many-branches)
bfi_dagster_project/assets/transcode_retry.py:294:0: ♻️ R0915: Too many statements (82/50) (too-many-statements)
bfi_dagster_project/assets/transcode_retry.py:1:0: ⚠️ W0611: Unused import cmd (unused-import)
bfi_dagster_project/assets/transcode_retry.py:8:0: ⚠️ W0611: Unused List imported from typing (unused-import)
************* Module bfi_dagster_project.assets.transcoding
bfi_dagster_project/assets/transcoding.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/transcoding.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/assets/transcoding.py:29:4: ♻️ R0914: Too many local variables (21/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:29:4: ♻️ R0912: Too many branches (15/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:14:0: ♻️ R0915: Too many statements (53/50) (too-many-statements)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0914: Too many local variables (28/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:229:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0912: Too many branches (24/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:128:0: ♻️ R0915: Too many statements (93/50) (too-many-statements)
bfi_dagster_project/assets/transcoding.py:237:8: ⚠️ W0612: Unused variable 'err' (unused-variable)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0914: Too many local variables (19/15) (too-many-locals)
bfi_dagster_project/assets/transcoding.py:304:26: 🚨 E0606: Possibly using variable 'spath' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/transcoding.py:396:4: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0912: Too many branches (19/12) (too-many-branches)
bfi_dagster_project/assets/transcoding.py:292:0: ♻️ R0915: Too many statements (86/50) (too-many-statements)
************* Module bfi_dagster_project.assets.utils
bfi_dagster_project/assets/utils.py:625:0: 🎨 C0301: Line too long (152/100) (line-too-long)
bfi_dagster_project/assets/utils.py:633:0: 🎨 C0301: Line too long (141/100) (line-too-long)
bfi_dagster_project/assets/utils.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/assets/utils.py:14:0: 🚨 E0401: Unable to import 'ffmpeg' (import-error)
bfi_dagster_project/assets/utils.py:15:0: 🚨 E0401: Unable to import 'tenacity' (import-error)
bfi_dagster_project/assets/utils.py:20:0: 🚨 E0401: Unable to import 'adlib_v3' (import-error)
bfi_dagster_project/assets/utils.py:20:0: 🎨 C0413: Import "import adlib_v3 as ad" should be placed at the top of the module (wrong-import-position)
bfi_dagster_project/assets/utils.py:38:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:69:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:128:8: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/utils.py:152:8: ♻️ R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
bfi_dagster_project/assets/utils.py:103:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:170:42: 🚨 E0606: Possibly using variable 'policy' before assignment (possibly-used-before-assignment)
bfi_dagster_project/assets/utils.py:174:8: ♻️ R1720: Unnecessary "elif" after "raise", remove the leading "el" from "elif" (no-else-raise)
bfi_dagster_project/assets/utils.py:175:12: ⚠️ W0719: Raising too general exception: Exception (broad-exception-raised)
bfi_dagster_project/assets/utils.py:195:8: ♻️ R1720: Unnecessary "elif" after "raise", remove the leading "el" from "elif" (no-else-raise)
bfi_dagster_project/assets/utils.py:196:12: ⚠️ W0719: Raising too general exception: Exception (broad-exception-raised)
bfi_dagster_project/assets/utils.py:264:8: 🎨 C0200: Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
bfi_dagster_project/assets/utils.py:225:0: ♻️ R0911: Too many return statements (9/6) (too-many-return-statements)
bfi_dagster_project/assets/utils.py:225:0: ♻️ R0912: Too many branches (17/12) (too-many-branches)
bfi_dagster_project/assets/utils.py:294:14: 🎨 C0207: Use subprocess.check_output(cmd, shell=False).decode().rsplit(': ', maxsplit=1)[-1] instead (use-maxsplit-arg)
bfi_dagster_project/assets/utils.py:424:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:445:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:449:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:472:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:507:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:502:18: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/utils.py:535:15: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:540:34: ⚠️ W0640: Cell variable f defined in loop (cell-var-from-loop)
bfi_dagster_project/assets/utils.py:519:10: ♻️ R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bfi_dagster_project/assets/utils.py:580:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:577:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:570:0: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bfi_dagster_project/assets/utils.py:598:11: ⚠️ W0718: Catching too general exception Exception (broad-exception-caught)
bfi_dagster_project/assets/utils.py:609:13: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:612:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:665:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:690:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:709:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:728:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
bfi_dagster_project/assets/utils.py:739:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
************* Module bfi_dagster_project.resources.__init__
bfi_dagster_project/resources/__init__.py:73:0: 🎨 C0301: Line too long (103/100) (line-too-long)
************* Module bfi_dagster_project.resources
bfi_dagster_project/resources/__init__.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/resources/__init__.py:9:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/resources/__init__.py:12:0: 🎨 C0115: Missing class docstring (missing-class-docstring)
bfi_dagster_project/resources/__init__.py:18:4: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:26:4: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:32:0: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
bfi_dagster_project/resources/__init__.py:96:0: 🎨 C0115: Missing class docstring (missing-class-docstring)
bfi_dagster_project/resources/__init__.py:199:4: ♻️ R0913: Too many arguments (6/5) (too-many-arguments)
bfi_dagster_project/resources/__init__.py:199:4: ♻️ R0917: Too many positional arguments (6/5) (too-many-positional-arguments)
************* Module bfi_dagster_project.sensors
bfi_dagster_project/sensors/__init__.py:1:0: 🎨 C0114: Missing module docstring (missing-module-docstring)
bfi_dagster_project/sensors/__init__.py:4:0: 🚨 E0401: Unable to import 'dagster' (import-error)
bfi_dagster_project/sensors/__init__.py:34:4: ⚠️ W0621: Redefining name 'failed_encoding_retry_sensor' from outer scope (line 123) (redefined-outer-name)
bfi_dagster_project/sensors/__init__.py:34:4: ♻️ R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
************* Module app
encoding_ui/app.py:13:0: 🚨 E0401: Unable to import 'flask' (import-error)
encoding_ui/app.py:20:0: 🎨 C0116: Missing function or method docstring (missing-function-docstring)
encoding_ui/app.py:322:9: ⚠️ W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[318:459]
==bfi_dagster_project.assets.transcoding:[320:458]
    dpath = os.path.join(str(Path(spath).parents[1]), "processing/", seq)
    log_data.append(f"Paths to work with:\n{dpath}\n{spath}")
    folder_size = utils.get_folder_size(dpath)
    file_size = utils.get_folder_size(spath)
    log_data.append(
        f"Found sizes in bytes:\n{folder_size} {dpath}\n{file_size} {spath}"
    )
    log = f"{spath}.txt"

    # Run chmod on MKV
    try:
        utils.recursive_chmod(spath, 0o777)
    except PermissionError as err:
        print(err)

    validation = True
    if not os.path.isfile(spath):
        log_data.append(f"WARNING: Filepath not found: {spath}")
        validation = False
        error_message = "RAWcook file not found"

    result = utils.mediaconch_mkv(spath)
    if result[0] != "Pass":
        log_data.append(result[1])
        log_data.append(f"WARNING: MKV file failed Mediaconch policy: {result[-1]}")
        validation = False
        error_message = "MKV policy failed, see validation log for details."
    log_data.append(f"MKV passed policy check: \n{result[1]}")

    # Check log for success statement
    success = utils.check_mkv_log(log)
    if success is False:
        validation = False
        log_data.append("WARNING: MKV log file returned Error warning")
        error_message = "Error found in RAWcooked log"
    log_data.append("Log for MKV passed checks")

    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass
    success = utils.check_file(spath)
    if success is False:
        validation = False
        log_data.append("WARNING: Matroska failed --check pass")
        error_message = "FFV1 MKV failed --check pass"
    log_data.append("MKV file passed --check test")

    # Check MKV not smaller than source folder
    if file_size > folder_size:
        log_data.append(
            f"WARNING: Directory size is not smaller that folder: {file_size} <= {folder_size}"
        )
        validation = False
        error_message = "MKV file larger than original folder size"

    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    else:
        # Move image sequence and delete
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}")

        success = utils.delete_sequence(os.path.join(cpath, seq))
        seq_del = "Deletion failed"
        if success:
            log_data.append("Image sequence deleted")
            seq_del = "Sequence deleted"

        # Move file to ingest
        success = utils.move_to_autoingest(spath)
        if not success:
            auto_move = "No"
        else:
            auto_move = "Yes"

        log_data.append("RAWcooked validation completed.")
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "transcode_logs")

        arguments = (
            ["status", "MKV validation complete"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["validation_success", "Yes"],
            ["error_message", "None"],
            ["sequence_deleted", seq_del],
            ["moved_to_autoingest", auto_move],
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }


# Import note (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[148:184]
==bfi_dagster_project.assets.transcoding:[187:223]
        output_v2 = utils.check_for_version_two(log_path)
        cmd = ["rawcooked", "-y", "--all"]

        if gaps is False:
            cmd.append("--no-accept-gaps")

        if output_v2 is True:
            cmd.extend(["--output-version", "2"])

        if fps16 is True:
            cmd.extend(["-framerate", "16"])
        if fps18 is True:
            cmd.extend(["-framerate", "18"])
        if fps24 is True:
            cmd.extend(["-framerate", "24"])
        if fps25 is True:
            cmd.extend(["-framerate", "25"])
        if fps30 is True:
            cmd.extend(["-framerate", "30"])
        if fps48 is True:
            cmd.extend(["-framerate", "48"])
        if fps50 is True:
            cmd.extend(["-framerate", "50"])
        if fps60 is True:
            cmd.extend(["-framerate", "60"])

        cmd.extend(
            [
                "-s",
                "5281680",
                f"{fullpath}",
                "-o",
                f"{ffv1_path}",
            ]
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==app:[31:55]
==bfi_dagster_project.resources.__init__:[167:191]
                    first_image TEXT,
                    last_image TEXT,
                    gaps_in_sequence TEXT,
                    assessment_pass TEXT,
                    assessment_complete TIMESTAMP,
                    colourspace TEXT,
                    seq_size INTEGER,
                    bitdepth INTEGER,
                    image_width TEXT,
                    image_height TEXT,
                    process_start TIMESTAMP,
                    encoding_choice TEXT,
                    encoding_log TEXT,
                    encoding_retry TEXT,
                    encoding_complete TIMESTAMP,
                    derivative_path TEXT,
                    derivative_size INTEGER,
                    derivative_md5 TEXT,
                    validation_complete TIMESTAMP,
                    validation_success TEXT,
                    error_message TEXT,
                    last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
                    sequence_deleted TEXT,
                    moved_to_autoingest TEXT, (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[355:378]
==bfi_dagster_project.assets.transcoding:[395:417]
    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[393:415]
==bfi_dagster_project.assets.transcoding:[357:380]
    if validation is False:
        # Move files/logs to failure path
        log_data.append(f"WARNING: RAWcook MKV failed: {error_message}")
        utils.move_to_failures(spath)
        utils.move_to_failures(dpath)
        for line in log_data:
            utils.append_to_log(log, line)
        utils.move_log_to_dest(log, "failures")

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_success", "No"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["error_message", error_message],
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[81:111]
==bfi_dagster_project.assets.transcoding:[94:124]
            "invalid": [r["sequence"] for r in results if r["success"] is False],
        }
        context.log.info(
            f"{log_prefix}Validation results: Valid={len(validated_files['valid'])}, "
            f"Invalid={len(validated_files['invalid'])}"
        )

        # Write data to log / db
        for data in results:
            seq = data["sequence"]
            args = data["db_arguments"]
            entry = context.resources.database.append_to_database(context, seq, args)
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log:
                    context.log.warning(f"{log_prefix}{log}")
                else:
                    context.log.info(f"{log_prefix}{log}")

        return dg.Output(
            value={
                "validated_files": validated_files["valid"],
                "invalid_files": validated_files["invalid"],
            },
            metadata={
                "successfully_complete": len(validated_files["valid"]),
                "failed_items": len(validated_files["invalid"]),
            },
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[357:370]
==bfi_dagster_project.assets.transcoding:[310:324]
        )
        return {
            "sequence": None,
            "success": False,
            "db_arguments": arguments,
            "logs": log_data,
        }
    fname = os.path.basename(spath)
    seq = fname.split(".")[0]
    dpath = os.path.join(str(Path(spath).parents[1]), "processing/", seq)
    log_data.append(f"Paths to work with:\n{dpath}\n{spath}")
    folder_size = utils.get_folder_size(dpath)
    file_size = utils.get_folder_size(spath) (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:436]
==bfi_dagster_project.assets.transcoding:[409:425]
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }
    else:
        # Delete source sequence
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}") (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[100:111]
==bfi_dagster_project.assets.transcode_retry:[279:290]
        return dg.Output(
            value={
                "validated_files": validated_files["valid"],
                "invalid_files": validated_files["invalid"],
            },
            metadata={
                "successfully_complete": len(validated_files["valid"]),
                "failed_items": len(validated_files["invalid"]),
            },
        )
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[455:468]
==bfi_dagster_project.assets.transcode_retry:[443:459]
            ["validation_complete", str(datetime.datetime.today())[:19]],
            ["validation_success", "Yes"],
            ["error_message", "None"],
            ["sequence_deleted", seq_del],
            ["moved_to_autoingest", auto_move],
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        } (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:436]
==bfi_dagster_project.assets.transcode_retry:[407:423]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    else:
        # Move image sequence and delete
        cpath = os.path.join(str(Path(spath).parents[1]), "processing/for_deletion/")
        if not os.path.exists(cpath):
            os.makedirs(cpath, exist_ok=True, mode=0o777)
        shutil.move(dpath, os.path.join(cpath, seq))
        log_data.append(f"Image sequence moved to {cpath}")
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[303:312]
==bfi_dagster_project.assets.transcoding:[303:312]
    if not os.path.exists(spath):
        log_data.append(f"WARNING: Failed to find path {spath}. Exiting.")
        log_data.append(utils.move_to_failures(spath))

        arguments = (
            ["status", "RAWcook failed"],
            ["validation_complete", str(datetime.datetime.today())[:19]],
        )
        return { (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[421:429]
==bfi_dagster_project.assets.transcode_retry:[369:378]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[460:468]
==bfi_dagster_project.assets.transcode_retry:[407:415]
        )

        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        } (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[448:459]
==bfi_dagster_project.assets.transcoding:[371:380]
        )
        return {
            "sequence": seq,
            "success": validation,
            "db_arguments": arguments,
            "logs": log_data,
        }

    # Run RAWcook check pass (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[93:100]
==bfi_dagster_project.assets.transcoding:[79:87]
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log:
                    context.log.warning(f"{log_prefix}{log}")
                else:
                    context.log.info(f"{log_prefix}{log}")
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.transcode_retry:[197:204]
==bfi_dagster_project.assets.transcoding:[226:233]
    tic = time.perf_counter()
    # Alternative method for stderr stdout capture for RAWcooked/FFmpeg command
    with open(log_path, "a") as log_file:
        try:
            result = subprocess.run(
                cmd, shell=False, check=True, stdout=log_file, stderr=log_file
            ) (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[442:448]
==bfi_dagster_project.assets.transcode_retry:[430:436]
        success = utils.move_to_autoingest(spath)
        if not success:
            auto_move = "No"
        else:
            auto_move = "Yes"
 (duplicate-code)
encoding_ui/app.py:1:0: ♻️ R0801: Similar lines in 2 files
==bfi_dagster_project.assets.archiving:[65:70]
==bfi_dagster_project.assets.transcoding:[104:109]
            args = data["db_arguments"]
            entry = context.resources.database.append_to_database(context, seq, args)
            context.log.info(f"{log_prefix}Written to Database: {entry}")
            for log in data["logs"]:
                if "WARNING" in log: (duplicate-code)

-----------------------------------
Your code has been rated at 8.73/10

Note: 🚨 Errors need immediate attention! ⚠️ Warnings should be reviewed, but are less critical. ℹ️ Information messages are for your reference.

@pre-commit-ci pre-commit-ci bot force-pushed the pre-commit-ci-update-config branch from 77d24a5 to 675a300 Compare March 9, 2026 20:14
updates:
- [github.com/psf/black-pre-commit-mirror: 25.9.0 → 26.3.1](psf/black-pre-commit-mirror@25.9.0...26.3.1)
- [github.com/pycqa/isort: 7.0.0 → 8.0.1](PyCQA/isort@7.0.0...8.0.1)
- [github.com/pylint-dev/pylint: v4.0.2 → v4.0.5](pylint-dev/pylint@v4.0.2...v4.0.5)
@pre-commit-ci pre-commit-ci bot force-pushed the pre-commit-ci-update-config branch from 66e1b8c to 792b5f2 Compare March 16, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant