MCPcopy Create free account
hub / github.com/fogleman/primitive / base_encode

Function base_encode

bot/main.py:202–208  ·  view source on GitHub ↗
(alphabet, number, suffix='')

Source from the content-addressed store, hash-verified

200 return 'https://flic.kr/p/%s' % base_encode(alphabet, int(photo_id))
201
202def base_encode(alphabet, number, suffix=''):
203 base = len(alphabet)
204 if number >= base:
205 div, mod = divmod(number, base)
206 return base_encode(alphabet, div, alphabet[mod] + suffix)
207 else:
208 return alphabet[number] + suffix
209
210def generate():
211 date = random_date()

Callers 1

flickr_urlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…