cape.cfdx.manage: Manage file counts and quotas

This module provides a variety of CAPE-related file management tools, including

  • find_json() to find apparent main CAPE JSON files

  • find_large_cases() to find large case folders

and more.

cape.cfdx.manage.find_json(pat: str | None = None) → list

Find all tracked CAPE JSON files in a repository

The test is not perfect and consists of the following three fairly reliable criteria:

  1. The JSON file is tracked by git

  2. The file name ends with .json

  3. The file contains "RunControl"

Obviously from criterion #1, this function only works in git repositories.

Call:
>>> cape_json_files = find_json(pat=None)
Inputs:
pat: {None} | str

Pattern to search for, defaults to "*.json"

Outputs:
cape_json_files: list[str]

List of apparent CAPE JSON files

Versions:
  • 2025-09-25 @ddalle: v1.0

  • 2026-07-18 @ddalle: v1.1; search "RunControl"

cape.cfdx.manage.find_json_solver(pat: str | None = None) → list

Find tracked CAPE JSON files in repo and report which solver

The results will be returned in order from most recently modified to least recently modified.

The test is not perfect and consists of the following three fairly reliable criteria:

  1. The JSON file is tracked by git

  2. The file name ends with .json

  3. The file contains "RunControl"

Obviously from criterion #1, this function only works in git repositories.

Call:
>>> json_files = find_json_solver()
Inputs:
pat: {None} | str

Pattern to search for, defaults to "*.json"

Outputs:
json_files: list[str, str]

List of apparent CAPE JSON files

Versions:
  • 2026-07-18 @ddalle: v1.0

  • 2026-07-20 @ddalle: v1.1; special rules for py{X}.json`

  • 2026-07-29 @ddalle: v1.2; work outside of git repo

cape.cfdx.manage.identify_case_solver() → str | None

Determine the intended solver of the current case folder

Call:
>>> solver = identify_case_solver()
Outputs:
solver: str | None

Intended solver "pycart", "pyfun", etc., if one could be determined. If no case.json file is found, returns None. If case.json is present but no other identifying features were found for a specific solver, returns "cfdx"

Versions:
  • 2026-07-20 @ddalle: v1.0

cape.cfdx.manage.identify_solver(fjson: str) → str | None

Determine the intended solver for a CAPE JSON file

Call:
>>> solver = identify_solver(fjson)
Inputs:
fjson: str

Name of JSON file to investigate

Outputs:
solver: str | None

Intended solver "pycart", "pyfun", etc., if one could be determined. If no “RunControl” section is found, returns None. If “RunControl” section is present but no other identifying features were found for a specific solver, returns "cfdx"

Versions:
  • 2026-07-18 @ddalle: v1.0

cape.cfdx.manage.search_repo_large(pat: str | None = None, cutoff: str | float | int = '100MB', **kw) → dict