Playground style, easy for testing small features.
Conf and working code are in separate files.
Cons:
Some linters may complain about wrong-import-order, due to conf must be placed before from pyot.models import .... Can be disabled in linter conf files (e.g. .pylintrc) or use python syntax import ... instead of import_confs(...) but that will cause linters to complain unused-import.
Structure
File: main.py
import asyncioimport sysfrom typing import Listimport statisticsfrom pyot.conf.utils import import_confsimport_confs("pyotconf")from pyot.core.queue import Queuefrom pyot.models import lolasyncdefaverage_match_duration_millis(summoner_name:str):asyncwithQueue()as queue: summoner =await lol.Summoner(name=summoner_name).get() history =await summoner.match_history.get()for match in history.matches[:10]:await queue.put(match.get()) first_10_matches: List[lol.Match]=await queue.join()return statistics.mean([match.info.duration_millis for match in first_10_matches] or [0])if__name__=="__main__":print("Summoner name:", sys.argv[1]) avr_match_duration_millis = asyncio.run(average_match_duration_millis(sys.argv[1]))print("Average match duration (last 10 matches):", avr_match_duration_millis,"milliseconds", "(~", avr_match_duration_millis /1000/60, "minutes)" )