reference-handler 0.9.1__tar.gz → 0.9.2__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.
Files changed (36) hide show
  1. reference_handler-0.9.2/PKG-INFO +180 -0
  2. reference_handler-0.9.2/README.md +153 -0
  3. {reference_handler-0.9.1 → reference_handler-0.9.2}/reference_handler/__init__.py +2 -2
  4. {reference_handler-0.9.1 → reference_handler-0.9.2}/reference_handler/_version.py +3 -3
  5. {reference_handler-0.9.1 → reference_handler-0.9.2}/reference_handler/latex_utf8.py +45 -48
  6. {reference_handler-0.9.1 → reference_handler-0.9.2}/reference_handler/reference_handler.py +252 -281
  7. {reference_handler-0.9.1 → reference_handler-0.9.2}/reference_handler/tests/test_exceptions.py +9 -12
  8. reference_handler-0.9.2/reference_handler/tests/test_latex.py +385 -0
  9. {reference_handler-0.9.1 → reference_handler-0.9.2}/reference_handler/tests/test_reference_handler.py +101 -111
  10. {reference_handler-0.9.1 → reference_handler-0.9.2}/reference_handler/utils.py +9 -10
  11. reference_handler-0.9.2/reference_handler.egg-info/PKG-INFO +180 -0
  12. {reference_handler-0.9.1 → reference_handler-0.9.2}/reference_handler.egg-info/SOURCES.txt +1 -4
  13. reference_handler-0.9.2/reference_handler.egg-info/requires.txt +1 -0
  14. reference_handler-0.9.2/requirements.txt +1 -0
  15. reference_handler-0.9.2/requirements_install.txt +2 -0
  16. {reference_handler-0.9.1 → reference_handler-0.9.2}/setup.cfg +3 -9
  17. {reference_handler-0.9.1 → reference_handler-0.9.2}/versioneer.py +2 -2
  18. reference_handler-0.9.1/PKG-INFO +0 -139
  19. reference_handler-0.9.1/README.md +0 -120
  20. reference_handler-0.9.1/reference_handler/tests/scratch/database.db +0 -0
  21. reference_handler-0.9.1/reference_handler/tests/scratch/outfile.bib +0 -0
  22. reference_handler-0.9.1/reference_handler/tests/scratch/tmp.db +0 -0
  23. reference_handler-0.9.1/reference_handler/tests/test_latex.py +0 -385
  24. reference_handler-0.9.1/reference_handler.egg-info/PKG-INFO +0 -139
  25. reference_handler-0.9.1/reference_handler.egg-info/requires.txt +0 -1
  26. reference_handler-0.9.1/requirements.txt +0 -1
  27. reference_handler-0.9.1/requirements_install.txt +0 -2
  28. {reference_handler-0.9.1 → reference_handler-0.9.2}/LICENSE +0 -0
  29. {reference_handler-0.9.1 → reference_handler-0.9.2}/MANIFEST.in +0 -0
  30. {reference_handler-0.9.1 → reference_handler-0.9.2}/reference_handler/tests/__init__.py +0 -0
  31. {reference_handler-0.9.1 → reference_handler-0.9.2}/reference_handler/tests/build_filenames.py +0 -0
  32. {reference_handler-0.9.1 → reference_handler-0.9.2}/reference_handler/tests/data/library.bib +0 -0
  33. {reference_handler-0.9.1 → reference_handler-0.9.2}/reference_handler.egg-info/dependency_links.txt +0 -0
  34. {reference_handler-0.9.1 → reference_handler-0.9.2}/reference_handler.egg-info/top_level.txt +0 -0
  35. {reference_handler-0.9.1 → reference_handler-0.9.2}/requirements_dev.txt +0 -0
  36. {reference_handler-0.9.1 → reference_handler-0.9.2}/setup.py +0 -0
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.4
2
+ Name: reference_handler
3
+ Version: 0.9.2
4
+ Author: MolSSI
5
+ Author-email: meliseo@vt.edu
6
+ License: BSD-3-Clause
7
+ Keywords: reference_handler
8
+ Classifier: Development Status :: 2 - Pre-Alpha
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: License :: OSI Approved :: BSD License
11
+ Classifier: Natural Language :: English
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.6
14
+ Classifier: Programming Language :: Python :: 3.7
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: bibtexparser<2
18
+ Dynamic: author
19
+ Dynamic: author-email
20
+ Dynamic: classifier
21
+ Dynamic: description
22
+ Dynamic: description-content-type
23
+ Dynamic: keywords
24
+ Dynamic: license
25
+ Dynamic: license-file
26
+ Dynamic: requires-dist
27
+
28
+ reference_handler
29
+ ==============================
30
+ [//]: # (Badges)
31
+ [![Travis Build Status](https://travis-ci.org/molssi/reference_handler.png)](https://travis-ci.org/molssi/reference_handler)
32
+ [![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/REPLACE_WITH_APPVEYOR_LINK/branch/master?svg=true)](https://ci.appveyor.com/project/molssi/reference_handler/branch/master)
33
+ [![codecov](https://codecov.io/gh/molssi/reference_handler/branch/master/graph/badge.svg)](https://codecov.io/gh/molssi/reference_handler/branch/master)
34
+ [![Documentation Status](https://readthedocs.org/projects/reference-handler/badge/?version=latest)](https://reference-handler.readthedocs.io/en/latest/?badge=latest)
35
+
36
+ A python package for scientific software citation.
37
+
38
+ ## Motivation & goal
39
+
40
+ An appropriate recognition of the value of the scientific software on an equal footing with
41
+ scholarly manuscripts and datasets is dependent upon the realization and promotion of
42
+ community guidelines and best practices for software citation. Such practices can improve
43
+ reproducibility and validation of the scientific discoveries, encourage software reuse and
44
+ boost collaborative efforts.
45
+
46
+ ## Package overview
47
+
48
+ The *reference handler* is comprised of two core parts:
49
+
50
+ **1. Central SQLite3 database** which contains two tables:
51
+ (i) the *citation* table which hosts all essential data pertinent to each unique citation,
52
+ such as the raw citation text and its ID number, and (ii) the *context* table which contains
53
+ information about the context in which a given citation was used. For instance, the function
54
+ where the citation was used or the number of times the citation was "mentioned"
55
+ by any function of your Python package. Since each citation can have many contexts, a
56
+ one-to-many relationship exist between the *citation* and the *context* tables, respectively.
57
+
58
+ **2. Functions to ease the interaction with central database.** Examples are a function
59
+ to cite a desired reference or a function to dump the contents of the database into a
60
+ `.bib` file for subsequent compilation using BibTeX.
61
+
62
+ ## Audience
63
+
64
+ * 1. Method and scientific software developers.
65
+ * 2. Computational molecular science practitioners
66
+
67
+ ## Main features
68
+
69
+ * Automatic and seamless runtime citation to all adopted software modules in the executed program
70
+ * Managing citations within complex workflows and interoperable environments conveniently with simple syntax and APIs
71
+ * Providing context and number of counts for all modules used in the executed application
72
+ * Prioritization of all cited modules at different levels
73
+ * Recommended citation style according to the community guidelines and best practices
74
+ * Exporting references as databases and formatted documents in BibTeX and RIS
75
+
76
+ ## Installation
77
+
78
+ * **Step 1**: Clone this repository on a host machine:
79
+
80
+ ```bash
81
+ $ git clone git@github.com:MolSSI/reference_handler.git
82
+ ```
83
+
84
+ * **Step 2**: Change the current directory to *reference_handler's* root directory:
85
+
86
+ ```bash
87
+ $ cd <path-to-reference-handler-root-directory>/reference_handler
88
+ ```
89
+
90
+ * **Step 3**: Create a Conda environment with *python 3.9* and *pip*:
91
+
92
+ ```bash
93
+ $ conda create -n <env-name> python=3.9 pip
94
+ ```
95
+
96
+ replace the `<env-name>` with the desired name of your environment.
97
+
98
+ * **Step 4**: Activate your conda environment:
99
+
100
+ ```bash
101
+ $ conda activate <env-name>
102
+ ```
103
+
104
+ * **Step 5**: Run the following command to install *bibtexparser 1.2.0* using pip
105
+ within your conda environment
106
+
107
+ ```bash
108
+ $ pip install bibtexparser==1.2.0
109
+ ```
110
+
111
+ * **Step 6**: Finally, run the following command to install *reference_handler* in
112
+ your conda environment
113
+
114
+ ```bash
115
+ $ make install
116
+ ```
117
+
118
+ * **Step 7 (optional)**: Make sure all tests run without errors
119
+
120
+ ```bash
121
+ $ pytest -v
122
+ ```
123
+
124
+ ## Minimal example
125
+
126
+ ```python
127
+ import reference_handler
128
+
129
+ lj_citation = """
130
+ @article{lj1924,
131
+ author = {J. E. Jones and Sydney Chapman },
132
+ title = {On the determination of molecular fields. \&\#x2014;II. From the equation of state of a gas},
133
+ journal = {Proceedings of the Royal Society of London. Series A, Containing Papers of a Mathematical and Physical Character},
134
+ volume = {106},
135
+ number = {738},
136
+ pages = {463-477},
137
+ year = {1924},
138
+ doi = {10.1098/rspa.1924.0082},
139
+ }
140
+ """
141
+
142
+ def lennard_jones(sigma, epsilon, rij):
143
+ rf.cite(raw=lj_citation, alias='lj_citation', module='lennard_jones',
144
+ level=1, note='The first version of the Lennard-Jones potential')
145
+ sig_by_r6 = (sigma / rij ** 6)
146
+ sig_by_r12 = (sig_by_r6 ** 2)
147
+ return 4.0 * epsilon * (sig_by_r12 - sig_by_r6)
148
+
149
+ rf = reference_handler.Reference_Handler('database.db')
150
+
151
+ sigma = 3.54
152
+ epsilon = 98.0
153
+ rij = 20.0
154
+
155
+ lj_energy = lennard_jones(sigma, epsilon, rij)
156
+
157
+ rf.dump(outfile='bibliography.bib')
158
+ ```
159
+
160
+ ## Documentation
161
+
162
+ The documentation is under development. Please check back later.
163
+
164
+ ## References
165
+
166
+ * [Katz, D. S., Chue Hong, N. P., Clark T., Muench, A., Stall, S., Bouquin, D., Cannon, M., Edmunds, S., Faez, T., Farmer, R., \
167
+ Feeney, P., Fenner, M., Friedman, M., Grenier, G., Harrison, M., Heber, J., Leary, A., MacCallum, C., Murray, H., ... Yeston, J. \
168
+ (2020) Recognizing the value of software: a software citation guide. F1000 Research. https://doi.org/10.12688/f1000research.26932.2](https://doi.org/10.12688/f1000research.26932.2)
169
+
170
+ * [Smith A. M., Katz D. S., Niemeyer K. E., FORCE11 Software Citation Working Group.2016. \
171
+ Software citation principles. PeerJ Computer Science 2:e86 https://doi.org/10.7717/peerj-cs.86](https://doi.org/10.7717/peerj-cs.86)
172
+
173
+ ## Copyright
174
+
175
+ Copyright (c) 2019-2022, MolSSI
176
+
177
+ ## Acknowledgements
178
+
179
+ Project based on the
180
+ [Computational Molecular Science Python Cookiecutter](https://github.com/molssi/cookiecutter-cms) version 1.0.
@@ -0,0 +1,153 @@
1
+ reference_handler
2
+ ==============================
3
+ [//]: # (Badges)
4
+ [![Travis Build Status](https://travis-ci.org/molssi/reference_handler.png)](https://travis-ci.org/molssi/reference_handler)
5
+ [![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/REPLACE_WITH_APPVEYOR_LINK/branch/master?svg=true)](https://ci.appveyor.com/project/molssi/reference_handler/branch/master)
6
+ [![codecov](https://codecov.io/gh/molssi/reference_handler/branch/master/graph/badge.svg)](https://codecov.io/gh/molssi/reference_handler/branch/master)
7
+ [![Documentation Status](https://readthedocs.org/projects/reference-handler/badge/?version=latest)](https://reference-handler.readthedocs.io/en/latest/?badge=latest)
8
+
9
+ A python package for scientific software citation.
10
+
11
+ ## Motivation & goal
12
+
13
+ An appropriate recognition of the value of the scientific software on an equal footing with
14
+ scholarly manuscripts and datasets is dependent upon the realization and promotion of
15
+ community guidelines and best practices for software citation. Such practices can improve
16
+ reproducibility and validation of the scientific discoveries, encourage software reuse and
17
+ boost collaborative efforts.
18
+
19
+ ## Package overview
20
+
21
+ The *reference handler* is comprised of two core parts:
22
+
23
+ **1. Central SQLite3 database** which contains two tables:
24
+ (i) the *citation* table which hosts all essential data pertinent to each unique citation,
25
+ such as the raw citation text and its ID number, and (ii) the *context* table which contains
26
+ information about the context in which a given citation was used. For instance, the function
27
+ where the citation was used or the number of times the citation was "mentioned"
28
+ by any function of your Python package. Since each citation can have many contexts, a
29
+ one-to-many relationship exist between the *citation* and the *context* tables, respectively.
30
+
31
+ **2. Functions to ease the interaction with central database.** Examples are a function
32
+ to cite a desired reference or a function to dump the contents of the database into a
33
+ `.bib` file for subsequent compilation using BibTeX.
34
+
35
+ ## Audience
36
+
37
+ * 1. Method and scientific software developers.
38
+ * 2. Computational molecular science practitioners
39
+
40
+ ## Main features
41
+
42
+ * Automatic and seamless runtime citation to all adopted software modules in the executed program
43
+ * Managing citations within complex workflows and interoperable environments conveniently with simple syntax and APIs
44
+ * Providing context and number of counts for all modules used in the executed application
45
+ * Prioritization of all cited modules at different levels
46
+ * Recommended citation style according to the community guidelines and best practices
47
+ * Exporting references as databases and formatted documents in BibTeX and RIS
48
+
49
+ ## Installation
50
+
51
+ * **Step 1**: Clone this repository on a host machine:
52
+
53
+ ```bash
54
+ $ git clone git@github.com:MolSSI/reference_handler.git
55
+ ```
56
+
57
+ * **Step 2**: Change the current directory to *reference_handler's* root directory:
58
+
59
+ ```bash
60
+ $ cd <path-to-reference-handler-root-directory>/reference_handler
61
+ ```
62
+
63
+ * **Step 3**: Create a Conda environment with *python 3.9* and *pip*:
64
+
65
+ ```bash
66
+ $ conda create -n <env-name> python=3.9 pip
67
+ ```
68
+
69
+ replace the `<env-name>` with the desired name of your environment.
70
+
71
+ * **Step 4**: Activate your conda environment:
72
+
73
+ ```bash
74
+ $ conda activate <env-name>
75
+ ```
76
+
77
+ * **Step 5**: Run the following command to install *bibtexparser 1.2.0* using pip
78
+ within your conda environment
79
+
80
+ ```bash
81
+ $ pip install bibtexparser==1.2.0
82
+ ```
83
+
84
+ * **Step 6**: Finally, run the following command to install *reference_handler* in
85
+ your conda environment
86
+
87
+ ```bash
88
+ $ make install
89
+ ```
90
+
91
+ * **Step 7 (optional)**: Make sure all tests run without errors
92
+
93
+ ```bash
94
+ $ pytest -v
95
+ ```
96
+
97
+ ## Minimal example
98
+
99
+ ```python
100
+ import reference_handler
101
+
102
+ lj_citation = """
103
+ @article{lj1924,
104
+ author = {J. E. Jones and Sydney Chapman },
105
+ title = {On the determination of molecular fields. \&\#x2014;II. From the equation of state of a gas},
106
+ journal = {Proceedings of the Royal Society of London. Series A, Containing Papers of a Mathematical and Physical Character},
107
+ volume = {106},
108
+ number = {738},
109
+ pages = {463-477},
110
+ year = {1924},
111
+ doi = {10.1098/rspa.1924.0082},
112
+ }
113
+ """
114
+
115
+ def lennard_jones(sigma, epsilon, rij):
116
+ rf.cite(raw=lj_citation, alias='lj_citation', module='lennard_jones',
117
+ level=1, note='The first version of the Lennard-Jones potential')
118
+ sig_by_r6 = (sigma / rij ** 6)
119
+ sig_by_r12 = (sig_by_r6 ** 2)
120
+ return 4.0 * epsilon * (sig_by_r12 - sig_by_r6)
121
+
122
+ rf = reference_handler.Reference_Handler('database.db')
123
+
124
+ sigma = 3.54
125
+ epsilon = 98.0
126
+ rij = 20.0
127
+
128
+ lj_energy = lennard_jones(sigma, epsilon, rij)
129
+
130
+ rf.dump(outfile='bibliography.bib')
131
+ ```
132
+
133
+ ## Documentation
134
+
135
+ The documentation is under development. Please check back later.
136
+
137
+ ## References
138
+
139
+ * [Katz, D. S., Chue Hong, N. P., Clark T., Muench, A., Stall, S., Bouquin, D., Cannon, M., Edmunds, S., Faez, T., Farmer, R., \
140
+ Feeney, P., Fenner, M., Friedman, M., Grenier, G., Harrison, M., Heber, J., Leary, A., MacCallum, C., Murray, H., ... Yeston, J. \
141
+ (2020) Recognizing the value of software: a software citation guide. F1000 Research. https://doi.org/10.12688/f1000research.26932.2](https://doi.org/10.12688/f1000research.26932.2)
142
+
143
+ * [Smith A. M., Katz D. S., Niemeyer K. E., FORCE11 Software Citation Working Group.2016. \
144
+ Software citation principles. PeerJ Computer Science 2:e86 https://doi.org/10.7717/peerj-cs.86](https://doi.org/10.7717/peerj-cs.86)
145
+
146
+ ## Copyright
147
+
148
+ Copyright (c) 2019-2022, MolSSI
149
+
150
+ ## Acknowledgements
151
+
152
+ Project based on the
153
+ [Computational Molecular Science Python Cookiecutter](https://github.com/molssi/cookiecutter-cms) version 1.0.
@@ -12,6 +12,6 @@ from .latex_utf8 import encode_latex # noqa: F401
12
12
  from ._version import get_versions
13
13
 
14
14
  versions = get_versions()
15
- __version__ = versions['version']
16
- __git_revision__ = versions['full-revisionid']
15
+ __version__ = versions["version"]
16
+ __git_revision__ = versions["full-revisionid"]
17
17
  del get_versions, versions
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2021-05-05T14:18:44-0400",
11
+ "date": "2026-09-20T19:28:51-0400",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "2c570bee48e7419570bf15fd999fa83a68c0453a",
15
- "version": "0.9.1"
14
+ "full-revisionid": "e2f9c6eab9da1597c472cc0168e1e3dc580a35fc",
15
+ "version": "0.9.2"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -70,54 +70,53 @@ import re
70
70
  import typing
71
71
  import unicodedata
72
72
 
73
- alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
73
+ alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
74
74
 
75
75
  # LaTeX characters in accent macros of form \<char>{<letter>}, i.e. \"{u}
76
76
  accent = {
77
- '"': '\N{Combining Diaeresis}',
78
- "'": '\N{Combining Acute Accent}',
79
- '.': '\N{Combining Dot Above}',
80
- '=': '\N{Combining Macron}',
81
- '^': '\N{Combining Circumflex Accent}',
82
- '`': '\N{Combining Grave Accent}',
83
- '|': '\N{Combining Vertical Line Above}',
84
- '~': '\N{Combining Tilde}',
85
- 'b': '\N{Combining Macron Below}',
86
- 'c': '\N{Combining Cedilla}',
87
- 'C': '\N{Combining Double Grave Accent}',
88
- 'd': '\N{Combining Dot Below}',
89
- 'f': '\N{Combining Inverted Breve}',
90
- 'h': '\N{Combining Hook Above}',
91
- 'H': '\N{Combining Double Acute Accent}',
92
- 'k': '\N{Combining Ogonek}',
93
- 'r': '\N{Combining Ring Above}',
94
- 't': '\N{Combining Double Inverted Breve}',
95
- 'u': '\N{Combining Breve}',
96
- 'U': '\N{Combining Double Vertical Line Above}',
97
- 'v': '\N{Combining Caron}'
77
+ '"': "\N{COMBINING DIAERESIS}",
78
+ "'": "\N{COMBINING ACUTE ACCENT}",
79
+ ".": "\N{COMBINING DOT ABOVE}",
80
+ "=": "\N{COMBINING MACRON}",
81
+ "^": "\N{COMBINING CIRCUMFLEX ACCENT}",
82
+ "`": "\N{COMBINING GRAVE ACCENT}",
83
+ "|": "\N{COMBINING VERTICAL LINE ABOVE}",
84
+ "~": "\N{COMBINING TILDE}",
85
+ "b": "\N{COMBINING MACRON BELOW}",
86
+ "c": "\N{COMBINING CEDILLA}",
87
+ "C": "\N{COMBINING DOUBLE GRAVE ACCENT}",
88
+ "d": "\N{COMBINING DOT BELOW}",
89
+ "f": "\N{COMBINING INVERTED BREVE}",
90
+ "h": "\N{COMBINING HOOK ABOVE}",
91
+ "H": "\N{COMBINING DOUBLE ACUTE ACCENT}",
92
+ "k": "\N{COMBINING OGONEK}",
93
+ "r": "\N{COMBINING RING ABOVE}",
94
+ "t": "\N{COMBINING DOUBLE INVERTED BREVE}",
95
+ "u": "\N{COMBINING BREVE}",
96
+ "U": "\N{COMBINING DOUBLE VERTICAL LINE ABOVE}",
97
+ "v": "\N{COMBINING CARON}",
98
98
  }
99
99
 
100
100
  # The regexp to detect the LaTeX accent commands. The two added characters
101
101
  # are the dotless i and j.
102
- accent_re = re.compile(
103
- r'\\([' + ''.join(accent.keys()) + r']){([a-zA-Z\u0131\u0237])}'
104
- )
102
+ accent_re = re.compile(r"\\([" + "".join(accent.keys()) + r"]){([a-zA-Z\u0131\u0237])}")
105
103
 
106
104
  # Invert the accent dictionary for each letter in the alphabet to make
107
105
  # a dictionary of LaTeX encodings.
108
106
  encoding = {}
109
107
  for key, val in accent.items():
110
108
  for char in list(alphabet):
111
- encoding[char + val] = '\\' + key + '{' + char + '}'
109
+ encoding[char + val] = "\\" + key + "{" + char + "}"
112
110
  # handle any precombined versions of the character
113
- string = unicodedata.normalize('NFC', char + val)
111
+ string = unicodedata.normalize("NFC", char + val)
114
112
  if len(string) == 1:
115
113
  encoding[string] = encoding[char + val]
116
114
  for char in [
117
- '\N{Latin Small Letter Dotless I}', '\N{Latin Small Letter Dotless J}'
115
+ "\N{LATIN SMALL LETTER DOTLESS I}",
116
+ "\N{LATIN SMALL LETTER DOTLESS J}",
118
117
  ]:
119
- encoding[char + val] = r'\%s{%s}' % (key, char)
120
- string = unicodedata.normalize('NFC', char + val)
118
+ encoding[char + val] = r"\%s{%s}" % (key, char)
119
+ string = unicodedata.normalize("NFC", char + val)
121
120
  # These characters have no precombined versions, but check anyway
122
121
  if len(string) == 1:
123
122
  encoding[string] = encoding[char + val]
@@ -137,20 +136,20 @@ def _decode_latex_accent(match: typing.Match) -> str:
137
136
 
138
137
  # LaTeX single character symbols
139
138
  symbol = {
140
- 'i': '\N{Latin Small Letter Dotless I}',
141
- 'j': '\N{Latin Small Letter Dotless J}',
142
- 'l': '\N{Latin Small Letter L With Stroke}',
143
- 'L': '\N{Latin Capital Letter L With Stroke}',
144
- 'o': '\N{Latin Small Letter O With Stroke}',
145
- 'O': '\N{Latin Capital Letter O With Stroke}'
139
+ "i": "\N{LATIN SMALL LETTER DOTLESS I}",
140
+ "j": "\N{LATIN SMALL LETTER DOTLESS J}",
141
+ "l": "\N{LATIN SMALL LETTER L WITH STROKE}",
142
+ "L": "\N{LATIN CAPITAL LETTER L WITH STROKE}",
143
+ "o": "\N{LATIN SMALL LETTER O WITH STROKE}",
144
+ "O": "\N{LATIN CAPITAL LETTER O WITH STROKE}",
146
145
  }
147
146
 
148
147
  # The regexp to detect the LaTeX commands for special characters
149
- symbol_re = re.compile(r'\\([' + ''.join(symbol.keys()) + '])')
148
+ symbol_re = re.compile(r"\\([" + "".join(symbol.keys()) + "])")
150
149
 
151
150
  # Invert the symbol dictionary to make a dictionary of LaTeX encodings.
152
151
  for key, val in symbol.items():
153
- encoding[val] = '\\' + key
152
+ encoding[val] = "\\" + key
154
153
 
155
154
 
156
155
  def _decode_latex_symbol(match: typing.Match) -> str:
@@ -166,10 +165,10 @@ def _decode_latex_symbol(match: typing.Match) -> str:
166
165
 
167
166
 
168
167
  # LaTeX dashes
169
- dash = {'--': '\N{EN Dash}', '---': '\N{EM Dash}'}
168
+ dash = {"--": "\N{EN DASH}", "---": "\N{EM DASH}"}
170
169
 
171
170
  # The regexp to detect the LaTeX commands for dashes
172
- dash_re = re.compile(r'([^-]?)(-{2,3})([^-]?)')
171
+ dash_re = re.compile(r"([^-]?)(-{2,3})([^-]?)")
173
172
 
174
173
  # Invert the dictionary tomake a dictionary of LaTeX encodings.
175
174
  for key, val in dash.items():
@@ -205,13 +204,11 @@ def decode_latex(text: str) -> str:
205
204
  """
206
205
 
207
206
  return brace_re.sub(
208
- r'\1',
207
+ r"\1",
209
208
  accent_re.sub(
210
209
  _decode_latex_accent,
211
- symbol_re.sub(
212
- _decode_latex_symbol, dash_re.sub(_decode_latex_dash, text)
213
- )
214
- )
210
+ symbol_re.sub(_decode_latex_symbol, dash_re.sub(_decode_latex_dash, text)),
211
+ ),
215
212
  )
216
213
 
217
214
 
@@ -228,7 +225,7 @@ def encode_latex(text: str) -> str:
228
225
  """
229
226
 
230
227
  # Map the double character representations
231
- text2 = ''
228
+ text2 = ""
232
229
  char1 = text[0]
233
230
  i = 1
234
231
  len_text = len(text)
@@ -250,7 +247,7 @@ def encode_latex(text: str) -> str:
250
247
  text2 += char1
251
248
 
252
249
  # Map the single characters representations
253
- result = ''
250
+ result = ""
254
251
  for char in list(text2):
255
252
  if char in encoding:
256
253
  result += encoding[char]
@@ -260,7 +257,7 @@ def encode_latex(text: str) -> str:
260
257
  return result
261
258
 
262
259
 
263
- if __name__ == '__main__': # pragma: no cover
260
+ if __name__ == "__main__": # pragma: no cover
264
261
  text = r"""
265
262
  (Vorlova_2015) Barbora Vorlov{\'{a}} and Dana Nachtigallov{\'{a}} and Jana
266
263
  Jir{\'{a}}skov{\'{a}}-Van{\'{\i}}{\v{c}}kov{\'{a}} and Haresh Ajani and Petr