Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Zhavoronkov committed Nov 11, 2021
1 parent d08c77e commit 80f30a2
Show file tree
Hide file tree
Showing 2 changed files with 395 additions and 7 deletions.
8 changes: 4 additions & 4 deletions cvat/apps/engine/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def export_to(self, filename):
self._write_manifest(output_file)

class ProjectImporter(_ImporterBase, _ProjectBackupBase):
TASKNAME_RE = 'task_\d+/'
TASKNAME_RE = 'task_(\d+)/'

def __init__(self, filename, user_id):
super().__init__(logger=slogger.glob)
Expand Down Expand Up @@ -700,12 +700,12 @@ def _import_project(self):

def _import_tasks(self):
def get_tasks(zip_object):
task_list = set()
tasks = {}
for fname in zip_object.namelist():
m = re.match(self.TASKNAME_RE, fname)
if m:
task_list.add(m.group(0))
return task_list
tasks[int(m.group(1))] = m.group(0)
return [v for _, v in sorted(tasks.items())]

with ZipFile(self._filename, 'r') as zf:
task_dirs = get_tasks(zf)
Expand Down
Loading

0 comments on commit 80f30a2

Please sign in to comment.