auto-reference-generator 1.0.0__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.0.0/.github/workflows/codeql.yml +71 -0
- auto_reference_generator-1.0.0/.github/workflows/pypi-publish.yml +51 -0
- auto_reference_generator-1.0.0/.gitignore +6 -0
- auto_reference_generator-1.0.0/LICENSE.md +202 -0
- auto_reference_generator-1.0.0/PKG-INFO +15 -0
- auto_reference_generator-1.0.0/README.md +274 -0
- auto_reference_generator-1.0.0/assets/AccessionPreview.png +0 -0
- auto_reference_generator-1.0.0/assets/HashPreview.png +0 -0
- auto_reference_generator-1.0.0/assets/ReferencesPreview.png +0 -0
- auto_reference_generator-1.0.0/assets/SpreadGen.png +0 -0
- auto_reference_generator-1.0.0/assets/SpreadPreview.png +0 -0
- auto_reference_generator-1.0.0/assets/metaFolder.png +0 -0
- auto_reference_generator-1.0.0/assets/sample_from_dict.json +1 -0
- auto_reference_generator-1.0.0/auto_reference_generator/__init__.py +15 -0
- auto_reference_generator-1.0.0/auto_reference_generator/classification_generator.py +537 -0
- auto_reference_generator-1.0.0/auto_reference_generator/cli.py +103 -0
- auto_reference_generator-1.0.0/auto_reference_generator/common.py +165 -0
- auto_reference_generator-1.0.0/auto_reference_generator/hash.py +27 -0
- auto_reference_generator-1.0.0/auto_reference_generator/options/options.properties +26 -0
- auto_reference_generator-1.0.0/auto_reference_generator.egg-info/PKG-INFO +15 -0
- auto_reference_generator-1.0.0/auto_reference_generator.egg-info/SOURCES.txt +25 -0
- auto_reference_generator-1.0.0/auto_reference_generator.egg-info/dependency_links.txt +1 -0
- auto_reference_generator-1.0.0/auto_reference_generator.egg-info/entry_points.txt +2 -0
- auto_reference_generator-1.0.0/auto_reference_generator.egg-info/requires.txt +2 -0
- auto_reference_generator-1.0.0/auto_reference_generator.egg-info/top_level.txt +1 -0
- auto_reference_generator-1.0.0/pyproject.toml +28 -0
- auto_reference_generator-1.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: "CodeQL"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [ master ]
|
|
17
|
+
pull_request:
|
|
18
|
+
# The branches below must be a subset of the branches above
|
|
19
|
+
branches: [ master ]
|
|
20
|
+
schedule:
|
|
21
|
+
- cron: '20 10 * * 6'
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
analyze:
|
|
25
|
+
name: Analyze
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
permissions:
|
|
28
|
+
actions: read
|
|
29
|
+
contents: read
|
|
30
|
+
security-events: write
|
|
31
|
+
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
language: [ 'python' ]
|
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
|
37
|
+
# Learn more:
|
|
38
|
+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
|
39
|
+
|
|
40
|
+
steps:
|
|
41
|
+
- name: Checkout repository
|
|
42
|
+
uses: actions/checkout@v2
|
|
43
|
+
|
|
44
|
+
# Initializes the CodeQL tools for scanning.
|
|
45
|
+
- name: Initialize CodeQL
|
|
46
|
+
uses: github/codeql-action/init@v2
|
|
47
|
+
with:
|
|
48
|
+
languages: ${{ matrix.language }}
|
|
49
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
50
|
+
# By default, queries listed here will override any specified in a config file.
|
|
51
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
52
|
+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
53
|
+
|
|
54
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
55
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
|
56
|
+
- name: Autobuild
|
|
57
|
+
uses: github/codeql-action/autobuild@v2
|
|
58
|
+
|
|
59
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
60
|
+
# 📚 https://git.io/JvXDl
|
|
61
|
+
|
|
62
|
+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
63
|
+
# and modify them (or add more) to build your code if your project
|
|
64
|
+
# uses a compiled language
|
|
65
|
+
|
|
66
|
+
#- run: |
|
|
67
|
+
# make bootstrap
|
|
68
|
+
# make release
|
|
69
|
+
|
|
70
|
+
- name: Perform CodeQL Analysis
|
|
71
|
+
uses: github/codeql-action/analyze@v2
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Publish Python distribution to PyPI
|
|
2
|
+
|
|
3
|
+
on: push
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
name: Build distribution
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v6
|
|
12
|
+
with:
|
|
13
|
+
persist-credentials: false
|
|
14
|
+
- name: Set up Python
|
|
15
|
+
uses: actions/setup-python@v6
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.x"
|
|
18
|
+
- name: Install pypa/build
|
|
19
|
+
run: >-
|
|
20
|
+
python3 -m
|
|
21
|
+
pip install
|
|
22
|
+
build
|
|
23
|
+
- name: Build a binary wheel and a source tarball
|
|
24
|
+
run: python3 -m build
|
|
25
|
+
- name: Store the distribution packages
|
|
26
|
+
uses: actions/upload-artifact@v5
|
|
27
|
+
with:
|
|
28
|
+
name: python-package-distributions
|
|
29
|
+
path: dist/
|
|
30
|
+
|
|
31
|
+
publish-to-pypi:
|
|
32
|
+
name: >-
|
|
33
|
+
Publish Python distribution to PyPI
|
|
34
|
+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
|
|
35
|
+
needs:
|
|
36
|
+
- build
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
environment:
|
|
39
|
+
name: pypi
|
|
40
|
+
url: https://pypi.org/p/auto_reference_generator # Replace <package-name> with your PyPI project name
|
|
41
|
+
permissions:
|
|
42
|
+
id-token: write # IMPORTANT: mandatory for trusted publishing
|
|
43
|
+
|
|
44
|
+
steps:
|
|
45
|
+
- name: Download all the dists
|
|
46
|
+
uses: actions/download-artifact@v6
|
|
47
|
+
with:
|
|
48
|
+
name: python-package-distributions
|
|
49
|
+
path: dist/
|
|
50
|
+
- name: Publish distribution to PyPI
|
|
51
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: auto_reference_generator
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Auto Reference Generator Tool for Archivists
|
|
5
|
+
Author-email: Christopher Prince <c.pj.prince@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/CPJPRINCE/auto_reference_generator
|
|
7
|
+
Project-URL: Issues, https://github.com/CPJPRINCE/auto_reference_generator/issues
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Topic :: System :: Archiving
|
|
12
|
+
License-File: LICENSE.md
|
|
13
|
+
Requires-Dist: pandas
|
|
14
|
+
Requires-Dist: openpyxl
|
|
15
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
# Auto Reference Generator Tool
|
|
2
|
+
|
|
3
|
+
The Auto Reference Generator tool is small python programme to help Digital archivists reference and catalogue Digital Items. It recursively acts through a given directory to create generating reference codes for each directory and file, then exporting the results to an Excel or CSV spreadsheet.
|
|
4
|
+
|
|
5
|
+
It's platform independent tested functioning on Windows, MacOS and Linux.
|
|
6
|
+
|
|
7
|
+
## Why use this tool?
|
|
8
|
+
|
|
9
|
+
If you're an archivist dealing with Digital Records, this provides a means of undertaking a referencing of a large amount of digital records at a time, saving a significant amount of time in assigning reference codes to individual records.
|
|
10
|
+
|
|
11
|
+
The generated spreadsheet also serves as the basis for spreadsheet inputs for the Opex Manifest Generator tool [*\*Shameless Self promotion\**.](https://github.com/CPJPRINCE/opex_manifest_generator/)
|
|
12
|
+
|
|
13
|
+
## A Quick Note
|
|
14
|
+
|
|
15
|
+
If you need to conduct an arrangement of the files; this must be done beforehand for the references to be accurate; though a temporary spreadsheet can be generated to provide assistance in this.
|
|
16
|
+
|
|
17
|
+
## Additional features:
|
|
18
|
+
|
|
19
|
+
Some additional features include.
|
|
20
|
+
|
|
21
|
+
- Append prefixes to the Archival Reference.
|
|
22
|
+
- Identifying the depth / level of each folder.
|
|
23
|
+
- Gathering standard set of Metadata.
|
|
24
|
+
- Changeable starting reference.
|
|
25
|
+
- Logged removal of empty directories.
|
|
26
|
+
- An alternative "Accession Reference" mode.
|
|
27
|
+
- Compatibility with Win32 / Window's 256 Character limit.
|
|
28
|
+
|
|
29
|
+
## Structure of References
|
|
30
|
+
```
|
|
31
|
+
Folder Reference
|
|
32
|
+
-->Root 0
|
|
33
|
+
---->Folder 1 1
|
|
34
|
+
------>Sub Folder 1 1/1
|
|
35
|
+
-------->File 1 1/1/1
|
|
36
|
+
-------->File 2 1/1/2
|
|
37
|
+
------>Sub Folder 2 1/2
|
|
38
|
+
-------->File 3 1/2/1
|
|
39
|
+
-------->File 4 1/2/2
|
|
40
|
+
---->Folder 2 2
|
|
41
|
+
------>Sub Folder 3 2/1
|
|
42
|
+
------>File 5 2/2
|
|
43
|
+
---->File 6 3
|
|
44
|
+
```
|
|
45
|
+
The root reference defaults to 0, however this the Prefix option can be utilized to change 0 to the desired prefix / archival reference, changing the structure to:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
-->Root Folder ARC
|
|
49
|
+
---->Folder ARC/1
|
|
50
|
+
------>Sub Folder ARC/1/1
|
|
51
|
+
------>File ARC/1/2
|
|
52
|
+
etc
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Prerequisites
|
|
56
|
+
|
|
57
|
+
The following modules are utilized and installed with the package:
|
|
58
|
+
|
|
59
|
+
- pandas
|
|
60
|
+
- openpyxl
|
|
61
|
+
|
|
62
|
+
Optional Modules also include:
|
|
63
|
+
- lxml (for XML Export)
|
|
64
|
+
- odfpy (for ODS Export)
|
|
65
|
+
|
|
66
|
+
Python Version 3.8+ is also recommended. It may work on earlier versions, but this has not been tested.
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
To install, simply run:
|
|
71
|
+
|
|
72
|
+
`pip install -U auto_Reference_generator`
|
|
73
|
+
|
|
74
|
+
## Usage
|
|
75
|
+
|
|
76
|
+
To run the basic program, run from the terminal:
|
|
77
|
+
|
|
78
|
+
`auto_ref {path/to/your/folder}`
|
|
79
|
+
|
|
80
|
+
Replacing the path with your folder. If a space is in the path enclose in quotations. On Windows this may look like:
|
|
81
|
+
|
|
82
|
+
`auto_ref "C:\Users\Christopher\Downloads\"`
|
|
83
|
+
|
|
84
|
+
Additional options can be appended before or after the root directory.
|
|
85
|
+
|
|
86
|
+
To run the program with the Prefix option, add the `-p` option and type in your prefix:
|
|
87
|
+
|
|
88
|
+
`auto_ref "C:\Users\Christopher\Downloads\" -p "ARCH"`
|
|
89
|
+
|
|
90
|
+
This will generate a spreadsheet in a folder called 'meta' within the 'root' directory.
|
|
91
|
+
|
|
92
|
+

|
|
93
|
+
|
|
94
|
+
The spreadsheet will be named after the 'root' folder and appended with "_Autoref".
|
|
95
|
+
|
|
96
|
+

|
|
97
|
+
|
|
98
|
+
Within the spreadsheet you will have information on the paths of the files as well as some additional metadata: size, extensions and dates.
|
|
99
|
+
|
|
100
|
+

|
|
101
|
+
|
|
102
|
+
At the end of the spreadsheet an `Archive_Reference` column with the generated reference.
|
|
103
|
+
|
|
104
|
+

|
|
105
|
+
|
|
106
|
+
(If ran without Prefix Option this will simply be the numerals)
|
|
107
|
+
|
|
108
|
+
## Accession mode
|
|
109
|
+
|
|
110
|
+
There is an alternative method of generating a reference number; having create a code based on the directory hierarchy you can simply create one that follows an 'accession number' pattern. IE each file or folder regardless of depth will be given a running number; depending on the 'mode' the running number will only apply to Directories, Files or Both!
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Example running Accession in "File" Mode
|
|
115
|
+
|
|
116
|
+
----> Root ACC-Dir
|
|
117
|
+
------> Folder 1 ACC-Dir
|
|
118
|
+
--------> File 1 ACC-1
|
|
119
|
+
--------> File 2 ACC-2
|
|
120
|
+
------> File 3 ACC-3
|
|
121
|
+
------> Folder 2 ACC-Dir
|
|
122
|
+
--------> Sub-Folder ACC-Dir
|
|
123
|
+
----------> File 4 ACC-4
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The available modes are `File, Dir, All`
|
|
127
|
+
|
|
128
|
+
To run in accession mode, use the `-acc` and `-accp` options (A prefix must be set):
|
|
129
|
+
|
|
130
|
+
`auto_ref "C:\Users\Christopher\Downloads\" -acc File -accp "ACC"`
|
|
131
|
+
|
|
132
|
+

|
|
133
|
+
|
|
134
|
+
When you generate an Accession Reference an Archive_Reference code will always also be generated.
|
|
135
|
+
|
|
136
|
+
## Set start reference
|
|
137
|
+
|
|
138
|
+
To set a start reference simply add `-str` followed by (Note this must be numeral)
|
|
139
|
+
|
|
140
|
+
## Clear Empty Directories
|
|
141
|
+
|
|
142
|
+
Adding `--empty` or `-rm` to the will automatically remove any empty directories within the files. It will also generate a simple text log in the meta folder of the empty directories that were removed.
|
|
143
|
+
|
|
144
|
+
## Fixity
|
|
145
|
+
|
|
146
|
+
You can also generate Fixities by simply adding the `-fx` option. This will default to using the SHA-1 algorithm, only MD5, SHA-1, SHA-256 and SHA-512 are supported.
|
|
147
|
+
|
|
148
|
+

|
|
149
|
+
|
|
150
|
+
To run a SHA-512 generation:
|
|
151
|
+
|
|
152
|
+
`auto_ref "C:\Users\Christopher\Downloads\" -fx SHA-512`
|
|
153
|
+
|
|
154
|
+
## Filtering
|
|
155
|
+
|
|
156
|
+
By default hidden folders and folders named 'meta' will be ignored. You can include hidden folders by using the option `--hidden`
|
|
157
|
+
|
|
158
|
+
## Skip
|
|
159
|
+
|
|
160
|
+
If you just want to generate a spreadsheet without a reference code you can add `-skp | --skip`, and it will simply generate a spreadsheet without the Archive_Reference
|
|
161
|
+
|
|
162
|
+
## Options:
|
|
163
|
+
|
|
164
|
+
For up to date options use the `-h` option to show dialog:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
Options:
|
|
168
|
+
-h, --help Show Help dialog
|
|
169
|
+
|
|
170
|
+
-p, --prefix Replace Root 0 with specified prefix [string]
|
|
171
|
+
Is added to all references
|
|
172
|
+
|
|
173
|
+
-s --suffix Add a suffix to references [string]
|
|
174
|
+
|
|
175
|
+
--suffix-options Set whether to apply to files, {apply_to_files,apply_to_folders,
|
|
176
|
+
folders,or to all apply_to_all}
|
|
177
|
+
default is to apply_to_files.
|
|
178
|
+
|
|
179
|
+
-l --level-limit Set whether to limit generation to [int]
|
|
180
|
+
a specific level.
|
|
181
|
+
Note generated references may have
|
|
182
|
+
extra delimiter.
|
|
183
|
+
|
|
184
|
+
-dlm --delimiter Set to change the default delimiter [string]
|
|
185
|
+
|
|
186
|
+
-acc, --accession Run in "Accession Mode", this will {Dir,File,
|
|
187
|
+
generate a running number of either All}
|
|
188
|
+
Files, directories, or Both
|
|
189
|
+
|
|
190
|
+
-accp, --acc-prefix Set the Prefix to append onto the running [boolean]
|
|
191
|
+
number generated in "Accession Mode"
|
|
192
|
+
|
|
193
|
+
-fx --fixity Generate fixity codes for files {MD5, SHA-1,
|
|
194
|
+
SHA-256, SHA-512}
|
|
195
|
+
|
|
196
|
+
-hid --hidden Include Hidden directories and files in [boolean]
|
|
197
|
+
generation.
|
|
198
|
+
|
|
199
|
+
--rm-empty Will remove all Empty Directories from [boolean]
|
|
200
|
+
within a given folder, not including them
|
|
201
|
+
in the Reference Generation.
|
|
202
|
+
A simply Text list of removed folders is
|
|
203
|
+
then generated to the output directory.
|
|
204
|
+
|
|
205
|
+
-str, --start-ref Set the number to start the Reference [int]
|
|
206
|
+
generation from.
|
|
207
|
+
|
|
208
|
+
-o, --output Set the directory to export the spreadsheet to. [string]
|
|
209
|
+
|
|
210
|
+
--disable-meta-dir Set whether to generate a "meta" directory, [boolean]
|
|
211
|
+
to export CSV / Excel file to.
|
|
212
|
+
Default behavior will be to create a directory,
|
|
213
|
+
using this option will disable it.
|
|
214
|
+
|
|
215
|
+
-skp --skip Skip running the Auto Reference process, [boolean]
|
|
216
|
+
will generate a spreadsheet but not
|
|
217
|
+
an Archival Reference
|
|
218
|
+
|
|
219
|
+
-fmt, --format Set export format. Will require {xlsx,csv,ods,dict,xml,json}
|
|
220
|
+
appropriate modules in Python.
|
|
221
|
+
ods - PyODF
|
|
222
|
+
xlsx - OpenPyXL
|
|
223
|
+
xml - lxml
|
|
224
|
+
Defaults to xlsx.
|
|
225
|
+
|
|
226
|
+
-key --keywords Set keywords to replace numericals with [string|path]
|
|
227
|
+
alphanumerical characters
|
|
228
|
+
Can be single word or
|
|
229
|
+
list: 'written,like,this'
|
|
230
|
+
Or path to a JSON file containing a dict
|
|
231
|
+
|
|
232
|
+
Keywords only currently act upon folders
|
|
233
|
+
and not files.
|
|
234
|
+
|
|
235
|
+
-keym -keywords-mode Set way to replace: {initialise,first_letters,from_json}
|
|
236
|
+
initialise: My New Folder > MNF
|
|
237
|
+
first_letters: My New Folder > MYF
|
|
238
|
+
from_json: Imports
|
|
239
|
+
Requires to have a Json file with a
|
|
240
|
+
dictionary of words to replace:
|
|
241
|
+
{'Word':'Replacement',
|
|
242
|
+
'SecondWord':'2ndReplacement}
|
|
243
|
+
|
|
244
|
+
--keywords-retain- Set whether to continue reference numbering [bool]
|
|
245
|
+
order If not used keywords don't 'count' towards
|
|
246
|
+
additional references.
|
|
247
|
+
IE if the keyword you are replacing is
|
|
248
|
+
be reference number: 2, this is moved
|
|
249
|
+
to what would originally be number 3.
|
|
250
|
+
Retaining the order means, this scheme is
|
|
251
|
+
maintained: IE 3 is still 3, and 2 is skipped
|
|
252
|
+
|
|
253
|
+
--keywords-case- Set to enable case-sensitivity for keyword [bool]
|
|
254
|
+
sensitivity matches. Default is cases are not sensitive.
|
|
255
|
+
|
|
256
|
+
--keywords-abbreviation Set the number of characters to abbreviate to [int]
|
|
257
|
+
-number Only for first_letters mode.
|
|
258
|
+
|
|
259
|
+
--sort-by Set the sorting method: folders_first, sorts [folders_first|alphabetically]
|
|
260
|
+
folders first. Alphabetically, you can guess.
|
|
261
|
+
Ignores folders.
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Future Developments
|
|
268
|
+
|
|
269
|
+
- ~~Level Limitations to allow for "group references"~~ - Added!
|
|
270
|
+
- ~~Generating reference's which use alphabetic characters~~ - Added!
|
|
271
|
+
|
|
272
|
+
## Contributing
|
|
273
|
+
|
|
274
|
+
I welcome further contributions and feedback.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"autO_classification_Generator":"ACG","Assets":"AST"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
auto_classification_generator package definitions
|
|
3
|
+
|
|
4
|
+
Author: Christopher Prince
|
|
5
|
+
license: Apache License 2.0"
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .common import *
|
|
9
|
+
from .reference_generator import ReferenceGenerator
|
|
10
|
+
from .cli import parse_args,run_cli
|
|
11
|
+
import importlib.metadata
|
|
12
|
+
|
|
13
|
+
__author__ = "Christopher Prince (c.pj.prince@gmail.com)"
|
|
14
|
+
__license__ = "Apache License Version 2.0"
|
|
15
|
+
__version__ = importlib.metadata.version("auto_reference_generator")
|