File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 11import math
22
3- ## Rate Limiter
43from slowapi import Limiter
54from slowapi .util import get_remote_address
65
6+ # Initialize a rate limiter
77limiter = Limiter (key_func = get_remote_address )
88
99
10- ## Logarithmic slider to file size conversion
1110def logSliderToSize (position : int ) -> int :
12- """Convert slider position to file size in KB"""
11+ """
12+ Convert a slider position to a file size in bytes using a logarithmic scale.
13+
14+ Parameters
15+ ----------
16+ position : int
17+ Slider position ranging from 0 to 500.
18+
19+ Returns
20+ -------
21+ int
22+ File size in bytes corresponding to the slider position.
23+ """
1324 maxp = 500
1425 minv = math .log (1 )
15- maxv = math .log (102400 )
16-
26+ maxv = math .log (102_400 )
1727 return round (math .exp (minv + (maxv - minv ) * pow (position / maxp , 1.5 ))) * 1024
1828
1929
You can’t perform that action at this time.
0 commit comments