MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / update

Function update

lib/sqlalchemy/orm/collections.py:1294–1316  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

1292 return setdefault
1293
1294 def update(fn):
1295 def update(self, __other=NO_ARG, **kw):
1296 if __other is not NO_ARG:
1297 if hasattr(__other, "keys"):
1298 for key in list(__other):
1299 if key not in self or self[key] is not __other[key]:
1300 self[key] = __other[key]
1301 else:
1302 __set_wo_mutation(self, __other[key], None)
1303 else:
1304 for key, value in __other:
1305 if key not in self or self[key] is not value:
1306 self[key] = value
1307 else:
1308 __set_wo_mutation(self, value, None)
1309 for key in kw:
1310 if key not in self or self[key] is not kw[key]:
1311 self[key] = kw[key]
1312 else:
1313 __set_wo_mutation(self, kw[key], None)
1314
1315 _tidy(update)
1316 return update
1317
1318 l = locals().copy()
1319 l.pop("_tidy")

Callers 15

test_update_1Method · 0.90
test_update_3Method · 0.90
test_update_4Method · 0.90
test_update_5Method · 0.90
test_update_6Method · 0.90
test_update_7Method · 0.90
test_update_8Method · 0.90
test_update_10Method · 0.90

Calls 3

__set_wo_mutationFunction · 0.85
_tidyFunction · 0.85
addMethod · 0.45

Tested by 15

test_update_1Method · 0.72
test_update_3Method · 0.72
test_update_4Method · 0.72
test_update_5Method · 0.72
test_update_6Method · 0.72
test_update_7Method · 0.72
test_update_8Method · 0.72
test_update_10Method · 0.72