pyformatjson 0.2.6__tar.gz → 0.2.9__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 (26) hide show
  1. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/PKG-INFO +1 -1
  2. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/pyformatjson/core/update_json.py +6 -11
  3. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/pyformatjson/tools/generate_dict.py +1 -1
  4. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/pyformatjson/tools/write_dict.py +17 -9
  5. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/pyproject.toml +1 -1
  6. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/scripts/generate_docs.py +4 -4
  7. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/.github/workflows/docs.yml +0 -0
  8. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/.github/workflows/publish.yml +0 -0
  9. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/.github/workflows/release.yml +0 -0
  10. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/.gitignore +0 -0
  11. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/CODE_OF_CONDUCT.md +0 -0
  12. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/LICENSE +0 -0
  13. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/README.md +0 -0
  14. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/docs/api-manual/index.md +0 -0
  15. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/docs/index.md +0 -0
  16. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/docs/requirements.txt +0 -0
  17. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/docs/users-guide/bug-report.md +0 -0
  18. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/docs/users-guide/installation.md +0 -0
  19. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/docs/users-guide/pull-request.md +0 -0
  20. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/mkdocs.yml +0 -0
  21. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/pyformatjson/__init__.py +0 -0
  22. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/pyformatjson/core/__init__.py +0 -0
  23. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/pyformatjson/core/_base.py +0 -0
  24. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/pyformatjson/main.py +0 -0
  25. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/pyformatjson/tools/__init__.py +0 -0
  26. {pyformatjson-0.2.6 → pyformatjson-0.2.9}/pyformatjson.sublime-project +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyformatjson
3
- Version: 0.2.6
3
+ Version: 0.2.9
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
@@ -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,7 +63,7 @@ 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
- with open(full_json_cj, "w", encoding="utf-8") as f:
66
+ with open(full_json_cj, "w", encoding="utf-8", newline="\n") as f:
67
67
  f.write(json.dumps(json_dict, indent=4, sort_keys=True, ensure_ascii=True))
68
68
 
69
69
  return json_dict
@@ -169,8 +169,7 @@ class CheckAcronymAbbrAndFullDict:
169
169
  for i, main_acronym in enumerate(acronyms):
170
170
  # Normalize items: lowercase and remove parentheses
171
171
  main_items = [
172
- item.lower().replace("(", "").replace(")", "")
173
- for item in data[main_acronym].get(key_type, [])
172
+ item.lower().replace("(", "").replace(")", "") for item in data[main_acronym].get(key_type, [])
174
173
  ]
175
174
 
176
175
  # Create exact match patterns
@@ -179,17 +178,13 @@ class CheckAcronymAbbrAndFullDict:
179
178
  matches_found = []
180
179
 
181
180
  # Compare with other acronyms
182
- for other_acronym in acronyms[i + 1:]:
181
+ for other_acronym in acronyms[i + 1 :]:
183
182
  other_items = [
184
- item.lower().replace("(", "").replace(")", "")
185
- for item in data[other_acronym].get(key_type, [])
183
+ item.lower().replace("(", "").replace(")", "") for item in data[other_acronym].get(key_type, [])
186
184
  ]
187
185
 
188
186
  # Find matching items
189
- matching_items = [
190
- item for item in other_items
191
- if any(pattern.match(item) for pattern in patterns)
192
- ]
187
+ matching_items = [item for item in other_items if any(pattern.match(item) for pattern in patterns)]
193
188
 
194
189
  if matching_items:
195
190
  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'[<>:"/\\|?*]', '_', text)
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"), "w", encoding="utf-8"
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(os.path.join(self.path_output, f"Publishers_{self.cj.title()}.md"), "w", encoding="utf-8") as f:
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"), "w", encoding="utf-8"
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.2.6"
3
+ version = "0.2.9"
4
4
  description = "pyformatjson"
5
5
  license = "GPL-3.0-or-later"
6
6
  license-files = ["LICENSE"]
@@ -41,7 +41,7 @@ class DocGenerator:
41
41
  "path": module_path,
42
42
  "name": module_name,
43
43
  "import_path": f"{self.package_name}.{module_name}",
44
- "doc_path": self.api_dir / f"{module_name}.md"
44
+ "doc_path": self.api_dir / f"{module_name}.md",
45
45
  }
46
46
 
47
47
  def generate_module_doc(self, module_info: dict[str, Any]) -> str:
@@ -58,7 +58,7 @@ class DocGenerator:
58
58
  " heading_level: 2",
59
59
  " show_source: true",
60
60
  " show_category_heading: true",
61
- ""
61
+ "",
62
62
  ]
63
63
 
64
64
  return "\n".join(content)
@@ -73,7 +73,7 @@ class DocGenerator:
73
73
  f"This is the complete API reference documentation for the {self.package_name} library.",
74
74
  "",
75
75
  "## Module List",
76
- ""
76
+ "",
77
77
  ]
78
78
 
79
79
  # Group modules by directory
@@ -104,7 +104,7 @@ class DocGenerator:
104
104
  # Ensure directory exists
105
105
  filepath.parent.mkdir(parents=True, exist_ok=True)
106
106
 
107
- with open(filepath, "w", encoding="utf-8") as f:
107
+ with open(filepath, "w", encoding="utf-8", newline="\n") as f:
108
108
  f.write(content)
109
109
 
110
110
  print(f"✓ Generated documentation: {filepath}")
File without changes
File without changes
File without changes
File without changes
File without changes