rda-python-common 1.0.0__tar.gz → 1.0.2__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 (21) hide show
  1. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/PKG-INFO +1 -1
  2. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/pyproject.toml +1 -1
  3. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common/PgCMD.py +8 -7
  4. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common/PgDBI.py +4 -3
  5. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common/PgFile.py +7 -6
  6. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common/PgGLBS.py +9 -7
  7. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common/PgLOG.py +9 -6
  8. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common/PgLock.py +8 -7
  9. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common/PgOPT.py +7 -6
  10. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common/PgPGS.py +4 -3
  11. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common/PgSIG.py +5 -4
  12. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common/PgSplit.py +6 -5
  13. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common/PgUtil.py +3 -2
  14. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common.egg-info/PKG-INFO +1 -1
  15. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/LICENSE +0 -0
  16. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/README.md +0 -0
  17. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/setup.cfg +0 -0
  18. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common/__init__.py +0 -0
  19. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common.egg-info/SOURCES.txt +0 -0
  20. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common.egg-info/dependency_links.txt +0 -0
  21. {rda_python_common-1.0.0 → rda_python_common-1.0.2}/src/rda_python_common.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rda_python_common
3
- Version: 1.0.0
3
+ Version: 1.0.2
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.0"
7
+ version = "1.0.2"
8
8
  authors = [
9
9
  { name="Zaihua Ji", email="zji@ucar.edu" },
10
10
  ]
@@ -4,11 +4,12 @@
4
4
  # Title : PgCMD.py
5
5
  # Author : Zaihua Ji, zji@ucar.edu
6
6
  # Date : 08/25/2020
7
+ # 2025-01-10 transferred to package rda_python_common from
8
+ # https://github.com/NCAR/rda-shared-libraries.git
7
9
  # Purpose : python library module for functions to record commands for delayed
8
10
  # mode or command recovery
9
11
  #
10
- # Work File : $DSSHOME/lib/python/PgCMD.py
11
- # Github : https://github.com/NCAR/rda-shared-libraries.git
12
+ # Github : https://github.com/NCAR/rda-python-common.git
12
13
  #
13
14
  ###############################################################################
14
15
  #
@@ -16,11 +17,11 @@ import os
16
17
  import re
17
18
  import sys
18
19
  import time
19
- import PgLOG
20
- import PgSIG
21
- import PgUtil
22
- import PgLock
23
- import PgDBI
20
+ from . import PgLOG
21
+ from . import PgSIG
22
+ from . import PgUtil
23
+ from . import PgLock
24
+ from . import PgDBI
24
25
 
25
26
  # cached dscheck info
26
27
  DSCHK = {}
@@ -4,10 +4,11 @@
4
4
  # Title : PgDBI.py -- PostgreSQL DataBase Interface
5
5
  # Author : Zaihua Ji, zji@ucar.edu
6
6
  # Date : 06/07/2022
7
+ # 2025-01-10 transferred to package rda_python_common from
8
+ # https://github.com/NCAR/rda-shared-libraries.git
7
9
  # Purpose : Python library module to handle query and manipulate PostgreSQL database
8
10
  #
9
- # Work File : $DSSHOME/lib/python/PgDBI.py
10
- # Github : https://github.com/NCAR/rda-shared-libraries.git
11
+ # Github : https://github.com/NCAR/rda-python-common.git
11
12
  #
12
13
  ###############################################################################
13
14
 
@@ -19,7 +20,7 @@ import psycopg2 as PgSQL
19
20
  from psycopg2.extras import execute_values
20
21
  from psycopg2.extras import execute_batch
21
22
  from os import path as op
22
- import PgLOG
23
+ from . import PgLOG
23
24
 
24
25
  pgdb = None # reference to a connected database object
25
26
  curtran = 0 # 0 - no transaction, 1 - in transaction
@@ -4,11 +4,12 @@
4
4
  # Title : PgFile.py
5
5
  # Author : Zaihua Ji, zji@ucar.edu
6
6
  # Date : 08/05/2020
7
+ # 2025-01-10 transferred to package rda_python_common from
8
+ # https://github.com/NCAR/rda-shared-libraries.git
7
9
  # Purpose : python library module to copy, move and delete data files locally
8
10
  # and remotely
9
11
  #
10
- # Work File : $DSSHOME/lib/python/PgFile.py
11
- # Github : https://github.com/NCAR/rda-shared-libraries.git
12
+ # Github : https://github.com/NCAR/rda-python_common.git
12
13
  #
13
14
  ###############################################################################
14
15
  #
@@ -22,10 +23,10 @@ import re
22
23
  import time
23
24
  import glob
24
25
  import json
25
- import PgLOG
26
- import PgUtil
27
- import PgSIG
28
- import PgDBI
26
+ from . import PgLOG
27
+ from . import PgUtil
28
+ from . import PgSIG
29
+ from . import PgDBI
29
30
 
30
31
  CMDBTH = (0x0033) # return both stdout and stderr, 16 + 32 + 2 + 1
31
32
  RETBTH = (0x0030) # return both stdout and stderr, 16 + 32
@@ -4,21 +4,23 @@
4
4
  # Title : PgGLBS.py
5
5
  # Author : Thomas Cram, tcram@ucar.edu
6
6
  # Date : 12/10/2014
7
- # Purpose : python library module for Globus functions and utilities
8
- # Changes : 10/10/2020, Zaihua Ji, zji@ucar.edu:
7
+ # 10/10/2020, Zaihua Ji, zji@ucar.edu:
9
8
  # converted from perl package to python module
9
+ # 2025-01-10, Zaihua Ji, zji@ucar.edu:
10
+ # transferred to package rda_python_common from
11
+ # https://github.com/NCAR/rda-shared-libraries.git
12
+ # Purpose : python library module for Globus functions and utilities
10
13
  #
11
- # Work File : $DSSHOME/lib/python/PgGLBS.py
12
- # Github : https://github.com/NCAR/rda-shared-libraries.git
14
+ # Github : https://github.com/NCAR/rda-python-common.git
13
15
  #
14
16
  ###############################################################################
15
17
  #
16
18
  import os
17
19
  import re
18
- import PgLOG
19
- import PgUtil
20
+ from . import PgLOG
21
+ from . import PgUtil
20
22
  from MyGlobus import MyGlobus, MyEndpoints, GLOBUS_REQUEST_DOMAIN
21
- import PgDBI
23
+ from . import PgDBI
22
24
 
23
25
  try:
24
26
  from urllib.parse import urlencode
@@ -4,12 +4,13 @@
4
4
  # Title : PgLOG.py -- Module for logging messages.
5
5
  # Author : Zaihua Ji, zji@ucar.edu
6
6
  # Date : 03/02/2016
7
+ # 2025-01-10 transferred to package rda_python_common from
8
+ # https://github.com/NCAR/rda-shared-libraries.git
7
9
  # Purpose : Python library module to log message and also do other things
8
10
  # according to the value of logact, like display the error
9
11
  # message on screen and exit script
10
12
  #
11
- # Work File : $DSSHOME/lib/python/PgLOG.py
12
- # Github : https://github.com/NCAR/rda-shared-libraries.git
13
+ # Github : https://github.com/NCAR/rda-python-common.git
13
14
  #
14
15
  ###############################################################################
15
16
 
@@ -1511,17 +1512,19 @@ def check_process_host(hosts, chost = None, mflag = None, pinfo = None, logact =
1511
1512
  #
1512
1513
  # convert special characters
1513
1514
  #
1514
- def convert_chars(name, default = None):
1515
+ def convert_chars(name, default = 'X'):
1516
+
1517
+ if not name: return default
1518
+ if re.match(r'^[a-zA-Z0-9]+$', name): return name # no need convert
1515
1519
 
1516
- if not name or re.match(r'^[a-zA-Z0-9]+$', name): return name # no need convert
1517
-
1518
1520
  z = ord('z')
1519
1521
  newchrs = ochrs = ''
1520
- if default == None: default = name
1521
1522
  for i in range(len(name)):
1522
1523
  ch = name[i]
1523
1524
  if re.match(r'^[a-zA-Z0-9]$', ch):
1524
1525
  newchrs += ch
1526
+ elif (ch == ' ' or ch == '_') and newchrs:
1527
+ newchrs += '_'
1525
1528
  elif ord(ch) > z and ochrs != None:
1526
1529
  if not ochrs:
1527
1530
  ochrs = None
@@ -4,20 +4,21 @@
4
4
  # Title : PgLock.py
5
5
  # Author : Zaihua Ji, zji@ucar.edu
6
6
  # Date : 08/118/2020
7
+ # 2025-01-10 transferred to package rda_python_common from
8
+ # https://github.com/NCAR/rda-shared-libraries.git
7
9
  # Purpose : python library module for functions to lock RDADB records
8
10
  #
9
- # Work File : $DSSHOME/lib/python/PgLock.py
10
- # Github : https://github.com/NCAR/rda-shared-libraries.git
11
+ # Github : https://github.com/NCAR/rda-python-common.git
11
12
  #
12
13
  ###############################################################################
13
14
  #
14
15
  import re
15
16
  import time
16
- import PgLOG
17
- import PgSIG
18
- import PgUtil
19
- import PgFile
20
- import PgDBI
17
+ from . import PgLOG
18
+ from . import PgSIG
19
+ from . import PgUtil
20
+ from . import PgFile
21
+ from . import PgDBI
21
22
 
22
23
  DOLOCKS = {-2 : 'Force Unlock', -1 : 'Unlock', 0 : 'Unlock', 1 : 'Relock', 2 : 'Force Relock'}
23
24
 
@@ -5,11 +5,12 @@
5
5
  #
6
6
  # Author : Zaihua Ji, zji@ucar.edu
7
7
  # Date : 08/26/2020
8
+ # 2025-01-10 transferred to package rda_python_common from
9
+ # https://github.com/NCAR/rda-shared-libraries.git
8
10
  # Purpose : python library module for holding global varaibles
9
11
  # functions for processing options and other global functions
10
12
  #
11
- # Work File : $DSSHOME/lib/python/PgOPT.py
12
- # Github : https://github.com/NCAR/rda-shared-libraries.git
13
+ # Github : https://github.com/NCAR/rda-pyhon-common.git
13
14
  #
14
15
  ###############################################################################
15
16
  #
@@ -18,10 +19,10 @@ import sys
18
19
  import re
19
20
  import time
20
21
  from os import path as op
21
- import PgLOG
22
- import PgUtil
23
- import PgFile
24
- import PgDBI
22
+ from . import PgLOG
23
+ from . import PgUtil
24
+ from . import PgFile
25
+ from . import PgDBI
25
26
 
26
27
  OUTPUT = None
27
28
  CMDOPTS = {}
@@ -4,17 +4,18 @@
4
4
  # Title : PgPGS.py -- PostgreSQL Interface for CDP DataBase Per psql
5
5
  # Author : Zaihua Ji, zji@ucar.edu
6
6
  # Date : 08/31/2020
7
+ # 2025-01-10 transferred to package rda_python_common from
8
+ # https://github.com/NCAR/rda-shared-libraries.git
7
9
  # Purpose : python library module to handle sql scripts to retrieve info
8
10
  # from cdp database per psql
9
11
  #
10
- # Work File : $DSSHOME/lib/python/PgPGS.py
11
- # Github : https://github.com/NCAR/rda-shared-libraries.git
12
+ # Github : https://github.com/NCAR/rda-python-common.git
12
13
  #
13
14
  ###############################################################################
14
15
  #
15
- import PgLOG
16
16
  import os
17
17
  import re
18
+ from . import PgLOG
18
19
 
19
20
  PGPGS = {}
20
21
  PGPGS["PGSSERV"] = PgLOG.get_environment("PGSSERV", '-h vetsdbprod -p 5432 -U acadmin access_control');
@@ -5,10 +5,11 @@
5
5
  #
6
6
  # Author : Zaihua Ji, zji@ucar.edu
7
7
  # Date : 08/05/2020
8
+ # 2025-01-10 transferred to package rda_python_common from
9
+ # https://github.com/NCAR/rda-shared-libraries.git
8
10
  # Purpose : python library module for start and control daemon process
9
11
  #
10
- # Work File : $DSSHOME/lib/python/PgSIG.py
11
- # Github : https://github.com/NCAR/rda-shared-libraries.git
12
+ # Github : https://github.com/NCAR/rda-python-common.git
12
13
  #
13
14
  ###############################################################################
14
15
  #
@@ -19,8 +20,8 @@ import errno
19
20
  import signal
20
21
  import time
21
22
  from contextlib import contextmanager
22
- import PgLOG
23
- import PgDBI
23
+ from . import PgLOG
24
+ from . import PgDBI
24
25
 
25
26
  VUSERS = [] # allow users to start this daemon
26
27
  CPIDS = {} # allow upto 'mproc' processes at one time for daemon
@@ -4,19 +4,20 @@
4
4
  # Title : PgSplit.py -- PostgreSQL DataBase Interface foe table wfile
5
5
  # Author : Zaihua Ji, zji@ucar.edu
6
6
  # Date : 09/010/2024
7
+ # 2025-01-10 transferred to package rda_python_common from
8
+ # https://github.com/NCAR/rda-shared-libraries.git
7
9
  # Purpose : Python library module to handle query and manipulate table wfile
8
10
  #
9
- # Work File : $DSSHOME/lib/python/PgSplit.py
10
- # Github : https://github.com/NCAR/rda-shared-libraries.git
11
+ # Github : https://github.com/NCAR/rda-python-common.git
11
12
  #
12
13
  ###############################################################################
13
14
 
14
15
  import os
15
16
  import re
16
17
  from os import path as op
17
- import PgLOG
18
- import PgDBI
19
- import PgUtil
18
+ from . import PgLOG
19
+ from . import PgDBI
20
+ from . import PgUtil
20
21
 
21
22
  #
22
23
  # compare wfile records between tables wfile and wfile_dNNNNNN,
@@ -4,10 +4,11 @@
4
4
  # Title : PgUtil.py -- module for misc utilities.
5
5
  # Author : Zaihua Ji, zji@ucar.edu
6
6
  # Date : 07/27/2020
7
+ # 2025-01-10 transferred to package rda_python_common from
8
+ # https://github.com/NCAR/rda-shared-libraries.git
7
9
  # Purpose : python library module for global misc utilities
8
10
  #
9
- # Work File : $DSSHOME/lib/python/PgUtil.py
10
- # Github : https://github.com/NCAR/rda-shared-libraries.git
11
+ # Github : https://github.com/NCAR/rda-python-common.git
11
12
  #
12
13
  ###############################################################################
13
14
  #
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rda_python_common
3
- Version: 1.0.0
3
+ Version: 1.0.2
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