From b38deb26c3d1f2628b8d9136dcea8d6f6b8b7af1 Mon Sep 17 00:00:00 2001 From: Sepand Haghighi Date: Fri, 9 Dec 2022 17:28:44 +0330 Subject: [PATCH] Random mode modification (#168) * fix : RANDOM_EQUATION_GEN_COMPLEXITY added * fix : ELEMENTS_LIST updated * doc : CHANGELOG updated * doc : dependencies section in README.md removed * fix : ubuntu version fixed to 20.04 --- .github/workflows/test.yml | 8 ++++---- CHANGELOG.md | 2 ++ README.md | 14 -------------- samila/functions.py | 4 ++-- samila/params.py | 3 +++ 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2a9eaab..609f48b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest] + os: [ubuntu-20.04, windows-latest] python-version: [3.5, 3.6, 3.7, 3.8, 3.9, 3.10.0, 3.11.0] steps: - uses: actions/checkout@v2 @@ -40,7 +40,7 @@ jobs: python -m pytest test --cov=samila --cov-report=term env: NFT_STORAGE_API_KEY: ${{ secrets.NFT_STORAGE_API_KEY }} - if: matrix.python-version == 3.8 && matrix.os == 'ubuntu-latest' + if: matrix.python-version == 3.8 && matrix.os == 'ubuntu-20.04' - name: Version check run: | python otherfiles/version_check.py @@ -55,11 +55,11 @@ jobs: run: | pip install notebook>=5.2.2 python otherfiles/notebook_check.py - if: matrix.python-version == 3.8 && matrix.os == 'ubuntu-latest' + if: matrix.python-version == 3.8 && matrix.os == 'ubuntu-20.04' - name: Codecov run: | codecov - if: matrix.python-version == 3.8 && matrix.os == 'ubuntu-latest' + if: matrix.python-version == 3.8 && matrix.os == 'ubuntu-20.04' - name: cProfile run: | python -m cProfile -s cumtime otherfiles/samila_profile.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 005c941..aa9dc1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,8 +15,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `upload_config` parameter added to `nft_storage` method - `generate` method optimized - Test system modified +- `README.md` updated - `Python 3.11` added to `test.yml` - `plot` method warning bug fixed +- Random mode modified ### Removed - `fill_data` function ## [0.9] - 2022-09-28 diff --git a/README.md b/README.md index 3d8b267..a10ffbd 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ * [Mathematical Details](https://github.com/sepandhaghighi/samila#mathematical-details) * [Try Samila in Your Browser](https://github.com/sepandhaghighi/samila#try-samila-in-your-browser) * [Issues & Bug Reports](https://github.com/sepandhaghighi/samila#issues--bug-reports) - * [Dependencies](https://github.com/sepandhaghighi/samila#dependencies) * [Social Media](https://github.com/sepandhaghighi/samila#social-media) * [Contribution](https://github.com/sepandhaghighi/samila/blob/master/.github/CONTRIBUTING.md) * [References](https://github.com/sepandhaghighi/samila#references) @@ -401,19 +400,6 @@ You can also join our discord server -## Dependencies - - - - - - - - - - -
masterdev
Requirements StatusRequirements Status
- ## Social media 1. [Instagram](https://www.instagram.com/samila_arts) diff --git a/samila/functions.py b/samila/functions.py index 1cce9ff..df3bd97 100644 --- a/samila/functions.py +++ b/samila/functions.py @@ -19,7 +19,7 @@ from .params import NO_FIG_ERROR_MESSAGE, FIG_SAVE_SUCCESS_MESSAGE, NFT_STORAGE_ from .params import INVALID_COLOR_TYPE_ERROR, COLOR_SIZE_ERROR from .params import BOTH_COLOR_COMPLEMENT_WARNING, COLOR_NOT_FOUND_WARNING from .params import DATA_SAVE_SUCCESS_MESSAGE, SEED_LOWER_BOUND, SEED_UPPER_BOUND -from .params import ELEMENTS_LIST, ARGUMENTS_LIST, OPERATORS_LIST, RANDOM_COEF_LIST +from .params import ELEMENTS_LIST, ARGUMENTS_LIST, OPERATORS_LIST, RANDOM_COEF_LIST, RANDOM_EQUATION_GEN_COMPLEXITY from .errors import samilaDataError, samilaPlotError, samilaConfigError from warnings import warn @@ -30,7 +30,7 @@ def random_equation_gen(): :return: equation as str """ - num_elements = random.randint(1, len(ELEMENTS_LIST)) + num_elements = random.randint(1, RANDOM_EQUATION_GEN_COMPLEXITY) result = "" index = 1 random_coef = random.choice(RANDOM_COEF_LIST) diff --git a/samila/params.py b/samila/params.py index 735c5de..eac4414 100644 --- a/samila/params.py +++ b/samila/params.py @@ -123,6 +123,7 @@ ELEMENTS_LIST = [ "{0}*math.tanh({1})", "{0}*math.cos({1})", "{0}*math.sin({1})", + "{0}*math.tan({1})", "{0}*{1}", "{0}*abs({1})", "{0}*math.ceil({1})", @@ -149,3 +150,5 @@ ARGUMENTS_LIST = [ "y*(x**3)"] OPERATORS_LIST = ["+", "-", "*", "/"] + +RANDOM_EQUATION_GEN_COMPLEXITY = len(ELEMENTS_LIST) + 1