Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
BeardedManZhao committed May 21, 2024
1 parent 80143df commit 5e6e904
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README-Chinese.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 7 additions & 7 deletions mathematical_expression/core/manager/ConstantRegion.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ')'
Expand Down Expand Up @@ -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
Expand All @@ -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}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "mathematical-expression-py"
version = "1.2.4"
version = "1.2.5"
authors = [
{ name = "BeardedManZhao", email = "[email protected]" },
]
Expand Down
7 changes: 0 additions & 7 deletions update/log04_1.2,1_1.2.2.md

This file was deleted.

File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions update/log06_1.2.4_1.2.5.md
Original file line number Diff line number Diff line change
@@ -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` 的错误!
- 修正更新日志文件名称

0 comments on commit 5e6e904

Please sign in to comment.