@@ -77,20 +77,21 @@ def from_characters_args(
7777 intervals &= charmap .intervals_from_codec (codec )
7878
7979 _args = []
80- if codec is not None :
81- _args .append (("codec" , codec ))
82- if min_codepoint is not None :
83- _args .append (("min_codepoint" , min_codepoint ))
84- if max_codepoint is not None :
85- _args .append (("max_codepoint" , max_codepoint ))
8680 if categories is not None and set (categories ) != set (charmap .categories ()) - {
8781 "Cs"
8882 }:
8983 _args .append (("categories" , categories ))
90- if exclude_characters not in [None , "" ]:
91- _args .append (("exclude_characters" , exclude_characters ))
92- if include_characters not in [None , "" ]:
93- _args .append (("include_characters" , include_characters ))
84+ _args .extend (
85+ (k , v )
86+ for k , v in [
87+ ("codec" , codec ),
88+ ("min_codepoint" , min_codepoint ),
89+ ("max_codepoint" , max_codepoint ),
90+ ("exclude_characters" , exclude_characters ),
91+ ("include_characters" , include_characters ),
92+ ]
93+ if v not in (None , "" )
94+ )
9495 _arg_repr = ", " .join (f"{ k } ={ v !r} " for k , v in _args )
9596 if not intervals :
9697 raise InvalidArgument (
0 commit comments