@@ -1111,76 +1111,9 @@ def show_model_changes(
11111111 return bool (changes )
11121112
11131113
1114- def show_path_changes (path_changes ):
1115- """Given a list of tuples (source, destination) that indicate the
1116- path changes, log the changes as INFO-level output to the beets log.
1117- The output is guaranteed to be unicode.
1118-
1119- Every pair is shown on a single line if the terminal width permits it,
1120- else it is split over two lines. E.g.,
1121-
1122- Source -> Destination
1123-
1124- vs.
1125-
1126- Source
1127- -> Destination
1128- """
1129- sources , destinations = zip (* path_changes )
1130-
1131- # Ensure unicode output
1132- sources = list (map (util .displayable_path , sources ))
1133- destinations = list (map (util .displayable_path , destinations ))
1134-
1135- # Calculate widths for terminal split
1136- col_width = (term_width () - len (" -> " )) // 2
1137- max_width = len (max (sources + destinations , key = len ))
1138-
1139- if max_width > col_width :
1140- # Print every change over two lines
1141- for source , dest in zip (sources , destinations ):
1142- color_source , color_dest = colordiff (source , dest )
1143- print_ (f"{ color_source } \n -> { color_dest } " )
1144- else :
1145- # Print every change on a single line, and add a header
1146- title_pad = max_width - len ("Source " ) + len (" -> " )
1147-
1148- print_ (f"Source { ' ' * title_pad } Destination" )
1149- for source , dest in zip (sources , destinations ):
1150- pad = max_width - len (source )
1151- color_source , color_dest = colordiff (source , dest )
1152- print_ (f"{ color_source } { ' ' * pad } -> { color_dest } " )
1153-
1154-
11551114# Helper functions for option parsing.
11561115
11571116
1158- def _store_dict (option , opt_str , value , parser ):
1159- """Custom action callback to parse options which have ``key=value``
1160- pairs as values. All such pairs passed for this option are
1161- aggregated into a dictionary.
1162- """
1163- dest = option .dest
1164- option_values = getattr (parser .values , dest , None )
1165-
1166- if option_values is None :
1167- # This is the first supplied ``key=value`` pair of option.
1168- # Initialize empty dictionary and get a reference to it.
1169- setattr (parser .values , dest , {})
1170- option_values = getattr (parser .values , dest )
1171-
1172- try :
1173- key , value = value .split ("=" , 1 )
1174- if not (key and value ):
1175- raise ValueError
1176- except ValueError :
1177- raise UserError (
1178- f"supplied argument `{ value } ' is not of the form `key=value'"
1179- )
1180-
1181- option_values [key ] = value
1182-
1183-
11841117class CommonOptionsParser (optparse .OptionParser ):
11851118 """Offers a simple way to add common formatting options.
11861119
@@ -1666,7 +1599,7 @@ def parse_csl_callback(
16661599 and subargs [0 ] == "config"
16671600 and ("-e" in subargs or "--edit" in subargs )
16681601 ):
1669- from beets .ui .commands import config_edit
1602+ from beets .ui .commands . config import config_edit
16701603
16711604 return config_edit ()
16721605
0 commit comments