kekeedme / cpspp

Computational Physics: Scientific Programming in Python
GNU General Public License v3.0
0 stars 0 forks source link

docstring on functions, pylint #6

Closed kekeedme closed 1 year ago

kekeedme commented 1 year ago

I have written docstrings for my functions, and respected the synthax and format that I have read on multiple documentations. However, pylint keeps telling me that I faild the docstring test. Can you please take a look and let me know what I am missing?

tipanverella commented 1 year ago

Men sa li di:

(cpspp) tipanverella@blackwell76:~/git/cpspp$ make lint
pylint notebooks
************* Module UsefulMathFunctions.taylorapproximation
notebooks/UsefulMathFunctions/taylorapproximation.py:1:0: C0114: Missing module docstring (missing-module-docstring)
************* Module UsefulMathFunctions.nderivative
notebooks/UsefulMathFunctions/nderivative.py:1:0: C0114: Missing module docstring (missing-module-docstring)
notebooks/UsefulMathFunctions/nderivative.py:1:0: R0801: Similar lines in 2 files
==UsefulMathFunctions.nderivative:[16:28]
==UsefulMathFunctions.taylorapproximation:[16:44]
    derivative = 0

    # setting up a loop to perform the sum for the nth derivative

    for k in range(order + 1):
        derivative = derivative + (
            (-1) ** (order + k)
            * (fact(order) / (fact(k) * fact(order - k)))
            * function(argument + k * stepsize)
        ) / (stepsize**order)

    return derivative

def taylorapprox(function, argument, a_value, maxorder, stepsize):
    """This function outputs the taylor approximation
    to nth-order of a user-specified function.

    It takes:
    :param function: the user-specified function
    :param argument: the argument at which we evaluate the approximation
              usually x-values for 1-D functions, can be a list.
    :param a_value: the center around which the user seeks the approximation
    :param maxorder: the maximum order of the approximation
    :param stepsize: the stepsize used to evaluate the derivatives
    Author: Kedy Edme
    Date: Jan 20th 2023
    """ (duplicate-code)

------------------------------------------------------------------
Your code has been rated at 8.24/10 (previous run: 8.24/10, +0.00)

An patikilye, li di ke fichye ou yo Missing module docstring (missing-module-docstring)! Ki vle di ke fichye yo pa gen yon docstring ki endike kisa fichye a ap fe, pa fonksyon ki andedan fichye a.

Mwen mete de placehoder docstring pou ou lan fichye yo.

tipanverella commented 1 year ago

Men li poko ka pase make lint, paske ou gen yon posyon kod lan UsefulMathFunctions.nderivative.py:[19:31] ki idantik a posyon UsefulMathFunctions.taylorapproximation.py:[20:48]. Lint pap ka kouprann poukisa ou bezwen sa a. O fet problem lan seke ou repete definisyon fonksyon nderivative lan nan fichye notebooks/UsefulMathFunctions/taylorapproximation.py.

(cpspp) tipanverella@blackwell76:~/git/cpspp$ make lint
pylint notebooks
************* Module UsefulMathFunctions.nderivative
notebooks/UsefulMathFunctions/nderivative.py:1:0: R0801: Similar lines in 2 files
==UsefulMathFunctions.nderivative:[19:31]
==UsefulMathFunctions.taylorapproximation:[20:48]
    derivative = 0

    # setting up a loop to perform the sum for the nth derivative

    for k in range(order + 1):
        derivative = derivative + (
            (-1) ** (order + k)
            * (fact(order) / (fact(k) * fact(order - k)))
            * function(argument + k * stepsize)
        ) / (stepsize**order)

    return derivative

def taylorapprox(function, argument, a_value, maxorder, stepsize):
    """This function outputs the taylor approximation
    to nth-order of a user-specified function.

    It takes:
    :param function: the user-specified function
    :param argument: the argument at which we evaluate the approximation
              usually x-values for 1-D functions, can be a list.
    :param a_value: the center around which the user seeks the approximation
    :param maxorder: the maximum order of the approximation
    :param stepsize: the stepsize used to evaluate the derivatives
    Author: Kedy Edme
    Date: Jan 20th 2023
    """ (duplicate-code)

------------------------------------------------------------------
Your code has been rated at 9.41/10 (previous run: 9.41/10, +0.00)

make: *** [Makefile:8: lint] Error 8
tipanverella commented 1 year ago

Pou korije a pati de sa mwen fe yo: Sou laptop pa w la,

  1. git fetch origin
  2. git checkout issue006
  3. Fe chanjman ke ou deside la a
  4. git add -A
  5. git commit -m "<komante ki di ki chwa ou fe>"
  6. git push origin

Epi nou ka diskute e fe pull-requests la ansanm.