Skip to content

Commit

Permalink
more careful casting
Browse files Browse the repository at this point in the history
  • Loading branch information
fgregg committed Jun 20, 2024
1 parent 098129a commit b43ce75
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions dedupe/convenience.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ def randomPairs(n_records: int, sample_size: int) -> IndicesIterator:
else:
try:
random_pairs = numpy.array(
random.sample(range(n), sample_size), dtype=numpy.uint
random.sample(range(n), sample_size), dtype=numpy.uint64
)
except OverflowError:
return randomPairsWithReplacement(n_records, sample_size)

b: int = 1 - 2 * n_records

i = (-b - 2 * numpy.sqrt(2 * (n - random_pairs) + 0.25)) // 2
i = i.astype(numpy.uint)
i = i.astype(numpy.int64)

j = random_pairs + i * (b + i + 2) // 2 + 1
j = j.astype(numpy.uint)
j = j.astype(numpy.uint64)

return zip(i, j)

Expand Down
2 changes: 1 addition & 1 deletion dedupe/variables/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class InteractionType(Variable):
type = "Interaction"
higher_vars: list[InteractionVariable]

def __init__(self, *args, **kwargs):
def __init__(self, *args: str, **kwargs):
self.interactions = list(args)

self.name = "(Interaction: %s)" % str(self.interactions)
Expand Down

0 comments on commit b43ce75

Please sign in to comment.