mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
classes: make _to_lower_core and _expandPUID type-safe
This commit is contained in:
parent
2aca4e39c1
commit
50f8cde694
@ -510,6 +510,8 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
@functools.lru_cache(maxsize=2048)
|
@functools.lru_cache(maxsize=2048)
|
||||||
def _to_lower_core(text, casemapping='rfc1459'):
|
def _to_lower_core(text, casemapping='rfc1459'):
|
||||||
|
if not text:
|
||||||
|
return text
|
||||||
if casemapping == 'rfc1459':
|
if casemapping == 'rfc1459':
|
||||||
text = text.replace('{', '[')
|
text = text.replace('{', '[')
|
||||||
text = text.replace('}', ']')
|
text = text.replace('}', ']')
|
||||||
@ -1232,8 +1234,9 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
|
|||||||
Returns the nick or server name for the given UID/SID. This method helps support protocol
|
Returns the nick or server name for the given UID/SID. This method helps support protocol
|
||||||
modules that use PUIDs internally, as they must convert them to talk with the uplink.
|
modules that use PUIDs internally, as they must convert them to talk with the uplink.
|
||||||
"""
|
"""
|
||||||
|
log.debug('(%s) _expandPUID: got uid %s', self.name, uid)
|
||||||
# TODO: stop hardcoding @ as separator
|
# TODO: stop hardcoding @ as separator
|
||||||
if '@' in uid:
|
if uid and '@' in uid:
|
||||||
if uid in self.users:
|
if uid in self.users:
|
||||||
# UID exists and has a @ in it, meaning it's a PUID (orignick@counter style).
|
# UID exists and has a @ in it, meaning it's a PUID (orignick@counter style).
|
||||||
# Return this user's nick accordingly.
|
# Return this user's nick accordingly.
|
||||||
|
Loading…
Reference in New Issue
Block a user