Skip to content
New issue

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

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

Already on GitHub? # to your account

Reformat sources according to PEP8 #257

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

GBR-613
Copy link

@GBR-613 GBR-613 commented Sep 1, 2024

This PR includes the most trivial changes: spaces, removal of trailing semicolons, using is None instead of ==None etc.

@GBR-613
Copy link
Author

GBR-613 commented Sep 1, 2024

@dmnfarrell there are three issues that I eventually noticed:

  1. in dialogs.py, there is the following code:
        if mask is None:
            mask = df.index == df.index

Looks strange... I believe x==x always returns True, except if x is None or np.nan. If that is your intention, I would suggest to do it in more gracious way:
mask = mask or np.isnan(df.index)
2. In several places I see the following: webbrowser.open(link, autoraise=1)
Tools show a warning here, because autoraise parameter is declared to be BOOL.
Did you mean to use "new" parameter?
3. In core.py:

        cmap = d.results[0]
        alpha = float(d.results[1])
        df = self.model.df
        for col in cols:
            colname = df.columns[col]
            x = df[colname]
            clrs = self.values_to_colors(x, cmap, alpha)
            clrs = pd.Series(clrs, index=df.index)
            rc = self.rowcolors
            rc[colname] = clrs

Why is the casting to float? The respective parameter of values_to_colors() is declared to be int and d.results[1] is declared as int too.
Is the casting redundant or the 3rd parameter of values_to_colors() should be changed to float?

@GBR-613
Copy link
Author

GBR-613 commented Sep 1, 2024

  1. cope.py, line 3002:
        def popupFocusOut(event):
            popupmenu.unpost()

        if outside is None:
            # if outside table, just show general items
            row = self.get_row_clicked(event)
            col = self.get_col_clicked(event)
            coltype = self.model.getColumnType(col)

Does popupFocusOut(): really contain only one line, or there is a broken indentation?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants