def getbasetemp(self):
if self._basetemp is None:<EOL><INDENT>if self._given_basetemp is not None:<EOL><INDENT>basetemp = self._given_basetemp<EOL>ensure_reset_dir(basetemp)<EOL>basetemp = basetemp.resolve()<EOL><DEDENT>else:<EOL><INDENT>from_env = os.environ.get("<STR_LIT>")<EOL>temproot = Path(from_env or tempfile.gettempdir()).resolve()<EOL>user = get_user() or "<STR_LIT>"<EOL>rootdir = temproot.joinpath("<STR_LIT>".format(user))<EOL>rootdir.mkdir(exist_ok=True)<EOL>basetemp = make_numbered_dir_with_cleanup(<EOL>prefix="<STR_LIT>", root=rootdir, keep=<NUM_LIT:3>, lock_timeout=LOCK_TIMEOUT<EOL>)<EOL><DEDENT>assert basetemp is not None<EOL>self._basetemp = t = basetemp<EOL>self._trace("<STR_LIT>", t)<EOL>return t<EOL><DEDENT>else:<EOL><INDENT>return self._basetemp<EOL><DEDENT>
return base temporary directory.