def _resolve_distribution_names(dist_fn_args, dist_names, leaf_name):
if dist_names is None:<EOL><INDENT>dist_names = []<EOL><DEDENT>else:<EOL><INDENT>dist_names = dist_names.copy()<EOL><DEDENT>n = len(dist_fn_args)<EOL>dist_names.extend([None]*(n - len(dist_names)))<EOL>for i_, args in enumerate(reversed(dist_fn_args)):<EOL><INDENT>if not args:<EOL><INDENT>continue  <EOL><DEDENT>i = n - i_ - <NUM_LIT:1><EOL>for j, arg_name in enumerate(args):<EOL><INDENT>dist_names[i - j - <NUM_LIT:1>] = arg_name<EOL><DEDENT><DEDENT>j = <NUM_LIT:0><EOL>for i_ in range(len(dist_names)):<EOL><INDENT>i = n - i_ - <NUM_LIT:1><EOL>if dist_names[i] is None:<EOL><INDENT>dist_names[i] = leaf_name if j == <NUM_LIT:0> else leaf_name + str(j)<EOL>j += <NUM_LIT:1><EOL><DEDENT><DEDENT>return tuple(dist_names)<EOL>
Uses arg names to resolve distribution names.