1010
1111def add_time_filters (parser , prefix = "move" ):
1212 """Add time-based filtering arguments (ctime/mtime) to a parser.
13-
13+
1414 Args:
1515 parser: The argument parser or argument group
1616 prefix: Prefix for argument names (e.g., 'move' for --move-sizes)
1717 """
1818 prefix_dash = f"--{ prefix } -" if prefix else "--"
19-
19+
2020 time_group = parser .add_argument_group ("Time Filters" )
2121 time_group .add_argument (
2222 f"{ prefix_dash } time-created" ,
@@ -68,22 +68,22 @@ def add_time_filters(parser, prefix="move"):
6868
6969def process_time_filters (args , prefix = "move" ):
7070 """Process time-based filtering arguments into filter functions.
71-
71+
7272 Args:
7373 args: Parsed arguments namespace
7474 prefix: Prefix for argument names (e.g., 'move' or empty)
7575 """
7676 prefix_underscore = f"{ prefix } _" if prefix else ""
7777 now = time .time ()
78-
78+
7979 # Process time-created arguments
8080 created_within = getattr (args , f"{ prefix_underscore } created_within" , [])
8181 created_before = getattr (args , f"{ prefix_underscore } created_before" , [])
82-
82+
8383 # Calculate threshold timestamps
8484 created_within_thresholds = [now - nums .human_to_seconds (s ) for s in created_within ]
8585 created_before_thresholds = [now - nums .human_to_seconds (s ) for s in created_before ]
86-
86+
8787 # Create filter function: timestamp must be >= all within thresholds AND < all before thresholds
8888 def time_created_filter (timestamp ):
8989 if timestamp is None :
@@ -95,17 +95,17 @@ def time_created_filter(timestamp):
9595 if timestamp >= threshold :
9696 return False
9797 return True
98-
98+
9999 args .time_created = time_created_filter
100-
100+
101101 # Process time-modified arguments
102102 modified_within = getattr (args , f"{ prefix_underscore } modified_within" , [])
103103 modified_before = getattr (args , f"{ prefix_underscore } modified_before" , [])
104-
104+
105105 # Calculate threshold timestamps
106106 modified_within_thresholds = [now - nums .human_to_seconds (s ) for s in modified_within ]
107107 modified_before_thresholds = [now - nums .human_to_seconds (s ) for s in modified_before ]
108-
108+
109109 # Create filter function
110110 def time_modified_filter (timestamp ):
111111 if timestamp is None :
@@ -117,7 +117,7 @@ def time_modified_filter(timestamp):
117117 if timestamp >= threshold :
118118 return False
119119 return True
120-
120+
121121 args .time_modified = time_modified_filter
122122
123123
0 commit comments