From 5e6e904d51a27ba23c921039defdac8b3bea0c9e Mon Sep 17 00:00:00 2001 From: LingYuZhao Date: Tue, 21 May 2024 11:45:52 +0800 Subject: [PATCH] update --- README-Chinese.md | 2 +- README.md | 2 +- .../core/manager/ConstantRegion.py | 14 +++++++------- pyproject.toml | 2 +- update/log04_1.2,1_1.2.2.md | 7 ------- update/{log03_1.2_1.2.1.md => log04_1.2_1.2.1.md} | 0 .../{log03_1.2.1_1.2.4.md => log05_1.2.1_1.2.4.md} | 0 update/log06_1.2.4_1.2.5.md | 11 +++++++++++ 8 files changed, 21 insertions(+), 17 deletions(-) delete mode 100644 update/log04_1.2,1_1.2.2.md rename update/{log03_1.2_1.2.1.md => log04_1.2_1.2.1.md} (100%) rename update/{log03_1.2.1_1.2.4.md => log05_1.2.1_1.2.4.md} (100%) create mode 100644 update/log06_1.2.4_1.2.5.md diff --git a/README-Chinese.md b/README-Chinese.md index e948c39..aa5a6b5 100644 --- a/README-Chinese.md +++ b/README-Chinese.md @@ -163,7 +163,7 @@ print("计算层数:" + str(calculation.get_result_layers()) + "\n计算结果 针对一个没有括号,但是有加减乘除以及取余等运算操作的数学表达式而设计的组件,该组件可以实现带有优先级计算的功能,其中通过前缀表达式解析计算,将操作数与操作符一同存储到栈,在存储的同时配有计算优先级比较,如果当下的优先级较小,就先将上一个操作数与操作符与当前操作数进行运算,形成一个新的数值,然后再入栈。 - API使用示例 - 该组件支持的运算符有: a+b a-b a*b a/b a%b + 该组件支持的运算符有: `a+b` `a-b` `a*b` `a/b` `a%b` `a^b` ```python # This is a sample Python script. diff --git a/README.md b/README.md index 53634a8..925b2f0 100644 --- a/README.md +++ b/README.md @@ -181,7 +181,7 @@ print("计算层数:" + str(calculation.get_result_layers()) + "\n计算结果 operand and operator with the current operand to form a new value, and then put it on the stack. - API Usage Example - The operators supported by this component are: a+b a-b a*b a/b a%b + The operators supported by this component are: `a+b` `a-b` `a*b` `a/b` `a%b` `a^b` ```python # This is a sample Python script. diff --git a/mathematical_expression/core/manager/ConstantRegion.py b/mathematical_expression/core/manager/ConstantRegion.py index 15574ac..6f07c57 100644 --- a/mathematical_expression/core/manager/ConstantRegion.py +++ b/mathematical_expression/core/manager/ConstantRegion.py @@ -9,7 +9,7 @@ import logging from typing import List -VERSION: float = 1.24 +VERSION: float = 1.25 STRING_NULL: str = "null" LEFT_BRACKET: str = '(' RIGHT_BRACKET: str = ')' @@ -78,7 +78,7 @@ def re_fresh(): REGULAR_CONTAINS_ADDSUB = "\\+" + MINUS_SIGN + "|" + MINUS_SIGN + "\\+" \ if PLUS_SIGN == '+' else \ PLUS_SIGN + MINUS_SIGN + '|' + MINUS_SIGN + PLUS_SIGN - ARITHMETIC_OPERATOR_STRING: str = PLUS_SIGN.join( + ARITHMETIC_OPERATOR_STRING = PLUS_SIGN.join( [MINUS_SIGN, MULTIPLICATION_SIGN, DIVISION_SIGN, REMAINDER_SIGN, POW_SIGN]) EQUAL_SIGN2 = EQUAL_SIGN1 + EQUAL_SIGN1 NOT_EQUAL_SIGN1 = NEGATE_SIGN + EQUAL_SIGN1 @@ -91,8 +91,8 @@ def re_fresh(): EQUAL_SIGN2, LESS_THAN_SIGN, EQUAL_SIGN1, GREATER_THAN_SIGN) - LEGAL_CHARACTERS: set = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - EMPTY, PLUS_SIGN, MINUS_SIGN, - MULTIPLICATION_SIGN, DIVISION_SIGN, - REMAINDER_SIGN, POW_SIGN, - LEFT_BRACKET, RIGHT_BRACKET, DECIMAL_POINT} + LEGAL_CHARACTERS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + EMPTY, PLUS_SIGN, MINUS_SIGN, + MULTIPLICATION_SIGN, DIVISION_SIGN, + REMAINDER_SIGN, POW_SIGN, + LEFT_BRACKET, RIGHT_BRACKET, DECIMAL_POINT} diff --git a/pyproject.toml b/pyproject.toml index 58bf9c0..c6ad770 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mathematical-expression-py" -version = "1.2.4" +version = "1.2.5" authors = [ { name = "BeardedManZhao", email = "liming7887@qq.com" }, ] diff --git a/update/log04_1.2,1_1.2.2.md b/update/log04_1.2,1_1.2.2.md deleted file mode 100644 index 1f5c646..0000000 --- a/update/log04_1.2,1_1.2.2.md +++ /dev/null @@ -1,7 +0,0 @@ -# 1.2 -> 1.2.1 版本更新日志 - -### 更新时间:UTC2024-05-13 11:01 【正在开发中】 - -==python== - -- 针对底层的计算操作进行优化,将一些繁琐的 if 进行分支优化,将每次类似 `1 +|-|*|...|/|% 10` 这类的基本运算操作的时间复杂度降低。 \ No newline at end of file diff --git a/update/log03_1.2_1.2.1.md b/update/log04_1.2_1.2.1.md similarity index 100% rename from update/log03_1.2_1.2.1.md rename to update/log04_1.2_1.2.1.md diff --git a/update/log03_1.2.1_1.2.4.md b/update/log05_1.2.1_1.2.4.md similarity index 100% rename from update/log03_1.2.1_1.2.4.md rename to update/log05_1.2.1_1.2.4.md diff --git a/update/log06_1.2.4_1.2.5.md b/update/log06_1.2.4_1.2.5.md new file mode 100644 index 0000000..9041813 --- /dev/null +++ b/update/log06_1.2.4_1.2.5.md @@ -0,0 +1,11 @@ +# 1.2 -> 1.2.1 版本更新日志 + +### 更新时间:UTC2024-05-21 12:00 + +==python== + +- 版本号位于:mathematical_expression/core/manager/ConstantRegion.py +- 针对底层的计算操作进行优化,将一些繁琐的 if 进行分支优化,将每次类似 `1 +|-|*|...|/|% 10` 这类的基本运算操作的时间复杂度降低。 +- 对于幂运算 `^` 操作进行了支持。 +- 修复了在一些情况下会出现 `SyntaxError: annotated name 'xxx' can't be global` 的错误! +- 修正更新日志文件名称 \ No newline at end of file