Skip to content

Commit 8854561

Browse files
committed
Use warnings.warn instead of unused variable _logger
After adding a type signature to create_file_node(), mypy complained that _logger was undefined. That was correct, as I'd copied and pasted that section from DFXML's walk_to_dfxml.py. Another issue around a multi-value-types dictionary will require a bigger patch before the type signature gets committed. References: * [AC-211] Add static type checking to CASE-Utilities-Python Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
1 parent 43ff130 commit 8854561

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

case_utils/case_file/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import hashlib
2222
import os
2323
import typing
24+
import warnings
2425

2526
import rdflib # type: ignore
2627

@@ -166,7 +167,7 @@ def create_file_node(graph, filepath, node_iri=None, node_prefix=DEFAULT_PREFIX,
166167
raise ValueError("Failed to confirm hashes of file %r." % filepath)
167168
if successful_hashdict["filesize"] != file_stat.st_size:
168169
# TODO - Discuss with AC whether this should be something stronger, like an assertion error.
169-
_logger.warning(
170+
warnings.warn(
170171
"Inode file size and hashed file sizes disagree: %d vs. %d.",
171172
file_stat.st_size,
172173
successful_hashdict["filesize"]

0 commit comments

Comments
 (0)