@@ -494,6 +494,16 @@ if isinstance(member.type, (Array, AbstractSequence)):
494494
495495 @@@ (member .name ).setter @ (noqa_string)
496496 def @ (member .name )(self, value : @ (type_annotations_setter[member .name ])) -> None : @ (noqa_string)
497+
498+ @ [ if isinstance (member .type , AbstractNestedType)]@
499+ from collections .abc import Set
500+ if isinstance (value, Set ):
501+ import warnings
502+ warnings .warn (
503+ ' Using set or subclass of set is deprecated,'
504+ ' please use a subclass of collections.abc.Sequence like list' ,
505+ DeprecationWarning)
506+ @ [ end if ]@
497507 if self ._check_fields :
498508@ [ if isinstance (member .type , AbstractNestedType) and isinstance (member .type .value_type , BasicType) and member .type .value_type .typename in SPECIAL_NESTED_BASIC_TYPES]@
499509@ [ if isinstance (member .type , Array )]@
@@ -529,8 +539,6 @@ if isinstance(member.type, (Array, AbstractSequence)):
529539@ [ end if ]@
530540@ [ if isinstance (member .type , AbstractNestedType)]@
531541 from collections .abc import Sequence
532- from collections .abc import Set
533- from collections import UserList
534542 from collections import UserString
535543@ [ elif isinstance (type_, AbstractGenericString) and type_ .has_maximum_size ()]@
536544 from collections import UserString
@@ -540,11 +548,10 @@ if isinstance(member.type, (Array, AbstractSequence)):
540548 assert \
541549@ [ if isinstance (member .type , AbstractNestedType)]@
542550 ((isinstance (value, Sequence) or
543- isinstance (value, Set ) or
544- isinstance (value, UserList)) and
551+ isinstance (value, Set )) and
545552 not isinstance (value, str) and
546553 not isinstance (value, UserString) and
547- @ {assert_msg_suffixes = [' a set or sequence' ]}@
554+ @ {assert_msg_suffixes = [' sequence' ]}@
548555@ [ if isinstance (type_, AbstractGenericString) and type_ .has_maximum_size ()]@
549556 all (len (val) <= @ (type_ .maximum_size ) for val in value) and
550557@ {assert_msg_suffixes .append (' and each string value not longer than %d' % type_ .maximum_size )}@
0 commit comments