コード例 #1
0
    def serialize(self):
        """ Serialize project to json dict
        """
        project = self
        banlist = ('json', 'dir-jsons')
        available_storages = list(
            filter(lambda i: i[0] not in banlist,
                   get_available_storage_names().items()))

        output = {
            'project_name': project.name,
            'task_count': len(project.source_storage.ids()),
            'completion_count': len(project.get_completions_ids()),
            'config': project.config,
            'can_manage_tasks': project.can_manage_tasks,
            'can_manage_completions': project.can_manage_completions,
            'can_delete_tasks': project.can_delete_tasks,
            'target_storage': {
                'readable_path': project.target_storage.readable_path
            },
            'source_storage': {
                'readable_path': project.source_storage.readable_path
            },
            'available_storages': available_storages,
            'source_syncing': self.source_storage.is_syncing,
            'target_syncing': self.target_storage.is_syncing,
            'data_types': self.data_types,
            'label_config_line': self.label_config_line
        }
        return output
コード例 #2
0
ファイル: project.py プロジェクト: rajeshnair/label-studio
    def serialize(self):
        """Serialize project to json dict"""
        ban_list = ("json", "dir-jsons")
        available_storages = list(
            filter(lambda i: i[0] not in ban_list,
                   get_available_storage_names().items()))

        output = {
            "project_name": self.name,
            "task_count": len(self.source_storage.ids()),
            "completion_count": len(self.get_completions_ids()),
            "config": self.config,
            "instruction": self.config["instruction"],
            "can_manage_tasks": self.can_manage_tasks,
            "can_manage_completions": self.can_manage_completions,
            "can_delete_tasks": self.can_delete_tasks,
            "target_storage": {
                "readable_path": self.target_storage.readable_path
            },
            "source_storage": {
                "readable_path": self.source_storage.readable_path
            },
            "available_storages": available_storages,
            "source_syncing": self.source_storage.is_syncing,
            "target_syncing": self.target_storage.is_syncing,
            "data_types": self.data_types,
            "label_config_line": self.label_config_line,
        }
        return output
コード例 #3
0
 def serialize(self):
     """ Serialize project to json dict
     """
     ban_list = ('json', 'dir-jsons')
     available_storages = list(filter(lambda i: i[0] not in ban_list, get_available_storage_names().items()))
     task_ids = self.source_storage.ids()
     output = {
         'project_name': self.name,
         'task_count': len(task_ids),
         'completion_count': len(self.get_completions_ids(task_ids)),
         'config': self.config,
         'instruction': self.config['instruction'],
         'can_manage_tasks': self.can_manage_tasks,
         'can_manage_completions': self.can_manage_completions,
         'can_delete_tasks': self.can_delete_tasks,
         'target_storage': {'readable_path': self.target_storage.readable_path},
         'source_storage': {'readable_path': self.source_storage.readable_path},
         'available_storages': available_storages,
         'source_syncing': self.source_storage.is_syncing,
         'target_syncing': self.target_storage.is_syncing,
         'data_types': self.data_types,
         'label_config_line': self.label_config_line,
         'config_has_control_tags': len(self.parsed_label_config) > 0
     }
     return output
コード例 #4
0
ファイル: project.py プロジェクト: rajeshnair/label-studio
 def get_available_target_storage_names(self):
     names = OrderedDict()
     nameset = set(self.get_available_target_storages())
     for name, desc in get_available_storage_names().items():
         # blobs have no sense for target storages
         if name in nameset:
             names[name] = desc
     return names
コード例 #5
0
ファイル: project.py プロジェクト: rajeshnair/label-studio
 def get_available_source_storage_names(self):
     names = OrderedDict()
     nameset = set(self.get_available_source_storages())
     for name, desc in get_available_storage_names().items():
         # we don't expose configurable filesystem storage in UI to avoid security problems
         if name in nameset:
             names[name] = desc
     return names