Skip to content

Commit

Permalink
Merge pull request #564 from iKostanOrg/master
Browse files Browse the repository at this point in the history
Merge from master
  • Loading branch information
ikostan authored Dec 20, 2024
2 parents d87e55d + a646ccf commit 3e760de
Show file tree
Hide file tree
Showing 294 changed files with 3,097 additions and 2,563 deletions.
27 changes: 18 additions & 9 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
---
engines:
# ... CONFIG CONTENT ...
pylint:
enabled: true
# ... CONFIG CONTENT ...
checks:
import-error:
enabled: false
# ... CONFIG CONTENT ...
version: "2" # required to adjust maintainability checks

checks:
import-error:
enabled: false
syntax-error:
enabled: false
no-name-in-module:
enabled: false
similar-code:
config:
threshold: 68
identical-code:
config:
threshold: 32
plugins:
duplication:
enabled: false
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
python -m pytest . -v --cov-report term-missing --cov-report=xml --cov=./
# yamllint enable rule:line-length
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5.0.7
uses: codecov/codecov-action@v5.1.2
with:
token: ${{ secrets.codecov_token }}
files: coverage.xml
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/pydocstyle_kyu2.yml
Original file line number Diff line number Diff line change
@@ -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
46 changes: 46 additions & 0 deletions .github/workflows/pydocstyle_kyu3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: pydocstyle for kyu3

on: # yamllint disable-line rule:truthy
push:
branches:
- 'kyu3'

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_3
46 changes: 46 additions & 0 deletions .github/workflows/pydocstyle_kyu4.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: pydocstyle for kyu4

on: # yamllint disable-line rule:truthy
push:
branches:
- 'kyu4'

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_4
46 changes: 46 additions & 0 deletions .github/workflows/pydocstyle_kyu5.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: pydocstyle for kyu5

on: # yamllint disable-line rule:truthy
push:
branches:
- 'kyu5'

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_5
46 changes: 46 additions & 0 deletions .github/workflows/pydocstyle_kyu6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
name: pydocstyle for kyu6

on: # yamllint disable-line rule:truthy
push:
branches:
- 'kyu6'

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_6
3 changes: 3 additions & 0 deletions .pydocstyle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[pydocstyle]
inherit = false
match = .*\.py
10 changes: 3 additions & 7 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ rules:
brackets: enable
colons: enable
commas: enable
comments:
level: warning
comments-indentation:
level: warning
document-end: disable
document-start:
level: warning
comments: disable
comments-indentation: enable
document-start: enable
empty-lines: enable
empty-values: disable
float-values: disable
Expand Down
1 change: 1 addition & 0 deletions kyu_2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Codewars kyu_2 package."""
1 change: 1 addition & 0 deletions kyu_2/evaluate_mathematical_expression/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Codewars kyu_2 package: Evaluate mathematical expression."""
28 changes: 19 additions & 9 deletions kyu_2/evaluate_mathematical_expression/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
"""
Expand All @@ -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:
Expand All @@ -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
"""
Expand Down Expand Up @@ -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
"""
Expand Down Expand Up @@ -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
"""
Expand All @@ -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
Expand Down
Loading

0 comments on commit 3e760de

Please sign in to comment.