Skip to content

Commit a11b8a8

Browse files
committed
Fixed errors involving array.py functions
1 parent 9ab771d commit a11b8a8

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

philh_myftp_biz/array.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class List[V]:
1515
"""
1616

1717
def __init__(self,
18-
array: 'list[V] | tuple[V] | Self[V] | filter[V] | JSON | _var | PKL' = []
18+
array: 'list[V] | tuple[V] | Self[V] | filter[V] | JSON | _var | PKL | range' = []
1919
):
2020
from .file import JSON, PKL, temp
2121
from builtins import filter
@@ -28,7 +28,7 @@ def __init__(self,
2828
elif isinstance(array, List):
2929
self.var = array.var
3030

31-
elif isinstance(array, (list, tuple, filter)):
31+
elif isinstance(array, (list, tuple, filter, range)):
3232
self.var = PKL(
3333
temp('array', 'pkl')
3434
)

philh_myftp_biz/num.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@ def shuffle_range(min:int, max:int):
1414
"""
1515
Get a range of numbers, but shuffled
1616
"""
17-
from .array import random
17+
from .array import List
1818

19-
return random.shuffle(list(range(min, max+1)))
19+
ordered = List(range(min, max+1))
20+
21+
ordered.shuffle()
22+
23+
return ordered
2024

2125
class valid:
2226
"""

philh_myftp_biz/web.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ def sort(self,
677677
"""
678678
Automatically Sort the Download Queue
679679
"""
680-
from .array import sort, priority
680+
from .array import List, priority
681681

682682
self._debug('Sorting Download Queue')
683683

@@ -688,13 +688,12 @@ def sort(self,
688688
)
689689

690690
#
691-
torrents = self._client().torrents_info()
691+
torrents: List[TorrentDictionary] = self._client().torrents_info()
692692

693-
# Get sorted list of torrents
694-
items: list[TorrentDictionary] = sort(torrents, func)
693+
torrents.sort(func)
695694

696695
# Loop through all items
697-
for t in items:
696+
for t in torrents:
698697

699698
# Move to the top of the queue
700699
t.top_priority()

0 commit comments

Comments
 (0)