pyeasyphd 0.2.0__py3-none-any.whl → 0.2.2__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.

@@ -15,6 +15,7 @@ class PaperLinksGenerator(object):
15
15
  self,
16
16
  full_json_c: str,
17
17
  full_json_j: str,
18
+ full_json_k: str,
18
19
  data_base_path: str,
19
20
  keywords_category_name: str = "",
20
21
  display_year_period: int = 10,
@@ -24,12 +25,14 @@ class PaperLinksGenerator(object):
24
25
  Args:
25
26
  full_json_c (str): Path to conferences JSON file.
26
27
  full_json_j (str): Path to journals JSON file.
28
+ full_json_k (str): Path to keywords JSON file.
27
29
  data_base_path (str): Path to data files directory.
28
30
  keywords_category_name (str, optional): Category name for keywords. Defaults to "".
29
31
  display_year_period (int, optional): Number of years to display. Defaults to 10.
30
32
  """
31
33
  self.full_json_c = full_json_c
32
34
  self.full_json_j = full_json_j
35
+ self.full_json_k = full_json_k
33
36
 
34
37
  self.data_base_path = standard_path(data_base_path)
35
38
 
@@ -89,8 +92,8 @@ class PaperLinksGenerator(object):
89
92
  table_rows = self._generate_table_rows_abbr(json_data, cj, folder_flags, folder_name)
90
93
  if table_rows:
91
94
  md_content.extend(table_rows)
92
- self._write_md_file(md_content, folder_name, f"{cj}_Abbr.md")
93
- self._convert_md_to_html(folder_name, f"{cj}_Abbr")
95
+ self._write_md_file(md_content, folder_name, f"{cj}_Abbreviation.md")
96
+ self._convert_md_to_html(folder_name, f"{cj}_Abbreviation")
94
97
 
95
98
  return None
96
99
 
@@ -128,6 +131,8 @@ class PaperLinksGenerator(object):
128
131
  file_path = os.path.expanduser(self.full_json_c)
129
132
  elif file_name.lower().strip() == "journals":
130
133
  file_path = os.path.expanduser(self.full_json_j)
134
+ elif file_name.lower().strip() == "keywords":
135
+ file_path = os.path.expanduser(self.full_json_k)
131
136
  else:
132
137
  file_path = ""
133
138
 
@@ -294,12 +299,15 @@ class PaperLinksGenerator(object):
294
299
 
295
300
  for publisher in keyword_publisher_abbr[keyword]:
296
301
  for abbr in keyword_publisher_abbr[keyword][publisher]:
297
- lines = [
298
- f"[Link]({os.path.join(folder_name, cj.title(), ff, publisher.lower(), abbr, f'{abbr}.html')})"
299
- for ff in folder_flags
300
- ]
301
-
302
- if any(self._check_file_exists(ff, folder_name, cj, publisher, abbr) for ff in folder_flags):
302
+ lines = []
303
+ for ff in folder_flags:
304
+ ll = os.path.join(folder_name, cj.title(), ff, publisher.lower(), abbr, f'{abbr}.html')
305
+ if os.path.exists(os.path.join(self.data_base_path, ll)):
306
+ lines.append(f"[Link]({ll})")
307
+ else:
308
+ lines.append("")
309
+
310
+ if any(lines):
303
311
  data_list.append(f"|{publisher}|{abbr}|" + "|".join(lines) + "|\n")
304
312
 
305
313
  if len(data_list) == 3:
@@ -334,13 +342,6 @@ class PaperLinksGenerator(object):
334
342
  # default
335
343
  return sorted(keywords)
336
344
 
337
- def _check_file_exists(self, folder, folder_name, cj, publisher, abbr):
338
- """Check if HTML file exists for given parameters."""
339
- file_path = os.path.join(
340
- self.data_base_path, folder_name, cj.title(), folder, publisher.lower(), abbr, f"{abbr}.html"
341
- )
342
- return os.path.exists(file_path)
343
-
344
345
  def _convert_md_to_html_keyword(self, folder_name, cj, keyword):
345
346
  """Convert markdown file to HTML using pandoc."""
346
347
  base_path = os.path.join(self.data_base_path, folder_name, f"{cj.title()}_Keywords")
pyeasyphd/utils/utils.py CHANGED
@@ -1,3 +1,4 @@
1
+ import datetime
1
2
  import os
2
3
  import re
3
4
 
@@ -61,3 +62,39 @@ def operate_on_generate_html(html_name: str) -> None:
61
62
  data_list = combine_content_in_list([head_list, [content], tail_list])
62
63
  write_list(data_list, html_name, "w", None, False)
63
64
  return None
65
+
66
+
67
+ def is_last_week_of_month():
68
+ """
69
+ Check if today's date falls in the last week of the current month.
70
+
71
+ Returns:
72
+ bool: True if today is in the last week of the month, False otherwise.
73
+ """
74
+ # Get today's date
75
+ today = datetime.date.today()
76
+
77
+ # Calculate the last day of the current month
78
+ # First, find the first day of next month
79
+ if today.month == 12:
80
+ next_month = datetime.date(today.year + 1, 1, 1)
81
+ else:
82
+ next_month = datetime.date(today.year, today.month + 1, 1)
83
+
84
+ # Subtract one day to get the last day of the current month
85
+ last_day_of_month = next_month - datetime.timedelta(days=1)
86
+
87
+ # Calculate the week number of today and the last day of the month
88
+ # Using isocalendar() which returns (year, week number, weekday)
89
+ today_week = today.isocalendar()[1]
90
+ last_day_week = last_day_of_month.isocalendar()[1]
91
+
92
+ # For December, the week number might roll over to next year
93
+ # If so, we need to adjust the comparison
94
+ if today.month == 12 and today_week < last_day_week:
95
+ # This handles the case where the last week of December is actually
96
+ # the first week of the next year in the ISO calendar
97
+ return True
98
+
99
+ # Check if we're in the same week as the last day of the month
100
+ return today_week == last_day_week
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyeasyphd
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: pyeasyphd
5
5
  License: GPL-3.0-or-later
6
6
  Keywords: Python,Markdown,LaTex
@@ -29,7 +29,7 @@ pyeasyphd/tools/__init__.py,sha256=u1MZu_JjVac3HhEmcSTwroS83UVu0W5Vspy3Wu_-GH8,4
29
29
  pyeasyphd/tools/generate/generate_from_bibs.py,sha256=Dp1MyADwIRb9qFTFOkMPJLaeeh7NBjuiSLBN7smP2eo,7640
30
30
  pyeasyphd/tools/generate/generate_html.py,sha256=JzUEqgTVCaFzd4hXTYUEf0cVSO1QRe0nVUS72W6oyyU,5349
31
31
  pyeasyphd/tools/generate/generate_library.py,sha256=cU043qWCG4CSITuJpyYECdSzWcNCJ5nlRoq1k-0f4p8,7918
32
- pyeasyphd/tools/generate/generate_links.py,sha256=cDMYkcgtDGUY0nWRNafzIPkIvHxTEvmuaK04ePeck_E,15101
32
+ pyeasyphd/tools/generate/generate_links.py,sha256=TRsQMsC5XU-eG0HDgl_o_na6o1Y-6fj9VFcV5a8Yn7k,15138
33
33
  pyeasyphd/tools/py_run_bib_md_tex.py,sha256=fqwWAEbS3GcBxCcsJGh0Kf-pk18B7LirzbvdmfmGGls,14845
34
34
  pyeasyphd/tools/search/data.py,sha256=ykFEd8Tc04dupiG9Y8viOcEe5g56LCaMH-0KwbV4vt4,10306
35
35
  pyeasyphd/tools/search/search_base.py,sha256=JR80m72UBJu__CWV1KP7ixPhK1uDyApPhDaExrlzfKM,5950
@@ -37,7 +37,7 @@ pyeasyphd/tools/search/search_core.py,sha256=Ks_dK69dRfOelaoK_B3fLvmLA9qONgZNb9O
37
37
  pyeasyphd/tools/search/search_keywords.py,sha256=YCurXuoYeU1ftve0cb8Hcn_g2FXCXf7Zn8EdFZZCBy8,10855
38
38
  pyeasyphd/tools/search/search_writers.py,sha256=Dz6D8m17R7x8NT7_PCjwmzlq29AfUz-N6sjyCguDTo4,15702
39
39
  pyeasyphd/tools/search/utils.py,sha256=bo7xtIZu31dQvjol1lwyWq1t6ldbw28oondwK8VbAqk,7562
40
- pyeasyphd/utils/utils.py,sha256=9PLLvkI4FVyeCmoEExX-7wslzfjuhMzne8QtJPDQlrw,1788
41
- pyeasyphd-0.2.0.dist-info/METADATA,sha256=q5bti-eTKuViaShoTh-55_KzJ9LWrjl2jn2Q9WndxfM,984
42
- pyeasyphd-0.2.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
43
- pyeasyphd-0.2.0.dist-info/RECORD,,
40
+ pyeasyphd/utils/utils.py,sha256=kWxzzgNwz77K9Q7j-RKTaoPpxqiVLVtaBMMhLuEenwE,3128
41
+ pyeasyphd-0.2.2.dist-info/METADATA,sha256=WQXUSb2VVOHPOkWP6KXm7AsKB6CY4IWV0PcYnVXl9R0,984
42
+ pyeasyphd-0.2.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
43
+ pyeasyphd-0.2.2.dist-info/RECORD,,