Skip to content

Commit

Permalink
Rename missing->load_default for mashmallow
Browse files Browse the repository at this point in the history
'missing' was deprecated.
  • Loading branch information
clenk committed Sep 29, 2023
1 parent 12e7283 commit 3e0f877
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 36 deletions.
26 changes: 13 additions & 13 deletions app/objects/c_ability.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@

class AbilitySchema(ma.Schema):
ability_id = ma.fields.String()
tactic = ma.fields.String(missing=None)
technique_name = ma.fields.String(missing=None)
technique_id = ma.fields.String(missing=None)
name = ma.fields.String(missing=None)
description = ma.fields.String(missing=None)
tactic = ma.fields.String(load_default=None)
technique_name = ma.fields.String(load_default=None)
technique_id = ma.fields.String(load_default=None)
name = ma.fields.String(load_default=None)
description = ma.fields.String(load_default=None)
executors = ma.fields.List(ma.fields.Nested(ExecutorSchema))
requirements = ma.fields.List(ma.fields.Nested(RequirementSchema), missing=None)
privilege = ma.fields.String(missing=None)
repeatable = ma.fields.Bool(missing=None)
buckets = ma.fields.List(ma.fields.String(), missing=None)
requirements = ma.fields.List(ma.fields.Nested(RequirementSchema), load_default=None)
privilege = ma.fields.String(load_default=None)
repeatable = ma.fields.Bool(load_default=None)
buckets = ma.fields.List(ma.fields.String(), load_default=None)
additional_info = ma.fields.Dict(keys=ma.fields.String(), values=ma.fields.String())
access = ma.fields.Nested(AccessSchema, missing=None)
singleton = ma.fields.Bool(missing=None)
plugin = ma.fields.String(missing=None)
delete_payload = ma.fields.Bool(missing=None)
access = ma.fields.Nested(AccessSchema, load_default=None)
singleton = ma.fields.Bool(load_default=None)
plugin = ma.fields.String(load_default=None)
delete_payload = ma.fields.Bool(load_default=None)

@ma.pre_load
def fix_id(self, data, **_):
Expand Down
2 changes: 1 addition & 1 deletion app/objects/c_adversary.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AdversarySchema(ma.Schema):
objective = ma.fields.String()
tags = ma.fields.List(ma.fields.String(), allow_none=True)
has_repeatable_abilities = ma.fields.Boolean(dump_only=True)
plugin = ma.fields.String(missing=None)
plugin = ma.fields.String(load_default=None)

@ma.pre_load
def fix_id(self, adversary, **_):
Expand Down
2 changes: 1 addition & 1 deletion app/objects/c_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class OperationSchema(ma.Schema):
visibility = ma.fields.Integer()
objective = ma.fields.Nested(ObjectiveSchema())
use_learning_parsers = ma.fields.Boolean()
group = ma.fields.String(missing='')
group = ma.fields.String(load_default='')
source = ma.fields.Nested(SourceSchema())

@ma.pre_load()
Expand Down
2 changes: 1 addition & 1 deletion app/objects/c_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PlannerSchema(ma.Schema):
stopping_conditions = ma.fields.List(ma.fields.Nested(FactSchema()))
ignore_enforcement_modules = ma.fields.List(ma.fields.String())
allow_repeatable_abilities = ma.fields.Boolean()
plugin = ma.fields.String(missing=None)
plugin = ma.fields.String(load_default=None)

@ma.post_load()
def build_planner(self, data, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion app/objects/c_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SourceSchema(ma.Schema):
rules = ma.fields.List(ma.fields.Nested(RuleSchema))
adjustments = ma.fields.List(ma.fields.Nested(AdjustmentSchema))
relationships = ma.fields.List(ma.fields.Nested(RelationshipSchema))
plugin = ma.fields.String(missing=None)
plugin = ma.fields.String(load_default=None)

@ma.pre_load
def fix_adjustments(self, in_data, **_):
Expand Down
14 changes: 7 additions & 7 deletions app/objects/secondclass/c_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@


class ExecutorSchema(ma.Schema):
name = ma.fields.String(missing=None)
platform = ma.fields.String(missing=None)
command = ma.fields.String(missing=None)
code = ma.fields.String(missing=None)
language = ma.fields.String(missing=None)
build_target = ma.fields.String(missing=None)
name = ma.fields.String(load_default=None)
platform = ma.fields.String(load_default=None)
command = ma.fields.String(load_default=None)
code = ma.fields.String(load_default=None)
language = ma.fields.String(load_default=None)
build_target = ma.fields.String(load_default=None)
payloads = ma.fields.List(ma.fields.String())
uploads = ma.fields.List(ma.fields.String())
timeout = ma.fields.Int(missing=60)
timeout = ma.fields.Int(load_default=60)
parsers = ma.fields.List(ma.fields.Nested(ParserSchema()))
cleanup = ma.fields.List(ma.fields.String())
variations = ma.fields.List(ma.fields.Nested(VariationSchema()))
Expand Down
2 changes: 1 addition & 1 deletion app/objects/secondclass/c_instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class InstructionSchema(ma.Schema):
payloads = ma.fields.List(ma.fields.String())
deadman = ma.fields.Boolean()
uploads = ma.fields.List(ma.fields.Dict(keys=ma.fields.String(), values=ma.fields.String()))
delete_payload = ma.fields.Bool(missing=None)
delete_payload = ma.fields.Bool(load_default=None)

@ma.post_load
def build_instruction(self, data, **_):
Expand Down
16 changes: 8 additions & 8 deletions app/objects/secondclass/c_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ class LinkSchema(ma.Schema):
class Meta:
unknown = ma.EXCLUDE

id = ma.fields.String(missing='')
id = ma.fields.String(load_default='')
paw = ma.fields.String()
command = ma.fields.String()
plaintext_command = ma.fields.String()
status = ma.fields.Integer(missing=-3)
score = ma.fields.Integer(missing=0)
jitter = ma.fields.Integer(missing=0)
status = ma.fields.Integer(load_default=-3)
score = ma.fields.Integer(load_default=0)
jitter = ma.fields.Integer(load_default=0)
decide = ma.fields.DateTime(format=BaseObject.TIME_FORMAT)
pin = ma.fields.Integer(missing=0)
pin = ma.fields.Integer(load_default=0)
pid = ma.fields.String()
facts = ma.fields.List(ma.fields.Nested(FactSchema()))
relationships = ma.fields.List(ma.fields.Nested(RelationshipSchema()))
Expand All @@ -43,12 +43,12 @@ class Meta:
finish = ma.fields.String()
ability = ma.fields.Nested(AbilitySchema())
executor = ma.fields.Nested(ExecutorSchema())
cleanup = ma.fields.Integer(missing=0)
cleanup = ma.fields.Integer(load_default=0)
visibility = ma.fields.Nested(VisibilitySchema())
host = ma.fields.String(missing=None)
host = ma.fields.String(load_default=None)
output = ma.fields.String()
deadman = ma.fields.Boolean()
agent_reported_time = ma.fields.DateTime(format=BaseObject.TIME_FORMAT, missing=None)
agent_reported_time = ma.fields.DateTime(format=BaseObject.TIME_FORMAT, load_default=None)

@ma.pre_load()
def fix_ability(self, link, **_):
Expand Down
4 changes: 2 additions & 2 deletions app/objects/secondclass/c_parserconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class Meta:
unknown = ma.INCLUDE

source = ma.fields.String()
edge = ma.fields.String(missing=None)
target = ma.fields.String(missing=None)
edge = ma.fields.String(load_default=None)
target = ma.fields.String(load_default=None)
custom_parser_vals = ma.fields.Dict(keys=ma.fields.String(), values=ma.fields.String())

@ma.pre_load
Expand Down
2 changes: 1 addition & 1 deletion app/objects/secondclass/c_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ResultSchema(ma.Schema):
exit_code = ma.fields.String()
pid = ma.fields.String()
status = ma.fields.String()
agent_reported_time = ma.fields.DateTime(format=BaseObject.TIME_FORMAT, missing=None)
agent_reported_time = ma.fields.DateTime(format=BaseObject.TIME_FORMAT, load_default=None)

@ma.post_load
def build_result(self, data, **_):
Expand Down

0 comments on commit 3e0f877

Please sign in to comment.