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

Make use of dataclasses #13

Closed
rohaquinlop opened this issue Dec 28, 2023 · 0 comments
Closed

Make use of dataclasses #13

rohaquinlop opened this issue Dec 28, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@rohaquinlop
Copy link
Owner

Refactor DFA and NFA definition to make use of dataclasses, replace __init__ with dataclasses.

Refac this...

def __init__(self, name: str, unit_price: float, quantity_on_hand: int = 0):
    self.name = name
    self.unit_price = unit_price
    self.quantity_on_hand = quantity_on_hand

to this...

from dataclasses import dataclass

@dataclass
class InventoryItem:
    """Class for keeping track of an item in inventory."""
    name: str
    unit_price: float
    quantity_on_hand: int = 0

    def total_cost(self) -> float:
        return self.unit_price * self.quantity_on_hand
@rohaquinlop rohaquinlop self-assigned this Dec 28, 2023
@rohaquinlop rohaquinlop added enhancement New feature or request good first issue Good for newcomers labels Dec 28, 2023
rohaquinlop added a commit that referenced this issue Feb 16, 2024
- Make use of dataclasses in the implementation
of NFA and DFA classes
- Format all the python code using Ruff
- Update the functions and methods docstrings
- Make use of data types hinting in the functions,
methods and classes
rohaquinlop added a commit that referenced this issue Feb 16, 2024
feat(back): #13 update dfa and nfa classes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant