communities: ranking fix

* Fixes an issue with the community ranking in the case no records
  have been accepted.

* Fixes some PEP8 errors.

Signed-off-by: Lars Holm Nielsen <lars.holm.nielsen@cern.ch>