On 03/18/2015 04:11 PM, Zygmunt Krynicki wrote:
> Review: Needs Fixing
>
> Hey.
>
> Thanks for improving this, it looks much better. I must ask you to
> run flake8 though as there are plenty of small things that flake
> will tell you
about.
I'd done that before, but I hadn't had the flake8-docstrings
installed. I've now installed it and it's coming up clean.
Sorry, I must disagree on this one. From a cognitive point of view,
blank lines help separate logically-related sections of functions,
which helps both finding relevant sections of code and understanding
it. In Googling the issue, I found, in PEP-8:
: Use blank lines in functions, sparingly, to indicate logical
: sections.
Judging by comments on online forums, this sentence seems to be
interpreted as anything from "use as many blank lines as you want" to
"don't ever use blank lines." In the face of that ambiguity, I'm
sticking with what both my personal preference and my cognitive
psychology training says works.
>> + "https://certification.canonical.com/me/") +
>> parser.add_argument( + "release", help="Ubuntu release
>> ('trusty', 'precise', etc.)")
>
> don't enumerate this but add choices=('trusty', ...) this will let
> argparse check it automatically
The downside to this is that it will require changes for each new
version. Granted, that's not often, but I'd rather not deal with that
(or, worse, foist it onto somebody who's never seen the code) when
16.04 or 18.04 comes out. As it is now, the script returns a report
with no entries if the code name is mistyped, which IMHO is not a big
deal; and it will work with future releases. Thus, I'd prefer to leave
it as-is.
- --
Rod Smith
Server and Cloud Certification Engineer
<email address hidden>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 03/18/2015 04:11 PM, Zygmunt Krynicki wrote:
> Review: Needs Fixing
>
> Hey.
>
> Thanks for improving this, it looks much better. I must ask you to
> run flake8 though as there are plenty of small things that flake
> will tell you
about.
I'd done that before, but I hadn't had the flake8-docstrings
installed. I've now installed it and it's coming up clean.
A couple more comments below....
>> + if certnum == "all": + request_params = {"username":
>> username, + "api_key": api_key} +
>> else: + request_params = {"username": username, +
>> "api_key": api_key, + "name": certnum}
>
> Don't add empty lines within functions.
Sorry, I must disagree on this one. From a cognitive point of view,
blank lines help separate logically-related sections of functions,
which helps both finding relevant sections of code and understanding
it. In Googling the issue, I found, in PEP-8:
: Use blank lines in functions, sparingly, to indicate logical
: sections.
Judging by comments on online forums, this sentence seems to be
interpreted as anything from "use as many blank lines as you want" to
"don't ever use blank lines." In the face of that ambiguity, I'm
sticking with what both my personal preference and my cognitive
psychology training says works.
>> + "https:/ /certification. canonical. com/me/") + add_argument( + "release", help="Ubuntu release
>> parser.
>> ('trusty', 'precise', etc.)")
>
> don't enumerate this but add choices=('trusty', ...) this will let
> argparse check it automatically
The downside to this is that it will require changes for each new
version. Granted, that's not often, but I'd rather not deal with that
(or, worse, foist it onto somebody who's never seen the code) when
16.04 or 18.04 comes out. As it is now, the script returns a report
with no entries if the code name is mistyped, which IMHO is not a big
deal; and it will work with future releases. Thus, I'd prefer to leave
it as-is.
- --
Rod Smith
Server and Cloud Certification Engineer
<email address hidden>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBAgAGBQJ VCel3AAoJEFgyRI +V0FjmH4YH/ 1z1sQGyB5bcE+ m2JLTPHt4Y VmKwNPgEbtJ+ zrk5isMnE+ A/e4ZpTisPcZLNj wNA9vyT5jY+ k FrbLZ8mJXYzcbeG o2aboPRljrBs+ 2SBKuuS6OM02MaK dYQaBs 3DmP/2cMvgTLLRu e25QKiP3sncj1ur 695Efy2NpSgeZo1 j/pd gigKJJRWLxBfVhz tXPlwPSqnESMMbE yxxNybPL59fYz9K C9+o O2f4hipfnJWzZqO tH9fltyv5m4A5JJ Cy4OasxeWwF0xl6 Xwg=
hZXxJAD81UgRSar
3AhTv4bZiDQGhXc
423F+0pDgZkHHue
i5MfbbPY240WsbL
pX+4dPbVBTCD7GV
=2kQB
-----END PGP SIGNATURE-----