Ruff: flake8 pie (misc lints) (#29318)
flake8 pie old-commit-hash: af3ed37c5cd8823f793aec60e1c74760cf795bd9
This commit is contained in:
@@ -5,7 +5,7 @@ from atomicwrites import AtomicWriter
|
||||
|
||||
|
||||
def mkdirs_exists_ok(path):
|
||||
if path.startswith('http://') or path.startswith('https://'):
|
||||
if path.startswith(('http://', 'https://')):
|
||||
raise ValueError('URL path')
|
||||
try:
|
||||
os.makedirs(path)
|
||||
|
||||
@@ -197,7 +197,7 @@ build-backend = "poetry.core.masonry.api"
|
||||
|
||||
# https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml
|
||||
[tool.ruff]
|
||||
select = ["E", "F", "W"]
|
||||
select = ["E", "F", "W", "PIE"]
|
||||
ignore = ["W292", "E741", "E402"]
|
||||
line-length = 160
|
||||
target-version="py311"
|
||||
|
||||
@@ -40,7 +40,7 @@ for f in sorted(pyf):
|
||||
print("%5d %s %s" % (lns, f, xbit))
|
||||
if 'test' in f:
|
||||
testlns += lns
|
||||
elif f.startswith('tools/') or f.startswith('scripts/') or f.startswith('selfdrive/debug'):
|
||||
elif f.startswith(('tools/', 'scripts/', 'selfdrive/debug')):
|
||||
scriptlns += lns
|
||||
elif f.startswith('selfdrive/car'):
|
||||
carlns += lns
|
||||
|
||||
@@ -137,8 +137,8 @@ class Laikad:
|
||||
#TODO this only saves currently valid ephems, when we download future ephems we should save them too
|
||||
valid_navs = [e for e in nav_list if e.valid(self.last_report_time)]
|
||||
if len(valid_navs) > 0:
|
||||
ephem_cache = ephemeris_structs.EphemerisCache(**{'glonassEphemerides': [e.data for e in valid_navs if e.prn[0]=='R'],
|
||||
'gpsEphemerides': [e.data for e in valid_navs if e.prn[0]=='G']})
|
||||
ephem_cache = ephemeris_structs.EphemerisCache(glonassEphemerides=[e.data for e in valid_navs if e.prn[0]=='R'],
|
||||
gpsEphemerides=[e.data for e in valid_navs if e.prn[0]=='G'])
|
||||
put_nonblocking(EPHEMERIS_CACHE, ephem_cache.to_bytes())
|
||||
cloudlog.debug("Cache saved")
|
||||
self.last_cached_t = self.last_report_time
|
||||
|
||||
@@ -90,7 +90,7 @@ def is_comma_remote() -> bool:
|
||||
if origin is None:
|
||||
return False
|
||||
|
||||
return origin.startswith('git@github.com:commaai') or origin.startswith('https://github.com/commaai')
|
||||
return origin.startswith(('git@github.com:commaai', 'https://github.com/commaai'))
|
||||
|
||||
|
||||
@cache
|
||||
|
||||
@@ -6,6 +6,6 @@ DATA_ENDPOINT = os.getenv("DATA_ENDPOINT", "http://data-raw.comma.internal/")
|
||||
def FileReader(fn, debug=False):
|
||||
if fn.startswith("cd:/"):
|
||||
fn = fn.replace("cd:/", DATA_ENDPOINT)
|
||||
if fn.startswith("http://") or fn.startswith("https://"):
|
||||
if fn.startswith(("http://", "https://")):
|
||||
return URLFile(fn, debug=debug)
|
||||
return open(fn, "rb")
|
||||
|
||||
Reference in New Issue
Block a user