Skip to content

Commit f6b5eed

Browse files
gh-146153: Use frozendict in pure python fallback for curses.has_key (#146154)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
1 parent 8a531f8 commit f6b5eed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Lib/curses/has_key.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# Table mapping curses keys to the terminfo capability name
99

10-
_capability_names = {
10+
_capability_names = frozendict({
1111
_curses.KEY_A1: 'ka1',
1212
_curses.KEY_A3: 'ka3',
1313
_curses.KEY_B2: 'kb2',
@@ -157,7 +157,7 @@
157157
_curses.KEY_SUSPEND: 'kspd',
158158
_curses.KEY_UNDO: 'kund',
159159
_curses.KEY_UP: 'kcuu1'
160-
}
160+
})
161161

162162
def has_key(ch):
163163
if isinstance(ch, str):
@@ -170,7 +170,7 @@ def has_key(ch):
170170

171171
#Check the current terminal description for that capability;
172172
#if present, return true, else return false.
173-
if _curses.tigetstr( capability_name ):
173+
if _curses.tigetstr(capability_name):
174174
return True
175175
else:
176176
return False

0 commit comments

Comments
 (0)