pyeasyphd 0.0.9__py3-none-any.whl → 0.1.1__py3-none-any.whl
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.
Potentially problematic release.
This version of pyeasyphd might be problematic. Click here for more details.
- pyeasyphd/.python-version +1 -1
- pyeasyphd/main/__init__.py +0 -4
- pyeasyphd/main/basic_input.py +7 -63
- pyeasyphd/main/python_run_md.py +3 -3
- pyeasyphd/pyeasyphd.sublime-settings +1 -159
- pyeasyphd/tools/__init__.py +1 -16
- pyeasyphd/tools/generate/generate_from_bibs.py +54 -330
- pyeasyphd/tools/generate/generate_html.py +122 -0
- pyeasyphd/tools/generate/generate_library.py +188 -0
- pyeasyphd/tools/generate/generate_links.py +13 -6
- pyeasyphd/tools/py_run_bib_md_tex.py +11 -12
- pyeasyphd/tools/search/search_base.py +8 -5
- pyeasyphd/tools/search/search_core.py +4 -3
- pyeasyphd/tools/search/search_keywords.py +1 -1
- pyeasyphd/tools/search/search_writers.py +8 -5
- {pyeasyphd-0.0.9.dist-info → pyeasyphd-0.1.1.dist-info}/METADATA +3 -6
- pyeasyphd-0.1.1.dist-info/RECORD +27 -0
- pyeasyphd/bib/__init__.py +0 -1
- pyeasyphd/bib/bibtexbase/__init__.py +0 -7
- pyeasyphd/bib/bibtexbase/standardize/_base.py +0 -36
- pyeasyphd/bib/bibtexbase/standardize/default_data.py +0 -97
- pyeasyphd/bib/bibtexbase/standardize/do_on_bib.py +0 -54
- pyeasyphd/bib/bibtexbase/standardize/do_on_comment_block.py +0 -38
- pyeasyphd/bib/bibtexbase/standardize/do_on_entry_block.py +0 -310
- pyeasyphd/bib/bibtexbase/standardize/do_on_preamble_block.py +0 -35
- pyeasyphd/bib/bibtexbase/standardize/do_on_string_block.py +0 -34
- pyeasyphd/bib/bibtexbase/standardize_bib.py +0 -75
- pyeasyphd/bib/bibtexparser/__init__.py +0 -47
- pyeasyphd/bib/bibtexparser/bibtex_format.py +0 -87
- pyeasyphd/bib/bibtexparser/exceptions.py +0 -64
- pyeasyphd/bib/bibtexparser/library.py +0 -207
- pyeasyphd/bib/bibtexparser/middlewares/block/add.py +0 -94
- pyeasyphd/bib/bibtexparser/middlewares/block/authors.py +0 -22
- pyeasyphd/bib/bibtexparser/middlewares/block/doi_url.py +0 -62
- pyeasyphd/bib/bibtexparser/middlewares/block/entry_field_keys_normalize.py +0 -47
- pyeasyphd/bib/bibtexparser/middlewares/block/entry_field_keys_replace.py +0 -31
- pyeasyphd/bib/bibtexparser/middlewares/block/entry_field_values_normalize.py +0 -222
- pyeasyphd/bib/bibtexparser/middlewares/block/entry_fields_delete.py +0 -34
- pyeasyphd/bib/bibtexparser/middlewares/block/entry_fields_keep.py +0 -33
- pyeasyphd/bib/bibtexparser/middlewares/block/entry_fields_sort.py +0 -70
- pyeasyphd/bib/bibtexparser/middlewares/block/entry_types.py +0 -15
- pyeasyphd/bib/bibtexparser/middlewares/block/journal_booktitle.py +0 -113
- pyeasyphd/bib/bibtexparser/middlewares/block/month_year.py +0 -34
- pyeasyphd/bib/bibtexparser/middlewares/block/number_volume.py +0 -21
- pyeasyphd/bib/bibtexparser/middlewares/block/pages.py +0 -28
- pyeasyphd/bib/bibtexparser/middlewares/block/title.py +0 -20
- pyeasyphd/bib/bibtexparser/middlewares/library/generating_entrykeys.py +0 -98
- pyeasyphd/bib/bibtexparser/middlewares/library/keeping_blocks.py +0 -29
- pyeasyphd/bib/bibtexparser/middlewares/library/sorting_blocks.py +0 -124
- pyeasyphd/bib/bibtexparser/middlewares/middleware.py +0 -222
- pyeasyphd/bib/bibtexparser/middlewares/parsestack.py +0 -13
- pyeasyphd/bib/bibtexparser/middlewares/utils.py +0 -226
- pyeasyphd/bib/bibtexparser/middlewares_library_to_library.py +0 -414
- pyeasyphd/bib/bibtexparser/middlewares_library_to_str.py +0 -42
- pyeasyphd/bib/bibtexparser/middlewares_str_to_library.py +0 -35
- pyeasyphd/bib/bibtexparser/middlewares_str_to_str.py +0 -29
- pyeasyphd/bib/bibtexparser/model.py +0 -481
- pyeasyphd/bib/bibtexparser/splitter.py +0 -151
- pyeasyphd/bib/core/__init__.py +0 -18
- pyeasyphd/bib/core/convert_library_to_library.py +0 -31
- pyeasyphd/bib/core/convert_library_to_str.py +0 -199
- pyeasyphd/bib/core/convert_str_to_library.py +0 -34
- pyeasyphd/bib/core/convert_str_to_str.py +0 -27
- pyeasyphd/main/python_run_bib.py +0 -73
- pyeasyphd/main/python_writers.py +0 -212
- pyeasyphd/tools/compare/compare_bibs.py +0 -234
- pyeasyphd/tools/experiments_base.py +0 -203
- pyeasyphd/tools/format_save_bibs.py +0 -178
- pyeasyphd/tools/replace/replace.py +0 -81
- pyeasyphd/tools/spider/process_spider_bib.py +0 -247
- pyeasyphd/tools/spider/process_spider_url.py +0 -75
- pyeasyphd/tools/spider/process_spider_url_bib.py +0 -62
- pyeasyphd-0.0.9.dist-info/RECORD +0 -80
- {pyeasyphd-0.0.9.dist-info → pyeasyphd-0.1.1.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
from typing import Any, Dict, List, Union
|
|
2
|
+
|
|
3
|
+
from pyadvtools import IterateSortDict
|
|
4
|
+
from pybibtexer.bib.bibtexparser import Entry, Library
|
|
5
|
+
from pybibtexer.main import PythonRunBib
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def generate_library_by_filters(
|
|
9
|
+
original_data: Union[List[str], str, Library],
|
|
10
|
+
issue_or_month_flag: Union[str, List[str]], # filter
|
|
11
|
+
year_flag: Union[str, List[str]] = "current_year", # filter
|
|
12
|
+
options: Dict[str, Any] = {},
|
|
13
|
+
full_json_c: str = "",
|
|
14
|
+
full_json_j: str = ""
|
|
15
|
+
) -> Library:
|
|
16
|
+
"""Generate a Library object from input data with given filters.
|
|
17
|
+
|
|
18
|
+
Parameters
|
|
19
|
+
----------
|
|
20
|
+
original_data : Union[List[str], str, Library]
|
|
21
|
+
Input bibliography data
|
|
22
|
+
issue_or_month_flag : Union[str, List[str]]
|
|
23
|
+
Flag for issue/month selection
|
|
24
|
+
year_flag : Union[str, List[str]], optional
|
|
25
|
+
Flag for year selection, by default "current_year"
|
|
26
|
+
options : Dict[str, Any], optional
|
|
27
|
+
Additional options, by default {}
|
|
28
|
+
full_json_c : str, optional
|
|
29
|
+
JSON configuration for conference proceedings, by default "".
|
|
30
|
+
full_json_j : str, optional
|
|
31
|
+
JSON configuration for journal articles, by default "".
|
|
32
|
+
|
|
33
|
+
Returns
|
|
34
|
+
-------
|
|
35
|
+
Library
|
|
36
|
+
Processed library object
|
|
37
|
+
"""
|
|
38
|
+
_options = {}
|
|
39
|
+
# convert_str_to_library
|
|
40
|
+
_options["is_standardize_bib"] = False # default is True
|
|
41
|
+
# middlewares_str_to_library.py
|
|
42
|
+
_options["is_display_implicit_comments"] = False # default is True
|
|
43
|
+
|
|
44
|
+
# convert_library_to_library.py
|
|
45
|
+
_options["choose_abbr_zotero_save"] = "save" # default is "save"
|
|
46
|
+
# middlewares_library_to_library.py
|
|
47
|
+
_options["generate_entry_cite_keys"] = False # default is False
|
|
48
|
+
_options["function_common_again"] = False # default is True
|
|
49
|
+
_options["function_common_again_abbr"] = False # default is True
|
|
50
|
+
_options["function_common_again_zotero"] = False # default is True
|
|
51
|
+
_options["function_common_again_save"] = False # default is True
|
|
52
|
+
|
|
53
|
+
# convert_library_to_str.py
|
|
54
|
+
# middlewares_library_to_str.py
|
|
55
|
+
_options["is_sort_entry_fields"] = True # compulsory
|
|
56
|
+
_options["is_sort_blocks"] = True # compulsory
|
|
57
|
+
_options["sort_entries_by_field_keys_reverse"] = True # compulsory
|
|
58
|
+
|
|
59
|
+
# convert_str_to_str.py
|
|
60
|
+
_options["default_additional_field_list"] = []
|
|
61
|
+
# middlewares_str_to_str.py
|
|
62
|
+
_options["substitute_in_bib"] = False # default is True
|
|
63
|
+
|
|
64
|
+
_options.update(options)
|
|
65
|
+
_python_bib = PythonRunBib(full_json_c, full_json_j, _options)
|
|
66
|
+
|
|
67
|
+
# Generate nested entries dictionary
|
|
68
|
+
entry_type_year_volume_number_month_entry_dict = _python_bib.parse_to_nested_entries_dict(original_data)
|
|
69
|
+
old_dict = entry_type_year_volume_number_month_entry_dict
|
|
70
|
+
|
|
71
|
+
# Filter by year flag
|
|
72
|
+
new_dict = _obtain_year_flag_library(old_dict, year_flag)
|
|
73
|
+
|
|
74
|
+
# Filter by year flag
|
|
75
|
+
if not (isinstance(year_flag, str) and (year_flag.lower().strip() == "current_year")):
|
|
76
|
+
issue_or_month_flag = "all_months"
|
|
77
|
+
|
|
78
|
+
# Filter by issue flag
|
|
79
|
+
if issue_or_month_flag in ["current_issue"]:
|
|
80
|
+
return _obtain_issue_flag_library(new_dict, issue_or_month_flag)
|
|
81
|
+
|
|
82
|
+
# Filter by month flag
|
|
83
|
+
return _obtain_month_flag_library(new_dict, issue_or_month_flag)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _obtain_year_flag_library(
|
|
87
|
+
nested_entries: Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, List[Entry]]]]]],
|
|
88
|
+
year_flag: Union[str, List[str]] = "current_year",
|
|
89
|
+
):
|
|
90
|
+
"""Filter dict by year flag."""
|
|
91
|
+
new_dict = {}
|
|
92
|
+
for entry_type in nested_entries:
|
|
93
|
+
years = [year for year in nested_entries[entry_type]]
|
|
94
|
+
|
|
95
|
+
# Update years
|
|
96
|
+
if isinstance(year_flag, List): # given_years
|
|
97
|
+
years = sorted(list(set(years).intersection(set(year_flag))))
|
|
98
|
+
elif year_flag.lower().strip() == "all_years": # all_years
|
|
99
|
+
years = years
|
|
100
|
+
elif year_flag.lower().strip() == "current_year": # current_year
|
|
101
|
+
years = years[:1]
|
|
102
|
+
else:
|
|
103
|
+
years = []
|
|
104
|
+
print(f"Unknown year flag: {year_flag}.")
|
|
105
|
+
|
|
106
|
+
for year in years:
|
|
107
|
+
new_dict.setdefault(entry_type, {}).update({year: nested_entries[entry_type][year]})
|
|
108
|
+
|
|
109
|
+
return new_dict
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _obtain_issue_flag_library(
|
|
113
|
+
nested_entries: Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, List[Entry]]]]]],
|
|
114
|
+
issue_flag: str = "current_issue"
|
|
115
|
+
) -> Library:
|
|
116
|
+
"""Filter dict by issue flag."""
|
|
117
|
+
nested_entries = IterateSortDict(True).dict_update(nested_entries)
|
|
118
|
+
|
|
119
|
+
entries = []
|
|
120
|
+
for entry_type in nested_entries:
|
|
121
|
+
for year in nested_entries[entry_type]:
|
|
122
|
+
temp_dict = nested_entries[entry_type][year]
|
|
123
|
+
|
|
124
|
+
# Article entries
|
|
125
|
+
if entry_type.lower() == "article":
|
|
126
|
+
volumes, numbers, months = [], [], []
|
|
127
|
+
for volume in (volumes := [volume for volume in temp_dict]):
|
|
128
|
+
for number in (numbers := [number for number in temp_dict[volume]]):
|
|
129
|
+
months = [month for month in temp_dict[volume][number]]
|
|
130
|
+
break
|
|
131
|
+
break
|
|
132
|
+
|
|
133
|
+
if issue_flag == "current_issue": # current volume, current issue, and current month
|
|
134
|
+
entries.extend(temp_dict[volumes[0]][numbers[0]][months[0]])
|
|
135
|
+
else:
|
|
136
|
+
print(f"Unknown issue flag: {issue_flag}.")
|
|
137
|
+
|
|
138
|
+
else:
|
|
139
|
+
# Non-article entries
|
|
140
|
+
for volume in temp_dict:
|
|
141
|
+
for number in temp_dict[volume]:
|
|
142
|
+
for month in temp_dict[volume][number]:
|
|
143
|
+
entries.extend(temp_dict[volume][number][month])
|
|
144
|
+
|
|
145
|
+
return Library(entries)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def _obtain_month_flag_library(
|
|
149
|
+
nested_entries: Dict[str, Dict[str, Dict[str, Dict[str, Dict[str, List[Entry]]]]]],
|
|
150
|
+
month_flag: Union[str, List[str]] = "current_month",
|
|
151
|
+
) -> Library:
|
|
152
|
+
"""Filter dict by month flag."""
|
|
153
|
+
new_dict = {}
|
|
154
|
+
for entry_type in nested_entries:
|
|
155
|
+
for year in nested_entries[entry_type]:
|
|
156
|
+
|
|
157
|
+
for volume in nested_entries[entry_type][year]:
|
|
158
|
+
for number in nested_entries[entry_type][year][volume]:
|
|
159
|
+
for month in nested_entries[entry_type][year][volume][number]:
|
|
160
|
+
new_dict.setdefault(entry_type, {}).setdefault(year, {}).setdefault(month, {}).setdefault(
|
|
161
|
+
volume, {}
|
|
162
|
+
).setdefault(number, []).extend(nested_entries[entry_type][year][volume][number][month])
|
|
163
|
+
|
|
164
|
+
# Sort
|
|
165
|
+
nested_entries = IterateSortDict(True).dict_update(new_dict)
|
|
166
|
+
|
|
167
|
+
entries = []
|
|
168
|
+
for entry_type in nested_entries:
|
|
169
|
+
for year in nested_entries[entry_type]:
|
|
170
|
+
temp_dict = nested_entries[entry_type][year]
|
|
171
|
+
default_months = [month for month in temp_dict]
|
|
172
|
+
|
|
173
|
+
# Update month
|
|
174
|
+
new_months = []
|
|
175
|
+
if month_flag == "current_month": # current_month
|
|
176
|
+
new_months = default_months[:1]
|
|
177
|
+
elif month_flag == "all_months": # all months
|
|
178
|
+
new_months = default_months
|
|
179
|
+
else:
|
|
180
|
+
print(f"Unknown month flag: {month_flag}.")
|
|
181
|
+
|
|
182
|
+
# Filter by month
|
|
183
|
+
for month in new_months:
|
|
184
|
+
for volume in temp_dict[month]:
|
|
185
|
+
for number in temp_dict[month][volume]:
|
|
186
|
+
entries.extend(temp_dict[month][volume][number])
|
|
187
|
+
|
|
188
|
+
return Library(entries)
|
|
@@ -8,12 +8,13 @@ from typing import Dict, List
|
|
|
8
8
|
from pyadvtools import standard_path
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class PaperLinksGenerator:
|
|
11
|
+
class PaperLinksGenerator(object):
|
|
12
12
|
"""Generate markdown files with paper links from JSON data."""
|
|
13
13
|
|
|
14
14
|
def __init__(
|
|
15
15
|
self,
|
|
16
|
-
|
|
16
|
+
full_json_c: str,
|
|
17
|
+
full_json_j: str,
|
|
17
18
|
data_base_path: str,
|
|
18
19
|
keywords_category_name: str = "",
|
|
19
20
|
display_year_period: int = 10,
|
|
@@ -25,7 +26,9 @@ class PaperLinksGenerator:
|
|
|
25
26
|
json_base_path: Path to JSON files directory
|
|
26
27
|
data_base_path: Path to data files directory
|
|
27
28
|
"""
|
|
28
|
-
self.
|
|
29
|
+
self.full_json_c = full_json_c
|
|
30
|
+
self.full_json_j = full_json_j
|
|
31
|
+
|
|
29
32
|
self.data_base_path = standard_path(data_base_path)
|
|
30
33
|
|
|
31
34
|
# Process keyword category name and load data
|
|
@@ -115,7 +118,13 @@ class PaperLinksGenerator:
|
|
|
115
118
|
def _load_json_data(self, file_name: str) -> Dict:
|
|
116
119
|
"""Load JSON data from file."""
|
|
117
120
|
try:
|
|
118
|
-
|
|
121
|
+
if file_name.lower().strip() == "conferences":
|
|
122
|
+
file_path = os.path.expanduser(self.full_json_c)
|
|
123
|
+
elif file_name.lower().strip() == "journals":
|
|
124
|
+
file_path = os.path.expanduser(self.full_json_j)
|
|
125
|
+
else:
|
|
126
|
+
file_path = ""
|
|
127
|
+
|
|
119
128
|
if not os.path.exists(file_path):
|
|
120
129
|
return {}
|
|
121
130
|
|
|
@@ -249,7 +258,6 @@ class PaperLinksGenerator:
|
|
|
249
258
|
|
|
250
259
|
return None
|
|
251
260
|
|
|
252
|
-
#
|
|
253
261
|
def generate_keywords_links_monthly(self, cj: str, folder_name=os.path.join("data", "Weekly")):
|
|
254
262
|
flags = ["Current Issue", "Current Month", "All Months"]
|
|
255
263
|
folder_flags = [f"current_year_{f.replace(' ', '_').lower()}" for f in flags]
|
|
@@ -298,7 +306,6 @@ class PaperLinksGenerator:
|
|
|
298
306
|
# Pandoc
|
|
299
307
|
self._convert_md_to_html_keyword(folder_name, cj, keyword)
|
|
300
308
|
|
|
301
|
-
# TODO
|
|
302
309
|
ll = os.path.join(folder_name, f"{cj.title()}_Keywords", f"{keyword.replace(' ', '_')}.html")
|
|
303
310
|
all_data_list.append(f"|{idx}|{keyword}|[Link]({ll})|\n")
|
|
304
311
|
|
|
@@ -3,15 +3,11 @@ import re
|
|
|
3
3
|
import shutil
|
|
4
4
|
from typing import Any, Dict, List, Optional, Tuple, Union
|
|
5
5
|
|
|
6
|
-
from pyadvtools import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
standard_path,
|
|
10
|
-
write_list,
|
|
11
|
-
)
|
|
6
|
+
from pyadvtools import combine_content_in_list, read_list, standard_path, write_list
|
|
7
|
+
from pybibtexer.bib.bibtexparser import Library
|
|
8
|
+
from pybibtexer.main import PythonRunBib, PythonWriters
|
|
12
9
|
|
|
13
|
-
from ..
|
|
14
|
-
from ..main import BasicInput, PythonRunBib, PythonRunMd, PythonRunTex, PythonWriters
|
|
10
|
+
from ..main import BasicInput, PythonRunMd, PythonRunTex
|
|
15
11
|
|
|
16
12
|
|
|
17
13
|
class PyRunBibMdTex(BasicInput):
|
|
@@ -69,10 +65,11 @@ class PyRunBibMdTex(BasicInput):
|
|
|
69
65
|
self.delete_original_bib_in_output_folder = options.get("delete_original_bib_in_output_folder", False)
|
|
70
66
|
|
|
71
67
|
# Initialize helper classes
|
|
72
|
-
self._python_bib = PythonRunBib(self.options)
|
|
68
|
+
self._python_bib = PythonRunBib(self.full_json_c, self.full_json_j, self.options)
|
|
69
|
+
self._python_writer = PythonWriters(self.full_json_c, self.full_json_j, self.options)
|
|
70
|
+
|
|
73
71
|
self._python_md = PythonRunMd(self.options)
|
|
74
72
|
self._python_tex = PythonRunTex(self.options)
|
|
75
|
-
self._python_writer = PythonWriters(self.options)
|
|
76
73
|
|
|
77
74
|
def run_files(
|
|
78
75
|
self, file_list_md_tex: List[str], output_prefix: str = "", output_level: str = "next"
|
|
@@ -206,8 +203,10 @@ class PyRunBibMdTex(BasicInput):
|
|
|
206
203
|
|
|
207
204
|
# Write bibliography files
|
|
208
205
|
_path_output = os.path.join(self.path_output, self.bib_folder_name)
|
|
209
|
-
full_bib_for_abbr, full_bib_for_zotero, full_bib_for_save =
|
|
210
|
-
|
|
206
|
+
full_bib_for_abbr, full_bib_for_zotero, full_bib_for_save = (
|
|
207
|
+
self._python_writer.write_multi_library_to_multi_file(
|
|
208
|
+
_path_output, abbr_library, zotero_library, save_library, key_in_md_tex
|
|
209
|
+
)
|
|
211
210
|
)
|
|
212
211
|
|
|
213
212
|
# Process content based on format
|
|
@@ -2,8 +2,10 @@ import copy
|
|
|
2
2
|
import re
|
|
3
3
|
from typing import Dict, List, Tuple
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
from
|
|
5
|
+
from pybibtexer.bib.bibtexparser import Library
|
|
6
|
+
from pybibtexer.main import PythonRunBib, PythonWriters
|
|
7
|
+
|
|
8
|
+
from ...main import BasicInput
|
|
7
9
|
from .search_writers import WriteInitialResult, WriteSeparateResult
|
|
8
10
|
|
|
9
11
|
|
|
@@ -33,7 +35,7 @@ def search_keywords_core(keywords_list_list: List[List[str]], library: Library,
|
|
|
33
35
|
return Library(search_library), Library(no_search_library)
|
|
34
36
|
|
|
35
37
|
|
|
36
|
-
class SearchInitialResult(
|
|
38
|
+
class SearchInitialResult(BasicInput):
|
|
37
39
|
"""Search initial result.
|
|
38
40
|
|
|
39
41
|
Args:
|
|
@@ -48,16 +50,17 @@ class SearchInitialResult(object):
|
|
|
48
50
|
|
|
49
51
|
def __init__(self, options: dict) -> None:
|
|
50
52
|
self.options = options
|
|
53
|
+
super().__init__(options)
|
|
51
54
|
|
|
52
55
|
self.print_on_screen: bool = options.get("print_on_screen", False)
|
|
53
56
|
self.deepcopy_library_for_every_field = options.get("deepcopy_library_for_every_field", False)
|
|
54
57
|
|
|
55
|
-
self._python_bib = PythonRunBib(options)
|
|
58
|
+
self._python_bib = PythonRunBib(self.full_json_c, self.full_json_j, options)
|
|
56
59
|
|
|
57
60
|
_options = {}
|
|
58
61
|
_options["empty_entry_cite_keys"] = True
|
|
59
62
|
_options.update(self.options)
|
|
60
|
-
self._python_writer = PythonWriters(_options)
|
|
63
|
+
self._python_writer = PythonWriters(self.full_json_c, self.full_json_j, _options)
|
|
61
64
|
|
|
62
65
|
def main(
|
|
63
66
|
self,
|
|
@@ -14,9 +14,10 @@ from pyadvtools import (
|
|
|
14
14
|
standard_path,
|
|
15
15
|
write_list,
|
|
16
16
|
)
|
|
17
|
+
from pybibtexer.bib.bibtexparser import Library
|
|
18
|
+
from pybibtexer.main import PythonRunBib
|
|
17
19
|
|
|
18
|
-
from ...
|
|
19
|
-
from ...main import BasicInput, PythonRunBib
|
|
20
|
+
from ...main import BasicInput
|
|
20
21
|
from .search_base import SearchInitialResult
|
|
21
22
|
from .search_writers import WriteAbbrCombinedResults
|
|
22
23
|
from .utils import keywords_type_for_title, switch_keywords_list, switch_keywords_type
|
|
@@ -95,7 +96,7 @@ class SearchResultsCore(BasicInput):
|
|
|
95
96
|
self.deepcopy_library_for_every_keywords = options.get("deepcopy_library_for_every_keywords", False)
|
|
96
97
|
|
|
97
98
|
# for bib
|
|
98
|
-
self._python_bib = PythonRunBib(options)
|
|
99
|
+
self._python_bib = PythonRunBib(self.full_json_c, self.full_json_j, options)
|
|
99
100
|
|
|
100
101
|
def optimize(self, search_year_list: List[str] = []) -> Dict[str, Dict[str, Dict[str, Dict[str, int]]]]:
|
|
101
102
|
search_year_list = list(set([str(i) for i in search_year_list]))
|
|
@@ -10,10 +10,10 @@ from pyadvtools import (
|
|
|
10
10
|
standard_path,
|
|
11
11
|
write_list,
|
|
12
12
|
)
|
|
13
|
+
from pybibtexer.tools.experiments_base import generate_standard_publisher_abbr_options_dict
|
|
13
14
|
|
|
14
15
|
from ...main import PandocMdTo
|
|
15
16
|
from ...utils.utils import html_head, html_style, html_tail
|
|
16
|
-
from ..experiments_base import generate_standard_publisher_abbr_options_dict
|
|
17
17
|
from .data import obtain_search_keywords
|
|
18
18
|
from .search_core import SearchResultsCore
|
|
19
19
|
from .utils import extract_information, temp_html_style
|
|
@@ -7,9 +7,10 @@ from pyadvtools import (
|
|
|
7
7
|
read_list,
|
|
8
8
|
write_list,
|
|
9
9
|
)
|
|
10
|
+
from pybibtexer.bib.bibtexparser import Library
|
|
11
|
+
from pybibtexer.main import PythonWriters
|
|
10
12
|
|
|
11
|
-
from ...
|
|
12
|
-
from ...main import PandocMdTo, PythonWriters
|
|
13
|
+
from ...main import BasicInput, PandocMdTo
|
|
13
14
|
from ...tools.search.utils import (
|
|
14
15
|
combine_keywords_for_file_name,
|
|
15
16
|
combine_keywords_for_title,
|
|
@@ -17,7 +18,7 @@ from ...tools.search.utils import (
|
|
|
17
18
|
)
|
|
18
19
|
|
|
19
20
|
|
|
20
|
-
class WriteInitialResult(
|
|
21
|
+
class WriteInitialResult(BasicInput):
|
|
21
22
|
"""Write initial results for single keyword.
|
|
22
23
|
|
|
23
24
|
Args:
|
|
@@ -28,6 +29,8 @@ class WriteInitialResult(object):
|
|
|
28
29
|
"""
|
|
29
30
|
|
|
30
31
|
def __init__(self, options: dict) -> None:
|
|
32
|
+
super().__init__(options)
|
|
33
|
+
|
|
31
34
|
self.options = options
|
|
32
35
|
|
|
33
36
|
self._level_title_md = "###"
|
|
@@ -53,7 +56,7 @@ class WriteInitialResult(object):
|
|
|
53
56
|
# update options
|
|
54
57
|
_options = copy.deepcopy(self.options)
|
|
55
58
|
_options["keep_entries_by_cite_keys"] = cite_keys
|
|
56
|
-
_python_writer = PythonWriters(_options)
|
|
59
|
+
_python_writer = PythonWriters(self.full_json_c, self.full_json_j, _options)
|
|
57
60
|
|
|
58
61
|
# generate tex and md data
|
|
59
62
|
data_list_tex, data_list_md, header = self.generate_content_tex_md(
|
|
@@ -112,7 +115,7 @@ class WriteInitialResult(object):
|
|
|
112
115
|
|
|
113
116
|
# library
|
|
114
117
|
_options = copy.deepcopy(self.options)
|
|
115
|
-
_python_writer = PythonWriters(_options)
|
|
118
|
+
_python_writer = PythonWriters(self.full_json_c, self.full_json_j, _options)
|
|
116
119
|
key_url_http_bib_dict = _python_writer.output_key_url_http_bib_dict(library_for_zotero)
|
|
117
120
|
|
|
118
121
|
key_basic_dict, key_beauty_dict, key_complex_dict = self._pandoc_md_to.generate_key_data_dict(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyeasyphd
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: pyeasyphd
|
|
5
5
|
License: GPL-3.0-or-later
|
|
6
6
|
Keywords: Python,Markdown,LaTex
|
|
@@ -8,17 +8,14 @@ Author: NextAI
|
|
|
8
8
|
Author-email: nextartifintell@gmail.com
|
|
9
9
|
Maintainer: NextAI
|
|
10
10
|
Maintainer-email: nextartifintell@gmail.com
|
|
11
|
-
Requires-Python: >=3.
|
|
11
|
+
Requires-Python: >=3.13
|
|
12
12
|
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
18
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
19
15
|
Classifier: Programming Language :: Python :: 3.14
|
|
20
16
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
17
|
Requires-Dist: pyadvtools (>=0.0.5,<0.0.6)
|
|
18
|
+
Requires-Dist: pybibtexer (>=0.0.3,<0.0.4)
|
|
22
19
|
Project-URL: Documentation, https://github.com/NextArtifIntell/pyeasyphd
|
|
23
20
|
Project-URL: Homepage, https://github.com/NextArtifIntell/pyeasyphd
|
|
24
21
|
Project-URL: Repository, https://github.com/NextArtifIntell/pyeasyphd
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
pyeasyphd/.python-version,sha256=Auc1s9_hwygz61ULf_j_oX9fK8P6HnuuYaj1o4g845g,5
|
|
2
|
+
pyeasyphd/Main.sublime-menu,sha256=6IKSvXyUSqq-eXrzSVGbzakbrPzw9n7hKe-p-FXmDXM,1561
|
|
3
|
+
pyeasyphd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
pyeasyphd/main/__init__.py,sha256=2PXcpkfVEni4Snq5OJ_B8drhunh5npFp9J8QaM88BXI,266
|
|
5
|
+
pyeasyphd/main/basic_input.py,sha256=LF1wf7oGXZVQ03BmEFe2EZRBswjIlp93omCjYiwlqr4,5497
|
|
6
|
+
pyeasyphd/main/pandoc_md_to.py,sha256=SPbQBlAvfB5hcXmfKlMDc2zoT2nJ_uQNyw8bHeiyy1s,15280
|
|
7
|
+
pyeasyphd/main/python_run_md.py,sha256=AypAh-GN5P0jCAZrtcBIYSRGul7-DXjzF2RJLZK7FUg,10413
|
|
8
|
+
pyeasyphd/main/python_run_tex.py,sha256=BNSXp0KnxvYyXr5q43Sr4NwD32EiGaqZJ0QYDwit0tw,5937
|
|
9
|
+
pyeasyphd/pyeasyphd.py,sha256=vPM4uPmr6jSxVOy0zYetoijc8wUkQdXExUVdJyWynVQ,2875
|
|
10
|
+
pyeasyphd/pyeasyphd.sublime-settings,sha256=KCCZ9jiTPbFXw_00HvcZeSB8e-yjWnnOsbjjebsj5-o,2294
|
|
11
|
+
pyeasyphd/pyeasyphd.sublime-syntax,sha256=pXylbA-tye-K5dCTjEJLFVRqtY1T7AgWZ4laxo-dnaE,73
|
|
12
|
+
pyeasyphd/tools/__init__.py,sha256=9JvQ_Sl_l2bV9b_IyLYPDrPUxTV27zr1wv7xMbIHDPw,369
|
|
13
|
+
pyeasyphd/tools/generate/generate_from_bibs.py,sha256=TNj5icRi_Sq8PaQxdDAvEtVznxLVPGx6H-xOLULCxYo,6960
|
|
14
|
+
pyeasyphd/tools/generate/generate_html.py,sha256=VV-fVsxMMhnwLvzuAu0i-Avp6RcwLGRcrYMSrb_3z3U,4127
|
|
15
|
+
pyeasyphd/tools/generate/generate_library.py,sha256=Qq8JYmPMeCoiBejkd-jMbJoLKaAlgmDh1SjbM6zIM-k,7294
|
|
16
|
+
pyeasyphd/tools/generate/generate_links.py,sha256=BKDCNIzw9cZ0KHRnwKDcI-riqwFmEj2Vv5IVKjBeFTc,14652
|
|
17
|
+
pyeasyphd/tools/py_run_bib_md_tex.py,sha256=MWeGEJYft4qvEHM1DBK53S_Athx87-R_eBOGBo9ThcI,14791
|
|
18
|
+
pyeasyphd/tools/search/data.py,sha256=7uHXfHTcn88zkfqAGZMNcSd2OjS2LhkpE9paNuSUUqw,10754
|
|
19
|
+
pyeasyphd/tools/search/search_base.py,sha256=-nHa0gXF9zu2-qFTlhFUyHtVQbi7-orua4lKQB8cIzw,4665
|
|
20
|
+
pyeasyphd/tools/search/search_core.py,sha256=2OOGzA81f_u0fGAopqtU7KEyjJfQJ_2rPt782S53FAk,13853
|
|
21
|
+
pyeasyphd/tools/search/search_keywords.py,sha256=zhHdg97VT92AxrWuabsvPKe7OyQsssipTrepoXOLSGc,10445
|
|
22
|
+
pyeasyphd/tools/search/search_writers.py,sha256=5n4JA0qPvCNeK3KMx5WSYFCb5M640TjIekHcD4HTwo4,12722
|
|
23
|
+
pyeasyphd/tools/search/utils.py,sha256=yLKrMmM2x-fHdm6P8haFZzagd9sLkViTdwJTHyGRgXY,6092
|
|
24
|
+
pyeasyphd/utils/utils.py,sha256=yuHy6D2mTsd2aAwNBSMC7CU4LV-MkWwzKeO_0Iehbyg,1655
|
|
25
|
+
pyeasyphd-0.1.1.dist-info/METADATA,sha256=N7M4KOnDOaxkuMXinHswecsXX_---ecfARQVITTj0QU,933
|
|
26
|
+
pyeasyphd-0.1.1.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
|
|
27
|
+
pyeasyphd-0.1.1.dist-info/RECORD,,
|
pyeasyphd/bib/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"""Initialization."""
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import re
|
|
2
|
-
from typing import List
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
def split_data_list(split_pattern: str, data_list: List[str], last_next: str = "next") -> List[str]:
|
|
6
|
-
r"""Split data list according to the split pattern.
|
|
7
|
-
|
|
8
|
-
The capturing parentheses must be used in the pattern, such as `(\n)`.
|
|
9
|
-
|
|
10
|
-
Args:
|
|
11
|
-
split_pattern (str): split pattern.
|
|
12
|
-
data_list (List[str]): data list.
|
|
13
|
-
last_next (str): "next" or "last".
|
|
14
|
-
|
|
15
|
-
Returns:
|
|
16
|
-
List[str]: new data list.
|
|
17
|
-
|
|
18
|
-
Examples:
|
|
19
|
-
split_pattern = r"(\n)", last_next = "next" or "last".
|
|
20
|
-
"""
|
|
21
|
-
new_data_list = []
|
|
22
|
-
for line in data_list:
|
|
23
|
-
split_list = re.split(split_pattern, line)
|
|
24
|
-
list_one = split_list[0:len(split_list):2]
|
|
25
|
-
list_two = split_list[1:len(split_list):2]
|
|
26
|
-
|
|
27
|
-
temp = []
|
|
28
|
-
if last_next == "next":
|
|
29
|
-
list_two.insert(0, "")
|
|
30
|
-
temp = [list_two[i] + list_one[i] for i in range(len(list_one))]
|
|
31
|
-
if last_next == "last":
|
|
32
|
-
list_two.append("")
|
|
33
|
-
temp = [list_one[i] + list_two[i] for i in range(len(list_one))]
|
|
34
|
-
new_data_list.extend(temp)
|
|
35
|
-
new_data_list = [line for line in new_data_list if line.strip()]
|
|
36
|
-
return new_data_list
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
FIELD_FORMAT_FLAG = [r'"', r"{", r"\w"]
|
|
2
|
-
|
|
3
|
-
DEFAULT_FIELDS_LIST = [
|
|
4
|
-
"abstract",
|
|
5
|
-
"accepted",
|
|
6
|
-
"accessdate",
|
|
7
|
-
"address",
|
|
8
|
-
"affiliation",
|
|
9
|
-
"affiliations",
|
|
10
|
-
"annotation",
|
|
11
|
-
"archive",
|
|
12
|
-
"article-number",
|
|
13
|
-
"articleno",
|
|
14
|
-
"audio",
|
|
15
|
-
"author",
|
|
16
|
-
"author-email",
|
|
17
|
-
"authors",
|
|
18
|
-
"bibsource",
|
|
19
|
-
"biburl",
|
|
20
|
-
"book-group-author",
|
|
21
|
-
"booktitle",
|
|
22
|
-
"cited-references",
|
|
23
|
-
"code",
|
|
24
|
-
"copyright",
|
|
25
|
-
"crossref",
|
|
26
|
-
"data",
|
|
27
|
-
"date",
|
|
28
|
-
"doc-delivery-number",
|
|
29
|
-
"doi",
|
|
30
|
-
"edition",
|
|
31
|
-
"editor",
|
|
32
|
-
"editors",
|
|
33
|
-
"eissn",
|
|
34
|
-
"eprint",
|
|
35
|
-
"extra",
|
|
36
|
-
"fjournal",
|
|
37
|
-
"funding-acknowledgement",
|
|
38
|
-
"funding-text",
|
|
39
|
-
"howpublished",
|
|
40
|
-
"institution",
|
|
41
|
-
"isbn",
|
|
42
|
-
"isbn-13",
|
|
43
|
-
"issn",
|
|
44
|
-
"issue",
|
|
45
|
-
"issue_date",
|
|
46
|
-
"journal",
|
|
47
|
-
"journal-iso",
|
|
48
|
-
"journalabbr",
|
|
49
|
-
"journalabbreviation",
|
|
50
|
-
"key",
|
|
51
|
-
"keywords",
|
|
52
|
-
"keywords-plus",
|
|
53
|
-
"language",
|
|
54
|
-
"lccn",
|
|
55
|
-
"location",
|
|
56
|
-
"month",
|
|
57
|
-
"note",
|
|
58
|
-
"number",
|
|
59
|
-
"number-of-cited-references",
|
|
60
|
-
"numpages",
|
|
61
|
-
"orcid-numbers",
|
|
62
|
-
"organization",
|
|
63
|
-
"pages",
|
|
64
|
-
"pdf",
|
|
65
|
-
"place",
|
|
66
|
-
"pubdates",
|
|
67
|
-
"publisher",
|
|
68
|
-
"remark",
|
|
69
|
-
"research-areas",
|
|
70
|
-
"researcherid-numbers",
|
|
71
|
-
"rights",
|
|
72
|
-
"school",
|
|
73
|
-
"series",
|
|
74
|
-
"shortjournal"
|
|
75
|
-
"shorttitle",
|
|
76
|
-
"slide",
|
|
77
|
-
"submitted",
|
|
78
|
-
"summary",
|
|
79
|
-
"supplementary",
|
|
80
|
-
"times-cited",
|
|
81
|
-
"timestamp",
|
|
82
|
-
"title",
|
|
83
|
-
"type",
|
|
84
|
-
"unique-id",
|
|
85
|
-
"url",
|
|
86
|
-
"usage-count-last-180-days",
|
|
87
|
-
"usage-count-since-2013",
|
|
88
|
-
"video",
|
|
89
|
-
"volume",
|
|
90
|
-
"web-of-science-categories",
|
|
91
|
-
"web-of-science-index",
|
|
92
|
-
"xxeditor",
|
|
93
|
-
"xxnote",
|
|
94
|
-
"xxtitle",
|
|
95
|
-
"xxyear",
|
|
96
|
-
"year",
|
|
97
|
-
]
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import re
|
|
2
|
-
from typing import Dict, List, Tuple
|
|
3
|
-
|
|
4
|
-
from ._base import split_data_list
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class SplitBibAccordingToMark(object):
|
|
8
|
-
def __init__(self) -> None:
|
|
9
|
-
super().__init__()
|
|
10
|
-
|
|
11
|
-
def split_marks(self, data_list: List[str]) -> List[str]:
|
|
12
|
-
return split_data_list(r"(@[a-zA-Z]+{)", data_list, "next")
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class ObtainMarkBlocksDict(object):
|
|
16
|
-
def __init__(self) -> None:
|
|
17
|
-
pass
|
|
18
|
-
|
|
19
|
-
def obtain_dict(
|
|
20
|
-
self, data_list: List[str], is_lower_mark: bool = True
|
|
21
|
-
) -> Tuple[Dict[str, List[List[str]]], List[List[str]]]:
|
|
22
|
-
r"""Generate blocks.
|
|
23
|
-
|
|
24
|
-
Args:
|
|
25
|
-
data_list (List[str]): data list.
|
|
26
|
-
|
|
27
|
-
Returns:
|
|
28
|
-
Tuple[Dict[str, List[List[str]]], List[str]]: dict and implicit comments.
|
|
29
|
-
"""
|
|
30
|
-
regex_mark = re.compile(r"@([a-zA-Z]+){")
|
|
31
|
-
line_index, len_data, implicit_comment_list = 0, len(data_list), []
|
|
32
|
-
mark_patch_bib_list_dict: Dict[str, List[List[str]]] = {}
|
|
33
|
-
while line_index < len_data:
|
|
34
|
-
line = data_list[line_index]
|
|
35
|
-
line_index += 1
|
|
36
|
-
if mch := regex_mark.match(line):
|
|
37
|
-
mark = mch.group(1)
|
|
38
|
-
temp = [line]
|
|
39
|
-
while line_index < len_data:
|
|
40
|
-
line = data_list[line_index]
|
|
41
|
-
if regex_mark.match(line):
|
|
42
|
-
break
|
|
43
|
-
temp.append(line)
|
|
44
|
-
line_index += 1
|
|
45
|
-
if is_lower_mark:
|
|
46
|
-
mark = mark.lower()
|
|
47
|
-
mark_patch_bib_list_dict.setdefault(mark, []).append(temp)
|
|
48
|
-
else:
|
|
49
|
-
implicit_comment_list.append([line, __class__.__name__])
|
|
50
|
-
return mark_patch_bib_list_dict, implicit_comment_list
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if __name__ == "__main__":
|
|
54
|
-
pass
|