diff --git a/.github/workflows/pydocstyle_kyu2.yml b/.github/workflows/pydocstyle_kyu2.yml new file mode 100644 index 00000000000..f27a6ba054f --- /dev/null +++ b/.github/workflows/pydocstyle_kyu2.yml @@ -0,0 +1,46 @@ +--- +name: pydocstyle for kyu2 + +on: # yamllint disable-line rule:truthy + push: + branches: + - 'kyu2' + +permissions: + contents: read + pull-requests: read + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.x"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + # This is the version of the action for setting up Python, + # not the Python version. + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + # You can test your matrix by printing the current Python version + - name: Display Python version + run: python -c "import sys; print(sys.version)" + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + pip install -r requirements.txt + pip install pydocstyle + pip install types-requests + - name: Check to make sure that the module is in your Python path + run: | + echo $PYTHONPATH + - name: Check pydocstyle version + run: | + pydocstyle --version + - name: Doc style checking with pydocstyle + # Pydocstyle testing (Guide) + # https://www.pydocstyle.org/en/stable/usage.html#cli-usage + run: | + pydocstyle --verbose --explain --count kyu_2 diff --git a/.pydocstyle b/.pydocstyle new file mode 100644 index 00000000000..7182aa80170 --- /dev/null +++ b/.pydocstyle @@ -0,0 +1,3 @@ +[pydocstyle] +inherit = false +match = .*\.py \ No newline at end of file diff --git a/kyu_2/__init__.py b/kyu_2/__init__.py index e69de29bb2d..bd812863680 100644 --- a/kyu_2/__init__.py +++ b/kyu_2/__init__.py @@ -0,0 +1 @@ +"""Codewars kyu_2 package.""" diff --git a/kyu_2/evaluate_mathematical_expression/__init__.py b/kyu_2/evaluate_mathematical_expression/__init__.py index e69de29bb2d..92e7bfd6530 100644 --- a/kyu_2/evaluate_mathematical_expression/__init__.py +++ b/kyu_2/evaluate_mathematical_expression/__init__.py @@ -0,0 +1 @@ +"""Codewars kyu_2 package: Evaluate mathematical expression.""" diff --git a/kyu_2/evaluate_mathematical_expression/evaluate.py b/kyu_2/evaluate_mathematical_expression/evaluate.py index 838725fb105..5df8845753f 100644 --- a/kyu_2/evaluate_mathematical_expression/evaluate.py +++ b/kyu_2/evaluate_mathematical_expression/evaluate.py @@ -13,7 +13,8 @@ def calculate(i: int, char: str, strings: list) -> None: """ - Calculate math expression + Calculate math expression. + :param i: int :param char: str :param strings: list @@ -35,7 +36,8 @@ def calculate(i: int, char: str, strings: list) -> None: def process_math_expression(string: str, operators: list) -> str: """ - Process math expression + Process math expression. + :param string: str :param operators: list :return: str @@ -53,7 +55,8 @@ def process_math_expression(string: str, operators: list) -> str: def bracket_start(strings: list) -> int: """ - Return index of first (open) bracket + Return index of first (open) bracket. + :param strings: list :return: int """ @@ -63,7 +66,8 @@ def bracket_start(strings: list) -> int: def bracket_end(strings: list, start: int) -> int: """ - Return index of last (close) bracket + Return index of last (close) bracket. + :param strings: :param start: :return: @@ -73,8 +77,10 @@ def bracket_end(strings: list, start: int) -> int: def process_brackets(strings: list) -> str: """ - Process brackets in order to convert - input string into math expression + Test bracket processing. + + Process brackets in order to convert input + string into math expression. :param strings: list :return: str """ @@ -103,7 +109,8 @@ def process_brackets(strings: list) -> str: def process_duplicate_minus(string: str) -> str: """ - Eliminate duplicate minus + Eliminate duplicate minus. + :param string: str :return: str """ @@ -139,7 +146,8 @@ def process_duplicate_minus(string: str) -> str: def calc(string: str) -> float: """ - Calculate math expression from input string + Calculate math expression from input string. + :param string: str :return: float """ @@ -164,7 +172,9 @@ def calc(string: str) -> float: def check_conditions(strings: list, string: str, temp: str) -> tuple[str, str]: """ - Normalizing string input by checking conditions + Test string normalization. + + Normalize string input by checking conditions. :param strings: list :param string: str :param temp: str diff --git a/kyu_2/evaluate_mathematical_expression/test_evaluate.py b/kyu_2/evaluate_mathematical_expression/test_evaluate.py index 8e0ca54451b..2adbbc6f463 100644 --- a/kyu_2/evaluate_mathematical_expression/test_evaluate.py +++ b/kyu_2/evaluate_mathematical_expression/test_evaluate.py @@ -1,5 +1,6 @@ """ -Test for -> calc method +Test for -> calc method. + Created by Egor Kostan. GitHub: https://github.com/ikostan """ @@ -34,13 +35,12 @@ name='Source/Kata') # pylint: enable=R0801 class CalcTestCase(unittest.TestCase): - """ - Testing calc method - """ + """Testing calc method.""" def test_calc(self): """ - Testing calc class + Testing calc class. + Given a mathematical expression as a string you must return the result as a number. """