Skip to content

Fix config.Config.classes assigning its subtype to subdoc instead of subtype - #593

Open
manucorsu wants to merge 1 commit into
Kozea:masterfrom
manucorsu:fix-config-classes-subtype-assignment
Open

Fix config.Config.classes assigning its subtype to subdoc instead of subtype#593
manucorsu wants to merge 1 commit into
Kozea:masterfrom
manucorsu:fix-config-classes-subtype-assignment

Conversation

@manucorsu

Copy link
Copy Markdown

Issue

In config.py (line 248), inside the Config class, the default assignment for classes was setting the str type as the value for its subdoc parameter instead of the intended subtype.

This is Key.__init__:

    def __init__(
            self, default_value, type_, category, doc, subdoc="", subtype=None
    ):
        """Create a configuration key"""
        self.value = default_value
        self.type = type_
        self.doc = doc
        self.category = category
        self.subdoc = subdoc
        self.subtype = subtype
        self.name = "Unbound"
        if category not in self._categories:
            self._categories.append(category)

        CONFIG_ITEMS.append(self)

And this was config.py line 248/249:

    classes = Key(('pygal-chart', ), list, "Style",
                  "Classes of the root svg node", str)

As you can see, str was being assigned to the fifth positional argument (subdoc), instead of the sixth (subtype).

Fix

I have modified that line to assign subtype by name instead of positionally:

    classes = Key(('pygal-chart', ), list, "Style",
                  "Classes of the root svg node", subtype=str)

Tests and linting

I've ran both make check and make lint: there are pytest warnings and linter errors but they do not stem from my change

(this is my first time contributing, please let me know if there's anything wrong with this PR)

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