mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-06 00:36:32 +08:00
replace common.file_helpers.mkdirs_exists_ok with python os.makedirs funtion (#30618)
replace common.file_helpers.mkdirs_exists_ok with python os.makedirs function old-commit-hash: db35dcd0b5353d9c009fcf5817e611125a6b0b8b
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import json
|
||||
import os
|
||||
from openpilot.common.file_helpers import mkdirs_exists_ok
|
||||
from openpilot.system.hardware.hw import Paths
|
||||
|
||||
|
||||
@@ -18,7 +17,7 @@ def get_token():
|
||||
|
||||
|
||||
def set_token(token):
|
||||
mkdirs_exists_ok(Paths.config_root())
|
||||
os.makedirs(Paths.config_root(), exist_ok=True)
|
||||
with open(os.path.join(Paths.config_root(), 'auth.json'), 'w') as f:
|
||||
json.dump({'access_token': token}, f)
|
||||
|
||||
|
||||
+1
-2
@@ -1,12 +1,11 @@
|
||||
import os
|
||||
import urllib.parse
|
||||
from openpilot.common.file_helpers import mkdirs_exists_ok
|
||||
|
||||
DEFAULT_CACHE_DIR = os.getenv("CACHE_ROOT", os.path.expanduser("~/.commacache"))
|
||||
|
||||
def cache_path_for_file_path(fn, cache_dir=DEFAULT_CACHE_DIR):
|
||||
dir_ = os.path.join(cache_dir, "local")
|
||||
mkdirs_exists_ok(dir_)
|
||||
os.makedirs(dir_, exist_ok=True)
|
||||
fn_parsed = urllib.parse.urlparse(fn)
|
||||
if fn_parsed.scheme == '':
|
||||
cache_fn = os.path.abspath(fn).replace("/", "_")
|
||||
|
||||
@@ -5,7 +5,7 @@ import pycurl
|
||||
from hashlib import sha256
|
||||
from io import BytesIO
|
||||
from tenacity import retry, wait_random_exponential, stop_after_attempt
|
||||
from openpilot.common.file_helpers import mkdirs_exists_ok, atomic_write_in_dir
|
||||
from openpilot.common.file_helpers import atomic_write_in_dir
|
||||
from openpilot.system.hardware.hw import Paths
|
||||
# Cache chunk size
|
||||
K = 1000
|
||||
@@ -40,7 +40,7 @@ class URLFile:
|
||||
except AttributeError:
|
||||
self._curl = self._tlocal.curl = pycurl.Curl()
|
||||
if not self._force_download:
|
||||
mkdirs_exists_ok(Paths.download_cache_root())
|
||||
os.makedirs(Paths.download_cache_root(), exist_ok=True)
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
Reference in New Issue
Block a user