|
15 | 15 | This module creates a graph object that provides a basic UCO characterization of a single file. The gathered metadata is among the more "durable" file characteristics, i.e. characteristics that would remain consistent when transferring a file between locations. |
16 | 16 | """ |
17 | 17 |
|
18 | | -__version__ = "0.3.1" |
| 18 | +__version__ = "0.3.2" |
19 | 19 |
|
20 | 20 | import argparse |
21 | 21 | import datetime |
|
28 | 28 | import rdflib # type: ignore |
29 | 29 |
|
30 | 30 | import case_utils |
31 | | -from case_utils.namespace import * |
| 31 | +from case_utils.namespace import ( |
| 32 | + NS_RDF, |
| 33 | + NS_UCO_CORE, |
| 34 | + NS_UCO_OBSERVABLE, |
| 35 | + NS_UCO_TYPES, |
| 36 | + NS_UCO_VOCABULARY, |
| 37 | + NS_XSD, |
| 38 | +) |
32 | 39 |
|
33 | 40 | DEFAULT_PREFIX = "http://example.org/kb/" |
34 | 41 |
|
@@ -147,7 +154,7 @@ def create_file_node( |
147 | 154 | sha1obj.update(buf) |
148 | 155 | sha256obj.update(buf) |
149 | 156 | sha512obj.update(buf) |
150 | | - if not stashed_error is None: |
| 157 | + if stashed_error is not None: |
151 | 158 | raise stashed_error |
152 | 159 | current_hashdict = HashDict( |
153 | 160 | byte_tally, |
@@ -182,7 +189,7 @@ def create_file_node( |
182 | 189 |
|
183 | 190 | # Add confirmed hashes into graph. |
184 | 191 | for key in successful_hashdict._fields: |
185 | | - if not key in ("md5", "sha1", "sha256", "sha512"): |
| 192 | + if key not in ("md5", "sha1", "sha256", "sha512"): |
186 | 193 | continue |
187 | 194 | n_hash = rdflib.BNode() |
188 | 195 | graph.add((n_contentdata_facet, NS_UCO_OBSERVABLE.hash, n_hash)) |
@@ -247,7 +254,7 @@ def main() -> None: |
247 | 254 | serialize_kwargs["context"] = context_dictionary |
248 | 255 |
|
249 | 256 | node_iri = NS_BASE["file-" + case_utils.local_uuid.local_uuid()] |
250 | | - n_file = create_file_node( |
| 257 | + create_file_node( |
251 | 258 | graph, |
252 | 259 | args.in_file, |
253 | 260 | node_iri=node_iri, |
|
0 commit comments