Skip to content

Commit

Permalink
Make mypy happy.
Browse files Browse the repository at this point in the history
  • Loading branch information
tfenne committed Jan 17, 2025
1 parent 063b979 commit de379a7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions fgpyo/vcf/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,13 @@ def add_info_header(
version: the version of the field
"""
if field_type == VcfFieldType.FLAG:
number = 0 # FLAGs always have number = 0
num = "0" # FLAGs always have number = 0

Check warning on line 334 in fgpyo/vcf/builder.py

View check run for this annotation

Codecov / codecov/patch

fgpyo/vcf/builder.py#L334

Added line #L334 was not covered by tests
elif isinstance(number, VcfFieldNumber):
number = number.value
num = number.value

Check warning on line 336 in fgpyo/vcf/builder.py

View check run for this annotation

Codecov / codecov/patch

fgpyo/vcf/builder.py#L336

Added line #L336 was not covered by tests
else:
num = str(number)

header_line = f"##INFO=<ID={name},Number={number},Type={field_type.value}"
header_line = f"##INFO=<ID={name},Number={num},Type={field_type.value}"
if description is not None:
header_line += f",Description={description}"
if source is not None:
Expand All @@ -362,9 +364,11 @@ def add_format_header(
description: the description of the field
"""
if isinstance(number, VcfFieldNumber):
number = number.value
num = number.value

Check warning on line 367 in fgpyo/vcf/builder.py

View check run for this annotation

Codecov / codecov/patch

fgpyo/vcf/builder.py#L367

Added line #L367 was not covered by tests
else:
num = str(number)

Check warning on line 369 in fgpyo/vcf/builder.py

View check run for this annotation

Codecov / codecov/patch

fgpyo/vcf/builder.py#L369

Added line #L369 was not covered by tests

header_line = f"##FORMAT=<ID={name},Number={number},Type={field_type.value}"
header_line = f"##FORMAT=<ID={name},Number={num},Type={field_type.value}"

Check warning on line 371 in fgpyo/vcf/builder.py

View check run for this annotation

Codecov / codecov/patch

fgpyo/vcf/builder.py#L371

Added line #L371 was not covered by tests
if description is not None:
header_line += f",Description={description}"
header_line += ">"
Expand Down

0 comments on commit de379a7

Please sign in to comment.