From c137b5b3fcee472e9a47aa98a07aaf6ff4d66665 Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Wed, 20 Nov 2024 12:57:04 +0000 Subject: [PATCH] target: Align Target.tempfile() with Target.make_temp() Align the parameters between the 2 methods: * Use "None" as default value * Do not add suffix or prefix if not asked for. * Separate components with "-" instead of "_" --- devlib/target.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/devlib/target.py b/devlib/target.py index fa9f92701..8b551882a 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -1315,8 +1315,10 @@ def get_workpath(self, name): return self.path.join(self.working_directory, name) @asyn.asyncf - async def tempfile(self, prefix='', suffix=''): - name = '{prefix}_{uuid}_{suffix}'.format( + async def tempfile(self, prefix=None, suffix=None): + prefix = f'{prefix}-' if prefix else '' + sufix = f'-{suffix}' if suffix else '' + name = '{prefix}{uuid}{suffix}'.format( prefix=prefix, uuid=uuid.uuid4().hex, suffix=suffix,