GithubHelp home page GithubHelp logo

Fails pep8 test about pykmip HOT 9 CLOSED

openkmip avatar openkmip commented on June 10, 2024
Fails pep8 test

from pykmip.

Comments (9)

PeterHamilton avatar PeterHamilton commented on June 10, 2024

@toothwalker Thanks for filing this. For-loops don't actually define their own scope so the reference to e in the raise call is legitimate. Are you actually seeing a pep8 error from this when you run tox -e pep8?

Regardless of scoping, I don't like having the raise call outside the except block like this, so I'll fix it.

from pykmip.

toothwalker avatar toothwalker commented on June 10, 2024

Yes I was running "tox -e pep8" and got the following error:
kmip/services/kmip_client.py:228:15: F821 undefined name 'e'

I believe the problem isn't the "for" loop. It is that "e" isn't assigned until it enters the exception handler (except Exception as e).

from pykmip.

PeterHamilton avatar PeterHamilton commented on June 10, 2024

Huh, that's bizarre. I've been running pep8 on this code for a year and haven't seen that error. Out of curiosity, what version of Python are you running?

from pykmip.

toothwalker avatar toothwalker commented on June 10, 2024

Python 2.7.12 is the default. Python 3.5.2 is also on the machine. I haven't looked the scripts to see if it is explicitly calling for Python 3.FYI I'm running Linux Mint 18

from pykmip.

toothwalker avatar toothwalker commented on June 10, 2024

Correct me if I'm wrong. But it looks like you are using flake8 for pep8 tests. My flake8 is indeed using Python 3.

flake8 --version
2.5.4 (pep8: 1.7.0, pyflakes: 1.1.0, mccabe: 0.2.1) CPython 3.5.2 on Linux

from pykmip.

PeterHamilton avatar PeterHamilton commented on June 10, 2024

You're correct, we are using flake8. When I look at the libraries installed for these runs (whether on my local system or in Travis), I see the following:

flake8: 3.0.4
mccabe: 0.5.2
pyflakes: 1.2.3

And this all runs on Python 2.7.9 (at least for Travis). It's possible that you're seeing this error due to using older versions of these libraries.

from pykmip.

PeterHamilton avatar PeterHamilton commented on June 10, 2024

In the process of looking through this code again I remembered why the raise statement is outside the loop. We only want to raise an exception if none of the potential endpoints can be connected to. If some fail, we just log the failure and keep trying. #201 simply removes the use of e outside the except block, which should resolve your pep8 error, while still retaining original functionality.

from pykmip.

toothwalker avatar toothwalker commented on June 10, 2024

I upgrade flake8, pyflakes, and mccabe to the same versions as you. I still had the error...But your patch fixed it. Thank you.

from pykmip.

PeterHamilton avatar PeterHamilton commented on June 10, 2024

Glad to hear it. If you see any other errors like that pop up, definitely file more issues.

from pykmip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.