def _shallow_copy_with_infer(self, values, **kwargs):
attributes = self._get_attributes_dict()<EOL>attributes.update(kwargs)<EOL>attributes['<STR_LIT>'] = False<EOL>if not len(values) and '<STR_LIT>' not in kwargs:<EOL><INDENT>attributes['<STR_LIT>'] = self.dtype<EOL><DEDENT>if self._infer_as_myclass:<EOL><INDENT>try:<EOL><INDENT>return self._constructor(values, **attributes)<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return Index(values, **attributes)<EOL>
Create a new Index inferring the class with passed value, don't copy
the data, use the same object attributes with passed in attributes
taking precedence.

*this is an internal non-public method*

Parameters
----------
values : the values to create the new Index, optional
kwargs : updates the default attributes for this Index