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

Fix undefined name errors #759

Open
jsjiang opened this issue Oct 4, 2024 · 0 comments
Open

Fix undefined name errors #759

jsjiang opened this issue Oct 4, 2024 · 0 comments

Comments

@jsjiang
Copy link
Contributor

jsjiang commented Oct 4, 2024

Flake8 reported F821 undefined name errors in following scripts:

ezid/ezidapp/stats.py:62:36: F821 undefined name 'lastM'
ezid/templates/doc/ezid.py:116:1: F821 undefined name 'django'
ezid/templates/doc/ezid.py:169:41: F821 undefined name 'django'
ezid/templates/doc/ezid.py:239:1: F821 undefined name 'django'
ezid/templates/doc/ezid.py:251:28: F821 undefined name 'django'
ezid/tools/dashboard.py:138:40: F821 undefined name 'lastMonth'

The ezid/templates/doc/ezid.py script is not used and can be ignored. The errors on the 'lastM' and 'lastMonth' are from two very similar next month calculation routines.

Define the 'lastM' and 'lastMonth' variables to 'None' before these routines should fix the issue.

    for m in months:
        if m != months[0]:
            # noinspection PyUnboundLocalVariable,PyUnboundLocalVariable
            nextM = incrementMonth(lastM)
            while nextM != m:
                table.append((nextM, {}))
                nextM = incrementMonth(nextM)
        table.append((m, counts[m]))
        lastM = m
    for month in months:
        if month != months[0]:
            # noinspection PyUnboundLocalVariable
            nextMonth = incrementMonth(lastMonth)
            while nextMonth not in months:
                counters[nextMonth] = Counter()
                nextMonth = incrementMonth(nextMonth)
        lastMonth = month
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

No branches or pull requests

1 participant