Ranger-Deep-Learning-Optimizer icon indicating copy to clipboard operation
Ranger-Deep-Learning-Optimizer copied to clipboard

Spelling, variables and PEP8

Open pablogps opened this issue 5 years ago • 6 comments

Hi and thanks for the code!

I am using your script for my code and while adapting it to PEP8 specs I found a few details that you may want to change. These are style changes that add clarity, but of course it is up to you whether to adhere to PEP8 recommendations or not. I could prepare a pull request as well if you like this style.

required (from torch.optim.optimizer) is not used itertools is not used

N_sma_threshhold <-- the variable name should not begin with a capital letter, also "threshold" has a typo

k <-- is an importan variable with an obscure name, perhaps something like "lookahead_steps" would be more clear?

Multi-line comments should use """comment""" Normal comments need a space after #

betas=(.95,0.999) (and others) need a space after the coma

You have commented code that is not used, perhaps it would be best to remove it altogether.

Spaces are not consistent and don't agree with PEP8.

pablogps avatar Sep 10 '19 08:09 pablogps

Hi @pablogps, Excellent recommendations and feedback. I will update the code per your suggestions and check it back in. Thanks again!

lessw2020 avatar Sep 10 '19 16:09 lessw2020

Not at all, thank you for uploading your work. I will take a look when it's done to see if I can be of any help :)

pablogps avatar Sep 11 '19 08:09 pablogps

@pablogps @lessw2020 PyCharm works wonders for code styling. It'll reformat all of your code to conform to PEP8 with one click under code > reformat code

glenn-jocher avatar Jan 19 '20 23:01 glenn-jocher

@lessw2020 Could you use black or yapf to make the code into a standard format? This would also reduce many PEP8 issues.

hiyyg avatar Jun 19 '20 18:06 hiyyg

@hiyyg - please try it now. I ran ranger.py through pylint via vscode and had a bunch of tweaks that should resolve this. Let me know if not! Thanks

lessw2020 avatar Jun 19 '20 18:06 lessw2020

Hi, and thanks for the update! I see many improvements, that's for sure! There may be a few lingering issues, though. For example, is the "required" import ever used? But most problems have been solved, so if you feel comfortable with the current version feel free to close the issue :)

pablogps avatar Aug 01 '20 19:08 pablogps