Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robust rule definition #5

Open
NithinChintala opened this issue Dec 27, 2022 · 1 comment
Open

Robust rule definition #5

NithinChintala opened this issue Dec 27, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@NithinChintala
Copy link
Contributor

NithinChintala commented Dec 27, 2022

It would be nice to define some more simple rules using just class variables to avoid __init__ logic, i.e. say a rule to Parse

This data is on a single line 5

to

[5]

With a rule like

class MyRule(SplitterRule):
     INDEX = 7
     CONVERTOR = int

could be nice to optionally define the tags (though we need logic to prevent these being defined both at the class and instance level)

class MyRule(Rule):
    START_TAG = "START DATA"
    END_TAG = "END_DATA"

    def process_lines(self, start_line):
         ...
@NithinChintala NithinChintala added the enhancement New feature or request label Dec 27, 2022
@NithinChintala NithinChintala self-assigned this Feb 10, 2023
@NithinChintala
Copy link
Contributor Author

If we add START_TAG and END_TAG class vars we probably will need a new method initState that is simply called at the end of init that can set up any non START_TAG / END_TAG state, this would allows users to not have to re-do the choose the init arg or class arg logic when over-riding initialization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant