rda-python-common 1.0.48__tar.gz → 1.0.50__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.

Potentially problematic release.


This version of rda-python-common might be problematic. Click here for more details.

Files changed (21) hide show
  1. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/PKG-INFO +1 -1
  2. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/pyproject.toml +1 -1
  3. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common/PgLOG.py +8 -24
  4. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common/PgOPT.py +9 -2
  5. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common.egg-info/PKG-INFO +1 -1
  6. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/LICENSE +0 -0
  7. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/README.md +0 -0
  8. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/setup.cfg +0 -0
  9. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common/PgCMD.py +0 -0
  10. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common/PgDBI.py +0 -0
  11. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common/PgFile.py +0 -0
  12. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common/PgLock.py +0 -0
  13. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common/PgSIG.py +0 -0
  14. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common/PgSplit.py +0 -0
  15. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common/PgUtil.py +0 -0
  16. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common/__init__.py +0 -0
  17. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common.egg-info/SOURCES.txt +0 -0
  18. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common.egg-info/dependency_links.txt +0 -0
  19. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common.egg-info/requires.txt +0 -0
  20. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/src/rda_python_common.egg-info/top_level.txt +0 -0
  21. {rda_python_common-1.0.48 → rda_python_common-1.0.50}/test/test_common.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 1.0.48
3
+ Version: 1.0.50
4
4
  Summary: RDA Python common library codes shared by other RDA python packages
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-common
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rda_python_common"
7
- version = "1.0.48"
7
+ version = "1.0.50"
8
8
  authors = [
9
9
  { name="Zaihua Ji", email="zji@ucar.edu" },
10
10
  ]
@@ -28,6 +28,7 @@ import time
28
28
  import socket
29
29
  import shutil
30
30
  import traceback
31
+ from unidecode import unidecode
31
32
 
32
33
  # define some constants for logging actions
33
34
  MSGLOG = (0x00001) # logging message
@@ -1579,33 +1580,16 @@ def check_process_host(hosts, chost = None, mflag = None, pinfo = None, logact =
1579
1580
  return ret
1580
1581
 
1581
1582
  #
1582
- # convert special characters
1583
+ # convert special foreign characters into ascii characters
1583
1584
  #
1584
1585
  def convert_chars(name, default = 'X'):
1585
-
1586
1586
  if not name: return default
1587
- if re.match(r'^[a-zA-Z0-9]+$', name): return name # no need convert
1588
-
1589
- z = ord('z')
1590
- newchrs = ochrs = ''
1591
- for i in range(len(name)):
1592
- ch = name[i]
1593
- if re.match(r'^[a-zA-Z0-9]$', ch):
1594
- newchrs += ch
1595
- elif (ch == ' ' or ch == '_') and newchrs:
1596
- newchrs += '_'
1597
- elif ord(ch) > z and ochrs != None:
1598
- if not ochrs:
1599
- ochrs = None
1600
- with open(PGLOG['DSSHOME'] + "/lib/ExtChrs.txt", "r") as CHR:
1601
- ochrs = CHR.readline()
1602
- nchrs = CHR.readline()
1603
- if ochrs is None: continue
1604
- idx = ochrs.find(ch)
1605
- if idx >= 0: newchrs += nchrs[idx]
1606
-
1607
- if newchrs:
1608
- return newchrs
1587
+ if re.match(r'^[a-zA-Z0-9]+$', name): return name # conversion not needed
1588
+ decoded_name = unidecode(name).strip()
1589
+ # remove any non-alphanumeric and non-underscore characters
1590
+ cleaned_name = re.sub(r'[^a-zA-Z0-9_]', '', decoded_name)
1591
+ if cleaned_name:
1592
+ return cleaned_name
1609
1593
  else:
1610
1594
  return default
1611
1595
 
@@ -1683,9 +1683,16 @@ def send_request_email_notice(pgrqst, errmsg, fcount, rstat, readyfile = None, p
1683
1683
 
1684
1684
  for ekey in einfo:
1685
1685
  if ekey == 'CCD' and not einfo['CCD']:
1686
- ebuf = re.sub(r'Cc:\s*<CCD>\s*', '', ebuf)
1686
+ mp = r'Cc:\s*<CCD>\s*'
1687
+ rep = ''
1687
1688
  else:
1688
- ebuf = re.sub(r'<{}>'.format(ekey), einfo[ekey], ebuf)
1689
+ mp = r'<{}>'.format(ekey)
1690
+ rep = einfo[ekey]
1691
+ if rep is None:
1692
+ PgLOG.pglog("{}.{}: None ekey value for reuqest email".format(pgrqst['rindex'], ekey),
1693
+ PGOPT['wrnlog']|PgLOG.FRCLOG)
1694
+ rep = ''
1695
+ ebuf = re.sub(mp, rep, ebuf)
1689
1696
 
1690
1697
  if PgLOG.PGLOG['DSCHECK'] and not pgpart:
1691
1698
  tbl = "dscheck"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 1.0.48
3
+ Version: 1.0.50
4
4
  Summary: RDA Python common library codes shared by other RDA python packages
5
5
  Author-email: Zaihua Ji <zji@ucar.edu>
6
6
  Project-URL: Homepage, https://github.com/NCAR/rda-python-common