2019-09-26 20:38:28 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
#
|
|
|
|
# Rtl.py
|
|
|
|
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
|
|
|
# This project is licensed under the terms of the MIT licence.
|
|
|
|
#
|
|
|
|
|
2019-10-01 17:03:29 +00:00
|
|
|
import re
|
2019-09-26 20:38:28 +00:00
|
|
|
|
|
|
|
def flatten(l):
|
|
|
|
return [li for l_ in l for li in l_]
|
|
|
|
|
2019-10-24 19:14:00 +00:00
|
|
|
def natural_sort(l):
|
|
|
|
convert = lambda text: int(text) if text.isdigit() else text.lower()
|
|
|
|
alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)]
|
2019-09-28 17:45:45 +00:00
|
|
|
return sorted(l, key=alphanum_key)
|
|
|
|
|
2019-09-26 20:38:28 +00:00
|
|
|
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120
|