Skip to content

fix(cli): restore fallback for unknown kernel language/type in kernels_pull#1091

Open
sridipbasu wants to merge 1 commit into
Kaggle:mainfrom
sridipbasu:fix/kernels-pull-fallback
Open

fix(cli): restore fallback for unknown kernel language/type in kernels_pull#1091
sridipbasu wants to merge 1 commit into
Kaggle:mainfrom
sridipbasu:fix/kernels-pull-fallback

Conversation

@sridipbasu

Copy link
Copy Markdown
Contributor

Summary

This fixes a bug in kernels_pull where the existing fallback for unknown kernel language/type combinations was never reached.

If the language/type doesn't match one of the known extension mappings, extension remains None. The code then attempts to build the filename using:

file_name = blob.slug + extension

which raises a TypeError before the fallback logic can execute.

Fix

Instead of concatenating immediately, the code now checks whether an extension was resolved first. If not, it allows the existing fallback to handle the case and use script.py.

This doesn't change the behavior for any of the currently supported language/type mappings.

Tests

Added regression tests covering:

  • unknown language
  • empty language
  • empty kernel type
  • unknown kernel type

Also verified that existing mappings continue to work correctly for supported kernel types.

Validation

  • pytest tests/unit
  • black --check .
  • mypy src/kaggle tests

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