Return a mapping of file information collected for the file at `location`.
(location, **kwargs)
| 337 | |
| 338 | |
| 339 | def get_file_info(location, **kwargs): |
| 340 | """ |
| 341 | Return a mapping of file information collected for the file at `location`. |
| 342 | """ |
| 343 | result = {} |
| 344 | |
| 345 | # TODO: move date and size these to the inventory collection step??? |
| 346 | result['date'] = get_last_modified_date(location) or None |
| 347 | result['size'] = getsize(location) or 0 |
| 348 | |
| 349 | sha1, md5, sha256, sha1_git = multi_checksums( |
| 350 | location=location, |
| 351 | checksum_names=('sha1', 'md5', 'sha256', 'sha1_git') |
| 352 | ).values() |
| 353 | result['sha1'] = sha1 |
| 354 | result['md5'] = md5 |
| 355 | result['sha256'] = sha256 |
| 356 | result['sha1_git'] = sha1_git |
| 357 | |
| 358 | collector = get_type(location) |
| 359 | result['mime_type'] = collector.mimetype_file or None |
| 360 | result['file_type'] = collector.filetype_file or None |
| 361 | result['programming_language'] = collector.programming_language or None |
| 362 | result['is_binary'] = bool(collector.is_binary) |
| 363 | result['is_text'] = bool(collector.is_text) |
| 364 | result['is_archive'] = bool(collector.is_archive) |
| 365 | result['is_media'] = bool(collector.is_media) |
| 366 | result['is_source'] = bool(collector.is_source) |
| 367 | result['is_script'] = bool(collector.is_script) |
| 368 | return result |
nothing calls this directly
no test coverage detected