|
1 | 1 | from __future__ import annotations
|
2 |
| -import os, functools, platform, time, re, contextlib, operator, hashlib, pickle, sqlite3, tempfile, pathlib, string, ctypes, sys, gzip |
| 2 | +import os, functools, platform, time, re, contextlib, operator, hashlib, pickle, sqlite3, tempfile, pathlib, string, ctypes, sys, gzip, getpass |
3 | 3 | import urllib.request, subprocess, shutil, math, contextvars, types, copyreg, inspect, importlib
|
4 | 4 | from dataclasses import dataclass
|
5 | 5 | from typing import Union, ClassVar, Optional, Iterable, Any, TypeVar, Callable, Sequence, TypeGuard, Iterator, Generic
|
@@ -79,7 +79,7 @@ def to_function_name(s:str): return ''.join([c if c in (string.ascii_letters+str
|
79 | 79 | @functools.lru_cache(maxsize=None)
|
80 | 80 | def getenv(key:str, default=0): return type(default)(os.getenv(key, default))
|
81 | 81 | def temp(x:str, append_user:bool=False) -> str:
|
82 |
| - return (pathlib.Path(tempfile.gettempdir()) / (f"{x}.{os.getenv('USERNAME', os.getlogin())}" if append_user else x)).as_posix() |
| 82 | + return (pathlib.Path(tempfile.gettempdir()) / (f"{x}.{getpass.getuser()}" if append_user else x)).as_posix() |
83 | 83 |
|
84 | 84 | class Context(contextlib.ContextDecorator):
|
85 | 85 | def __init__(self, **kwargs): self.kwargs = kwargs
|
|
0 commit comments