Skip to content

Commit d6e5bd0

Browse files
illusionalgtmanfred
authored andcommitted
Address nitpicks
1 parent 21cc21d commit d6e5bd0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

flask_rebar/compat.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
from flask_rebar.validation import filter_dump_only, RequireOnDumpMixin
1515

1616

17+
# Marshmallow version detection for backward compatibility
18+
MARSHMALLOW_VERSION_MAJOR = int(version("marshmallow").split(".")[0])
19+
20+
1721
def set_data_key(field: Field, key: str) -> Field:
1822
field.data_key = key
1923
return field
@@ -71,10 +75,6 @@ def exclude_unknown_fields(schema: Schema) -> Schema:
7175
return schema
7276

7377

74-
# Marshmallow version detection for backward compatibility
75-
MARSHMALLOW_VERSION_MAJOR = int(version("marshmallow").split(".")[0])
76-
77-
7878
def is_schema_ordered(schema: Schema) -> bool:
7979
"""
8080
Check if a schema should maintain field order.
@@ -89,6 +89,6 @@ def is_schema_ordered(schema: Schema) -> bool:
8989
if MARSHMALLOW_VERSION_MAJOR >= 4:
9090
# In Marshmallow 4+, fields are always ordered (insertion order)
9191
return True
92-
else:
93-
# In Marshmallow 3, check the 'ordered' attribute
94-
return getattr(schema, "ordered", False)
92+
93+
# In Marshmallow 3, check the 'ordered' attribute
94+
return getattr(schema, "ordered", False)

0 commit comments

Comments
 (0)