Skip to content

Commit

Permalink
Update paths.py
Browse files Browse the repository at this point in the history
  • Loading branch information
baseplate-admin committed Feb 22, 2024
1 parent ecb0a15 commit 73e9270
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions django_ltree/paths.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import string

from itertools import product

from django_ltree.fields import PathValue


class PathGenerator(object):
# "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
_alphabet = string.digits + string.ascii_letters
_default_label_size = 6 # Postgres limits this to 256

def __init__(self, prefix=None, skip=None, label_size=None):
self.skip_paths = [] if skip is None else skip[:]
self.path_prefix = prefix if prefix else []
self.product_iterator = product(
self._alphabet, repeat=label_size or self._default_label_size
string.digits + string.ascii_letters,
repeat=label_size or self._default_label_size,
)

def __iter__(self):
Expand Down

0 comments on commit 73e9270

Please sign in to comment.