rda-python-common 1.0.47__tar.gz → 1.0.49__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.47 → rda_python_common-1.0.49}/PKG-INFO +1 -1
  2. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/pyproject.toml +1 -1
  3. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common/PgLOG.py +9 -25
  4. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common.egg-info/PKG-INFO +1 -1
  5. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/LICENSE +0 -0
  6. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/README.md +0 -0
  7. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/setup.cfg +0 -0
  8. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common/PgCMD.py +0 -0
  9. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common/PgDBI.py +0 -0
  10. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common/PgFile.py +0 -0
  11. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common/PgLock.py +0 -0
  12. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common/PgOPT.py +0 -0
  13. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common/PgSIG.py +0 -0
  14. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common/PgSplit.py +0 -0
  15. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common/PgUtil.py +0 -0
  16. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common/__init__.py +0 -0
  17. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common.egg-info/SOURCES.txt +0 -0
  18. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common.egg-info/dependency_links.txt +0 -0
  19. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common.egg-info/requires.txt +0 -0
  20. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/src/rda_python_common.egg-info/top_level.txt +0 -0
  21. {rda_python_common-1.0.47 → rda_python_common-1.0.49}/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.47
3
+ Version: 1.0.49
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.47"
7
+ version = "1.0.49"
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
@@ -335,7 +336,7 @@ def send_python_email(subject = None, receiver = None, msg = None, sender = None
335
336
  emlmsg['Cc'] = cc
336
337
  logmsg += " Cc'd " + cc
337
338
  if not subject: subject = "Message from {}-{}".format(PGLOG['HOSTNAME'], get_command())
338
- if not re.search(r'!$', subject): subject += '!'
339
+ # if not re.search(r'!$', subject): subject += '!'
339
340
  emlmsg['Subject'] = subject
340
341
  if CPID['CPID']: logmsg += " in " + CPID['CPID']
341
342
  logmsg += ", Subject: {}\n".format(subject)
@@ -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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 1.0.47
3
+ Version: 1.0.49
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