Skip to content

Commit 88511d0

Browse files
committed
Make use of dict unions
1 parent a57ceb0 commit 88511d0

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

webware/MiscUtils/DictForArgs.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,10 @@ def expandDictWithExtras(d, key='Extras',
193193
to specify attributes that occur infrequently.
194194
"""
195195
if key in d:
196-
newDict = dict(d)
196+
baseDict = dict(d)
197197
if delKey:
198-
del newDict[key]
199-
newDict.update(dictForArgs(d[key]))
200-
return newDict
198+
del baseDict[key]
199+
return baseDict | dictForArgs(d[key])
201200
return d
202201

203202

webware/WebUtils/CGITraceback.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ def breaker():
3737

3838
def html(context=5, options=None):
3939
if options:
40-
opt = DefaultOptions.copy()
41-
opt.update(options)
40+
opt = DefaultOptions | options
4241
else:
4342
opt = DefaultOptions
4443

webware/WebUtils/ExpansiveHTMLForException.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
def expansiveHTMLForException(context=5, options=None):
1818
"""Create expansive HTML for exceptions."""
1919
if options:
20-
opt = HTMLForExceptionOptions.copy()
21-
opt.update(options)
20+
opt = HTMLForExceptionOptions | options
2221
else:
2322
opt = HTMLForExceptionOptions
2423
return CGITraceback.html(context=context, options=opt)

webware/WebUtils/HTMLForException.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ def htmlForLines(lines, options=None):
2929

3030
# Set up the options:
3131
if options:
32-
opt = HTMLForExceptionOptions.copy()
33-
opt.update(options)
32+
opt = HTMLForExceptionOptions | options
3433
else:
3534
opt = HTMLForExceptionOptions
3635

0 commit comments

Comments
 (0)