MCPcopy Index your code
hub / github.com/FactoryBoy/factory_boy / update

Method update

factory/builder.py:60–84  ·  view source on GitHub ↗

Add new declarations to this set/ Args: values (dict(name, declaration)): the declarations to ingest.

(self, values)

Source from the content-addressed store, hash-verified

58 return self.__class__(self.as_dict())
59
60 def update(self, values):
61 """Add new declarations to this set/
62
63 Args:
64 values (dict(name, declaration)): the declarations to ingest.
65 """
66 for k, v in values.items():
67 root, sub = self.split(k)
68 if sub is None:
69 self.declarations[root] = v
70 else:
71 self.contexts[root][sub] = v
72
73 extra_context_keys = set(self.contexts) - set(self.declarations)
74 if extra_context_keys:
75 raise errors.InvalidDeclarationError(
76 "Received deep context for unknown fields: %r (known=%r)" % (
77 {
78 self.join(root, sub): v
79 for root in extra_context_keys
80 for sub, v in self.contexts[root].items()
81 },
82 sorted(self.declarations),
83 )
84 )
85
86 def filter(self, entries):
87 """Filter a set of declarations: keep only those related to this object.

Callers 9

__init__Method · 0.95
unroll_contextMethod · 0.80
callMethod · 0.80
callMethod · 0.80
declarationsMethod · 0.80
contribute_to_classMethod · 0.80
parse_declarationsFunction · 0.80
get_or_createMethod · 0.80
get_or_createMethod · 0.80

Calls 2

splitMethod · 0.95
joinMethod · 0.95

Tested by 2

get_or_createMethod · 0.64
get_or_createMethod · 0.64