def _get_indices(self, names):
def get_converter(s):<EOL><INDENT>if isinstance(s, (Timestamp, datetime.datetime)):<EOL><INDENT>return lambda key: Timestamp(key)<EOL><DEDENT>elif isinstance(s, np.datetime64):<EOL><INDENT>return lambda key: Timestamp(key).asm8<EOL><DEDENT>else:<EOL><INDENT>return lambda key: key<EOL><DEDENT><DEDENT>if len(names) == <NUM_LIT:0>:<EOL><INDENT>return []<EOL><DEDENT>if len(self.indices) > <NUM_LIT:0>:<EOL><INDENT>index_sample = next(iter(self.indices))<EOL><DEDENT>else:<EOL><INDENT>index_sample = None     <EOL><DEDENT>name_sample = names[<NUM_LIT:0>]<EOL>if isinstance(index_sample, tuple):<EOL><INDENT>if not isinstance(name_sample, tuple):<EOL><INDENT>msg = ("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>raise ValueError(msg)<EOL><DEDENT>if not len(name_sample) == len(index_sample):<EOL><INDENT>try:<EOL><INDENT>return [self.indices[name] for name in names]<EOL><DEDENT>except KeyError:<EOL><INDENT>msg = ("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>raise ValueError(msg)<EOL><DEDENT><DEDENT>converters = [get_converter(s) for s in index_sample]<EOL>names = (tuple(f(n) for f, n in zip(converters, name))<EOL>for name in names)<EOL><DEDENT>else:<EOL><INDENT>converter = get_converter(index_sample)<EOL>names = (converter(name) for name in names)<EOL><DEDENT>return [self.indices.get(name, []) for name in names]<EOL>
Safe get multiple indices, translate keys for
datelike to underlying repr.