Skip to content

Commit

Permalink
Type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
jlumpe committed Jul 25, 2024
1 parent 366f6d6 commit 272d4bd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/gambit/kmers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Core functions for searching for and working with k-mers."""

from typing import Dict, Any, Iterator
from typing import Optional, Any, Iterator

import numpy as np
from attr import attrs, attrib
Expand All @@ -16,7 +16,7 @@ def nkmers(k: int) -> int:
return 4 ** k


def index_dtype(k: int) -> np.dtype:
def index_dtype(k: int) -> Optional[np.dtype]:
"""Get the smallest unsigned integer dtype that can store k-mer indices for the given ``k``."""
if k <= 4:
return np.dtype('u1')
Expand Down Expand Up @@ -119,7 +119,7 @@ def __to_json__(self):
return dict(k=int(self.k), prefix=self.prefix_str)

@classmethod
def __from_json__(cls, data: Dict[str, Any]) -> 'KmerSpec':
def __from_json__(cls, data: dict[str, Any]) -> 'KmerSpec':
return cls(data['k'], data['prefix'])


Expand Down

0 comments on commit 272d4bd

Please sign in to comment.