3636from hdwallet import cryptocurrencies
3737
3838from .defaults import BITS_DEFAULT , BITS , MNEM_ROWS_COLS , GROUP_REQUIRED_RATIO , CRYPTO_PATHS
39- from .util import ordinal
39+ from .util import ordinal , commas
4040from .recovery import produce_bip39 , recover_bip39
4141
4242log = logging .getLogger ( __package__ )
@@ -364,7 +364,7 @@ def path_default( cls, crypto, format=None ):
364364 crypto = cls .supported ( crypto )
365365 format = format .lower () if format else cls .address_format ( crypto )
366366 if format not in cls .CRYPTO_FORMAT_PATH [crypto ]:
367- raise ValueError ( f"{ format } not supported for { crypto } ; specify one of { ', ' . join ( cls .CRYPTO_FORMAT_PATH [crypto ].keys () )} " )
367+ raise ValueError ( f"{ format } not supported for { crypto } ; specify one of { commas ( cls .CRYPTO_FORMAT_PATH [crypto ].keys () )} " )
368368 return cls .CRYPTO_FORMAT_PATH [crypto ][format ]
369369
370370 @classmethod
@@ -380,7 +380,7 @@ def address_format( cls, crypto, format=None ):
380380
381381 format = format .lower () if format else None
382382 if format not in cls .FORMATS :
383- raise ValueError ( f"{ crypto } address format { format !r} not recognized; specify one of { ', ' . join ( cls .FORMATS )} " )
383+ raise ValueError ( f"{ crypto } address format { format !r} not recognized; specify one of { commas ( cls .FORMATS )} " )
384384 cls .CRYPTO_FORMAT [crypto ] = format
385385
386386 @classmethod
@@ -395,7 +395,7 @@ def supported( cls, crypto ):
395395 )
396396 if validated :
397397 return validated
398- raise ValueError ( f"{ crypto } not presently supported; specify { ', ' . join ( cls .CRYPTOCURRENCIES )} " )
398+ raise ValueError ( f"{ crypto } not presently supported; specify { commas ( cls .CRYPTOCURRENCIES )} " )
399399
400400 def __str__ ( self ):
401401 """Until from_seed/from_path are invoked, may not have an address or derivation path."""
@@ -905,7 +905,7 @@ def create(
905905 group_reqs = list (
906906 f"{ g_nam } ({ g_of } /{ len (g_mns )} )" if g_of != len (g_mns ) else f"{ g_nam } ({ g_of } )"
907907 for g_nam ,(g_of ,g_mns ) in groups .items () )
908- requires = f"Recover w/ { group_threshold } of { len (groups )} groups { ', ' . join ( group_reqs )} "
908+ requires = f"Recover w/ { group_threshold } of { len (groups )} groups { commas ( group_reqs )} "
909909 for g_n ,(g_name ,(g_of ,g_mnems )) in enumerate ( groups .items () ):
910910 log .info ( f"{ g_name } ({ g_of } /{ len (g_mnems )} ): { requires } " )
911911 for mn_n ,mnem in enumerate ( g_mnems ):
@@ -932,7 +932,7 @@ def mnemonics(
932932 master_secret = random_secret ( strength // 8 )
933933 if len ( master_secret ) * 8 not in BITS :
934934 raise ValueError (
935- f"Only { ', ' . join ( f' { b } -' for b in BITS ) } bit seeds supported; { len (master_secret )* 8 } -bit master_secret supplied" )
935+ f"Only { commas ( BITS , final_and = True ) } - bit seeds supported; { len (master_secret )* 8 } -bit seed supplied" )
936936 return generate_mnemonics (
937937 group_threshold = group_threshold ,
938938 groups = groups ,
0 commit comments