Skip to content

Conversation

@yannrichet-asnr
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings December 5, 2025 16:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a new fzl command for listing models and calculators with enhanced pattern matching capabilities, and refactors calculator/model argument handling for better modularity and maintainability.

Key Changes:

  • Added new fzl function and CLI command that lists models and calculators with support for glob/regex patterns, model-calculator compatibility checking, and optional validation
  • Moved calculator-related helper functions from fz/core.py to fz/helpers.py for better code organization
  • Implemented generic item resolution functions that support multiple argument forms: plain URIs, JSON files/strings, aliases, glob patterns, and regex patterns
  • Replaced the old list command implementation with the new fzl functionality (breaking change: removed --global flag in favor of --models and --calculators pattern matching)

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
tests/test_cli_commands.py Removed two tests for the old list command's --global flag functionality
tests/test_calculator_discovery.py Added 600+ lines of comprehensive tests covering calculator argument forms, glob patterns, regex patterns, JSON file patterns, and Windows-specific calculator handling
setup.py Added fzl entry point to console scripts
fz/helpers.py Moved calculator functions from core.py; added new generic item resolution functions supporting multiple argument forms and pattern matching
fz/core.py Removed calculator helper functions (moved to helpers.py); added new fzl function for listing models/calculators with validation support
fz/cli.py Added fzl_main CLI entry point with markdown/JSON/table output formats; updated list command to use new fzl functionality
fz/__init__.py Exported new fzl function in public API
Comments suppressed due to low confidence (2)

fz/helpers.py:1964

  • Except block directly handles BaseException.
        except:

fz/helpers.py:1994

  • Except block directly handles BaseException.
    except:

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

parsed = _parse_argument(item_str, alias_type=item_type)
if isinstance(parsed, dict):
if item_type == 'calculators':

Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blank line has incorrect indentation. Remove this blank line or fix its indentation.

Copilot uses AI. Check for mistakes.
if not _calculator_supports_model(item_data, model_name):
continue


Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra blank lines with incorrect indentation. Remove these blank lines or fix their indentation to be consistent with the surrounding code.

Suggested change

Copilot uses AI. Check for mistakes.
if not _calculator_supports_model(item_data, model_name):
continue


Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra blank lines with incorrect indentation. Remove these blank lines or fix their indentation to be consistent with the surrounding code.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +1994 to +1995
except:
pass
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bare except: clause catches all exceptions including KeyboardInterrupt and SystemExit, which can make debugging difficult. Specify the exception type(s) you want to catch, such as except (ValueError, TypeError, KeyError): or at minimum use except Exception:.

Copilot uses AI. Check for mistakes.
for item in parsed:
if isinstance(item, dict):
if item_type == 'calculators':

Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blank line has incorrect indentation (appears to have extra leading whitespace). Remove this blank line or fix its indentation.

Suggested change

Copilot uses AI. Check for mistakes.
parsed = _parse_argument(item_str, alias_type=item_type)
if isinstance(parsed, dict):
if item_type == 'calculators':

Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blank line has incorrect indentation. Remove this blank line or fix its indentation.

Copilot uses AI. Check for mistakes.
for item in parsed:
if isinstance(item, dict):
if item_type == 'calculators':

Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blank line has incorrect indentation. Remove this blank line or fix its indentation.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +267 to +270
_calculator_supports_model,
_extract_calculator_uri,
_find_all_calculators,
_filter_calculators_by_model,
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of '_calculator_supports_model' is not used.
Import of '_extract_calculator_uri' is not used.
Import of '_find_all_calculators' is not used.
Import of '_filter_calculators_by_model' is not used.

Suggested change
_calculator_supports_model,
_extract_calculator_uri,
_find_all_calculators,
_filter_calculators_by_model,

Copilot uses AI. Check for mistakes.
result = fzl_func(models=args.models, calculators=args.calculators, check=args.check)

if args.format == "json":
import json
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import of module json is redundant, as it was previously imported on line 6.

Suggested change
import json

Copilot uses AI. Check for mistakes.
result = fzl_func(models=args.models, calculators=args.calculators, check=args.check)

if args.format == "json":
import json
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import of module json is redundant, as it was previously imported on line 6.

Suggested change
import json

Copilot uses AI. Check for mistakes.
@yannrichet-asnr yannrichet-asnr merged commit 487a5b3 into main Dec 5, 2025
22 checks passed
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.

3 participants