Calmcode - flake8: usage

Usage

1 2 3 4 5 6 7

Flake8 will look at your code and check for style issues. It's automatable, which is great, but it's also very simple to use.

This is the code.py file that we start with;

import pandas as pd
from numpy import *

settings = {"a": 1, "b": 2, "c": 3, "a": 2}

def fibonachi( s1, s2, n ):
    """
    calculates the fibonachi sequence
    with given custom numbers
    """
    result = [s1 , s2]
    for i in range( n ):
        s1, s2 = s2, s1 + s2
        result.append(s2)
    return result

def fibonachi_standard(n):
    """
    calculates the standard fibonachi sequence
    """
    return Fibonachi(s1=1, s2=2, n)

We then run the following;

flake8 code.py

This gives us a list of errors and we remove them one by one.

settings = {"a": 1, "b": 2, "c": 3}

def fibonachi(s1, s2, n):
    """
    calculates the fibonachi sequence
    with given custom numbers
    """
    result = [s1, s2]
    for i in range(n):
        s1, s2 = s2, s1 + s2
        result.append(s2)
    return result


def fibonachi_standard(n):
    """
    calculates the standard fibonachi sequence
    """
    return fibonachi(s1=1, s2=2, n)