U ʗRe@sddlmZddlZddlZddlZddlmZddlmZddl m Z Gddde Z edd d d d d Z edd dd ddZ dgZdS)) annotationsN) lru_cache)cast)PlatformDirsABCc@seZdZdZeddddZeddddZedddd Zeddd d Zeddd d Z eddddZ eddddZ eddddZ eddddZ dS)Androidz Follows the guidance `from here `_. Makes use of the `appname ` and `version `. strreturncCs|tttdS)zd:return: data directory tied to the user, e.g. ``/data/user///files/``files_append_app_name_and_versionrr_android_folderselfr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/platformdirs/android.py user_data_dirszAndroid.user_data_dircCs|jS)z@:return: data directory shared by users, same as `user_data_dir`rrrrr site_data_dirszAndroid.site_data_dircCs|tttdS)z :return: config directory tied to the user, e.g. ``/data/user///shared_prefs/`` Z shared_prefsr rrrruser_config_dirszAndroid.user_config_dircCs|jS)zH:return: config directory shared by the users, same as `user_config_dir`)rrrrrsite_config_dir$szAndroid.site_config_dircCs|tttdS)zj:return: cache directory tied to the user, e.g. e.g. ``/data/user///cache/``cacher rrrruser_cache_dir)szAndroid.user_cache_dircCs|jS)zB:return: state directory tied to the user, same as `user_data_dir`rrrrruser_state_dir.szAndroid.user_state_dircCs|j}|jrtj|d}|S)z :return: log directory tied to the user, same as `user_cache_dir` if not opinionated else ``log`` in it, e.g. ``/data/user///cache//log`` logropinionospathjoinrrrrr user_log_dir3szAndroid.user_log_dircCstS)zf :return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents`` )_android_documents_folderrrrruser_documents_dir>szAndroid.user_documents_dircCs|j}|jrtj|d}|S)z :return: runtime directory tied to the user, same as `user_cache_dir` if not opinionated else ``tmp`` in it, e.g. ``/data/user///cache//tmp`` tmprr!rrruser_runtime_dirEszAndroid.user_runtime_dirN)__name__ __module__ __qualname____doc__propertyrrrrrrr"r$r&rrrrr s& r)maxsizez str | Noner cCsxz(ddlm}|d}|}WnJtk rrtd}tj D] }| |rH| dd}qnqHd}YnX|S)zB:return: base folder for the Android OS or None if cannot be foundr autoclassandroid.content.Contextz /data/(data|user/\d+)/(.+)/filesz/filesN) jniusr.Z getFilesDirZ getParentFilegetAbsolutePath Exceptionrecompilesysrmatchsplit)r.ContextresultpatternrrrrrQs     rrcCsNz0ddlm}|d}|d}||j}Wntk rHd}YnX|S)z,:return: documents folder for the Android OSrr-r/zandroid.os.Environmentz/storage/emulated/0/Documents)r0r.ZgetExternalFilesDirZDIRECTORY_DOCUMENTSr1r2)r.r8 Environment documents_dirrrrr#fs  r#) __future__rrr3r5 functoolsrtypingrapirrrr#__all__rrrrs    E