rda-python-common 2.1.2__tar.gz → 2.1.3__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 (33) hide show
  1. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/PKG-INFO +1 -1
  2. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/pyproject.toml +1 -1
  3. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/pg_log.py +19 -0
  4. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/pg_opt.py +0 -16
  5. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common.egg-info/PKG-INFO +1 -1
  6. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/LICENSE +0 -0
  7. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/README.md +0 -0
  8. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/setup.cfg +0 -0
  9. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/PgCMD.py +0 -0
  10. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/PgDBI.py +0 -0
  11. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/PgFile.py +0 -0
  12. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/PgLOG.py +0 -0
  13. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/PgLock.py +0 -0
  14. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/PgOPT.py +0 -0
  15. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/PgSIG.py +0 -0
  16. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/PgSplit.py +0 -0
  17. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/PgUtil.py +0 -0
  18. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/__init__.py +0 -0
  19. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/pg_cmd.py +0 -0
  20. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/pg_dbi.py +0 -0
  21. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/pg_file.py +0 -0
  22. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/pg_lock.py +0 -0
  23. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/pg_password.py +0 -0
  24. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/pg_sig.py +0 -0
  25. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/pg_split.py +0 -0
  26. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/pg_util.py +0 -0
  27. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common/pgpassword.py +0 -0
  28. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common.egg-info/SOURCES.txt +0 -0
  29. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common.egg-info/dependency_links.txt +0 -0
  30. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common.egg-info/entry_points.txt +0 -0
  31. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common.egg-info/requires.txt +0 -0
  32. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/src/rda_python_common.egg-info/top_level.txt +0 -0
  33. {rda_python_common-2.1.2 → rda_python_common-2.1.3}/test/test_common.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 2.1.2
3
+ Version: 2.1.3
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 = "2.1.2"
7
+ version = "2.1.3"
8
8
  authors = [
9
9
  { name="Zaihua Ji", email="zji@ucar.edu" },
10
10
  ]
@@ -184,6 +184,24 @@ class PgLOG:
184
184
  self.PBSSTATS = {}
185
185
  # set additional common PGLOG values
186
186
  self.set_common_pglog()
187
+ self.OUTPUT = None
188
+
189
+ def open_output(self, outfile=None):
190
+ """Open the result output destination.
191
+
192
+ Args:
193
+ outfile (str, optional): Path to a file to write results to. If
194
+ ``None`` or omitted, output is directed to ``sys.stdout``.
195
+ """
196
+ if outfile: # result output file
197
+ try:
198
+ self.OUTPUT = open(outfile, 'w')
199
+ except Exception as e:
200
+ self.pglog("{}: Error open file to write - {}".format(outfile, str(e)), self.PGOPT['extlog'])
201
+ else: # result to STDOUT
202
+ if self.OUTPUT and self.OUTPUT != sys.stdout:
203
+ self.OUTPUT.close()
204
+ self.OUTPUT = sys.stdout
187
205
 
188
206
  def current_datetime(self, ctime=0):
189
207
  """Return a datetime string in YYYYMMDDHHMMSS format.
@@ -573,6 +591,7 @@ class PgLOG:
573
591
  stat: Exit status code passed to ``sys.exit`` (default 0).
574
592
  """
575
593
  if self.PGLOG['PGDBBUF']: self.PGLOG['PGDBBUF'].close()
594
+ if self.OUTPUT and self.OUTPUT != sys.stdout: self.OUTPUT.close()
576
595
  sys.exit(stat)
577
596
 
578
597
  def get_error_command(self, ctime, logact):
@@ -47,7 +47,6 @@ class PgOPT(PgFile):
47
47
  def __init__(self):
48
48
  """Initialize PgOPT and its parent PgFile, setting up all class attributes."""
49
49
  super().__init__() # initialize parent class
50
- self.OUTPUT = None
51
50
  self.CMDOPTS = {}
52
51
  self.INOPTS = {}
53
52
  # global variables are used by all applications and this package.
@@ -290,21 +289,6 @@ class PgOPT(PgFile):
290
289
  return odval[0] # return the first char of a default string
291
290
  return None
292
291
 
293
- def open_output(self, outfile=None):
294
- """Open the result output destination.
295
-
296
- Args:
297
- outfile (str, optional): Path to a file to write results to. If
298
- ``None`` or omitted, output is directed to ``sys.stdout``.
299
- """
300
- if outfile: # result output file
301
- try:
302
- self.OUTPUT = open(outfile, 'w')
303
- except Exception as e:
304
- self.pglog("{}: Error open file to write - {}".format(outfile, str(e)), self.PGOPT['extlog'])
305
- else: # result to STDOUT
306
- self.OUTPUT = sys.stdout
307
-
308
292
  def validate_infile_names(self, dsid):
309
293
  """Validate all input file names against the expected dataset ID.
310
294
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rda_python_common
3
- Version: 2.1.2
3
+ Version: 2.1.3
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