Skip to content

Add return type Document for parse_file() #836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/spdx_tools/spdx/parser/parse_anything.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
import logging

from spdx_tools.spdx.formats import FileFormat, file_name_to_format
from spdx_tools.spdx.model import Document
from spdx_tools.spdx.parser.json import json_parser
from spdx_tools.spdx.parser.rdf import rdf_parser
from spdx_tools.spdx.parser.tagvalue import tagvalue_parser
from spdx_tools.spdx.parser.xml import xml_parser
from spdx_tools.spdx.parser.yaml import yaml_parser


def parse_file(file_name: str, encoding: str = "utf-8"):
def parse_file(file_name: str, encoding: str = "utf-8") -> Document:
if encoding != "utf-8":
logging.warning(
"It's recommended to use the UTF-8 encoding for any SPDX file. Consider changing the encoding of the file."
Expand Down