p3lib 1.1.109__py2.py3-none-any.whl → 1.1.110__py2.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.
- p3lib/helper.py +24 -2
- p3lib/uio.py +16 -16
- {p3lib-1.1.109.dist-info → p3lib-1.1.110.dist-info}/METADATA +1 -1
- {p3lib-1.1.109.dist-info → p3lib-1.1.110.dist-info}/RECORD +6 -6
- {p3lib-1.1.109.dist-info → p3lib-1.1.110.dist-info}/LICENSE +0 -0
- {p3lib-1.1.109.dist-info → p3lib-1.1.110.dist-info}/WHEEL +0 -0
p3lib/helper.py
CHANGED
@@ -273,7 +273,7 @@ def getHomePath():
|
|
273
273
|
if platform.system() == 'Linux' and os.geteuid() == 0:
|
274
274
|
# Fix for os.environ["HOME"] returning /home/root sometimes.
|
275
275
|
return '/root/'
|
276
|
-
|
276
|
+
|
277
277
|
elif "HOME" in os.environ:
|
278
278
|
return os.environ["HOME"]
|
279
279
|
|
@@ -417,4 +417,26 @@ def getAbsFile(filename):
|
|
417
417
|
file_found = abs_filename
|
418
418
|
break
|
419
419
|
|
420
|
-
return file_found
|
420
|
+
return file_found
|
421
|
+
|
422
|
+
|
423
|
+
PYPROJECT_FILE = "pyproject.toml"
|
424
|
+
|
425
|
+
def getProgramVersion():
|
426
|
+
"""@return The program/package version. This comes from the pyproject.toml file.
|
427
|
+
If this file is not found an exception is thrown. """
|
428
|
+
poetryConfigFile = getAbsFile(PYPROJECT_FILE)
|
429
|
+
programVersion = None
|
430
|
+
with open(poetryConfigFile, 'r') as fd:
|
431
|
+
lines = fd.readlines()
|
432
|
+
for line in lines:
|
433
|
+
line=line.strip("\r\n")
|
434
|
+
if line.startswith('version'):
|
435
|
+
elems = line.split("=")
|
436
|
+
if len(elems) == 2:
|
437
|
+
programVersion = elems[1].strip('" ')
|
438
|
+
break
|
439
|
+
if programVersion is None:
|
440
|
+
raise Exception(f"Failed to extract program version from '{line}' line of {poetryConfigFile} file.")
|
441
|
+
return programVersion
|
442
|
+
|
p3lib/uio.py
CHANGED
@@ -217,22 +217,22 @@ class UIO(object):
|
|
217
217
|
value = float(response)
|
218
218
|
else:
|
219
219
|
value = int(response, radix)
|
220
|
-
|
220
|
+
|
221
221
|
if minValue is not None and value < minValue:
|
222
222
|
self.warn(f"The minimum acceptable value is {minValue}")
|
223
|
-
|
223
|
+
|
224
224
|
if maxValue is not None and value > maxValue:
|
225
225
|
self.warn(f"The mximum acceptable value is {maxValue}")
|
226
|
-
|
226
|
+
|
227
227
|
return value
|
228
228
|
|
229
229
|
except ValueError:
|
230
230
|
if floatValue:
|
231
231
|
self.warn("%s is not a valid float value." % (response))
|
232
|
-
|
232
|
+
|
233
233
|
else:
|
234
234
|
self.warn("%s is not a valid integer value." % (response))
|
235
|
-
|
235
|
+
|
236
236
|
if allowQuit and response.lower() == 'q':
|
237
237
|
return None
|
238
238
|
|
@@ -424,7 +424,7 @@ class UIO(object):
|
|
424
424
|
#Ignore if se can't resolve address. We don't really syslog want errors to stop the user interface
|
425
425
|
except:
|
426
426
|
pass
|
427
|
-
|
427
|
+
|
428
428
|
def showTable(self, table, rowSeparatorChar = "-", colSeparatorChar = "|"):
|
429
429
|
"""@brief Show the contents of a table to the user.
|
430
430
|
@param table This must be a list. Each list element must be a table row (list).
|
@@ -435,18 +435,18 @@ class UIO(object):
|
|
435
435
|
# Check we have a table to display
|
436
436
|
if len(table) == 0:
|
437
437
|
raise Exception("No table rows to display")
|
438
|
-
|
438
|
+
|
439
439
|
# Check all rows have the same number of columns in the table
|
440
440
|
colCount = len(table[0])
|
441
441
|
for row in table:
|
442
442
|
if len(row) != colCount:
|
443
443
|
raise Exception(f"{str(row)} column count different from first row ({colCount})")
|
444
|
-
|
444
|
+
|
445
445
|
for row in table:
|
446
446
|
for col in row:
|
447
447
|
if not isinstance(col, str):
|
448
448
|
raise Exception(f"Table column is not a string: {col} in {row}")
|
449
|
-
|
449
|
+
|
450
450
|
# Get the max width for each column
|
451
451
|
for col in range(0,colCount):
|
452
452
|
maxWidth=0
|
@@ -458,10 +458,10 @@ class UIO(object):
|
|
458
458
|
tableWidth = 1
|
459
459
|
for columnWidth in columnWidths:
|
460
460
|
tableWidth += columnWidth + 3 # Space each side of the column + a column divider character
|
461
|
-
|
461
|
+
|
462
462
|
# Add the top line of the table
|
463
463
|
self.info(rowSeparatorChar*tableWidth)
|
464
|
-
|
464
|
+
|
465
465
|
# The starting row index
|
466
466
|
for rowIndex in range(0, len(table)):
|
467
467
|
rowText = colSeparatorChar
|
@@ -473,7 +473,7 @@ class UIO(object):
|
|
473
473
|
self.info(rowText)
|
474
474
|
# Add the row separator line
|
475
475
|
self.info(rowSeparatorChar*tableWidth)
|
476
|
-
|
476
|
+
|
477
477
|
class ConsoleMenu(object):
|
478
478
|
"""@brief Responsible for presenting a list of options to the user on a
|
479
479
|
console/terminal interface and allowing the user to select
|
@@ -508,10 +508,10 @@ class ConsoleMenu(object):
|
|
508
508
|
selectedMethod()
|
509
509
|
else:
|
510
510
|
selectedMethod(*args)
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
|
515
515
|
|
516
516
|
# -------------------------------------------------------------------
|
517
517
|
# @brief An implementation to allow syslog messages to be generated.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: p3lib
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.110
|
4
4
|
Summary: A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output.
|
5
5
|
Home-page: https://github.com/pjaos/test_equipment
|
6
6
|
License: MIT
|
@@ -7,7 +7,7 @@ p3lib/conduit.py,sha256=jPkjdtyCx2I6SFqcEo8y2g7rgnZ-jNY7oCuYIETzT5Q,6046
|
|
7
7
|
p3lib/database_if.py,sha256=XKu1w3zftGbj4Rh54wrWJnoCtqHkhCzJUPN2S70XIKg,11915
|
8
8
|
p3lib/file_io.py,sha256=A7_GKYPlmjRjq6U1YuWhmB0OhLhNm6cWQfQX8qfgYTk,5041
|
9
9
|
p3lib/gnome_desktop_app.py,sha256=zl9SKRBV8ipVg2faCs_gbAr8c42J1N_pntbFGG2BMiE,6694
|
10
|
-
p3lib/helper.py,sha256=
|
10
|
+
p3lib/helper.py,sha256=9Om9dzUD3KrLo7MJA_ma_jyPOfcBJBFX3d8PvuZODoc,14528
|
11
11
|
p3lib/json_networking.py,sha256=6u4s1SmypjTYPnSxHP712OgQ3ZJaxOqIkgHQ1J7Qews,9738
|
12
12
|
p3lib/login.html,sha256=DADTJGuvWQ-LTO4X6SaFdqK7JMW03DAa3lRieGD0d6g,2748
|
13
13
|
p3lib/mqtt_rpc.py,sha256=6LmFA1kR4HSJs9eWbOJORRHNY01L_lHWjvtE2fmY8P8,10511
|
@@ -17,8 +17,8 @@ p3lib/ngt.py,sha256=Y4HsSiaBEYi7OFWkqkDDJende_yyxsvIjUremfArXgA,39204
|
|
17
17
|
p3lib/pconfig.py,sha256=k1WHvmHzOfmkSbP7CrFyT1iTwn5_UROQjk6gltdh7bk,37280
|
18
18
|
p3lib/ssh.py,sha256=OyoAQ_h1L2RfkjTAChDrvLFfl4Fe_gBNdX5rvK-wKiw,42125
|
19
19
|
p3lib/table_plot.py,sha256=RPncwVlGUkkx5Fw0dHQedXo0TSPlTi__VrJBDzaMsuI,32116
|
20
|
-
p3lib/uio.py,sha256=
|
21
|
-
p3lib-1.1.
|
22
|
-
p3lib-1.1.
|
23
|
-
p3lib-1.1.
|
24
|
-
p3lib-1.1.
|
20
|
+
p3lib/uio.py,sha256=BAvzE3LFivaP6dlgjle04RYZ-YIWxXDE01Bfuzrz-Dc,23052
|
21
|
+
p3lib-1.1.110.dist-info/LICENSE,sha256=igqTy5u0kVWM1n-NUZMvAlinY6lVjAXKoag0okkS8V8,1067
|
22
|
+
p3lib-1.1.110.dist-info/METADATA,sha256=OMGf2ConUm--OzGAg0hX8gx8F0Gf2LviWOd_YpGin5c,1337
|
23
|
+
p3lib-1.1.110.dist-info/WHEEL,sha256=IrRNNNJ-uuL1ggO5qMvT1GGhQVdQU54d6ZpYqEZfEWo,92
|
24
|
+
p3lib-1.1.110.dist-info/RECORD,,
|
File without changes
|
File without changes
|