@classmethod<EOL><INDENT>def from_file(cls, filename_or_fobj, plugin_name=None, encoding=None,<EOL>mode="<STR_LIT:rb>", compressed=None, should_delete=False, should_close=None,<EOL>is_file=True, local=True):<DEDENT>
if isinstance(filename_or_fobj, (six.binary_type, six.text_type, Path)):<EOL><INDENT>fobj = open_compressed(filename_or_fobj, mode=mode)<EOL>filename = filename_or_fobj<EOL>should_close = True if should_close is None else should_close<EOL><DEDENT>else:  <EOL><INDENT>fobj = filename_or_fobj<EOL>filename = getattr(fobj, "<STR_LIT:name>", None)<EOL>if not isinstance(filename, (six.binary_type, six.text_type)):  <EOL><INDENT>filename = None<EOL><DEDENT>should_close = False if should_close is None else should_close<EOL><DEDENT>if is_file and local and filename and not isinstance(filename, Path):<EOL><INDENT>filename = Path(filename)<EOL><DEDENT>return Source(<EOL>compressed=compressed,<EOL>encoding=encoding,<EOL>fobj=fobj,<EOL>is_file=is_file,<EOL>local=local,<EOL>plugin_name=plugin_name,<EOL>should_close=should_close,<EOL>should_delete=should_delete,<EOL>uri=filename,<EOL>)<EOL>
Create a `Source` from a filename or fobj