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

Define xrange in python3 #15

Closed
wants to merge 5 commits into from

Conversation

cclauss
Copy link

@cclauss cclauss commented Sep 14, 2018

xrange(i) was removed in Python 3 in favor of range(i) so for small values of i, use range() in both versions of Python and for larger values of i, define xrange() in Python 3 to be identical to range().

Also:

cclauss added 2 commits September 14, 2018 16:29
Add [flake8](http://flake8.pycqa.org) tests to find Python syntax errors and undefined names.

__E901,E999,F821,F822,F823__ are the "_showstopper_" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. Most other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety.
* F821: undefined name `name`
* F822: undefined name `name` in `__all__`
* F823: local variable name referenced before assignment
* E901: SyntaxError or IndentationError
* E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
@cclauss
Copy link
Author

cclauss commented Sep 14, 2018

The remaining undefined names in Python 3 are covered in #16 and resolved in the commit below.

@hoffmansc
Copy link
Collaborator

The relevant files here are actually written by the original author and most of them are not necessary for our code. I recommend we do a couple things:

  • delete the unnecessary files (everything except __init__.py, commands.py, predict_lr.py, train_pr.py, fadm/lr/*, and fadm/util/* from what I can tell)
  • make the TypeError fix in fadm/lr/pr.py
  • make note of the above changes in prejudice_remover.py in the section which discusses the fairness-comparison changes
  • add the flake tests to Travis in addition to our pytest tests (it looks like these aren't being run here)
    • you may need to add the flake lines to both before_script sections and add back the exclude section (this seems to be a bug in Travis -- it spawns 4 builds otherwise)

@cclauss
Copy link
Author

cclauss commented Sep 19, 2018

I believed that the four runs were a feature not a bug. Two runs do flake8 static analysis while in parallel two other runs do pytest. By doing it all in parallel, we fail faster.

Also, perhaps it is better for you to delete the unnecessary files in a separate PR first. Then after that PR is merged, we can retool this PR around those changes

@hoffmansc
Copy link
Collaborator

Okay, I think I understand. Are you able to run a different script for different builds then? It looks like they all skip pytest right now. Also, is it necessary to install the pip requirements for the flake tests to run? If so, I'm not sure it saves any time to run in parallel. However, it might still be useful to run both flake and pytest separately so flake errors don't cause pytest not to run

BTW, I submitted a PR (#26) which removes the files

cclauss pushed a commit to cclauss/AIF360 that referenced this pull request Sep 25, 2018
Another attempt at Trusted-AI#15 which also tries to consolidate repetitive parts of the __.travis.yml__ file.

Add [flake8](http://flake8.pycqa.org) tests to find Python syntax errors and undefined names.

__E901,E999,F821,F822,F823__ are the "_showstopper_" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. Most other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety.
* F821: undefined name `name`
* F822: undefined name `name` in `__all__`
* F823: local variable name referenced before assignment
* E901: SyntaxError or IndentationError
* E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
@cclauss
Copy link
Author

cclauss commented Sep 25, 2018

Closing in favor of #26 and #29.

@cclauss cclauss closed this Sep 25, 2018
@cclauss cclauss deleted the Define-xrange-in-Python3 branch September 25, 2018 17:24
hoffmansc pushed a commit that referenced this pull request Sep 26, 2018
…#29)

* Travis CI: Add flake8 tests to find syntax errors and undefined names

Another attempt at #15 which also tries to consolidate repetitive parts of the __.travis.yml__ file.

Add [flake8](http://flake8.pycqa.org) tests to find Python syntax errors and undefined names.

__E901,E999,F821,F822,F823__ are the "_showstopper_" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. Most other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety.
* F821: undefined name `name`
* F822: undefined name `name` in `__all__`
* F823: local variable name referenced before assignment
* E901: SyntaxError or IndentationError
* E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree

* Undefined Name -- Typo: typeError --> typeError

* Move non-vital flake8 run to Python3 before_script

This run is merely about "style violations" that do not adversely effect Python runtime behavior.  Putting it in the __before_script_ keeps the output under a twisty.  We get quite similar results when running the style tests under Py2 and Py3 so just run them once.

* env: MLDB_URL="ftp://ftp.ics.uci.edu/pub/machine-learning-databases"

* Reinsert branches: only: - master
Illia-Kryvoviaz pushed a commit to Illia-Kryvoviaz/AIF360 that referenced this pull request Jun 7, 2023
…Trusted-AI#29)

* Travis CI: Add flake8 tests to find syntax errors and undefined names

Another attempt at Trusted-AI#15 which also tries to consolidate repetitive parts of the __.travis.yml__ file.

Add [flake8](http://flake8.pycqa.org) tests to find Python syntax errors and undefined names.

__E901,E999,F821,F822,F823__ are the "_showstopper_" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. Most other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety.
* F821: undefined name `name`
* F822: undefined name `name` in `__all__`
* F823: local variable name referenced before assignment
* E901: SyntaxError or IndentationError
* E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree

* Undefined Name -- Typo: typeError --> typeError

* Move non-vital flake8 run to Python3 before_script

This run is merely about "style violations" that do not adversely effect Python runtime behavior.  Putting it in the __before_script_ keeps the output under a twisty.  We get quite similar results when running the style tests under Py2 and Py3 so just run them once.

* env: MLDB_URL="ftp://ftp.ics.uci.edu/pub/machine-learning-databases"

* Reinsert branches: only: - master
Illia-Kryvoviaz pushed a commit to Illia-Kryvoviaz/AIF360 that referenced this pull request Jun 7, 2023
…Trusted-AI#29)

* Travis CI: Add flake8 tests to find syntax errors and undefined names

Another attempt at Trusted-AI#15 which also tries to consolidate repetitive parts of the __.travis.yml__ file.

Add [flake8](http://flake8.pycqa.org) tests to find Python syntax errors and undefined names.

__E901,E999,F821,F822,F823__ are the "_showstopper_" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. Most other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety.
* F821: undefined name `name`
* F822: undefined name `name` in `__all__`
* F823: local variable name referenced before assignment
* E901: SyntaxError or IndentationError
* E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree

* Undefined Name -- Typo: typeError --> typeError

* Move non-vital flake8 run to Python3 before_script

This run is merely about "style violations" that do not adversely effect Python runtime behavior.  Putting it in the __before_script_ keeps the output under a twisty.  We get quite similar results when running the style tests under Py2 and Py3 so just run them once.

* env: MLDB_URL="ftp://ftp.ics.uci.edu/pub/machine-learning-databases"

* Reinsert branches: only: - master
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.

None yet

2 participants