From ecf698734243f7f519ad51cca7437e371cbe0e66 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Jan 2026 11:11:27 +0000 Subject: [PATCH 1/6] fix(ci): handle non-interactive mode for missing field prompts - Add auto-detection of 'sub' field based on conference name keywords - Define default 'sub' value (PY) for conferences without keyword match - Skip interactive prompts in CI environments (when stdin is not a tty) - Fixes EOF error when CI tries to prompt for missing conference fields The fill_missing_required function now: 1. Tries to auto-detect 'sub' using existing subs.yml keywords 2. Falls back to DEFAULT_SUB (PY) in non-interactive mode 3. Skips prompts for other required fields in CI (leaves as NaN for validation) --- utils/tidy_conf/utils.py | 58 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/utils/tidy_conf/utils.py b/utils/tidy_conf/utils.py index 12aa8d8347..9f778fec91 100644 --- a/utils/tidy_conf/utils.py +++ b/utils/tidy_conf/utils.py @@ -98,7 +98,46 @@ def query_yes_no(question, default="no"): sys.stdout.write("Please respond with 'yes' or 'no' (or 'y' or 'n').\n") +def _load_subs_keywords(): + """Load sub keywords from subs.yml for auto-detection.""" + from .subs import load_subs + + return load_subs() + + +def _auto_detect_sub(conference_name: str) -> str | None: + """Auto-detect sub category based on conference name. + + Args: + conference_name: Name of the conference + + Returns: + Sub category string if matched, None otherwise + """ + keywords = _load_subs_keywords() + name_lower = conference_name.lower() + for sub_key, sub_keywords in keywords.items(): + if any(word in name_lower for word in sub_keywords): + return sub_key + return None + + +# Default sub value for conferences that don't match any keyword +DEFAULT_SUB = "PY" + + def fill_missing_required(df): + """Fill missing required fields in the DataFrame. + + In non-interactive environments (CI), uses auto-detection and defaults + instead of prompting for user input. + + Args: + df: DataFrame with conference data + + Returns: + DataFrame with missing required fields filled + """ required = [ "conference", "year", @@ -110,9 +149,28 @@ def fill_missing_required(df): "sub", ] + is_interactive = sys.stdin.isatty() + for i, row in df.copy().iterrows(): for keyword in required: if pd.isna(row[keyword]): + # Handle sub field specially - try auto-detection first + if keyword == "sub": + detected_sub = _auto_detect_sub(row["conference"]) + if detected_sub: + df.loc[i, keyword] = detected_sub + continue + # Use default if no match and non-interactive + if not is_interactive: + df.loc[i, keyword] = DEFAULT_SUB + continue + + # In non-interactive mode, skip prompting for other fields + if not is_interactive: + # Leave as NaN - will be caught by validation later + continue + + # Interactive mode - prompt user user_input = input( f"What's the value of '{keyword}' for conference '{row['conference']}' check {row['link']} ?: ", ) From c26582e137c9fa368768775e99d145428d20a9e1 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Jan 2026 12:22:15 +0000 Subject: [PATCH 2/6] fix(subs): use module-relative path for subs.yml loading - Change load_subs() to use Path(__file__).parent for robustness - Add fallback in _load_subs_keywords() if loading fails - Prevents failures when script is run from non-root directories --- utils/tidy_conf/subs.py | 7 ++++++- utils/tidy_conf/utils.py | 12 +++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/utils/tidy_conf/subs.py b/utils/tidy_conf/subs.py index 3deeef596d..2bcbddc3e7 100644 --- a/utils/tidy_conf/subs.py +++ b/utils/tidy_conf/subs.py @@ -20,6 +20,11 @@ def auto_add_sub(data): def load_subs(): - with Path("utils", "tidy_conf", "data", "subs.yml").open(encoding="utf-8") as file: + """Load sub keywords from subs.yml. + + Uses module-relative path for robustness regardless of working directory. + """ + subs_path = Path(__file__).parent / "data" / "subs.yml" + with subs_path.open(encoding="utf-8") as file: data = yaml.safe_load(file) return data diff --git a/utils/tidy_conf/utils.py b/utils/tidy_conf/utils.py index 9f778fec91..97e77647ff 100644 --- a/utils/tidy_conf/utils.py +++ b/utils/tidy_conf/utils.py @@ -99,10 +99,16 @@ def query_yes_no(question, default="no"): def _load_subs_keywords(): - """Load sub keywords from subs.yml for auto-detection.""" - from .subs import load_subs + """Load sub keywords from subs.yml for auto-detection. - return load_subs() + Returns empty dict if loading fails, allowing fallback to DEFAULT_SUB. + """ + try: + from .subs import load_subs + + return load_subs() + except (FileNotFoundError, ImportError): + return {} def _auto_detect_sub(conference_name: str) -> str | None: From 47ca82ab4999a0a4b04d5cd10c71f61f1846cb5b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 12:43:36 +0000 Subject: [PATCH 3/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- utils/tidy_conf/deduplicate.py | 2 +- utils/tidy_conf/utils.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/utils/tidy_conf/deduplicate.py b/utils/tidy_conf/deduplicate.py index e0852b9fc0..868fab0810 100644 --- a/utils/tidy_conf/deduplicate.py +++ b/utils/tidy_conf/deduplicate.py @@ -3,7 +3,7 @@ def merge_near_duplicates(group): # Fill missing values with the next value then take the first row - with pd.option_context('future.no_silent_downcasting', True): + with pd.option_context("future.no_silent_downcasting", True): group = group.bfill().ffill().infer_objects(copy=False) return group.iloc[0] diff --git a/utils/tidy_conf/utils.py b/utils/tidy_conf/utils.py index 97e77647ff..0c37450c9a 100644 --- a/utils/tidy_conf/utils.py +++ b/utils/tidy_conf/utils.py @@ -117,7 +117,8 @@ def _auto_detect_sub(conference_name: str) -> str | None: Args: conference_name: Name of the conference - Returns: + Returns + ------- Sub category string if matched, None otherwise """ keywords = _load_subs_keywords() @@ -141,7 +142,8 @@ def fill_missing_required(df): Args: df: DataFrame with conference data - Returns: + Returns + ------- DataFrame with missing required fields filled """ required = [ From 663875450e24ea53e8281cd38444a0d915f05ed9 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Jan 2026 12:45:18 +0000 Subject: [PATCH 4/6] fix(docs): fix docstring format for docsig compliance --- utils/tidy_conf/utils.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/utils/tidy_conf/utils.py b/utils/tidy_conf/utils.py index 0c37450c9a..bc21bd4ed2 100644 --- a/utils/tidy_conf/utils.py +++ b/utils/tidy_conf/utils.py @@ -117,9 +117,8 @@ def _auto_detect_sub(conference_name: str) -> str | None: Args: conference_name: Name of the conference - Returns - ------- - Sub category string if matched, None otherwise + Returns: + Sub category string if matched, None otherwise. """ keywords = _load_subs_keywords() name_lower = conference_name.lower() @@ -133,7 +132,7 @@ def _auto_detect_sub(conference_name: str) -> str | None: DEFAULT_SUB = "PY" -def fill_missing_required(df): +def fill_missing_required(df: pd.DataFrame) -> pd.DataFrame: """Fill missing required fields in the DataFrame. In non-interactive environments (CI), uses auto-detection and defaults @@ -142,9 +141,8 @@ def fill_missing_required(df): Args: df: DataFrame with conference data - Returns - ------- - DataFrame with missing required fields filled + Returns: + DataFrame with missing required fields filled. """ required = [ "conference", From 1d75023aa41a2027c9316083fd3ef8254658c9ad Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 12:45:34 +0000 Subject: [PATCH 5/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- utils/tidy_conf/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/tidy_conf/utils.py b/utils/tidy_conf/utils.py index bc21bd4ed2..59830c7a05 100644 --- a/utils/tidy_conf/utils.py +++ b/utils/tidy_conf/utils.py @@ -117,7 +117,8 @@ def _auto_detect_sub(conference_name: str) -> str | None: Args: conference_name: Name of the conference - Returns: + Returns + ------- Sub category string if matched, None otherwise. """ keywords = _load_subs_keywords() @@ -141,7 +142,8 @@ def fill_missing_required(df: pd.DataFrame) -> pd.DataFrame: Args: df: DataFrame with conference data - Returns: + Returns + ------- DataFrame with missing required fields filled. """ required = [ From c628efc982899b805bd10509da6224398eeb55dc Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Jan 2026 12:50:01 +0000 Subject: [PATCH 6/6] fix(docs): use numpy-style docstrings with type on separate line --- utils/tidy_conf/utils.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/utils/tidy_conf/utils.py b/utils/tidy_conf/utils.py index 59830c7a05..0ee7eafa4d 100644 --- a/utils/tidy_conf/utils.py +++ b/utils/tidy_conf/utils.py @@ -114,11 +114,14 @@ def _load_subs_keywords(): def _auto_detect_sub(conference_name: str) -> str | None: """Auto-detect sub category based on conference name. - Args: - conference_name: Name of the conference + Parameters + ---------- + conference_name : str + Name of the conference Returns ------- + str | None Sub category string if matched, None otherwise. """ keywords = _load_subs_keywords() @@ -139,11 +142,14 @@ def fill_missing_required(df: pd.DataFrame) -> pd.DataFrame: In non-interactive environments (CI), uses auto-detection and defaults instead of prompting for user input. - Args: - df: DataFrame with conference data + Parameters + ---------- + df : pd.DataFrame + DataFrame with conference data Returns ------- + pd.DataFrame DataFrame with missing required fields filled. """ required = [