<commit_before># -*- coding: utf-8 -*-

# Copyright (c) 2012-2014 CoNWeT Lab., Universidad Politécnica de Madrid

# This file is part of Wirecloud.

# Wirecloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# Wirecloud is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with Wirecloud.  If not, see <http://www.gnu.org/licenses/>.

from __future__ import unicode_literals

from copy import deepcopy
from hashlib import sha1
import json

from django.conf import settings
from django.utils.translation import get_language, ugettext_lazy as _

import wirecloud.platform
from wirecloud.platform.core.catalogue_manager import WirecloudCatalogueManager
from wirecloud.platform.plugins import build_url_template, get_active_features_info, WirecloudPlugin


WORKSPACE_CSS = (
    'css/workspace/wallet.scss',
    'css/workspace/dragboard_cursor.css',
    'css/workspace/iwidget.scss',
    'css/workspace/empty_workspace_message.css',
)

CLASSIC_CORE_CSS = (
    'css/window_menu.scss',
    'css/mac_search.css',
    'css/mac_field.css',
    'css/mac_selection_dialog.css',
)

CATALOGUE_CSS = (
    'css/catalogue/emptyCatalogueBox.css',
    'css/catalogue/resource.scss',
    'css/catalogue/resource_details.scss',
)

WIRING_EDITOR_FILES = (
    'js/wirecloud/ui/WiringEditor.js',
    'js/wirecloud/ui/WiringEditor/Anchor.js',
    'js/wirecloud/ui/WiringEditor/Arrow.js',
    'js/wirecloud/ui/WiringEditor/ArrowCreator.js',
    'js/wirecloud/ui/WiringEditor/Canvas.js',
    'js/wirecloud/ui/WiringEditor/GenericInterface.js',
    'js/wirecloud/ui/WiringEditor/WidgetInterface.js',
    'js/wirecloud/ui/WiringEditor/OperatorInterface.js',
    'js/wirecloud/ui/WiringEditor/SourceAnchor.js',
    'js/wirecloud/ui/WiringEditor/TargetAnchor.js',
    'js/wirecloud/ui/WiringEditor/Multiconnector.js',
    'js/wirecloud/ui/WiringEditor/GenericInterfaceSettingsMenuItems.js',
    'js/wirecloud/ui/WiringEditor/MiniInterfaceSettingsMenuItems.js',
    'js/wirecloud/ui/WiringPreview.js',
    'js/wirecloud/ui/ColorSmartBox.js',
    'js/wirecloud/ui/BasicRecommendations.js',
    'js/wirecloud/ui/RecommendationManager.js',
)

TUTORIAL_FILES = (
    'js/wirecloud/ui/Tutorial.js',
    'js/wirecloud/ui/TutorialCatalogue.js',
    'js/wirecloud/ui/TutorialSubMenu.js',
    'js/wirecloud/ui/Tutorial/PopUp.js',
    'js/wirecloud/ui/Tutorial/SimpleDescription.js',
    'js/wirecloud/ui/Tutorial/UserAction.js',
    'js/wirecloud/ui/Tutorial/FormAction.js',
    'js/wirecloud/ui/Tutorial/AutoAction.js',
    'js/wirecloud/Tutorials/BasicConcepts.js',
)

STYLED_ELEMENTS_FILES = (
    'js/StyledElements/ObjectWithEvents.js',
    'js/StyledElements/StyledElements.js',
    'js/StyledElements/Container.js',
    'js/StyledElements/Addon.js',
    'js/StyledElements/Accordion.js',
    'js/StyledElements/Expander.js',
    'js/StyledElements/Fragment.js',
    'js/StyledElements/PaginatedSource.js',
    'js/StyledElements/GUIBuilder.js',
    'js/StyledElements/Tooltip.js',
    'js/StyledElements/Button.js',
    'js/StyledElements/PopupMenuBase.js',
    'js/StyledElements/PopupMenu.js',
    'js/StyledElements/DynamicMenuItems.js',
    'js/StyledElements/MenuItem.js',
    'js/StyledElements/Separator.js',
    'js/StyledElements/SubMenuItem.js',
    'js/StyledElements/PopupButton.js',
    'js/StyledElements/StaticPaginatedSource.js',
    'js/StyledElements/FileField.js',
    'js/StyledElements/NumericField.js',
    'js/StyledElements/TextField.js',
    'js/StyledElements/TextArea.js',
    'js/StyledElements/StyledList.js',
    'js/StyledElements/PasswordField.js',
    'js/StyledElements/Select.js',
    'js/StyledElements/ToggleButton.js',
    'js/StyledElements/Pills.js',
    'js/StyledElements/Tab.js',
    'js/StyledElements/StyledNotebook.js',
    'js/StyledElements/Alternative.js',
    'js/StyledElements/Alternatives.js',
    'js/StyledElements/HorizontalLayout.js',
    'js/StyledElements/BorderLayout.js',
    'js/StyledElements/ModelTable.js',
    'js/StyledElements/EditableElement.js',
    'js/StyledElements/CheckBox.js',
    'js/StyledElements/InputInterface.js',
    'js/StyledElements/InputInterfaces.js',
    'js/wirecloud/ui/ParametrizableValueInputInterface.js',
    'js/StyledElements/VersionInputInterface.js',
    'js/StyledElements/InputInterfaceFactory.js',
    'js/StyledElements/DefaultInputInterfaceFactory.js',
    'js/StyledElements/Form.js',
    'js/StyledElements/PaginationInterface.js',
    'js/StyledElements/Popover.js',
)

BASE_CSS = (
    'css/base/body.scss',
    'css/base/fade.css',
    'css/base/panel.scss',
    'css/base/code.scss',
    'css/windowmenues/logwindowmenu.scss',
    'css/workspace/ioperator.css',
)

WIRING_EDITOR_CSS = (
    'css/wiring/editor.css',
    'css/wiring/anchor.css',
    'css/wiring/arrow.css',
    'css/wiring/entities.css',
    'css/wiring/multiconnector.css',
    'css/wiring/emptyWiringBox.css',
    'css/wiring/wiringPreview.css',
    'css/wiring/colorSmartBox.css',
)

TUTORIAL_CSS = (
    'css/tutorial.css',
)


STYLED_ELEMENTS_CSS = (
    'css/styled_elements_core.css',
    'css/styledelements/styled_addon.scss',
    'css/styledelements/styled_alternatives.scss',
    'css/styledelements/styled_button.scss',
    'css/styledelements/styled_checkbox.css',
    'css/styledelements/styled_pills.scss',
    'css/styledelements/styled_notebook.scss',
    'css/styledelements/styled_form.css',
    'css/styledelements/styled_pagination.scss',
    'css/styledelements/styled_numeric_field.scss',
    'css/styledelements/styled_text_field.scss',
    'css/styledelements/styled_text_area.scss',
    'css/styledelements/styled_password_field.scss',
    'css/styledelements/styled_select.scss',
    'css/styledelements/styled_border_layout.css',
    'css/styledelements/styled_horizontal_layout.css',
    'css/styledelements/styled_file_field.scss',
    'css/styledelements/styled_table.scss',
    'css/styledelements/styled_label_badge.scss',
    'css/styledelements/styled_message.scss',
    'css/styledelements/styled_rating.css',
    'css/styledelements/styled_popup_menu.scss',
    'css/styledelements/styled_popover.scss',
    'css/styledelements/styled_tooltip.css',
)


class WirecloudCorePlugin(WirecloudPlugin):

    features = {
        'Wirecloud': wirecloud.platform.__version__,
        'ApplicationMashup': '1.0',
        'StyledElements': '0.5',
    }

    def get_platform_context_definitions(self):
        return {
            'language': {
                'label': _('Language'),
                'description': _('Current language used in the platform'),
            },
            'username': {
                'label': _('Username'),
                'description': _('User name of the current logged user'),
            },
            'fullname': {
                'label': _('Full name'),
                'description': _('Full name of the logged user'),
            },
            'isanonymous': {
                'label': _('Is Anonymous'),
                'description': _('Boolean. Designates whether current user is logged in the system.'),
            },
            'isstaff': {
                'label': _('Is Staff'),
                'description': _('Boolean. Designates whether current user can access the admin site.'),
            },
            'issuperuser': {
                'label': _('Is Superuser'),
                'description': _('Boolean. Designates whether current user is a super user.'),
            },
            'mode': {
                'label': _('Mode'),
                'description': _('Rendering mode used by the platform (available modes: classic, smartphone and embedded)'),
            },
            'orientation': {
                'label': _('Orientation'),
                'description': _('Current screen orientation'),
            },
            'theme': {
                'label': _('Theme'),
                'description': _('Name of the theme used by the platform'),
            },
            'version': {
                'label': _('Version'),
                'description': _('Version of the platform'),
            },
            'version': {
                'label': _('Version'),
                'description': _('Version of the platform'),
            },
            'version_hash': {
                'label': _('Version Hash'),
                'description': _('Hash for the current version of the platform. This hash changes when the platform is updated or when an addon is added or removed'),
            },
        }

    def get_platform_context_current_values(self, user):
        from django.conf import settings

        if user.is_authenticated():
            username = user.username
            fullname = user.get_full_name()
        else:
            username = 'anonymous'
            fullname = _('Anonymous')

        return {
            'language': get_language(),
            'orientation': 'landscape',
            'username': username,
            'fullname': fullname,
            'isanonymous': user.is_anonymous(),
            'isstaff': user.is_staff,
            'issuperuser': user.is_superuser,
            'mode': 'unknown',
            'theme': settings.THEME_ACTIVE,
            'version': wirecloud.platform.__version__,
            'version_hash': sha1(json.dumps(get_active_features_info(), ensure_ascii=False, sort_keys=True).encode('utf8')).hexdigest(),
        }

    def get_workspace_context_definitions(self):
        return {
            'name': {
                'label': _('Name'),
                'description': _('Current name of the workspace'),
            },
            'owner': {
                'label': _('Owner'),
                'description': _("Workspace's owner username"),
            }
        }

    def get_workspace_context_current_values(self, workspace, user):
        return {
            'name': workspace.name,
            'owner': workspace.creator.username,
        }

    def get_workspace_preferences(self):
        return [
            {
                "name":          "public",
                "defaultValue":  False,
                "label":         _("Public"),
                "type":          "boolean",
                "description":   _("Allows other users to open this workspace (in read-only mode). (default: disabled)")
            },
            {
                "name":          "layout",
                "defaultValue":  "Fixed",
                "label":         _("Default grid layout"),
                "type":          "select",
                "initialEntries": [
                    {"value": "Fixed", "label": _("Fixed to the grid")},
                    {"value": "Free", "label": _("Out of the grid")}
                ],
                "description":   _("Default layout for the new widgets.")
            },
            {
                "name":          "smart",
                "defaultValue":  True,
                "label":         _("Smart grid for widgets fixed to the grid"),
                "type":          "boolean",
                "description":   _("iWidgets will be automatically reordered if this option is enabled. (default: enabled)")
            },
            {
                "name":          "columns",
                "defaultValue":  20,
                "label":         _("Grid columns"),
                "type":          "number",
                "description":   _("Grid columns. (default: 20)")
            },
            {
                "name":          "cell-height",
                "defaultValue":  12,
                "label":         _("Cell Height (in pixels)"),
                "type":          "number",
                "description":   _("Cell Height. Must be specified in pixel units. (default: 13)")
            },
            {
                "name":          "horizontal-margin",
                "defaultValue":  4,
                "label":         _("Horizontal Margin between iWidgets (in pixels)"),
                "type":          "number",
                "description":   _("Horizontal Margin between iWidgets. Must be specified in pixel units. (default: 4)")
            },
            {
                "name":          "vertical-margin",
                "defaultValue":  3,
                "label":         _("Vertical Margin between iWidgets (in pixels)"),
                "type":          "number",
                "description":   _("Vertical Margin between iWidgets. Must be specified in pixel units. (default: 3)")
            }
        ]

    def get_tab_preferences(self):
        workspace_preferences = self.get_workspace_preferences()
        tab_preferences = deepcopy(workspace_preferences)
        for preference in tab_preferences:
            if preference['name'] == 'public':
                tab_preferences.remove(preference)
            else:
                preference['inheriable'] = True
                preference['inheritableByDefault'] = True
<commit_msg>Fix tab preferences<commit_after># -*- coding: utf-8 -*-

# Copyright (c) 2012-2014 CoNWeT Lab., Universidad Politécnica de Madrid

# This file is part of Wirecloud.

# Wirecloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# Wirecloud is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.

# You should have received a copy of the GNU Affero General Public License
# along with Wirecloud.  If not, see <http://www.gnu.org/licenses/>.

from __future__ import unicode_literals

from copy import deepcopy
from hashlib import sha1
import json

from django.conf import settings
from django.utils.translation import get_language, ugettext_lazy as _

import wirecloud.platform
from wirecloud.platform.core.catalogue_manager import WirecloudCatalogueManager
from wirecloud.platform.plugins import build_url_template, get_active_features_info, WirecloudPlugin


WORKSPACE_CSS = (
    'css/workspace/wallet.scss',
    'css/workspace/dragboard_cursor.css',
    'css/workspace/iwidget.scss',
    'css/workspace/empty_workspace_message.css',
)

CLASSIC_CORE_CSS = (
    'css/window_menu.scss',
    'css/mac_search.css',
    'css/mac_field.css',
    'css/mac_selection_dialog.css',
)

CATALOGUE_CSS = (
    'css/catalogue/emptyCatalogueBox.css',
    'css/catalogue/resource.scss',
    'css/catalogue/resource_details.scss',
)

WIRING_EDITOR_FILES = (
    'js/wirecloud/ui/WiringEditor.js',
    'js/wirecloud/ui/WiringEditor/Anchor.js',
    'js/wirecloud/ui/WiringEditor/Arrow.js',
    'js/wirecloud/ui/WiringEditor/ArrowCreator.js',
    'js/wirecloud/ui/WiringEditor/Canvas.js',
    'js/wirecloud/ui/WiringEditor/GenericInterface.js',
    'js/wirecloud/ui/WiringEditor/WidgetInterface.js',
    'js/wirecloud/ui/WiringEditor/OperatorInterface.js',
    'js/wirecloud/ui/WiringEditor/SourceAnchor.js',
    'js/wirecloud/ui/WiringEditor/TargetAnchor.js',
    'js/wirecloud/ui/WiringEditor/Multiconnector.js',
    'js/wirecloud/ui/WiringEditor/GenericInterfaceSettingsMenuItems.js',
    'js/wirecloud/ui/WiringEditor/MiniInterfaceSettingsMenuItems.js',
    'js/wirecloud/ui/WiringPreview.js',
    'js/wirecloud/ui/ColorSmartBox.js',
    'js/wirecloud/ui/BasicRecommendations.js',
    'js/wirecloud/ui/RecommendationManager.js',
)

TUTORIAL_FILES = (
    'js/wirecloud/ui/Tutorial.js',
    'js/wirecloud/ui/TutorialCatalogue.js',
    'js/wirecloud/ui/TutorialSubMenu.js',
    'js/wirecloud/ui/Tutorial/PopUp.js',
    'js/wirecloud/ui/Tutorial/SimpleDescription.js',
    'js/wirecloud/ui/Tutorial/UserAction.js',
    'js/wirecloud/ui/Tutorial/FormAction.js',
    'js/wirecloud/ui/Tutorial/AutoAction.js',
    'js/wirecloud/Tutorials/BasicConcepts.js',
)

STYLED_ELEMENTS_FILES = (
    'js/StyledElements/ObjectWithEvents.js',
    'js/StyledElements/StyledElements.js',
    'js/StyledElements/Container.js',
    'js/StyledElements/Addon.js',
    'js/StyledElements/Accordion.js',
    'js/StyledElements/Expander.js',
    'js/StyledElements/Fragment.js',
    'js/StyledElements/PaginatedSource.js',
    'js/StyledElements/GUIBuilder.js',
    'js/StyledElements/Tooltip.js',
    'js/StyledElements/Button.js',
    'js/StyledElements/PopupMenuBase.js',
    'js/StyledElements/PopupMenu.js',
    'js/StyledElements/DynamicMenuItems.js',
    'js/StyledElements/MenuItem.js',
    'js/StyledElements/Separator.js',
    'js/StyledElements/SubMenuItem.js',
    'js/StyledElements/PopupButton.js',
    'js/StyledElements/StaticPaginatedSource.js',
    'js/StyledElements/FileField.js',
    'js/StyledElements/NumericField.js',
    'js/StyledElements/TextField.js',
    'js/StyledElements/TextArea.js',
    'js/StyledElements/StyledList.js',
    'js/StyledElements/PasswordField.js',
    'js/StyledElements/Select.js',
    'js/StyledElements/ToggleButton.js',
    'js/StyledElements/Pills.js',
    'js/StyledElements/Tab.js',
    'js/StyledElements/StyledNotebook.js',
    'js/StyledElements/Alternative.js',
    'js/StyledElements/Alternatives.js',
    'js/StyledElements/HorizontalLayout.js',
    'js/StyledElements/BorderLayout.js',
    'js/StyledElements/ModelTable.js',
    'js/StyledElements/EditableElement.js',
    'js/StyledElements/CheckBox.js',
    'js/StyledElements/InputInterface.js',
    'js/StyledElements/InputInterfaces.js',
    'js/wirecloud/ui/ParametrizableValueInputInterface.js',
    'js/StyledElements/VersionInputInterface.js',
    'js/StyledElements/InputInterfaceFactory.js',
    'js/StyledElements/DefaultInputInterfaceFactory.js',
    'js/StyledElements/Form.js',
    'js/StyledElements/PaginationInterface.js',
    'js/StyledElements/Popover.js',
)

BASE_CSS = (
    'css/base/body.scss',
    'css/base/fade.css',
    'css/base/panel.scss',
    'css/base/code.scss',
    'css/windowmenues/logwindowmenu.scss',
    'css/workspace/ioperator.css',
)

WIRING_EDITOR_CSS = (
    'css/wiring/editor.css',
    'css/wiring/anchor.css',
    'css/wiring/arrow.css',
    'css/wiring/entities.css',
    'css/wiring/multiconnector.css',
    'css/wiring/emptyWiringBox.css',
    'css/wiring/wiringPreview.css',
    'css/wiring/colorSmartBox.css',
)

TUTORIAL_CSS = (
    'css/tutorial.css',
)


STYLED_ELEMENTS_CSS = (
    'css/styled_elements_core.css',
    'css/styledelements/styled_addon.scss',
    'css/styledelements/styled_alternatives.scss',
    'css/styledelements/styled_button.scss',
    'css/styledelements/styled_checkbox.css',
    'css/styledelements/styled_pills.scss',
    'css/styledelements/styled_notebook.scss',
    'css/styledelements/styled_form.css',
    'css/styledelements/styled_pagination.scss',
    'css/styledelements/styled_numeric_field.scss',
    'css/styledelements/styled_text_field.scss',
    'css/styledelements/styled_text_area.scss',
    'css/styledelements/styled_password_field.scss',
    'css/styledelements/styled_select.scss',
    'css/styledelements/styled_border_layout.css',
    'css/styledelements/styled_horizontal_layout.css',
    'css/styledelements/styled_file_field.scss',
    'css/styledelements/styled_table.scss',
    'css/styledelements/styled_label_badge.scss',
    'css/styledelements/styled_message.scss',
    'css/styledelements/styled_rating.css',
    'css/styledelements/styled_popup_menu.scss',
    'css/styledelements/styled_popover.scss',
    'css/styledelements/styled_tooltip.css',
)


class WirecloudCorePlugin(WirecloudPlugin):

    features = {
        'Wirecloud': wirecloud.platform.__version__,
        'ApplicationMashup': '1.0',
        'StyledElements': '0.5',
    }

    def get_platform_context_definitions(self):
        return {
            'language': {
                'label': _('Language'),
                'description': _('Current language used in the platform'),
            },
            'username': {
                'label': _('Username'),
                'description': _('User name of the current logged user'),
            },
            'fullname': {
                'label': _('Full name'),
                'description': _('Full name of the logged user'),
            },
            'isanonymous': {
                'label': _('Is Anonymous'),
                'description': _('Boolean. Designates whether current user is logged in the system.'),
            },
            'isstaff': {
                'label': _('Is Staff'),
                'description': _('Boolean. Designates whether current user can access the admin site.'),
            },
            'issuperuser': {
                'label': _('Is Superuser'),
                'description': _('Boolean. Designates whether current user is a super user.'),
            },
            'mode': {
                'label': _('Mode'),
                'description': _('Rendering mode used by the platform (available modes: classic, smartphone and embedded)'),
            },
            'orientation': {
                'label': _('Orientation'),
                'description': _('Current screen orientation'),
            },
            'theme': {
                'label': _('Theme'),
                'description': _('Name of the theme used by the platform'),
            },
            'version': {
                'label': _('Version'),
                'description': _('Version of the platform'),
            },
            'version': {
                'label': _('Version'),
                'description': _('Version of the platform'),
            },
            'version_hash': {
                'label': _('Version Hash'),
                'description': _('Hash for the current version of the platform. This hash changes when the platform is updated or when an addon is added or removed'),
            },
        }

    def get_platform_context_current_values(self, user):
        from django.conf import settings

        if user.is_authenticated():
            username = user.username
            fullname = user.get_full_name()
        else:
            username = 'anonymous'
            fullname = _('Anonymous')

        return {
            'language': get_language(),
            'orientation': 'landscape',
            'username': username,
            'fullname': fullname,
            'isanonymous': user.is_anonymous(),
            'isstaff': user.is_staff,
            'issuperuser': user.is_superuser,
            'mode': 'unknown',
            'theme': settings.THEME_ACTIVE,
            'version': wirecloud.platform.__version__,
            'version_hash': sha1(json.dumps(get_active_features_info(), ensure_ascii=False, sort_keys=True).encode('utf8')).hexdigest(),
        }

    def get_workspace_context_definitions(self):
        return {
            'name': {
                'label': _('Name'),
                'description': _('Current name of the workspace'),
            },
            'owner': {
                'label': _('Owner'),
                'description': _("Workspace's owner username"),
            }
        }

    def get_workspace_context_current_values(self, workspace, user):
        return {
            'name': workspace.name,
            'owner': workspace.creator.username,
        }

    def get_workspace_preferences(self):
        return [
            {
                "name":          "public",
                "defaultValue":  False,
                "label":         _("Public"),
                "type":          "boolean",
                "description":   _("Allows other users to open this workspace (in read-only mode). (default: disabled)")
            },
            {
                "name":          "layout",
                "defaultValue":  "Fixed",
                "label":         _("Default grid layout"),
                "type":          "select",
                "initialEntries": [
                    {"value": "Fixed", "label": _("Fixed to the grid")},
                    {"value": "Free", "label": _("Out of the grid")}
                ],
                "description":   _("Default layout for the new widgets.")
            },
            {
                "name":          "smart",
                "defaultValue":  True,
                "label":         _("Smart grid for widgets fixed to the grid"),
                "type":          "boolean",
                "description":   _("iWidgets will be automatically reordered if this option is enabled. (default: enabled)")
            },
            {
                "name":          "columns",
                "defaultValue":  20,
                "label":         _("Grid columns"),
                "type":          "number",
                "description":   _("Grid columns. (default: 20)")
            },
            {
                "name":          "cell-height",
                "defaultValue":  12,
                "label":         _("Cell Height (in pixels)"),
                "type":          "number",
                "description":   _("Cell Height. Must be specified in pixel units. (default: 13)")
            },
            {
                "name":          "horizontal-margin",
                "defaultValue":  4,
                "label":         _("Horizontal Margin between iWidgets (in pixels)"),
                "type":          "number",
                "description":   _("Horizontal Margin between iWidgets. Must be specified in pixel units. (default: 4)")
            },
            {
                "name":          "vertical-margin",
                "defaultValue":  3,
                "label":         _("Vertical Margin between iWidgets (in pixels)"),
                "type":          "number",
                "description":   _("Vertical Margin between iWidgets. Must be specified in pixel units. (default: 3)")
            }
        ]

    def get_tab_preferences(self):
        workspace_preferences = self.get_workspace_preferences()
        tab_preferences = deepcopy(workspace_preferences)
        for preference in tab_preferences:
            if preference['name'] == 'public':
                public_preference = preference
            else:
                preference['inheritable'] = True
                preference['inheritByDefault'] = True

        tab_preferences.remove(public_preference)

{'fraction_non_alphanumeric': 0.12706913339824732, 'fraction_numerical': 0.002172121938431578, 'mean_word_length': 2.273630011033468, 'pattern_counts': {'":': 80, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5202156', 'n_tokens_mistral': 8197, 'n_tokens_neox': 7911, 'n_words': 1434}