Add some typing and str format

This commit is contained in:
Fabien Castan 2025-03-23 23:08:35 +01:00
parent c1a862d0cd
commit 3f69724788
3 changed files with 9 additions and 5 deletions

View file

@ -116,7 +116,7 @@ class Node(object):
raise NotImplementedError('No stopProcess implementation on node: {}'.format(chunk.node.name)) raise NotImplementedError('No stopProcess implementation on node: {}'.format(chunk.node.name))
def processChunk(self, chunk): def processChunk(self, chunk):
raise NotImplementedError('No processChunk implementation on node: "{}"'.format(chunk.node.name)) raise NotImplementedError(f'No processChunk implementation on node: "{chunk.node.name}"')
class InputNode(Node): class InputNode(Node):

View file

@ -23,11 +23,11 @@ from meshroom.core.attribute import attributeFactory, ListAttribute, GroupAttrib
from meshroom.core.exception import NodeUpgradeError, UnknownNodeTypeError from meshroom.core.exception import NodeUpgradeError, UnknownNodeTypeError
def getWritingFilepath(filepath): def getWritingFilepath(filepath: str) -> str:
return filepath + '.writing.' + str(uuid.uuid4()) return filepath + '.writing.' + str(uuid.uuid4())
def renameWritingToFinalPath(writingFilepath, filepath): def renameWritingToFinalPath(writingFilepath: str, filepath: str) -> str:
if platform.system() == 'Windows': if platform.system() == 'Windows':
# On Windows, attempting to remove a file that is in use causes an exception to be raised. # On Windows, attempting to remove a file that is in use causes an exception to be raised.
# So we may need multiple trials, if someone is reading it at the same time. # So we may need multiple trials, if someone is reading it at the same time.
@ -1061,7 +1061,7 @@ class BaseNode(BaseObject):
s = self.globalStatus s = self.globalStatus
for chunk in self._chunks: for chunk in self._chunks:
chunk.updateStatusFromCache() chunk.updateStatusFromCache()
# logging.warning("updateStatusFromCache: {}, status: {} => {}".format(self.name, s, self.globalStatus)) # logging.warning(f"updateStatusFromCache: {self.name}, status: {s} => {self.globalStatus}")
self.updateOutputAttr() self.updateOutputAttr()
def submit(self, forceCompute=False): def submit(self, forceCompute=False):

View file

@ -12,10 +12,14 @@ from PySide6.QtGui import QMatrix4x4, QMatrix3x3, QQuaternion, QVector3D, QVecto
import meshroom.core import meshroom.core
import meshroom.common import meshroom.common
from meshroom import multiview from meshroom import multiview
from meshroom.common.qt import QObjectListModel from meshroom.common.qt import QObjectListModel
from meshroom.core import Version from meshroom.core import Version
from meshroom.core.node import Node, CompatibilityNode, Status, Position, CompatibilityIssue from meshroom.core.node import Node, CompatibilityNode, Status, Position, CompatibilityIssue
from meshroom.core.taskManager import TaskManager
from meshroom.ui import commands
from meshroom.ui.graph import UIGraph from meshroom.ui.graph import UIGraph
from meshroom.ui.utils import makeProperty from meshroom.ui.utils import makeProperty
from meshroom.ui.components.filepath import FilepathHelper from meshroom.ui.components.filepath import FilepathHelper
@ -450,7 +454,7 @@ class Reconstruction(UIGraph):
"matchProvider": ["FeatureMatching", "StructureFromMotion"] "matchProvider": ["FeatureMatching", "StructureFromMotion"]
} }
def __init__(self, undoStack, taskManager, defaultPipeline="", parent=None): def __init__(self, undoStack: commands.UndoStack, taskManager: TaskManager, defaultPipeline: str="", parent: QObject=None):
super(Reconstruction, self).__init__(undoStack, taskManager, parent) super(Reconstruction, self).__init__(undoStack, taskManager, parent)
# initialize member variables for key steps of the 3D reconstruction pipeline # initialize member variables for key steps of the 3D reconstruction pipeline