scripts/check-cves: fix a bunch of pyright warnings
Before:
± pyright scripts/check-cves
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:211:32 - error: Object of type "str" is not callable (reportCallIssue)
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:252:37 - error: Operator "+" not supported for types "str | Unknown | list[str | Unknown] | list[Unknown]" and "Literal['/data/DSA/list']"
Operator "+" not supported for types "list[str | Unknown]" and "Literal['/data/DSA/list']"
Operator "+" not supported for types "list[Unknown]" and "Literal['/data/DSA/list']" (reportOperatorIssue)
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:326:32 - error: Argument of type "(cve: Unknown) -> Unknown" cannot be assigned to parameter "desc" of type "str" in function "convert_to_nvd"
"function" is incompatible with "str" (reportArgumentType)
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:414:32 - error: Argument of type "(cve: Unknown) -> Unknown" cannot be assigned to parameter "desc" of type "str" in function "convert_to_nvd"
"function" is incompatible with "str" (reportArgumentType)
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:497:32 - error: Argument of type "(c: Unknown) -> str" cannot be assigned to parameter "desc" of type "str" in function "convert_to_nvd"
"function" is incompatible with "str" (reportArgumentType)
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:597:52 - error: Operator "+" not supported for types "str | Unknown | list[str | Unknown] | list[Unknown]" and "Literal['/data/CVE/list']"
Operator "+" not supported for types "list[str | Unknown]" and "Literal['/data/CVE/list']"
Operator "+" not supported for types "list[Unknown]" and "Literal['/data/CVE/list']" (reportOperatorIssue)
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:780:49 - error: Operator "not in" not supported for types "Literal['Previously triaged as ignored in Ubuntu\n\n']" and "str | None"
Operator "not in" not supported for types "Literal['Previously triaged as ignored in Ubuntu\n\n']" and "None" (reportOperatorIssue)
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:786:30 - error: "split" is not a known member of "None" (reportOptionalMemberAccess)
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:791:27 - error: "find" is not a known member of "None" (reportOptionalMemberAccess)
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:791:59 - error: "find" is not a known member of "None" (reportOptionalMemberAccess)
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:1474:20 - error: "_exceptions" is not a known member of module "xml.sax" (reportAttributeAccessIssue)
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:1622:39 - error: Argument of type "_TemporaryFileWrapper[str] | TextIO" cannot be assigned to parameter "file" of type "TextIO" in function "display_cve"
Type "_TemporaryFileWrapper[str] | TextIO" cannot be assigned to type "TextIO"
"_TemporaryFileWrapper[str]" is incompatible with "TextIO" (reportArgumentType)
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:1631:39 - error: Argument of type "_TemporaryFileWrapper[str] | TextIO" cannot be assigned to parameter "file" of type "TextIO" in function "display_cve"
Type "_TemporaryFileWrapper[str] | TextIO" cannot be assigned to type "TextIO"
"_TemporaryFileWrapper[str]" is incompatible with "TextIO" (reportArgumentType)
13 errors, 0 warnings, 0 informations
After:
± pyright scripts/check-cves
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:253:37 - error: Operator "+" not supported for types "str | Unknown | list[str | Unknown] | list[Unknown]" and "Literal['/data/DSA/list']"
Operator "+" not supported for types "list[str | Unknown]" and "Literal['/data/DSA/list']"
Operator "+" not supported for types "list[Unknown]" and "Literal['/data/DSA/list']" (reportOperatorIssue)
/home/amurray/ubuntu/git/ubuntu-cve-tracker/scripts/check-cves:598:52 - error: Operator "+" not supported for types "str | Unknown | list[str | Unknown] | list[Unknown]" and "Literal['/data/CVE/list']"
Operator "+" not supported for types "list[str | Unknown]" and "Literal['/data/CVE/list']"
Operator "+" not supported for types "list[Unknown]" and "Literal['/data/CVE/list']" (reportOperatorIssue)
2 errors, 0 warnings, 0 informations
Signed-off-by: Alex Murray <email address hidden>
review approve
On Mon, Mar 18, 2024 at 01:26:18AM -0000, Alex Murray wrote: ubuntu/ git/ubuntu- cve-tracker/ scripts/ check-cves ubuntu/ git/ubuntu- cve-tracker/ scripts/ check-cves: 211:32 - error: Object of type "str" is not callable (reportCallIssue) ubuntu/ git/ubuntu- cve-tracker/ scripts/ check-cves: 252:37 - error: Operator "+" not supported for types "str | Unknown | list[str | Unknown] | list[Unknown]" and "Literal[ '/data/ DSA/list' ]" '/data/ DSA/list' ]" '/data/ DSA/list' ]" (reportOperator Issue) ubuntu/ git/ubuntu- cve-tracker/ scripts/ check-cves: 326:32 - error: Argument of type "(cve: Unknown) -> Unknown" cannot be assigned to parameter "desc" of type "str" in function "convert_to_nvd" Type) ubuntu/ git/ubuntu- cve-tracker/ scripts/ check-cves: 414:32 - error: Argument of type "(cve: Unknown) -> Unknown" cannot be assigned to parameter "desc" of type "str" in function "convert_to_nvd" Type) ubuntu/ git/ubuntu- cve-tracker/ scripts/ check-cves: 497:32 - error: Argument of type "(c: Unknown) -> str" cannot be assigned to parameter "desc" of type "str" in function "convert_to_nvd" Type) ubuntu/ git/ubuntu- cve-tracker/ scripts/ check-cves: 597:52 - error: Operator "+" not supported for types "str | Unknown | list[str | Unknown] | list[Unknown]" and "Literal[ '/data/ CVE/list' ]" '/data/ CVE/list' ]" '/data/ CVE/list' ]" (reportOperator Issue) ubuntu/ git/ubuntu- cve-tracker/ scripts/ check-cves: 780:49 - error: Operator "not in" not supported for types "Literal[ 'Previously triaged as ignored in Ubuntu\n\n']" and "str | None" 'Previously triaged as ignored in Ubuntu\n\n']" and "None" (reportOperator Issue) ubuntu/ git/ubuntu- cve-tracker/ scripts/ check-cves: 786:30 - error: "split" is not a known member of "None" (reportOptional MemberAccess) ubuntu/ git/ubuntu- cve-tracker/ scripts/ check-cves: 791:27 - error: "find" is not a known member of "None" (reportOptional MemberAccess) ubuntu/ git/ubuntu- cve-tracker/ scripts/ check-cves: 791:59 - error: "find" is not a known member of "None" (reportOptional MemberAccess) ubuntu/ git/ubuntu- cve-tracker/ scripts/ check-cves: 1474:20 - error: "_exceptions" is not a known member of module "xml.sax" (reportAttribut eAccessIssue) ubuntu/ git/ubuntu- cve-tracker/ scripts/ check-cves: 1622:39 - error: Argument of type "_Temporar...
> scripts/check-cves: fix a bunch of pyright warnings
>
> Before:
>
> ± pyright scripts/check-cves
> /home/amurray/
> /home/amurray/
> /home/amurray/
> Operator "+" not supported for types "list[str | Unknown]" and "Literal[
> Operator "+" not supported for types "list[Unknown]" and "Literal[
> /home/amurray/
> "function" is incompatible with "str" (reportArgument
> /home/amurray/
> "function" is incompatible with "str" (reportArgument
> /home/amurray/
> "function" is incompatible with "str" (reportArgument
> /home/amurray/
> Operator "+" not supported for types "list[str | Unknown]" and "Literal[
> Operator "+" not supported for types "list[Unknown]" and "Literal[
> /home/amurray/
> Operator "not in" not supported for types "Literal[
> /home/amurray/
> /home/amurray/
> /home/amurray/
> /home/amurray/
> /home/amurray/