cucumber / cucumber-expressions

Human friendly alternative to Regular Expressions
MIT License
143 stars 49 forks source link

Fix missing Python parameter type defaults #259

Closed kieran-ryan closed 5 months ago

kieran-ryan commented 7 months ago

🤔 What's changed?

The project documentation outlines for Customer Parameter Types that use_for_snippets "Defaults to true" and that prefer_for_regexp_match "Defaults to false".

Although this aligns with the documented Python example, its implementation is missing default values for those keyword arguments:

class ParameterType:
    def __init__(
        self,
        name,
        regexp,
        type,
        transformer,
        use_for_snippets,
        prefer_for_regexp_match,
    ):

With this PR:

  1. The appropriate defaults have been added to the ParameterType class.
  2. Two versions of Python type hints in the module defining that class have been reduced to one e.g. typing.List and list (through__future__.annotations).

⚡️ What's your motivation?

🏷️ What kind of change is this?

♻️ Anything particular you want feedback on?

Whether small correction to alternatives in README.md is appropriate.

📋 Checklist:

kieran-ryan commented 5 months ago

Appreciate the considered feedback @mpkorstanje - refined PR scope accordingly