p3lib 1.1.63__py3-none-any.whl → 1.1.64__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/bokeh_auth.py CHANGED
@@ -80,11 +80,11 @@ class CredentialsHasher(object):
80
80
  recommended for high security systems but is aimed at providing
81
81
  a simple credentials storage solution for Bokeh servers."""
82
82
 
83
- def __init__(self, userHashFile):
83
+ def __init__(self, credentialsJsonFile):
84
84
  """@brief Construct an object that can be used to generate a credentials has file and check
85
85
  credentials entered by a user.
86
- @param userHashFile A file that contains the hashed (via argon2) login credentials."""
87
- self._userHashFile = userHashFile
86
+ @param credentialsJsonFile A file that contains the hashed (via argon2) login credentials."""
87
+ self._credentialsJsonFile = credentialsJsonFile
88
88
  self._passwordHasher = PasswordHasher()
89
89
  self._credDict = self._getCredDict()
90
90
 
@@ -95,9 +95,9 @@ class CredentialsHasher(object):
95
95
  key = hashed password."""
96
96
  credDict = {}
97
97
  # If the hash file exists
98
- if os.path.isfile(self._userHashFile):
98
+ if os.path.isfile(self._credentialsJsonFile):
99
99
  # Add the hash a a line in the file
100
- with open(self._userHashFile, 'r') as fd:
100
+ with open(self._credentialsJsonFile, 'r') as fd:
101
101
  contents = fd.read()
102
102
  credDict = json.loads(contents)
103
103
  return credDict
@@ -113,7 +113,7 @@ class CredentialsHasher(object):
113
113
 
114
114
  def _saveCredentials(self):
115
115
  """@brief Save the cr3edentials to the file."""
116
- with open(self._userHashFile, 'w', encoding='utf-8') as f:
116
+ with open(self._credentialsJsonFile, 'w', encoding='utf-8') as f:
117
117
  json.dump(self._credDict, f, ensure_ascii=False, indent=4)
118
118
 
119
119
  def add(self, username, password):
@@ -170,13 +170,13 @@ class CredentialsHasher(object):
170
170
  class CredentialsManager(object):
171
171
  """@brief Responsible for allowing the user to add and remove credentials to a a local file."""
172
172
 
173
- def __init__(self, uio, userHashFile):
173
+ def __init__(self, uio, credentialsJsonFile):
174
174
  """@brief Constructor.
175
175
  @param uio A UIO instance that allows user input output.
176
- @param userHashFile A file that contains the hashed (via argon2) login credentials."""
176
+ @param credentialsJsonFile A file that contains the hashed (via argon2) login credentials."""
177
177
  self._uio = uio
178
- self._userHashFile = userHashFile
179
- self.credentialsHasher = CredentialsHasher(self._userHashFile)
178
+ self._credentialsJsonFile = credentialsJsonFile
179
+ self.credentialsHasher = CredentialsHasher(self._credentialsJsonFile)
180
180
 
181
181
  def _add(self):
182
182
  """@brief Add a username/password to the list of credentials."""
@@ -223,7 +223,7 @@ class CredentialsManager(object):
223
223
  while True:
224
224
  self._uio.info("")
225
225
  self._showUsernames()
226
- self._uio.info(f"{self.credentialsHasher.getCredentialCount()} credentials stored in {self._userHashFile}")
226
+ self._uio.info(f"{self.credentialsHasher.getCredentialCount()} credentials stored in {self._credentialsJsonFile}")
227
227
  self._uio.info("")
228
228
  self._uio.info("A - Add a username/password.")
229
229
  self._uio.info("D - Delete a username/password.")
p3lib/bokeh_gui.py CHANGED
@@ -759,19 +759,19 @@ class MultiAppServer(object):
759
759
  @return The TCP port or -1 if no port is available."""
760
760
  return SingleAppServer.GetNextUnusedPort(basePort=basePort, maxPort=maxPort, bindAddress=bindAddress)
761
761
 
762
- def __init__(self, address="0.0.0.0", bokehPort=0, wsOrigin="*:*", userHashFile=None):
762
+ def __init__(self, address="0.0.0.0", bokehPort=0, wsOrigin="*:*", credentialsJsonFile=None):
763
763
  """@Constructor
764
764
  @param address The address of the bokeh server.
765
765
  @param bokehPort The TCP port to run the server on. If left at the default
766
766
  of 0 then a spare TCP port will be used.
767
- @param userHashFile A file that contains the hashed (via argon2) login credentials.
767
+ @param credentialsJsonFile A file that contains the json formatted hashed (via argon2) login credentials.
768
768
  """
769
769
  if bokehPort == 0:
770
770
  bokehPort = MultiAppServer.GetNextUnusedPort()
771
771
  self._bokehPort=bokehPort
772
772
  self._address=address
773
773
  os.environ[MultiAppServer.BOKEH_ALLOW_WS_ORIGIN]=wsOrigin
774
- self._userHashFile = userHashFile
774
+ self._credentialsJsonFile = credentialsJsonFile
775
775
 
776
776
  def getServerPort(self):
777
777
  """@return The bokeh server port."""
@@ -800,7 +800,7 @@ class MultiAppServer(object):
800
800
  #As this gets run in a thread we need to start an event loop
801
801
  evtLoop = asyncio.new_event_loop()
802
802
  asyncio.set_event_loop(evtLoop)
803
- if self._userHashFile is None:
803
+ if self._credentialsJsonFile is None:
804
804
  self._server = Server(appDict,
805
805
  address=self._address,
806
806
  port=self._bokehPort)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: p3lib
3
- Version: 1.1.63
3
+ Version: 1.1.64
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/p3lib
6
6
  Author: Paul Austen
@@ -1,7 +1,7 @@
1
1
  p3lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  p3lib/ate.py,sha256=_BiqMUYNAlp4O8MkP_PAUe62Bzd8dzV4Ipv62OFS6Ok,4759
3
- p3lib/bokeh_auth.py,sha256=tGPelSePfsge03hqxyHJx0-46_SF8qCRhIv92cPTIjs,9725
4
- p3lib/bokeh_gui.py,sha256=q5XABYaT43dqefGF3We_bozgKMOXXod8VkIwDjqJUMo,39785
3
+ p3lib/bokeh_auth.py,sha256=u8lrdRRtnkBntwXU47ISM85myC_dhQXvv5SGYgeprdM,9816
4
+ p3lib/bokeh_gui.py,sha256=Kx8mKcKrxsaf7md6Jk252nBC8yilUFRx3nMCfVc8S4Q,39835
5
5
  p3lib/boot_manager.py,sha256=-kbfYbFpO-ktKv_heUgYdvvIQrntfCQ7pBcPWqS3C0s,12551
6
6
  p3lib/conduit.py,sha256=jPkjdtyCx2I6SFqcEo8y2g7rgnZ-jNY7oCuYIETzT5Q,6046
7
7
  p3lib/database_if.py,sha256=mgTdSeCTQs1V10E7KuyK3xRkdaU3RXrqYpMQvosrA_M,11897
@@ -13,8 +13,8 @@ p3lib/netplotly.py,sha256=PMDx-w1jtRVW6Od5u_kuKbBxNpTS_Y88mMF60puMxLM,9363
13
13
  p3lib/pconfig.py,sha256=_ri9w3aauHXZp8u2YLYHBVroFR_iCqaTCwj_MRa3rHo,30153
14
14
  p3lib/ssh.py,sha256=YE1ddgiEt9EeBM8evuxCV8Gnj4jz1Sv52vEKidvjrJA,38369
15
15
  p3lib/uio.py,sha256=hMarPnYXnqVF23HUIeDfzREo7TMdBjrupXMY_ffuCbI,23133
16
- p3lib-1.1.63.dist-info/LICENSE,sha256=igqTy5u0kVWM1n-NUZMvAlinY6lVjAXKoag0okkS8V8,1067
17
- p3lib-1.1.63.dist-info/METADATA,sha256=V1qYHHOdUIy253DfPr-Z6ShUBxJ4eotG-nAn8DFu_pg,920
18
- p3lib-1.1.63.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
19
- p3lib-1.1.63.dist-info/top_level.txt,sha256=SDCpXYh-19yCFp4Z8ZK4B-3J4NvTCJElZ42NPgcR6-U,6
20
- p3lib-1.1.63.dist-info/RECORD,,
16
+ p3lib-1.1.64.dist-info/LICENSE,sha256=igqTy5u0kVWM1n-NUZMvAlinY6lVjAXKoag0okkS8V8,1067
17
+ p3lib-1.1.64.dist-info/METADATA,sha256=C6TYAMUOgbrxycGFILpXgCLDcyRbxNgJKjGQBG8ytpE,920
18
+ p3lib-1.1.64.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
19
+ p3lib-1.1.64.dist-info/top_level.txt,sha256=SDCpXYh-19yCFp4Z8ZK4B-3J4NvTCJElZ42NPgcR6-U,6
20
+ p3lib-1.1.64.dist-info/RECORD,,
File without changes