pyformatjson 0.2.6__tar.gz → 0.3.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.
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/.github/workflows/release.yml +1 -1
- pyformatjson-0.3.0/.python-version +1 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/PKG-INFO +2 -2
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/docs/requirements.txt +1 -0
- pyformatjson-0.2.6/pyformatjson.sublime-project → pyformatjson-0.3.0/main.sublime-project +10 -3
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/pyformatjson/core/_base.py +2 -2
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/pyformatjson/core/update_json.py +39 -11
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/pyformatjson/tools/generate_dict.py +1 -1
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/pyformatjson/tools/write_dict.py +17 -9
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/pyproject.toml +2 -2
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/scripts/generate_docs.py +6 -5
- pyformatjson-0.3.0/tests/test_main.py +18 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/.github/workflows/docs.yml +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/.github/workflows/publish.yml +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/.gitignore +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/CODE_OF_CONDUCT.md +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/LICENSE +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/README.md +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/docs/api-manual/index.md +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/docs/index.md +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/docs/users-guide/bug-report.md +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/docs/users-guide/installation.md +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/docs/users-guide/pull-request.md +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/mkdocs.yml +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/pyformatjson/__init__.py +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/pyformatjson/core/__init__.py +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/pyformatjson/main.py +0 -0
- {pyformatjson-0.2.6 → pyformatjson-0.3.0}/pyformatjson/tools/__init__.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyformatjson
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: pyformatjson
|
|
5
5
|
Project-URL: Homepage, https://github.com/Easy-PhD/pyformatjson
|
|
6
6
|
Project-URL: Repository, https://github.com/Easy-PhD/pyformatjson
|
|
@@ -26,7 +26,7 @@ Requires-Dist: func-timeout>=4.3.5
|
|
|
26
26
|
Requires-Dist: lxml>=6.0.2
|
|
27
27
|
Requires-Dist: playwright>=1.55.0
|
|
28
28
|
Requires-Dist: psutil>=7.1.2
|
|
29
|
-
Requires-Dist: pyadvtools>=0.3.
|
|
29
|
+
Requires-Dist: pyadvtools>=0.3.10
|
|
30
30
|
Requires-Dist: requests>=2.32.5
|
|
31
31
|
Requires-Dist: selenium>=4.38.0
|
|
32
32
|
Description-Content-Type: text/markdown
|
|
@@ -8,6 +8,15 @@
|
|
|
8
8
|
"target": "terminus_exec",
|
|
9
9
|
"cancel": "terminus_cancel_build",
|
|
10
10
|
"shell_cmd": "\".venv/bin/python3\" -u \"$file\"",
|
|
11
|
+
"windows": {
|
|
12
|
+
"shell_cmd": "\".venv\\Scripts\\python.exe\" -u \"$file\"",
|
|
13
|
+
},
|
|
14
|
+
"osx": {
|
|
15
|
+
"shell_cmd": "\".venv/bin/python3\" -u \"$file\"",
|
|
16
|
+
},
|
|
17
|
+
"linux": {
|
|
18
|
+
"shell_cmd": "\".venv/bin/python3\" -u \"$file\"",
|
|
19
|
+
},
|
|
11
20
|
"env": {
|
|
12
21
|
"PYTHONIOENCODING": "utf-8",
|
|
13
22
|
"PYTHONPATH": ".",
|
|
@@ -17,8 +26,6 @@
|
|
|
17
26
|
],
|
|
18
27
|
"settings": {},
|
|
19
28
|
"folders": [
|
|
20
|
-
{
|
|
21
|
-
"path": ".",
|
|
22
|
-
},
|
|
29
|
+
{ "path": ".", },
|
|
23
30
|
],
|
|
24
31
|
}
|
|
@@ -69,8 +69,8 @@ def split_data_list(split_pattern: str, data_list: list[str], last_next: str = "
|
|
|
69
69
|
new_data_list = []
|
|
70
70
|
for line in data_list:
|
|
71
71
|
split_list = re.split(split_pattern, line)
|
|
72
|
-
list_one = split_list[0: len(split_list): 2]
|
|
73
|
-
list_two = split_list[1: len(split_list): 2]
|
|
72
|
+
list_one = split_list[0 : len(split_list) : 2]
|
|
73
|
+
list_two = split_list[1 : len(split_list) : 2]
|
|
74
74
|
|
|
75
75
|
temp = []
|
|
76
76
|
if last_next == "next":
|
|
@@ -12,7 +12,7 @@ def load_json_data(path_json: str, filename: str) -> dict:
|
|
|
12
12
|
if not os.path.exists(file_path):
|
|
13
13
|
return {}
|
|
14
14
|
|
|
15
|
-
with open(file_path, encoding="utf-8") as file:
|
|
15
|
+
with open(file_path, encoding="utf-8", newline="\n") as file:
|
|
16
16
|
return json.load(file)
|
|
17
17
|
|
|
18
18
|
except Exception as e:
|
|
@@ -63,12 +63,45 @@ def update_json_file(full_json_cj: str, conferences_or_journals: str) -> dict[st
|
|
|
63
63
|
|
|
64
64
|
# Save updated JSON
|
|
65
65
|
if flag and json_dict:
|
|
66
|
-
|
|
66
|
+
json_dict = add_multiple_add(json_dict, conferences_or_journals)
|
|
67
|
+
|
|
68
|
+
with open(full_json_cj, "w", encoding="utf-8", newline="\n") as f:
|
|
67
69
|
f.write(json.dumps(json_dict, indent=4, sort_keys=True, ensure_ascii=True))
|
|
68
70
|
|
|
69
71
|
return json_dict
|
|
70
72
|
|
|
71
73
|
|
|
74
|
+
def add_multiple_add(json_dict, conferences_or_journals):
|
|
75
|
+
for pub in json_dict:
|
|
76
|
+
for key in json_dict[pub][conferences_or_journals]:
|
|
77
|
+
names_abbr = json_dict[pub][conferences_or_journals][key].get("names_abbr", [])
|
|
78
|
+
names_full = json_dict[pub][conferences_or_journals][key].get("names_full", [])
|
|
79
|
+
|
|
80
|
+
names_abbr_, names_full_ = [], []
|
|
81
|
+
for abbr, full in zip(names_abbr, names_full, strict=True):
|
|
82
|
+
names_abbr_.append(abbr)
|
|
83
|
+
names_full_.append(full)
|
|
84
|
+
|
|
85
|
+
full = full.encode('unicode_escape').decode()
|
|
86
|
+
if "&" in full and r"\\&" not in full and r"\\\\&" not in full:
|
|
87
|
+
full_1 = re.sub("&", r"\\&", full)
|
|
88
|
+
full_2 = re.sub("&", r"\\\\&", full)
|
|
89
|
+
if full_1 not in names_full:
|
|
90
|
+
breakpoint()
|
|
91
|
+
names_abbr_.append(abbr)
|
|
92
|
+
names_full_.append(full_1)
|
|
93
|
+
|
|
94
|
+
if full_2 not in names_full:
|
|
95
|
+
breakpoint()
|
|
96
|
+
names_abbr_.append(abbr)
|
|
97
|
+
names_full_.append(full_2)
|
|
98
|
+
|
|
99
|
+
json_dict[pub][conferences_or_journals][key]["names_abbr"] = names_abbr_
|
|
100
|
+
json_dict[pub][conferences_or_journals][key]["names_full"] = names_full_
|
|
101
|
+
|
|
102
|
+
return json_dict
|
|
103
|
+
|
|
104
|
+
|
|
72
105
|
def generate_standard_form(json_dict: dict[str, Any], conferences_or_journals: str):
|
|
73
106
|
# Check for duplicate abbreviations in the data.
|
|
74
107
|
abbr_list = []
|
|
@@ -169,8 +202,7 @@ class CheckAcronymAbbrAndFullDict:
|
|
|
169
202
|
for i, main_acronym in enumerate(acronyms):
|
|
170
203
|
# Normalize items: lowercase and remove parentheses
|
|
171
204
|
main_items = [
|
|
172
|
-
item.lower().replace("(", "").replace(")", "")
|
|
173
|
-
for item in data[main_acronym].get(key_type, [])
|
|
205
|
+
item.lower().replace("(", "").replace(")", "") for item in data[main_acronym].get(key_type, [])
|
|
174
206
|
]
|
|
175
207
|
|
|
176
208
|
# Create exact match patterns
|
|
@@ -179,17 +211,13 @@ class CheckAcronymAbbrAndFullDict:
|
|
|
179
211
|
matches_found = []
|
|
180
212
|
|
|
181
213
|
# Compare with other acronyms
|
|
182
|
-
for other_acronym in acronyms[i + 1:]:
|
|
214
|
+
for other_acronym in acronyms[i + 1 :]:
|
|
183
215
|
other_items = [
|
|
184
|
-
item.lower().replace("(", "").replace(")", "")
|
|
185
|
-
for item in data[other_acronym].get(key_type, [])
|
|
216
|
+
item.lower().replace("(", "").replace(")", "") for item in data[other_acronym].get(key_type, [])
|
|
186
217
|
]
|
|
187
218
|
|
|
188
219
|
# Find matching items
|
|
189
|
-
matching_items = [
|
|
190
|
-
item for item in other_items
|
|
191
|
-
if any(pattern.match(item) for pattern in patterns)
|
|
192
|
-
]
|
|
220
|
+
matching_items = [item for item in other_items if any(pattern.match(item) for pattern in patterns)]
|
|
193
221
|
|
|
194
222
|
if matching_items:
|
|
195
223
|
matches_found.append([main_acronym, other_acronym, matching_items])
|
|
@@ -635,7 +635,7 @@ class GenerateDataDict:
|
|
|
635
635
|
mermaid, data_dict = [], {}
|
|
636
636
|
# |AAAI|1980|95|Proceedings of the First National Conference on Artificial Intelligence|
|
|
637
637
|
regex = re.compile(r"\|.*\|([0-9]+)\|([0-9]+)\|.*\|")
|
|
638
|
-
with open(full_readme, encoding="utf-8") as file:
|
|
638
|
+
with open(full_readme, encoding="utf-8", newline="\n") as file:
|
|
639
639
|
data_list = file.readlines()
|
|
640
640
|
for line in data_list:
|
|
641
641
|
if mch := regex.search(line):
|
|
@@ -8,9 +8,9 @@ from .generate_dict import conference_journal_header
|
|
|
8
8
|
def create_safe_filename(text: str) -> str:
|
|
9
9
|
"""Create a safe filename across all platforms."""
|
|
10
10
|
# Remove or replace invalid characters
|
|
11
|
-
safe_text = re.sub(r'[<>:"/\\|?*]',
|
|
11
|
+
safe_text = re.sub(r'[<>:"/\\|?*]', "_", text)
|
|
12
12
|
# Remove leading/trailing spaces and dots
|
|
13
|
-
safe_text = safe_text.strip(
|
|
13
|
+
safe_text = safe_text.strip(" .")
|
|
14
14
|
# Ensure it's not empty
|
|
15
15
|
return safe_text if safe_text else "unnamed"
|
|
16
16
|
|
|
@@ -135,7 +135,7 @@ class WriteDataToMd:
|
|
|
135
135
|
|
|
136
136
|
# Write to file
|
|
137
137
|
output_file = os.path.join(self.path_output, f"Introductions_{self.cj.title()}.md")
|
|
138
|
-
with open(output_file, "w", encoding="utf-8") as f:
|
|
138
|
+
with open(output_file, "w", encoding="utf-8", newline="\n") as f:
|
|
139
139
|
f.writelines(data_list)
|
|
140
140
|
|
|
141
141
|
# --------- --------- --------- --------- --------- --------- --------- --------- --------- #
|
|
@@ -208,7 +208,10 @@ class WriteDataToMd:
|
|
|
208
208
|
# Write to file
|
|
209
209
|
category_postfix = f"_{keywords_category_name.title()}" if keywords_category_name else ""
|
|
210
210
|
with open(
|
|
211
|
-
os.path.join(self.path_output, f"Categories_{self.cj.title()}{category_postfix}.md"),
|
|
211
|
+
os.path.join(self.path_output, f"Categories_{self.cj.title()}{category_postfix}.md"),
|
|
212
|
+
"w",
|
|
213
|
+
encoding="utf-8",
|
|
214
|
+
newline="\n",
|
|
212
215
|
) as f:
|
|
213
216
|
f.writelines(data_list)
|
|
214
217
|
|
|
@@ -249,7 +252,7 @@ class WriteDataToMd:
|
|
|
249
252
|
path_key = standardize_path(os.path.join(self.path_output, f"Categories_{self.cj.title()}"))
|
|
250
253
|
# Create safe filename by replacing invalid characters
|
|
251
254
|
safe_keyword = create_safe_filename(keyword).replace(" ", "_")
|
|
252
|
-
with open(os.path.join(path_key, f"{safe_keyword}.md"), "w", encoding="utf-8") as f:
|
|
255
|
+
with open(os.path.join(path_key, f"{safe_keyword}.md"), "w", encoding="utf-8", newline="\n") as f:
|
|
253
256
|
f.writelines(data_list)
|
|
254
257
|
|
|
255
258
|
return None
|
|
@@ -295,7 +298,9 @@ class WriteDataToMd:
|
|
|
295
298
|
idx += 1
|
|
296
299
|
|
|
297
300
|
# Write to file
|
|
298
|
-
with open(
|
|
301
|
+
with open(
|
|
302
|
+
os.path.join(self.path_output, f"Publishers_{self.cj.title()}.md"), "w", encoding="utf-8", newline="\n"
|
|
303
|
+
) as f:
|
|
299
304
|
f.writelines(data_list_pub)
|
|
300
305
|
return None
|
|
301
306
|
|
|
@@ -359,7 +364,7 @@ class WriteDataToMd:
|
|
|
359
364
|
|
|
360
365
|
# Write publisher-specific file
|
|
361
366
|
path_pub = standardize_path(os.path.join(self.path_output, f"Publishers_{self.cj.title()}"))
|
|
362
|
-
with open(os.path.join(path_pub, f"{pub}.md"), "w", encoding="utf-8") as f:
|
|
367
|
+
with open(os.path.join(path_pub, f"{pub}.md"), "w", encoding="utf-8", newline="\n") as f:
|
|
363
368
|
f.writelines(data_list)
|
|
364
369
|
|
|
365
370
|
return None
|
|
@@ -403,7 +408,10 @@ class WriteDataToMd:
|
|
|
403
408
|
# Write to file
|
|
404
409
|
category_postfix = f"_{keywords_category_name.title()}" if keywords_category_name else ""
|
|
405
410
|
with open(
|
|
406
|
-
os.path.join(self.path_output, f"Statistics_{self.cj.title()}{category_postfix}.md"),
|
|
411
|
+
os.path.join(self.path_output, f"Statistics_{self.cj.title()}{category_postfix}.md"),
|
|
412
|
+
"w",
|
|
413
|
+
encoding="utf-8",
|
|
414
|
+
newline="\n",
|
|
407
415
|
) as f:
|
|
408
416
|
f.writelines(data_list)
|
|
409
417
|
return None
|
|
@@ -449,7 +457,7 @@ class WriteDataToMd:
|
|
|
449
457
|
path_pub = standardize_path(os.path.join(self.path_output, f"Statistics_{self.cj.title()}"))
|
|
450
458
|
# Create safe filename by replacing invalid characters
|
|
451
459
|
safe_keyword = create_safe_filename(keyword).replace(" ", "_")
|
|
452
|
-
with open(os.path.join(path_pub, f"{safe_keyword}.md"), "w", encoding="utf-8") as f:
|
|
460
|
+
with open(os.path.join(path_pub, f"{safe_keyword}.md"), "w", encoding="utf-8", newline="\n") as f:
|
|
453
461
|
f.writelines(data_list)
|
|
454
462
|
|
|
455
463
|
return None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pyformatjson"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.3.0"
|
|
4
4
|
description = "pyformatjson"
|
|
5
5
|
license = "GPL-3.0-or-later"
|
|
6
6
|
license-files = ["LICENSE"]
|
|
@@ -28,7 +28,7 @@ dependencies = [
|
|
|
28
28
|
"lxml>=6.0.2",
|
|
29
29
|
"playwright>=1.55.0",
|
|
30
30
|
"psutil>=7.1.2",
|
|
31
|
-
"pyadvtools>=0.3.
|
|
31
|
+
"pyadvtools>=0.3.10",
|
|
32
32
|
"requests>=2.32.5",
|
|
33
33
|
"selenium>=4.38.0",
|
|
34
34
|
]
|
|
@@ -35,13 +35,14 @@ class DocGenerator:
|
|
|
35
35
|
def get_module_info(self, module_path: Path) -> dict[str, Any]:
|
|
36
36
|
# Calculate relative import path
|
|
37
37
|
relative_path = module_path.relative_to(self.source_dir)
|
|
38
|
-
module_name = str(relative_path).replace("/", ".").replace("\\", ".")
|
|
38
|
+
module_name = str(relative_path).replace("/", ".").replace("\\", ".")
|
|
39
|
+
module_name = module_name[:-3] # replace(".py", "")
|
|
39
40
|
|
|
40
41
|
return {
|
|
41
42
|
"path": module_path,
|
|
42
43
|
"name": module_name,
|
|
43
44
|
"import_path": f"{self.package_name}.{module_name}",
|
|
44
|
-
"doc_path": self.api_dir / f"{module_name}.md"
|
|
45
|
+
"doc_path": self.api_dir / f"{module_name}.md",
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
def generate_module_doc(self, module_info: dict[str, Any]) -> str:
|
|
@@ -58,7 +59,7 @@ class DocGenerator:
|
|
|
58
59
|
" heading_level: 2",
|
|
59
60
|
" show_source: true",
|
|
60
61
|
" show_category_heading: true",
|
|
61
|
-
""
|
|
62
|
+
"",
|
|
62
63
|
]
|
|
63
64
|
|
|
64
65
|
return "\n".join(content)
|
|
@@ -73,7 +74,7 @@ class DocGenerator:
|
|
|
73
74
|
f"This is the complete API reference documentation for the {self.package_name} library.",
|
|
74
75
|
"",
|
|
75
76
|
"## Module List",
|
|
76
|
-
""
|
|
77
|
+
"",
|
|
77
78
|
]
|
|
78
79
|
|
|
79
80
|
# Group modules by directory
|
|
@@ -104,7 +105,7 @@ class DocGenerator:
|
|
|
104
105
|
# Ensure directory exists
|
|
105
106
|
filepath.parent.mkdir(parents=True, exist_ok=True)
|
|
106
107
|
|
|
107
|
-
with open(filepath, "w", encoding="utf-8") as f:
|
|
108
|
+
with open(filepath, "w", encoding="utf-8", newline="\n") as f:
|
|
108
109
|
f.write(content)
|
|
109
110
|
|
|
110
111
|
print(f"✓ Generated documentation: {filepath}")
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
from pyformatjson.main import main_generate_md_files
|
|
4
|
+
|
|
5
|
+
if __name__ == "__main__":
|
|
6
|
+
full_json_c = os.getenv("FULL_JSON_C", "")
|
|
7
|
+
full_json_j = os.getenv("FULL_JSON_J", "")
|
|
8
|
+
full_json_k = os.getenv("FULL_JSON_K", "")
|
|
9
|
+
path_spidered_bibs = os.getenv("PATH_SPIDERED_BIBS", "")
|
|
10
|
+
path_output = os.path.join(os.getenv("PATH_AILINKS", ""), "docs", "data")
|
|
11
|
+
|
|
12
|
+
main_generate_md_files(full_json_c, full_json_j, full_json_k, path_output, path_spidered_bibs)
|
|
13
|
+
main_generate_md_files(
|
|
14
|
+
full_json_c, full_json_j, full_json_k, path_output, path_spidered_bibs, keywords_category_name="S"
|
|
15
|
+
)
|
|
16
|
+
main_generate_md_files(
|
|
17
|
+
full_json_c, full_json_j, full_json_k, path_output, path_spidered_bibs, keywords_category_name="Y"
|
|
18
|
+
)
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|