Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SettingFunction: cleanup imports #884

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions UM/Settings/SettingFunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,28 @@
# Uranium is released under the terms of the LGPLv3 or higher.

import ast
# noinspection PyUnresolvedReferences
import base64 # Imported here so it can be used easily by the setting functions.
import traceback
import builtins # To check against functions that are built-in in Python.

# Imported here, so it can be used easily by the setting functions.
# noinspection PyUnresolvedReferences
import hashlib # Imported here so it can be used easily by the setting functions.
import math
# noinspection PyUnresolvedReferences
import uuid # Imported here so it can be used easily by the setting functions.
import base64
# noinspection PyUnresolvedReferences
import hashlib
# noinspection PyUnresolvedReferences
import uuid

from types import CodeType
from typing import Any, Callable, Dict, FrozenSet, NamedTuple, Optional, Set, TYPE_CHECKING

# noinspection PyUnresolvedReferences
import math # Imported here so it can be used easily by the setting functions.

from UM.Logger import Logger
from UM.Settings.Interfaces import ContainerInterface
from UM.Settings.PropertyEvaluationContext import PropertyEvaluationContext

if TYPE_CHECKING:
from typing import FrozenSet



import traceback

from UM.Settings.Interfaces import ContainerInterface
from UM.Settings.PropertyEvaluationContext import PropertyEvaluationContext


class IllegalMethodError(Exception):
Expand Down Expand Up @@ -78,7 +76,7 @@ def _safeCompile(self):
except Exception as e:
Logger.log("e", "Exception in function ({0}) for setting: {1}".format(str(e), self._code))

def __call__(self, value_provider: ContainerInterface, context: Optional[PropertyEvaluationContext] = None) -> Any:
def __call__(self, value_provider: "ContainerInterface", context: Optional["PropertyEvaluationContext"] = None) -> Any:
"""Call the actual function to calculate the value.

:param value_provider: The container from which to get setting values in the formula.
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/cs_CZ/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Uranium 5.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: 2022-04-26 00:14+0200\n"
"Last-Translator: Miroslav Šustek <[email protected]>\n"
"Language-Team: DenyCZ <www.github.com/DenyCZ>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/de_DE/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/es_ES/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/fi_FI/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Uranium 5.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: 2017-09-27 12:27+0200\n"
"Last-Translator: Bothof <[email protected]>\n"
"Language-Team: Finnish <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/fr_FR/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/hu_HU/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Uranium 5.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: 2019-10-10 22:30+0200\n"
"Last-Translator: Nagy Attila\n"
"Language-Team: AT-VLOG <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/it_IT/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/ja_JP/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/ko_KR/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/nl_NL/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/pl_PL/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Uranium 5.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: 2019-11-15 15:35+0100\n"
"Last-Translator: Mariusz 'Virgin71' Matłosz <[email protected]>\n"
"Language-Team: reprapy.pl\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/pt_BR/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Uranium 5.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: 2022-04-25 07:03+0200\n"
"Last-Translator: Cláudio Sampaio <[email protected]>\n"
"Language-Team: Cláudio Sampaio\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/pt_PT/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/ru_RU/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/tr_TR/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
62 changes: 31 additions & 31 deletions resources/i18n/uranium.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -598,122 +598,122 @@ msgid "Local Container Provider"
msgstr ""

msgctxt "description"
msgid "Provides the Rotate tool."
msgid "Enables saving to local files."
msgstr ""

msgctxt "name"
msgid "Rotate Tool"
msgid "Local File Output Device"
msgstr ""

msgctxt "description"
msgid "Provides the Move tool."
msgid "Makes it possible to read Wavefront OBJ files."
msgstr ""

msgctxt "name"
msgid "Move Tool"
msgid "Wavefront OBJ Reader"
msgstr ""

msgctxt "description"
msgid "Provides the tool to manipulate the camera."
msgid "Provides support for writing STL files."
msgstr ""

msgctxt "name"
msgid "Camera Tool"
msgid "STL Writer"
msgstr ""

msgctxt "description"
msgid "Provides the Mirror tool."
msgid "Provides support for reading STL files."
msgstr ""

msgctxt "name"
msgid "Mirror Tool"
msgid "STL Reader"
msgstr ""

msgctxt "description"
msgid "Provides the Scale tool."
msgid "Makes it possible to write Wavefront OBJ files."
msgstr ""

msgctxt "name"
msgid "Scale Tool"
msgid "Wavefront OBJ Writer"
msgstr ""

msgctxt "description"
msgid "Provides the Selection tool."
msgid "Outputs log information to the console."
msgstr ""

msgctxt "name"
msgid "Selection Tool"
msgid "Console Logger"
msgstr ""

msgctxt "description"
msgid "Enables saving to local files."
msgid "Outputs log information to a file in your settings folder."
msgstr ""

msgctxt "name"
msgid "Local File Output Device"
msgid "File Logger"
msgstr ""

msgctxt "description"
msgid "Outputs log information to a file in your settings folder."
msgid "Provides a simple solid mesh view."
msgstr ""

msgctxt "name"
msgid "File Logger"
msgid "Simple View"
msgstr ""

msgctxt "description"
msgid "Outputs log information to the console."
msgid "Checks for updates of the software."
msgstr ""

msgctxt "name"
msgid "Console Logger"
msgid "Update Checker"
msgstr ""

msgctxt "description"
msgid "Checks for updates of the software."
msgid "Provides the Mirror tool."
msgstr ""

msgctxt "name"
msgid "Update Checker"
msgid "Mirror Tool"
msgstr ""

msgctxt "description"
msgid "Makes it possible to read Wavefront OBJ files."
msgid "Provides the Move tool."
msgstr ""

msgctxt "name"
msgid "Wavefront OBJ Reader"
msgid "Move Tool"
msgstr ""

msgctxt "description"
msgid "Makes it possible to write Wavefront OBJ files."
msgid "Provides the Rotate tool."
msgstr ""

msgctxt "name"
msgid "Wavefront OBJ Writer"
msgid "Rotate Tool"
msgstr ""

msgctxt "description"
msgid "Provides support for reading STL files."
msgid "Provides the tool to manipulate the camera."
msgstr ""

msgctxt "name"
msgid "STL Reader"
msgid "Camera Tool"
msgstr ""

msgctxt "description"
msgid "Provides support for writing STL files."
msgid "Provides the Scale tool."
msgstr ""

msgctxt "name"
msgid "STL Writer"
msgid "Scale Tool"
msgstr ""

msgctxt "description"
msgid "Provides a simple solid mesh view."
msgid "Provides the Selection tool."
msgstr ""

msgctxt "name"
msgid "Simple View"
msgid "Selection Tool"
msgstr ""

2 changes: 1 addition & 1 deletion resources/i18n/zh_CN/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
2 changes: 1 addition & 1 deletion resources/i18n/zh_TW/uranium.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Uranium 5.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-03 10:52+0000\n"
"POT-Creation-Date: 2023-07-07 09:49+0000\n"
"PO-Revision-Date: 2022-01-02 20:28+0800\n"
"Last-Translator: Valen Chang <[email protected]>\n"
"Language-Team: Valen Chang <[email protected]>\n"
Expand Down