Skip to content

Resolve warnings of logger library #5062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bin/anthology/texmath.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ def _parse_command(self, code, trg):
pass
# Give up, but preserve element
else:
log.warn(f"Unknown TeX-math command: {code}")
log.warning(f"Unknown TeX-math command: {code}")
self._append_unparsed(code, trg)

def _parse_fraction(self, args, trg):
if len(args) != 2:
log.warn(f"Couldn't parse \\frac: got {len(args)} arguments, expected 2")
log.warning(f"Couldn't parse \\frac: got {len(args)} arguments, expected 2")
self._append_unparsed({'name': 'frac', 'args': args}, trg)
else:
# Represent numerator of fraction as superscript
Expand All @@ -174,7 +174,7 @@ def _parse_fraction(self, args, trg):
def _parse_text(self, code, trg):
text = str(code)
# TexSoup doesn't parse any non-alpha command as a command. Ex: \$
# However it does seperate them into their own text part. Ex: 'r\\&dd' -> ['r', '\\&', 'dd']
# However it does separate them into their own text part. Ex: 'r\\&dd' -> ['r', '\\&', 'dd']
# Therefore try to do command mapping replacement of all text beginning with \ and of length 2
if len(text) == 2 and text[0] == '\\':
text = self.cmd_map.get(text[1], text)
Expand Down
6 changes: 3 additions & 3 deletions python/acl_anthology/text/texmath.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@
pass
# Give up, but preserve element
else:
log.warn(f"Unknown TeX-math command: {code}")
log.warning(f"Unknown TeX-math command: {code}")

Check warning on line 171 in python/acl_anthology/text/texmath.py

View check run for this annotation

Codecov / codecov/patch

python/acl_anthology/text/texmath.py#L171

Added line #L171 was not covered by tests
self._append_unparsed(code, trg)

def _parse_fraction(self, args: list[TexEverything], trg: etree._Element) -> None:
if len(args) != 2:
log.warn(f"Couldn't parse \\frac: got {len(args)} arguments, expected 2")
log.warning(f"Couldn't parse \\frac: got {len(args)} arguments, expected 2")

Check warning on line 176 in python/acl_anthology/text/texmath.py

View check run for this annotation

Codecov / codecov/patch

python/acl_anthology/text/texmath.py#L176

Added line #L176 was not covered by tests
self._append_unparsed(TexCmd("frac", args=args), trg)
else:
# Represent numerator of fraction as superscript
Expand All @@ -190,7 +190,7 @@
def _parse_text(self, code: str | TexText, trg: etree._Element) -> SxscriptStatus:
text = str(code)
# TexSoup doesn't parse any non-alpha command as a command. Ex: \$
# However it does seperate them into their own text part. Ex: 'r\\&dd' -> ['r', '\\&', 'dd']
# However it does separate them into their own text part. Ex: 'r\\&dd' -> ['r', '\\&', 'dd']
# Therefore try to do command mapping replacement of all text beginning with \ and of length 2
if len(text) == 2 and text[0] == "\\":
text = self.cmd_map.get(text[1], text)
Expand Down