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

flake8 fails on assert statement #38

Open
upkarlidder opened this issue Jun 5, 2021 · 4 comments
Open

flake8 fails on assert statement #38

upkarlidder opened this issue Jun 5, 2021 · 4 comments
Assignees
Labels

Comments

@upkarlidder
Copy link
Member

@JSegrave-IBM flake8 found an error that causes the build to fail.

Good first issue @Aquijada52 @TaeBlack. I will add the solution to the comment and @JSegrave-IBM can confirm.

  # stop the build if there are Python syntax errors or undefined names
  flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
  # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
  flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
  shell: /usr/bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.8.10/x64
./src/GasExposureAnalytics.py:226:99: F821 undefined name 'required_cols'
                assert FIREFIGHTER_ID_COL in df.columns, "CSV files is missing key columns %s" % (required_cols)
                                                                                                  ^
1     F821 undefined name 'required_cols'
@upkarlidder
Copy link
Member Author

@JSegrave-IBM can you confirm the required_cols should be ['timestamp_mins', 'firefighter_id']?

image

@upkarlidder
Copy link
Member Author

I commented the code out for now. @JSegrave-IBM please let us know what the right columns are to check for in this assert statement.

@upkarlidder
Copy link
Member Author

@JSegrave-IBM bumping issue.

@JSegrave-IBM
Copy link
Collaborator

Looking at that code, I'd say it's just 'firefighter_id'. It's true that 'timestamp_mins' would also be required, but the previous line of code would already have failed if that column was missing, so looks like this one is just checking that the rest of the key is present. So, something like this then?
assert FIREFIGHTER_ID_COL in df.columns, "CSV files is missing column %s" % (FIREFIGHTER_ID_COL)

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

No branches or pull requests

4 participants