File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -252,3 +252,13 @@ def __iter__(self):
252252
253253 def __next__ (self ):
254254 return self
255+
256+
257+ class _NoDefault (metaclass = Singleton ):
258+ pass
259+
260+
261+ NoDefault = _NoDefault ()
262+ """
263+ A sentinel singleton that can be used as a no-default marker when "None" is a valid option.
264+ """
Original file line number Diff line number Diff line change 44
55from refinery .lib .meta import check_variable_name
66from refinery .lib .tools import isbuffer , typename
7- from refinery .lib .types import Param , isq
7+ from refinery .lib .types import NoDefault , Param , isq
88from refinery .units import Arg , Chunk , Unit
99
10- _EMPTY = object ()
11-
1210
1311class put (Unit ):
1412 """
@@ -18,15 +16,15 @@ class put(Unit):
1816 def __init__ (
1917 self ,
2018 name : Param [str , Arg .String (help = 'The name of the variable to be used.' )],
21- value : Param [isq , Arg .NumSeq (check = False , help = (
19+ value : Param [isq | NoDefault , Arg .NumSeq (check = False , help = (
2220 'The value for the variable. If no value is given, the entire current chunk is stored.'
23- ))] = _EMPTY
21+ ))] = NoDefault
2422 ):
2523 super ().__init__ (name = check_variable_name (name ), value = value )
2624
2725 def process (self , data : Chunk ):
2826 value = self .args .value
29- if value is _EMPTY :
27+ if value is NoDefault :
3028 value = data
3129 if not isinstance (value , (int , float )) and not isbuffer (value ):
3230 try :
You can’t perform that action at this time.
0 commit comments