From 0b6ef97f410d9bfef86c8657f81bfb9cef4a5adb Mon Sep 17 00:00:00 2001 From: A_D Date: Tue, 7 Jul 2020 18:46:23 +0200 Subject: [PATCH] Made dict copy clearer While `dict(somedict)` does the same thing as `somedict.copy()`, the .copy is clearer as to intent --- companion.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/companion.py b/companion.py index 3909199b..87f3d351 100644 --- a/companion.py +++ b/companion.py @@ -480,7 +480,6 @@ class Session(object): def dump(self, r): print('cAPI\t' + r.url, r.status_code, r.reason and r.reason or 'None', r.text) - # Returns a shallow copy of the received data suitable for export to older tools # English commodity names and anomalies fixed up def fixup(data): @@ -560,8 +559,8 @@ def fixup(data): commodities.append(new) # return a shallow copy - datacopy = dict(data) - datacopy['lastStarport'] = dict(data['lastStarport']) + datacopy = data.copy() + datacopy['lastStarport'] = data['lastStarport'].copy() datacopy['lastStarport']['commodities'] = commodities return datacopy