auto-reference-generator 1.3.8__tar.gz → 1.3.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/.gitignore +1 -0
- {auto_reference_generator-1.3.8/auto_reference_generator.egg-info → auto_reference_generator-1.3.10}/PKG-INFO +1 -1
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/auto_reference_generator/__init__.py +3 -3
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/auto_reference_generator/cli.py +2 -2
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/auto_reference_generator/hash.py +1 -1
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/auto_reference_generator/referenceGen.py +22 -5
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10/auto_reference_generator.egg-info}/PKG-INFO +1 -1
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/pyproject.toml +1 -1
- auto_reference_generator-1.3.10/requirements.txt +14 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/tests/test_reference_loop_and_keywords.py +12 -0
- auto_reference_generator-1.3.8/requirements.txt +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/.github/workflows/build-portable.yml +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/.github/workflows/codeql.yml +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/.github/workflows/pypi-publish.yml +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/.github/workflows/python-tests.yml +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/.pre-commit-config.yaml +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/LICENSE.md +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/README.md +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/assets/AccessionPreview.png +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/assets/HashPreview.png +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/assets/ReferencesPreview.png +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/assets/SpreadGen.png +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/assets/SpreadPreview.png +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/assets/metaFolder.png +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/assets/sample_from_dict.json +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/auto_reference_generator/common.py +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/auto_reference_generator/options/options.properties +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/auto_reference_generator.egg-info/SOURCES.txt +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/auto_reference_generator.egg-info/dependency_links.txt +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/auto_reference_generator.egg-info/entry_points.txt +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/auto_reference_generator.egg-info/requires.txt +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/auto_reference_generator.egg-info/top_level.txt +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/installer/README.txt +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/installer/auto_ref.cmd +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/installer/install.cmd +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/installer/uninstall.cmd +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/optional-requirements.txt +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/pytest.ini +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/samples/auto_reference_generator_AutoRef.xlsx +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/samples/auto_reference_generator_AutoRef_from_json.xlsx +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/samples/sample_json_dict.json +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/setup.cfg +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/tests/test_common.py +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/tests/test_hash.py +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/tests/test_reference_generator.py +0 -0
- {auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/tests/test_reference_generator_integration.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: auto_reference_generator
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.10
|
|
4
4
|
Summary: A tool for archivist's to automate the generation of references for digital files
|
|
5
5
|
Author-email: Christopher Prince <c.pj.prince@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -5,7 +5,7 @@ Author: Christopher Prince
|
|
|
5
5
|
license: Apache License 2.0"
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
from .common import define_output_file, \
|
|
8
|
+
from auto_reference_generator.common import define_output_file, \
|
|
9
9
|
keyword_replace, \
|
|
10
10
|
win_file_split, \
|
|
11
11
|
filter_win_hidden, \
|
|
@@ -21,8 +21,8 @@ from .common import define_output_file, \
|
|
|
21
21
|
export_xml, \
|
|
22
22
|
suffix_addition, \
|
|
23
23
|
suffix_subtraction
|
|
24
|
-
from .referenceGen import ReferenceGenerator
|
|
25
|
-
from .cli import run_cli,create_parser
|
|
24
|
+
from auto_reference_generator.referenceGen import ReferenceGenerator
|
|
25
|
+
from auto_reference_generator.cli import run_cli,create_parser
|
|
26
26
|
from importlib import metadata
|
|
27
27
|
|
|
28
28
|
__author__ = "Christopher Prince (c.pj.prince@gmail.com)"
|
{auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/auto_reference_generator/cli.py
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
from .referenceGen import ReferenceGenerator
|
|
1
|
+
from auto_reference_generator.referenceGen import ReferenceGenerator
|
|
2
2
|
import argparse, os, logging, inspect
|
|
3
3
|
from importlib import metadata
|
|
4
|
-
from .common import running_time
|
|
4
|
+
from auto_reference_generator.common import running_time
|
|
5
5
|
from datetime import datetime
|
|
6
6
|
|
|
7
7
|
logger = logging.getLogger(__name__)
|
{auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/auto_reference_generator/hash.py
RENAMED
|
@@ -6,7 +6,7 @@ license: Apache License 2.0"
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
import hashlib, logging, os, zipfile
|
|
9
|
-
from .common import win_256_check
|
|
9
|
+
from auto_reference_generator.common import win_256_check
|
|
10
10
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
|
11
11
|
from typing import Dict, Iterable, Optional
|
|
12
12
|
|
|
@@ -9,7 +9,7 @@ author: Christopher Prince
|
|
|
9
9
|
license: Apache License 2.0"
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
|
-
from .common import define_output_file, \
|
|
12
|
+
from auto_reference_generator.common import define_output_file, \
|
|
13
13
|
keyword_replace, \
|
|
14
14
|
win_file_split, \
|
|
15
15
|
filter_win_hidden, \
|
|
@@ -25,7 +25,7 @@ from .common import define_output_file, \
|
|
|
25
25
|
export_xml, \
|
|
26
26
|
suffix_addition, \
|
|
27
27
|
suffix_subtraction
|
|
28
|
-
from .hash import HashGenerator
|
|
28
|
+
from auto_reference_generator.hash import HashGenerator
|
|
29
29
|
import pandas as pd
|
|
30
30
|
import os, configparser, logging
|
|
31
31
|
from typing import Optional, Union, Dict
|
|
@@ -254,13 +254,17 @@ class ReferenceGenerator():
|
|
|
254
254
|
file_type = "Dir"
|
|
255
255
|
else:
|
|
256
256
|
file_type = "File"
|
|
257
|
+
absolute_path = os.path.abspath(parse_path)
|
|
258
|
+
parent_path = os.path.abspath(os.path.join(absolute_path, os.pardir))
|
|
259
|
+
if parent_path == absolute_path:
|
|
260
|
+
parent_path = ""
|
|
257
261
|
if class_dict is None:
|
|
258
262
|
class_dict = {
|
|
259
|
-
self.PATH_FIELD: str(
|
|
263
|
+
self.PATH_FIELD: str(absolute_path),
|
|
260
264
|
self.RELATIVE_FIELD: str(parse_path).replace(self.root_path, ""),
|
|
261
265
|
self.BASENAME_FIELD: os.path.splitext(os.path.basename(file_path))[0],
|
|
262
266
|
self.EXTENSION_FIELD: os.path.splitext(file_path)[1],
|
|
263
|
-
self.PARENT_FIELD:
|
|
267
|
+
self.PARENT_FIELD: parent_path,
|
|
264
268
|
self.ATTRIBUTE_FIELD: file_type,
|
|
265
269
|
self.SIZE_FIELD: file_stats.st_size,
|
|
266
270
|
self.CREATEDATE_FIELD: datetime.fromtimestamp(file_stats.st_ctime),
|
|
@@ -470,7 +474,20 @@ class ReferenceGenerator():
|
|
|
470
474
|
pass
|
|
471
475
|
else:
|
|
472
476
|
new_ref = str(parent_ref) + delimiter + str(new_ref)
|
|
473
|
-
|
|
477
|
+
next_parent = self.df.loc[idx,self.PARENT_FIELD].item()
|
|
478
|
+
# root level handling IE "D:\"
|
|
479
|
+
if next_parent == parent:
|
|
480
|
+
if level == 0:
|
|
481
|
+
final_ref = str(ref)
|
|
482
|
+
if self.prefix:
|
|
483
|
+
final_ref = str(self.prefix)
|
|
484
|
+
else:
|
|
485
|
+
final_ref = str(new_ref)
|
|
486
|
+
if self.prefix:
|
|
487
|
+
final_ref = str(self.prefix) + delimiter + str(final_ref)
|
|
488
|
+
self.reference_list.append(final_ref)
|
|
489
|
+
return
|
|
490
|
+
parent = next_parent
|
|
474
491
|
track = track + 1
|
|
475
492
|
self.reference_loop(ref, parent, track, level, new_ref, delimiter=delimiter)
|
|
476
493
|
except KeyError as e:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: auto_reference_generator
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.10
|
|
4
4
|
Summary: A tool for archivist's to automate the generation of references for digital files
|
|
5
5
|
Author-email: Christopher Prince <c.pj.prince@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
colorama==0.4.6
|
|
2
|
+
et-xmlfile==2.0.0
|
|
3
|
+
iniconfig==2.3.0
|
|
4
|
+
numpy==2.5.1
|
|
5
|
+
openpyxl==3.1.5
|
|
6
|
+
packaging==26.2
|
|
7
|
+
pandas==3.0.3
|
|
8
|
+
pluggy==1.6.0
|
|
9
|
+
pygments==2.20.0
|
|
10
|
+
pytest==9.1.1
|
|
11
|
+
python-dateutil==2.9.0.post0
|
|
12
|
+
six==1.17.0
|
|
13
|
+
tqdm==4.69.0
|
|
14
|
+
tzdata==2026.3
|
|
@@ -87,3 +87,15 @@ def test_reference_loop_custom_delimiter_and_suffix():
|
|
|
87
87
|
rg.reference_loop(ref='', parent='/parent', track=2, level=2, new_ref='1_SFX', delimiter='-')
|
|
88
88
|
# parent_ref=10, new_ref should become '10-1_SFX'
|
|
89
89
|
assert rg.reference_list[-1] == '10-1_SFX'
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_reference_loop_stops_on_self_parent_row():
|
|
93
|
+
rg = ReferenceGenerator('.', prefix=None)
|
|
94
|
+
rg.df = pd.DataFrame([
|
|
95
|
+
{'FullName': 'D:/', 'Ref_Section': 0, 'Parent': 'D:/'}
|
|
96
|
+
])
|
|
97
|
+
rg.reference_list = []
|
|
98
|
+
|
|
99
|
+
rg.reference_loop(ref='1', parent='D:/', track=1, level=1, delimiter='/')
|
|
100
|
+
|
|
101
|
+
assert rg.reference_list[-1] == '1'
|
|
Binary file
|
|
File without changes
|
{auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/.github/workflows/codeql.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/assets/AccessionPreview.png
RENAMED
|
File without changes
|
|
File without changes
|
{auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/assets/ReferencesPreview.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/assets/sample_from_dict.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/optional-requirements.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/samples/sample_json_dict.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{auto_reference_generator-1.3.8 → auto_reference_generator-1.3.10}/tests/test_reference_generator.py
RENAMED
|
File without changes
|
|
File without changes
|