Skip to content

Commit

Permalink
fix: close fh and remove obsolete comment
Browse files Browse the repository at this point in the history
  • Loading branch information
TimD1 committed Jan 16, 2025
1 parent c69320f commit 8512844
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
7 changes: 0 additions & 7 deletions fgpyo/fasta/sequence_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,6 @@ def from_sam(

return seq_dict

# TODO: mypy doesn't like these
# @overload
# def __getitem__(self, key: str) -> SequenceMetadata: ...
#
# @overload
# def __getitem__(self, index: int) -> SequenceMetadata: ...

def __getitem__(self, key: Union[str, int]) -> SequenceMetadata:
return self._dict[key] if isinstance(key, str) else self.infos[key]

Expand Down
4 changes: 2 additions & 2 deletions tests/fgpyo/fasta/test_sequence_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ def test_sequence_dictionary_to_and_from_sam() -> None:
header_dict={"HD": {"VN": "1.5"}, "SQ": mapping, "RG": [{"ID": "foo"}]}
)
samfile: Path = builder.SamBuilder(sd=mapping).to_path()
alignment: pysam.AlignmentFile = reader(samfile)
with reader(samfile) as alignment_fh: # pysam.AlignmentFile
assert SequenceDictionary.from_sam(alignment_fh) == sd
assert SequenceDictionary.from_sam(samfile) == sd
assert SequenceDictionary.from_sam(alignment) == sd
assert SequenceDictionary.from_sam(mapping) == sd
assert SequenceDictionary.from_sam(header) == sd
assert sd.to_sam_header(extra_header={"RG": [{"ID": "foo"}]})
Expand Down

0 comments on commit 8512844

Please sign in to comment.