Skip to content

Commit

Permalink
fixups to pass mypy and pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzoic committed Mar 15, 2024
1 parent 0a5e320 commit 80667db
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
5 changes: 4 additions & 1 deletion countess/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def finish_output(self):
queue.finish()

def run_multithread(self, queue: SentinelQueue, name: str, logger: Logger, row_limit: Optional[int] = None):
assert isinstance(self.plugin, (ProcessPlugin,FileInputPlugin))
assert isinstance(self.plugin, ProcessPlugin)
for data_in in queue:
self.counter_in += 1
self.queue_output(self.plugin.process(data_in, name, logger))
Expand All @@ -136,6 +136,7 @@ def run_thread(self, logger: Logger, row_limit: Optional[int] = None):
self.plugin.prepare([node.name for node in self.parent_nodes], row_limit)

if len(self.parent_nodes) == 1:
assert isinstance(self.plugin, ProcessPlugin)
# there is only a single parent node, run several subthreads to
# do the processing
only_parent_node = list(self.parent_nodes)[0]
Expand All @@ -152,6 +153,7 @@ def run_thread(self, logger: Logger, row_limit: Optional[int] = None):
self.queue_output(self.plugin.finished(only_parent_node.name, logger))

elif len(self.parent_nodes) > 1:
assert isinstance(self.plugin, ProcessPlugin)
# there are multiple parent nodes: spawn off a subthread to handle
# each of them.
subthreads = [
Expand Down Expand Up @@ -187,6 +189,7 @@ def prerun(self, logger: Logger, row_limit=PRERUN_ROW_LIMIT):
self.plugin.prepare([node.name for node in self.parent_nodes], row_limit)

for parent_node in self.parent_nodes:
assert isinstance(self.plugin, ProcessPlugin)
parent_node.prerun(logger, row_limit)
if parent_node.result:
for data_in in parent_node.result:
Expand Down
1 change: 0 additions & 1 deletion countess/plugins/fastq.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import gzip
import os.path
from itertools import islice

import pandas as pd
Expand Down
2 changes: 1 addition & 1 deletion countess/plugins/sequence.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional

from fqfa.util.nucleotide import reverse_complement
from fqfa.util.nucleotide import reverse_complement # type: ignore

from countess import VERSION
from countess.core.logger import Logger
Expand Down
6 changes: 3 additions & 3 deletions countess/utils/variant.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import re
from typing import Iterable, Optional

from fqfa.constants.iupac.protein import AA_CODES
from fqfa.util.nucleotide import reverse_complement
from fqfa.util.translate import translate_dna
from fqfa.constants.iupac.protein import AA_CODES # type: ignore
from fqfa.util.nucleotide import reverse_complement # type: ignore
from fqfa.util.translate import translate_dna # type: ignore
from rapidfuzz.distance.Levenshtein import opcodes as levenshtein_opcodes

# Insertions shorter than this won't be searched for, just included.
Expand Down

0 comments on commit 80667db

Please sign in to comment.