Skip to content

Commit

Permalink
release v2.1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisschellekens committed Sep 3, 2023
1 parent 8e92db0 commit 78d9285
Show file tree
Hide file tree
Showing 559 changed files with 139 additions and 103 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Corpus Coverage : 100.0%](https://img.shields.io/badge/corpus%20coverage-100.0%25-green)]()
[![Text Extraction : 93.1%](https://img.shields.io/badge/text%20extraction-93.1%25-green)]()
[![Public Method Documentation : 100%](https://img.shields.io/badge/public%20method%20documentation-100%25-green)]()
[![Number of Tests : 633](https://img.shields.io/badge/number%20of%20tests-633-green)]()
[![Number of Tests : 634](https://img.shields.io/badge/number%20of%20tests-634-green)]()
[![Python : 3.8 | 3.9 | 3.10 ](https://img.shields.io/badge/python-3.8%20|%203.9%20|%203.10-green)]()

[![Downloads](https://pepy.tech/badge/borb)](https://pepy.tech/project/borb)
Expand Down
2 changes: 1 addition & 1 deletion borb/io/read/pdf_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def _to_json(self, memo_dict={}) -> typing.Any:
list_out: typing.List[typing.Any] = []
memo_dict[id(self)] = list_out
for v in self:
list_out += [PDFObject._to_json(v, memo_dict)]
list_out.append(PDFObject._to_json(v, memo_dict))
return list_out

# Reference
Expand Down
7 changes: 4 additions & 3 deletions borb/license/license.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import datetime
import json
import logging
import time
import typing
from hashlib import sha256
from pathlib import Path
Expand Down Expand Up @@ -277,11 +278,11 @@ def register(path_to_license_file: Path) -> bool:


if __name__ == "__main__":
# fmt: off
# noinspection PyProtectedMember
License._create_license(
company="borb (EZ)",
output_file=Path(
"/home/joris/Code/borb-dev/tests/license/artifacts_test_register_license/license.json"
),
output_file=Path("/home/joris/Code/borb-dev/tests/license/artifacts_test_register_license/license.json"),
user_id="Joris Schellekens",
)
# fmt: on
2 changes: 1 addition & 1 deletion borb/license/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ def get_version() -> str:
This function returns the current borb version
:return: the current borb version
"""
return "2.1.16"
return "2.1.17"
32 changes: 16 additions & 16 deletions borb/pdf/canvas/layout/equation/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ def _to_postfix(infix_expression: str) -> typing.List[Token]:
operators: typing.List[Token] = []
for i, t in enumerate(tokens):
if t.get_type() == TokenType.NUMBER:
postfix += [t]
postfix.append(t)
continue
if t.get_type() == TokenType.VARIABLE:
postfix += [t]
postfix.append(t)
continue
if t.get_type() == TokenType.FUNCTION:
operators += [t]
operators.append(t)
continue
if t.get_type() == TokenType.OPERATOR:
while (
Expand All @@ -48,28 +48,28 @@ def _to_postfix(infix_expression: str) -> typing.List[Token]:
)
)
):
postfix += [operators[-1]]
postfix.append(operators[-1])
operators.pop(-1)
operators += [t]
operators.append(t)
continue
if t.get_type() == TokenType.COMMA:
while (
len(operators) > 0
and operators[-1].get_type() != TokenType.LEFT_PARENTHESIS
):
postfix += [operators[-1]]
postfix.append(operators[-1])
operators.pop(-1)
continue
if t.get_type() == TokenType.LEFT_PARENTHESIS:
operators += [t]
operators.append(t)
continue
if t.get_type() == TokenType.RIGHT_PARENTHESIS:
assert len(operators) > 0
while (
len(operators) > 0
and operators[-1].get_type() != TokenType.LEFT_PARENTHESIS
):
postfix += [operators[-1]]
postfix.append(operators[-1])
operators.pop(-1)
assert len(operators) > 0
assert operators[-1].get_type() == TokenType.LEFT_PARENTHESIS
Expand All @@ -78,7 +78,7 @@ def _to_postfix(infix_expression: str) -> typing.List[Token]:
len(operators) > 0
and operators[-1].get_type() == TokenType.FUNCTION
):
postfix += [operators[-1]]
postfix.append(operators[-1])
operators.pop(-1)
continue

Expand All @@ -87,7 +87,7 @@ def _to_postfix(infix_expression: str) -> typing.List[Token]:
# {assert the operator on top of the stack is not a (left) parenthesis}
# pop the operator from the operator stack onto the output queue
while len(operators) > 0:
postfix += [operators[-1]]
postfix.append(operators[-1])
operators.pop(-1)

# return
Expand All @@ -104,29 +104,29 @@ def to_abstract_syntax_tree(s: str) -> Token:
postfix: typing.List[Token] = Parser._to_postfix(s)
for i, t in enumerate(postfix):
if t.get_type() == TokenType.NUMBER:
args += [t]
args.append(t)
continue

if t.get_type() == TokenType.VARIABLE:
args += [t]
args.append(t)
continue

if t.get_type() == TokenType.OPERATOR:
assert len(args) >= t.get_number_of_arguments()
for _ in range(0, t.get_number_of_arguments()):
# noinspection PyProtectedMember
t._children += [args[-1]]
t._children.append(args[-1])
args.pop(-1)
args += [t]
args.append(t)
continue

if t.get_type() == TokenType.FUNCTION:
assert len(args) >= t.get_number_of_arguments()
for _ in range(0, t.get_number_of_arguments()):
# noinspection PyProtectedMember
t._children += [args[-1]]
t._children.append(args[-1])
args.pop(-1)
args += [t]
args.append(t)
continue

# check
Expand Down
Loading

0 comments on commit 78d9285

Please sign in to comment.