Regression fixes and Documentation updates
This commit is contained in:
Binary file not shown.
@@ -114,6 +114,19 @@ def classify_files(file_list: List[str], config: Configuration) -> Dict[str, Lis
|
||||
for compiled_regex, original_keyword, rule_index in patterns_list:
|
||||
match = compiled_regex.search(filename)
|
||||
if match:
|
||||
# --- DEBUG LOG: Inspect available rule info ---
|
||||
log.debug(f" Match found! Rule Index: {rule_index}, Original Keyword: '{original_keyword}', Target Type: '{target_type}'")
|
||||
# Access the full rule details directly from the config's map_type_mapping list using the index
|
||||
matched_rule_details = None
|
||||
try:
|
||||
matched_rule_details = config.map_type_mapping[rule_index] # Access rule by index
|
||||
is_gloss_flag = matched_rule_details.get('is_gloss_source', False) # Get flag or default False
|
||||
log.debug(f" Associated rule details: {matched_rule_details}")
|
||||
log.debug(f" 'is_gloss_source' flag from rule: {is_gloss_flag}")
|
||||
except IndexError:
|
||||
log.warning(f" Could not access map_type_mapping rule at index {rule_index}. Cannot determine 'is_gloss_source' flag.")
|
||||
is_gloss_flag = False # Default if rule cannot be accessed
|
||||
# --- End DEBUG LOG ---
|
||||
matched_item_type = target_type # The standard type (e.g., MAP_COL)
|
||||
asset_name = None
|
||||
# --- Asset Name Extraction Logic (Simplified Heuristic) ---
|
||||
@@ -129,7 +142,9 @@ def classify_files(file_list: List[str], config: Configuration) -> Dict[str, Lis
|
||||
temp_grouped_files[asset_name].append({
|
||||
'file_path': file_path_str,
|
||||
'item_type': matched_item_type,
|
||||
'asset_name': asset_name
|
||||
'asset_name': asset_name,
|
||||
# --- Store the flag retrieved from the rule ---
|
||||
'is_gloss_source': is_gloss_flag # Store the boolean value obtained above
|
||||
})
|
||||
primary_asset_names.add(asset_name) # Mark this as a primary asset name
|
||||
is_map = True
|
||||
@@ -310,7 +325,8 @@ class PredictionHandler(QObject):
|
||||
# Create the single SourceRule for this input source
|
||||
source_rule = SourceRule(
|
||||
input_path=input_source_identifier, # Use the identifier provided
|
||||
supplier_identifier=supplier_identifier # Set overridable field
|
||||
supplier_identifier=supplier_identifier, # Set overridable field
|
||||
preset_name=preset_name # Pass the selected preset name
|
||||
)
|
||||
log.debug(f"Created SourceRule for identifier: {input_source_identifier} with supplier: {supplier_identifier}")
|
||||
|
||||
@@ -366,13 +382,26 @@ class PredictionHandler(QObject):
|
||||
item_type_override = "FILE_IGNORE" # Fallback to FILE_IGNORE string
|
||||
# Output format is determined by the engine, not predicted here. Leave as None.
|
||||
output_format_override = None
|
||||
|
||||
# --- DEBUG LOG: Inspect data before FileRule creation ---
|
||||
log.debug(f" Creating FileRule for: {file_info['file_path']}")
|
||||
log.debug(f" Using item_type_override: {item_type_override}")
|
||||
log.debug(f" Using target_asset_name_override: {target_asset_name_override}")
|
||||
# Explicitly check and log the flag value from file_info
|
||||
is_gloss_source_value = file_info.get('is_gloss_source', 'MISSING') # Get value or 'MISSING'
|
||||
log.debug(f" Value for 'is_gloss_source' from file_info: {is_gloss_source_value}")
|
||||
# --- End DEBUG LOG ---
|
||||
|
||||
# TODO: Need to verify FileRule constructor accepts is_gloss_source
|
||||
# and pass is_gloss_source_value if it does.
|
||||
# Pass the retrieved flag value to the constructor
|
||||
file_rule = FileRule(
|
||||
file_path=file_info['file_path'], # This is static info based on input
|
||||
# --- Populate ONLY Overridable Fields ---
|
||||
item_type_override=item_type_override,
|
||||
target_asset_name_override=target_asset_name_override,
|
||||
output_format_override=output_format_override,
|
||||
is_gloss_source=is_gloss_source_value if isinstance(is_gloss_source_value, bool) else False, # Pass the flag, ensure boolean
|
||||
# --- Leave Static Fields as Default/None ---
|
||||
resolution_override=None,
|
||||
channel_merge_instructions={},
|
||||
|
||||
Reference in New Issue
Block a user