1

In the centos-7 base and epel RPM repos, are there any reformatters for the Python language?

By "reformatter" I mean something that is like clang-format where the code stays functionally the same but the style is changed[1].

I saw in the epel that there are two tools that TEST against a specific style guide python-pep8.noarch and python2-pytest-pep8.noarch.

But neither of these reformats the python code.

p.s. if there is no such thing in the base or epel RPM repos, but pip is a little more tricky.


[1] Here is an example of code that stays functionally the same but is reformatted for style.

This example happens to use C++ file main.cc and clang-format... but I want this for Python.

Here is the file before I run clang-format:

#include <iostream>
using namespace std;
void func() { for(int i=0;i<10;i++) { cout << i << endl; } }
int main() { cout << "hello world 123123123123123" << endl; return 0; }

Then I run clang-format --style=Google main.cc and get the same functional code just different style:

#include <iostream>
using namespace std;
void func() {
  for (int i = 0; i < 10; i++) {
    cout << i << endl;
  }
}
int main() {
  cout << "hello world 123123123123123" << endl;
  return 0;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.