Skip to content
6 changes: 3 additions & 3 deletions Lib/curses/has_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Table mapping curses keys to the terminfo capability name

_capability_names = {
_capability_names = frozendict({
_curses.KEY_A1: 'ka1',
_curses.KEY_A3: 'ka3',
_curses.KEY_B2: 'kb2',
Expand Down Expand Up @@ -157,7 +157,7 @@
_curses.KEY_SUSPEND: 'kspd',
_curses.KEY_UNDO: 'kund',
_curses.KEY_UP: 'kcuu1'
}
})

def has_key(ch):
if isinstance(ch, str):
Expand All @@ -170,7 +170,7 @@ def has_key(ch):

#Check the current terminal description for that capability;
#if present, return true, else return false.
if _curses.tigetstr( capability_name ):
if _curses.tigetstr(capability_name):
return True
else:
return False
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Changed the ``_capability_names`` dictionary in :mod:`curses.has_key` to a :class:`frozendict`, since it is private and requires no modifications. Contributed by Jonathan Dung.
Loading