Skip to content

Receive Sequence of int in encode() #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sqids/sqids.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Set, Tuple
from typing import List, Sequence, Set, Tuple
import sys
from .constants import (
DEFAULT_ALPHABET,
Expand Down Expand Up @@ -70,7 +70,7 @@ def __init__(
self.__alphabet = self.__shuffle(alphabet)
self.__min_length = min_length

def encode(self, numbers: List[int]) -> str:
def encode(self, numbers: Sequence[int]) -> str:
if not numbers:
return ""

Expand All @@ -79,7 +79,7 @@ def encode(self, numbers: List[int]) -> str:

return self.__encode_numbers(numbers, 0)

def __encode_numbers(self, numbers: List[int], increment: int = 0) -> str:
def __encode_numbers(self, numbers: Sequence[int], increment: int = 0) -> str:
if increment > len(self.__alphabet):
raise ValueError("Reached max attempts to re-generate the ID")

Expand Down