code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def findPinByName(self, pinFullName):
"""Tries to find pin by name across all graphs
:param pinFullName: Full name of pin including node namespace
:type pinFullName: str
:rtype: :class:`~PyFlow.Core.PinBase.PinBase` or None
"""
result = None
for graph in self.get... | Tries to find pin by name across all graphs
:param pinFullName: Full name of pin including node namespace
:type pinFullName: str
:rtype: :class:`~PyFlow.Core.PinBase.PinBase` or None
| findPinByName | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def findNode(self, name):
"""Finds a node across all graphs
:param name: Node name to search by
:type name: str
:rtype: :class:`~PyFlow.Core.NodeBase.NodeBase`
"""
result = None
for graph in self.getAllGraphs():
result = graph.findNode(name)
... | Finds a node across all graphs
:param name: Node name to search by
:type name: str
:rtype: :class:`~PyFlow.Core.NodeBase.NodeBase`
| findNode | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def findVariableByUid(self, uuid):
"""Finds a variable across all graphs
:param uuid: Variable unique identifier
:type uuid: :class:`~uuid.UUID`
:rtype: :class:`~PyFlow.Core.Variable.Variable` or None
"""
result = None
for graph in self._graphs.values():
... | Finds a variable across all graphs
:param uuid: Variable unique identifier
:type uuid: :class:`~uuid.UUID`
:rtype: :class:`~PyFlow.Core.Variable.Variable` or None
| findVariableByUid | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def findVariableByName(self, name):
"""Finds a variable across all graphs
:param name: Variable name
:type name: str
:rtype: :class:`~PyFlow.Core.Variable.Variable` or None
"""
for graph in self._graphs.values():
for var in graph.getVars().values():
... | Finds a variable across all graphs
:param name: Variable name
:type name: str
:rtype: :class:`~PyFlow.Core.Variable.Variable` or None
| findVariableByName | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def getGraphsDict(self):
"""Creates and returns dictionary where graph name associated with graph
:rtype: dict(str, :class:`~PyFlow.Core.GraphBase.GraphBase`)
"""
result = {}
for graph in self.getAllGraphs():
result[graph.name] = graph
return result | Creates and returns dictionary where graph name associated with graph
:rtype: dict(str, :class:`~PyFlow.Core.GraphBase.GraphBase`)
| getGraphsDict | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def add(self, graph):
"""Adds graph to storage and ensures that graph name is unique
:param graph: Graph to add
:type graph: :class:`~PyFlow.Core.GraphBase.GraphBase`
"""
graph.name = self.getUniqGraphName(graph.name)
self._graphs[graph.uid] = graph | Adds graph to storage and ensures that graph name is unique
:param graph: Graph to add
:type graph: :class:`~PyFlow.Core.GraphBase.GraphBase`
| add | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def selectGraphByName(self, name):
"""Sets active graph by graph name and fires event
:param name: Name of target graph
:type name: str
"""
graphs = self.getGraphsDict()
if name in graphs:
if name != self.activeGraph().name:
newGraph = graphs[... | Sets active graph by graph name and fires event
:param name: Name of target graph
:type name: str
| selectGraphByName | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def selectGraph(self, graph):
"""Sets supplied graph as active and fires event
:param graph: Target graph
:type graph: :class:`~PyFlow.Core.GraphBase.GraphBase`
"""
for newGraph in self.getAllGraphs():
if newGraph.name == graph.name:
if newGraph.name ... | Sets supplied graph as active and fires event
:param graph: Target graph
:type graph: :class:`~PyFlow.Core.GraphBase.GraphBase`
| selectGraph | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def getAllNodes(self, classNameFilters=None):
"""Returns all nodes across all graphs
:param classNameFilters: If class name filters specified, only those node classes will be considered
:type classNameFilters: list(str)
:rtype: list(:class:`~PyFlow.Core.NodeBase.NodeBase`)
"""
... | Returns all nodes across all graphs
:param classNameFilters: If class name filters specified, only those node classes will be considered
:type classNameFilters: list(str)
:rtype: list(:class:`~PyFlow.Core.NodeBase.NodeBase`)
| getAllNodes | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def getAllVariables(self):
"""Returns a list of all variables
:rtype: list(:class:`~PyFlow.Core.Variable.Variable`)
"""
result = []
for graph in self.getAllGraphs():
result.extend(list(graph.getVars().values()))
return result | Returns a list of all variables
:rtype: list(:class:`~PyFlow.Core.Variable.Variable`)
| getAllVariables | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def getUniqGraphPinName(graph, name):
"""Returns unique pin name for graph
Used by compound node and graphInputs graphOutputs nodes.
To make all exposed to compound pins names unique.
:param graph: Target graph
:type graph: :class:`~PyFlow.Core.GraphBase.GraphBase`
:par... | Returns unique pin name for graph
Used by compound node and graphInputs graphOutputs nodes.
To make all exposed to compound pins names unique.
:param graph: Target graph
:type graph: :class:`~PyFlow.Core.GraphBase.GraphBase`
:param name: Target pin name
:type name: str
... | getUniqGraphPinName | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def getAllNames(self):
"""Returns list of all registered names
Includes graphs, nodes, pins, variables names
:rtype: list(str)
"""
existingNames = [g.name for g in self.getAllGraphs()]
existingNames.extend([n.name for n in self.getAllNodes()])
existingNames.exte... | Returns list of all registered names
Includes graphs, nodes, pins, variables names
:rtype: list(str)
| getAllNames | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def getUniqName(self, name):
"""Returns unique name
:param name: Source name
:type name: str
:rtype: str
"""
existingNames = self.getAllNames()
return getUniqNameFromList(existingNames, name) | Returns unique name
:param name: Source name
:type name: str
:rtype: str
| getUniqName | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def getUniqGraphName(self, name):
"""Returns unique graph name
:param name: Source name
:type name: str
:rtype: str
"""
existingNames = [g.name for g in self.getAllGraphs()]
return getUniqNameFromList(existingNames, name) | Returns unique graph name
:param name: Source name
:type name: str
:rtype: str
| getUniqGraphName | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def getUniqNodeName(self, name):
"""Returns unique node name
:param name: Source name
:type name: str
:rtype: str
"""
existingNames = [n.name for n in self.getAllNodes()]
return getUniqNameFromList(existingNames, name) | Returns unique node name
:param name: Source name
:type name: str
:rtype: str
| getUniqNodeName | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def getUniqVariableName(self, name):
"""Returns unique variable name
:param name: Source name
:type name: str
:rtype: str
"""
existingNames = [var.name for var in self.getAllVariables()]
return getUniqNameFromList(existingNames, name) | Returns unique variable name
:param name: Source name
:type name: str
:rtype: str
| getUniqVariableName | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def plot(self):
"""Prints all data to console. May be useful for debugging
"""
root = self.findRootGraph()
print(
"Active graph: {0}".format(str(self.activeGraph().name)),
"All graphs:",
[g.name for g in self._graphs.values()],
)
root.p... | Prints all data to console. May be useful for debugging
| plot | python | pedroCabrera/PyFlow | PyFlow/Core/GraphManager.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/GraphManager.py | Apache-2.0 |
def serialize(self, *args, **Kwargs):
"""Implements how item will be serialized
:raises NotImplementedError: If not implemented
"""
raise NotImplementedError(
"serialize method of ISerializable is not implemented"
) | Implements how item will be serialized
:raises NotImplementedError: If not implemented
| serialize | python | pedroCabrera/PyFlow | PyFlow/Core/Interfaces.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/Interfaces.py | Apache-2.0 |
def deserialize(self, jsonData):
"""Implements how item will be deserialized
:raises NotImplementedError: If not implemented
"""
raise NotImplementedError(
"deserialize method of ISerializable is not implemented"
) | Implements how item will be deserialized
:raises NotImplementedError: If not implemented
| deserialize | python | pedroCabrera/PyFlow | PyFlow/Core/Interfaces.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/Interfaces.py | Apache-2.0 |
def internalDataStructure():
"""Static hint of what real python type is this pin
:rtype: object
:raises NotImplementedError: If not implemented
"""
raise NotImplementedError(
"internalDataStructure method of IPin is not implemented"
) | Static hint of what real python type is this pin
:rtype: object
:raises NotImplementedError: If not implemented
| internalDataStructure | python | pedroCabrera/PyFlow | PyFlow/Core/Interfaces.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/Interfaces.py | Apache-2.0 |
def supportedDataTypes():
"""List of supported data types
List of data types that can be cast to this type. For example - int can support float, or vector3 can support vector4 etc.
:rtype: list(object)
:raises NotImplementedError: If not implemented
"""
raise NotImpleme... | List of supported data types
List of data types that can be cast to this type. For example - int can support float, or vector3 can support vector4 etc.
:rtype: list(object)
:raises NotImplementedError: If not implemented
| supportedDataTypes | python | pedroCabrera/PyFlow | PyFlow/Core/Interfaces.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/Interfaces.py | Apache-2.0 |
def inputs(self):
"""Returns all input pins. Dictionary generated every time property called, so cache it when possible.
"""
result = OrderedDict()
for pin in self.pins:
if pin.direction == PinDirection.Input:
result[pin.uid] = pin
return result | Returns all input pins. Dictionary generated every time property called, so cache it when possible.
| inputs | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def outputs(self):
"""Returns all output pins. Dictionary generated every time property called, so cache it when possible.
"""
result = OrderedDict()
for pin in self.pins:
if pin.direction == PinDirection.Output:
result[pin.uid] = pin
return result | Returns all output pins. Dictionary generated every time property called, so cache it when possible.
| outputs | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def isCallable(self):
"""Whether this node is callable or not
"""
for p in list(self.inputs.values()) + list(self.outputs.values()):
if p.isExec():
return True
return False | Whether this node is callable or not
| isCallable | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def setPosition(self, x, y):
"""Sets node coordinate on canvas
Used to correctly restore gui wrapper class
:param x: X coordinate
:type x: float
:param y: Y coordinate
:type y: float
"""
self.x = x
self.y = y | Sets node coordinate on canvas
Used to correctly restore gui wrapper class
:param x: X coordinate
:type x: float
:param y: Y coordinate
:type y: float
| setPosition | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def autoAffectPins(self):
"""All value inputs affects on all value outputs. All exec inputs affects on all exec outputs
"""
for i in self.inputs.values():
for o in self.outputs.values():
assert i is not o
if not i.IsValuePin() and o.IsValuePin():
... | All value inputs affects on all value outputs. All exec inputs affects on all exec outputs
| autoAffectPins | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def createInputPin(
self,
pinName,
dataType,
defaultValue=None,
callback=None,
structure=StructureType.Single,
constraint=None,
structConstraint=None,
supportedPinDataTypes=None,
group="",
):
"""Creates input pin
:param... | Creates input pin
:param pinName: Pin name
:type pinName: str
:param dataType: Pin data type
:type dataType: str
:param defaultValue: Pin default value
:type defaultValue: object
:param callback: Pin callback. used for exec pins
:type callback: function
... | createInputPin | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def createOutputPin(
self,
pinName,
dataType,
defaultValue=None,
structure=StructureType.Single,
constraint=None,
structConstraint=None,
supportedPinDataTypes=None,
group="",
):
"""Creates output pin
:param pinName: Pin name
... | Creates output pin
:param pinName: Pin name
:type pinName: str
:param dataType: Pin data type
:type dataType: str
:param defaultValue: Pin default value
:type defaultValue: object
:param structure: Pin structure
:type structure: :class:`~PyFlow.Core.Commo... | createOutputPin | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def setData(self, pinName, data, pinSelectionGroup=PinSelectionGroup.BothSides):
"""Sets data to pin by pin name
:param pinName: Target pin name
:type pinName: str
:param data: Pin data to be set
:type data: object
:param pinSelectionGroup: Which side to search
:... | Sets data to pin by pin name
:param pinName: Target pin name
:type pinName: str
:param data: Pin data to be set
:type data: object
:param pinSelectionGroup: Which side to search
:type pinSelectionGroup: :class:`~PyFlow.Core.Common.PinSelectionGroup`
| setData | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def getData(self, pinName, pinSelectionGroup=PinSelectionGroup.BothSides):
"""Get data from pin by name
:param pinName: Target pin name
:type pinName: str
:param pinSelectionGroup: Which side to search
:type pinSelectionGroup: :class:`~PyFlow.Core.Common.PinSelectionGroup`
... | Get data from pin by name
:param pinName: Target pin name
:type pinName: str
:param pinSelectionGroup: Which side to search
:type pinSelectionGroup: :class:`~PyFlow.Core.Common.PinSelectionGroup`
:rtype: object
| getData | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def getUniqPinName(self, name):
"""Returns unique name for pin
:param name: Target pin name
:type name: str
:rtype: str
"""
pinNames = [
i.name
for i in list(list(self.inputs.values()))
+ list(list(self.outputs.values()))
]
... | Returns unique name for pin
:param name: Target pin name
:type name: str
:rtype: str
| getUniqPinName | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def call(self, name, *args, **kwargs):
"""Call exec pin by name
:param name: Target pin name
:type name: str
"""
namePinOutputsMap = self.namePinOutputsMap
namePinInputsMap = self.namePinInputsMap
if name in namePinOutputsMap:
p = namePinOutputsMap[na... | Call exec pin by name
:param name: Target pin name
:type name: str
| call | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def getPinSG(self, name, pinsSelectionGroup=PinSelectionGroup.BothSides):
"""Tries to find pin by name and selection group
:param name: Pin name to search
:type name: str
:param pinsSelectionGroup: Side to search
:type pinsSelectionGroup: :class:`~PyFlow.Core.Common.PinSelection... | Tries to find pin by name and selection group
:param name: Pin name to search
:type name: str
:param pinsSelectionGroup: Side to search
:type pinsSelectionGroup: :class:`~PyFlow.Core.Common.PinSelectionGroup`
:rtype: :class:`~PyFlow.Core.PinBase.PinBase` or None
| getPinSG | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def getPinByName(self, name):
"""Tries to find pin by name
:param name: pin name
:type name: str
:rtype: :class:`~PyFlow.Core.PinBase.PinBase` or None
"""
inputs = self.inputs
outputs = self.outputs
for p in list(inputs.values()) + list(outputs.values()):... | Tries to find pin by name
:param name: pin name
:type name: str
:rtype: :class:`~PyFlow.Core.PinBase.PinBase` or None
| getPinByName | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def postCreate(self, jsonTemplate=None):
"""Called after node was added to graph
:param jsonTemplate: Serialized data of spawned node
:type jsonTemplate: dict or None
"""
if jsonTemplate is not None:
self.uid = uuid.UUID(jsonTemplate["uuid"])
self.setName... | Called after node was added to graph
:param jsonTemplate: Serialized data of spawned node
:type jsonTemplate: dict or None
| postCreate | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def initializeFromFunction(foo):
"""Constructs node from annotated function
.. seealso :: :mod:`PyFlow.Core.FunctionLibrary`
:param foo: Annotated function
:type foo: function
:rtype: :class:`~PyFlow.Core.NodeBase.NodeBase`
"""
retAnyOpts = None
retConst... | Constructs node from annotated function
.. seealso :: :mod:`PyFlow.Core.FunctionLibrary`
:param foo: Annotated function
:type foo: function
:rtype: :class:`~PyFlow.Core.NodeBase.NodeBase`
| initializeFromFunction | python | pedroCabrera/PyFlow | PyFlow/Core/NodeBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/NodeBase.py | Apache-2.0 |
def enableOptions(self, *options):
"""Enables flags on pin instance
Example:
>>> self.pinInstance.enableOptions(PinOptions.RenamingEnabled)
You can also pass array/set of flags
>>> self.pinInstance.enableOptions({PinOptions.RenamingEnabled, PinOptions.Dynamic})
This ... | Enables flags on pin instance
Example:
>>> self.pinInstance.enableOptions(PinOptions.RenamingEnabled)
You can also pass array/set of flags
>>> self.pinInstance.enableOptions({PinOptions.RenamingEnabled, PinOptions.Dynamic})
This is equivalent of
>>> self.pinInstance... | enableOptions | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def disableOptions(self, *options):
"""Same as :meth:`~PyFlow.Core.PinBase.PinBase.enableOptions` but inverse
"""
for option in options:
self._flags = self._flags & ~option
self._origFlags = self._flags | Same as :meth:`~PyFlow.Core.PinBase.PinBase.enableOptions` but inverse
| disableOptions | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def linkedTo(self):
"""store connection from pins
from left hand side to right hand side
.. code-block:: python
{
"lhsNodeName": "", "outPinId": 0,
"rhsNodeName": "", "inPinId": 0
}
where pin id is order in which pin was added t... | store connection from pins
from left hand side to right hand side
.. code-block:: python
{
"lhsNodeName": "", "outPinId": 0,
"rhsNodeName": "", "inPinId": 0
}
where pin id is order in which pin was added to node
:returns: Seria... | linkedTo | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def initAsArray(self, bIsArray):
"""Sets this pins to be a list always
:param bIsArray: Define as array
:type bIsArray: bool
"""
self._alwaysList = bool(bIsArray)
if bool(bIsArray):
self._alwaysDict = False
self.setAsArray(bool(bIsArray)) | Sets this pins to be a list always
:param bIsArray: Define as array
:type bIsArray: bool
| initAsArray | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def initAsDict(self, bIsDict):
"""Sets this pins to be a dict always
:param bIsDict: Define as dict
:type bIsDict: bool
"""
self._alwaysDict = bool(bIsDict)
if bool(bIsDict):
self._alwaysList = False
self.setAsDict(bool(bIsDict)) | Sets this pins to be a dict always
:param bIsDict: Define as dict
:type bIsDict: bool
| initAsDict | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def setAsArray(self, bIsArray):
"""Sets this pins to be a list
:param bIsArray: Define as Array
:type bIsArray: bool
"""
bIsArray = bool(bIsArray)
if self._isArray == bIsArray:
return
self._isArray = bIsArray
if bIsArray:
if self.... | Sets this pins to be a list
:param bIsArray: Define as Array
:type bIsArray: bool
| setAsArray | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def setAsDict(self, bIsDict):
"""Sets this pins to be a dict
:param bIsDict: Define as Array
:type bIsDict: bool
"""
bIsDict = bool(bIsDict)
if self._isDict == bIsDict:
return
self._isDict = bIsDict
if bIsDict:
if self.isArray():
... | Sets this pins to be a dict
:param bIsDict: Define as Array
:type bIsDict: bool
| setAsDict | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def setWrapper(self, wrapper):
"""Sets ui wrapper instance
:param wrapper: Whatever ui class that represents this pin
"""
if self._wrapper is None:
self._wrapper = weakref.ref(wrapper) | Sets ui wrapper instance
:param wrapper: Whatever ui class that represents this pin
| setWrapper | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def deserialize(self, jsonData):
"""Restores itself from supplied serialized data
:param jsonData: Json representation of pin
:type jsonData: dict
"""
self.setName(jsonData["name"])
self.uid = uuid.UUID(jsonData["uuid"])
for opt in PinOptions:
if opt... | Restores itself from supplied serialized data
:param jsonData: Json representation of pin
:type jsonData: dict
| deserialize | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def serialize(self):
"""Serializes itself to json
:rtype: dict
"""
storable = self.optionEnabled(PinOptions.Storable)
serializedData = None
if not self.dataType == "AnyPin":
if storable:
serializedData = json.dumps(self.currentData(),
... | Serializes itself to json
:rtype: dict
| serialize | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def setName(self, name, force=False):
"""Sets pin name and fires events
:param name: New pin name
:type name: str
:param force: If True - name will be changed even if option :attr:`~PyFlow.Core.Common.PinOptions.RenamingEnabled` is turned off
:type force: bool
:returns: ... | Sets pin name and fires events
:param name: New pin name
:type name: str
:param force: If True - name will be changed even if option :attr:`~PyFlow.Core.Common.PinOptions.RenamingEnabled` is turned off
:type force: bool
:returns: Whether renaming performed or not
:rtype:... | setName | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def defaultValue(self):
"""Returns default value of this pin
"""
if self.isArray():
return []
elif self.isDict():
return PFDict("StringPin", "AnyPin")
else:
return self._defaultValue | Returns default value of this pin
| defaultValue | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def clearError(self):
"""Clears any last error on this pin and fires event
"""
if self._lastError is not None:
self._lastError = None
self.errorCleared.send() | Clears any last error on this pin and fires event
| clearError | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def setData(self, data):
"""Sets value to pin
:param data: Data to be set
:type data: object
"""
if self.super is None:
return
try:
self.setDirty()
if isinstance(data, DictElement) and not self.optionEnabled(PinOptions.DictElementSuppo... | Sets value to pin
:param data: Data to be set
:type data: object
| setData | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def currentData(self):
"""Returns current value of this pin, without any graph evaluation
:rtype: object
"""
if self._data is None:
return self._defaultValue
return self._data | Returns current value of this pin, without any graph evaluation
:rtype: object
| currentData | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def aboutToConnect(self, other):
"""This method called right before two pins connected
:param other: Pin which this pin is going to be connected with
:type other: :class:`~PyFlow.Core.PinBase.PinBase`
"""
if other.structureType != self.structureType:
if self.optionEn... | This method called right before two pins connected
:param other: Pin which this pin is going to be connected with
:type other: :class:`~PyFlow.Core.PinBase.PinBase`
| aboutToConnect | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def getCurrentStructure(self):
"""Returns this pin structure type
:rtype: :class:`~PyFlow.Core.Common.StructureType`
"""
if self.structureType == StructureType.Multi:
if self._alwaysSingle:
return StructureType.Single
elif self._alwaysList:
... | Returns this pin structure type
:rtype: :class:`~PyFlow.Core.Common.StructureType`
| getCurrentStructure | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def changeStructure(self, newStruct, init=False):
"""Changes this pin structure type
:param newStruct: Target structure
:type newStruct: :class:`~PyFlow.Core.Common.StructureType`
:param init: **docs goes here**
:type init: bool
"""
free = self.canChangeStructure... | Changes this pin structure type
:param newStruct: Target structure
:type newStruct: :class:`~PyFlow.Core.Common.StructureType`
:param init: **docs goes here**
:type init: bool
| changeStructure | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def canChangeStructure(self, newStruct, checked=None, selfCheck=True, init=False):
"""Recursive function to determine if pin can change its structure
:param newStruct: New structure we want to apply
:type newStruct: :class:`~PyFlow.Core.Common.StructureType`
:param checked: Already visi... | Recursive function to determine if pin can change its structure
:param newStruct: New structure we want to apply
:type newStruct: :class:`~PyFlow.Core.Common.StructureType`
:param checked: Already visited pins, defaults to []
:type checked: list, optional
:param selfCheck: Defin... | canChangeStructure | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def canChangeTypeOnConnection(self, checked=None, can=True, extraPins=None, selfCheck=True):
"""Recursive function to determine if pin can change its dataType
:param checked: Already visited pins, defaults to []
:type checked: list, optional
:param can: Variable Updated during iteration... | Recursive function to determine if pin can change its dataType
:param checked: Already visited pins, defaults to []
:type checked: list, optional
:param can: Variable Updated during iteration, defaults to True
:type can: bool, optional
:param extraPins: extra pins, non-constrain... | canChangeTypeOnConnection | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def getDictElementNode(self, checked=None, node=None):
"""Get the connected :py:class:`PyFlow.Packages.PyFlowBase.Nodes.makeDictElement.makeDictElement` to this
pin recursively
:param checked: Currently visited pins, defaults to []
:type checked: list, optional
:param node: foun... | Get the connected :py:class:`PyFlow.Packages.PyFlowBase.Nodes.makeDictElement.makeDictElement` to this
pin recursively
:param checked: Currently visited pins, defaults to []
:type checked: list, optional
:param node: founded node, defaults to None
:rtype: :class:`~PyFlow.Core.No... | getDictElementNode | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def getDictNode(self, checked=None, node=None):
"""Get the connected :py:class:`PyFlow.Packages.PyFlowBase.Nodes.makeDict.makeDict` or
:py:class:`PyFlow.Packages.PyFlowBase.Nodes.makeAnyDict.makeAnyDict` to this pin recursively
:param checked: Currently visited pins, defaults to []
:typ... | Get the connected :py:class:`PyFlow.Packages.PyFlowBase.Nodes.makeDict.makeDict` or
:py:class:`PyFlow.Packages.PyFlowBase.Nodes.makeAnyDict.makeAnyDict` to this pin recursively
:param checked: Currently visited pins, defaults to []
:type checked: list, optional
:param node: founded node... | getDictNode | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def supportDictElement(self, checked=None, can=True, selfCheck=True):
"""Iterative functions that search in all connected pins to see if they support DictElement nodes.
:param checked: Already visited pins, defaults to []
:type checked: list, optional
:param can: this is the variable th... | Iterative functions that search in all connected pins to see if they support DictElement nodes.
:param checked: Already visited pins, defaults to []
:type checked: list, optional
:param can: this is the variable that will be actualized during the recursive function, defaults to False
:t... | supportDictElement | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def supportOnlyDictElement(self, checked=None, can=False, selfCheck=True):
"""Iterative Functions that search in all connected pins to see if they support only DictElement nodes, this
is done for nodes like makeDict and similar.
:param checked: Already Visited Pins, defaults to []
:type... | Iterative Functions that search in all connected pins to see if they support only DictElement nodes, this
is done for nodes like makeDict and similar.
:param checked: Already Visited Pins, defaults to []
:type checked: list, optional
:param can: this is the variable that will be actuali... | supportOnlyDictElement | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def updateConnectedDicts(self, checked=None, keyType=None):
"""Iterate over connected dicts pins and DictElements pins updating key data type
:param checked: Already visited pins, defaults to []
:type checked: list, optional
:param keyType: KeyDataType to set, defaults to None
:... | Iterate over connected dicts pins and DictElements pins updating key data type
:param checked: Already visited pins, defaults to []
:type checked: list, optional
:param keyType: KeyDataType to set, defaults to None
:type keyType: string, optional
| updateConnectedDicts | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def hasConnections(self):
"""Return the number of connections this pin has
:rtype: int
"""
numConnections = 0
if self.direction == PinDirection.Input:
numConnections += len(self.affected_by)
elif self.direction == PinDirection.Output:
numConnectio... | Return the number of connections this pin has
:rtype: int
| hasConnections | python | pedroCabrera/PyFlow | PyFlow/Core/PinBase.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PinBase.py | Apache-2.0 |
def compile(self, code):
"""Wraps code to function def
:param code: Code to wrap
:type code: :class:`str`
:returns: Function object
:rtype: :class:`function`
"""
foo = "def {}(self):".format(self._fooName)
lines = [i for i in code.split("\n") if len(i) > ... | Wraps code to function def
:param code: Code to wrap
:type code: :class:`str`
:returns: Function object
:rtype: :class:`function`
| compile | python | pedroCabrera/PyFlow | PyFlow/Core/PyCodeCompiler.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PyCodeCompiler.py | Apache-2.0 |
def compile(self, code, moduleName="PyFlowCodeCompiler", scope=None):
"""Evaluates supplied string
Used by python node
:param code: Whatever python code
:type code: str
:param moduleName: Used for runtime error messages
:type moduleName: str
:param scope: Storag... | Evaluates supplied string
Used by python node
:param code: Whatever python code
:type code: str
:param moduleName: Used for runtime error messages
:type moduleName: str
:param scope: Storage where symbols will be placed
:type scope: dict
| compile | python | pedroCabrera/PyFlow | PyFlow/Core/PyCodeCompiler.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/PyCodeCompiler.py | Apache-2.0 |
def __init__(
self,
graph,
value,
name,
dataType,
accessLevel=AccessLevel.public,
structure=StructureType.Single,
uid=None,
):
"""Constructor
:param graph: Owning graph
:type graph: :class:`~PyFlow.Core.GraphBase.GraphBase`
... | Constructor
:param graph: Owning graph
:type graph: :class:`~PyFlow.Core.GraphBase.GraphBase`
:param value: Variable value
:type value: object
:param name: Variable name
:type name: str
:param dataType: Variable data type
:type dataType: str
:para... | __init__ | python | pedroCabrera/PyFlow | PyFlow/Core/Variable.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/Variable.py | Apache-2.0 |
def jsonTemplate():
"""Returns dictionary with minimum required fields for serialization
:rtype: dict
"""
template = {
"name": None,
"value": None,
"dataType": None,
"accessLevel": None,
"package": None,
"uuid": Non... | Returns dictionary with minimum required fields for serialization
:rtype: dict
| jsonTemplate | python | pedroCabrera/PyFlow | PyFlow/Core/Variable.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/Variable.py | Apache-2.0 |
def fromString(string):
"""Constructs version class from string
>>> v = Version.fromString("1.0.2")
:param string: Version as string
:type string: str
"""
major, minor, patch = string.split(".")
return Version(int(major), int(minor), int(patch)) | Constructs version class from string
>>> v = Version.fromString("1.0.2")
:param string: Version as string
:type string: str
| fromString | python | pedroCabrera/PyFlow | PyFlow/Core/version.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Core/version.py | Apache-2.0 |
def extendArray(
lhs=(
"AnyPin",
[],
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.ENABLED_OPTIONS: PinOptions.ArraySupported
| PinOptions.AllowAny,
},
),
rhs=(
... | Extend the list by appending all the items from the iterable. | extendArray | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/ArrayLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/ArrayLib.py | Apache-2.0 |
def insertToArray(
ls=(
"AnyPin",
[],
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.ENABLED_OPTIONS: PinOptions.ArraySupported
| PinOptions.AllowAny,
},
),
elem=("AnyPi... | Insert an item at a given position. The first argument is the index of the element before which to insert. | insertToArray | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/ArrayLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/ArrayLib.py | Apache-2.0 |
def removeFromArray(
ls=(
"AnyPin",
[],
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.ENABLED_OPTIONS: PinOptions.ArraySupported
| PinOptions.AllowAny,
},
),
elem=("Any... | Remove the first item from the list whose value is equal to x. | removeFromArray | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/ArrayLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/ArrayLib.py | Apache-2.0 |
def popFromArray(
ls=(
"AnyPin",
[],
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.ENABLED_OPTIONS: PinOptions.ArraySupported
| PinOptions.AllowAny,
},
),
index=("IntPi... | Remove the item at the given position in the array, and return it. If no index is specified, ``a.pop()`` removes and returns the last item in the list. | popFromArray | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/ArrayLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/ArrayLib.py | Apache-2.0 |
def clearArray(
ls=(
"AnyPin",
[],
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.ENABLED_OPTIONS: PinOptions.ArraySupported
| PinOptions.AllowAny,
},
)
):
"""Remove... | Remove all items from the list. | clearArray | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/ArrayLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/ArrayLib.py | Apache-2.0 |
def arrayElementIndex(
ls=(
"AnyPin",
[],
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.ENABLED_OPTIONS: PinOptions.ArraySupported
| PinOptions.AllowAny,
},
),
element=... | Returns index of array element if it present. If element is not in array -1 will be returned. | arrayElementIndex | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/ArrayLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/ArrayLib.py | Apache-2.0 |
def copyObject(
obj=(
"AnyPin",
None,
{
PinSpecifiers.ENABLED_OPTIONS: PinOptions.ArraySupported
| PinOptions.AllowAny
| PinOptions.DictElementSupported,
... | Shallow or deep copy of an object. | copyObject | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/DefaultLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/DefaultLib.py | Apache-2.0 |
def getAttribute(
obj=("AnyPin", None, PIN_ALLOWS_ANYTHING.copy()), name=("StringPin", "attrName")
):
"""Returns attribute from object using "getattr(name)\""""
return getattr(obj, name) | Returns attribute from object using "getattr(name)" | getAttribute | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/DefaultLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/DefaultLib.py | Apache-2.0 |
def select(
A=(
"AnyPin",
None,
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.ENABLED_OPTIONS: PinOptions.ArraySupported
| PinOptions.AllowAny
| PinO... |
If bPickA is true, A is returned, otherwise B.
| select | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/DefaultLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/DefaultLib.py | Apache-2.0 |
def contains(
obj=(
"AnyPin",
None,
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.ENABLED_OPTIONS: PinOptions.ArraySupported
| PinOptions.AllowAny
| ... | Python's **in** keyword. `element in obj` will be executed | contains | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/DefaultLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/DefaultLib.py | Apache-2.0 |
def getItem(
obj=(
"AnyPin",
None,
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.ENABLED_OPTIONS: PinOptions.ArraySupported
| PinOptions.AllowAny,
},
),
element=(
... | Python's ``[]`` operator. ``obj[element]`` will be executed. | getItem | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/DefaultLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/DefaultLib.py | Apache-2.0 |
def appendTo(
obj=(
"AnyPin",
None,
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.STRUCT_CONSTRAINT: "1",
PinSpecifiers.ENABLED_OPTIONS: PinOptions.ArraySupported
| PinOptions.Allo... | Calls ``obj.append(element)``. And returns object. If failed - object is unchanged | appendTo | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/DefaultLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/DefaultLib.py | Apache-2.0 |
def addTo(
obj=(
"AnyPin",
None,
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.STRUCT_CONSTRAINT: "1",
PinSpecifiers.ENABLED_OPTIONS: PinOptions.ArraySupported
| PinOptions.AllowAn... | Calls ``obj.add(element)``. And returns object. If failed - object is unchanged | addTo | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/DefaultLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/DefaultLib.py | Apache-2.0 |
def normalizeToRange(
Value=("FloatPin", 0.0), RangeMin=("FloatPin", 0.0), RangeMax=("FloatPin", 0.0)
):
"""
Returns Value normalized to the given range. (e.g. 20 normalized to the range 10->50 would result in 0.25)
"""
if RangeMin == RangeMax:
return RangeMin
... |
Returns Value normalized to the given range. (e.g. 20 normalized to the range 10->50 would result in 0.25)
| normalizeToRange | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/FloatLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/FloatLib.py | Apache-2.0 |
def roundf(
Value=("FloatPin", 0.0),
Digits=("IntPin", 0, {PinSpecifiers.VALUE_RANGE: (0, 323)}),
):
"""
Round a number to a given precision in decimal digits.
"""
return round(Value, Digits) |
Round a number to a given precision in decimal digits.
| roundf | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/FloatLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/FloatLib.py | Apache-2.0 |
def testBit(intType=("IntPin", 0), offset=("IntPin", 0)):
"""Returns a nonzero result, 2**offset, if the bit at 'offset' is one"""
mask = 1 << offset
return intType & mask | Returns a nonzero result, 2**offset, if the bit at 'offset' is one | testBit | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/IntLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/IntLib.py | Apache-2.0 |
def setBit(intType=("IntPin", 0), offset=("IntPin", 0)):
"""Returns an integer with the bit at 'offset' set to 1."""
mask = 1 << offset
return intType | mask | Returns an integer with the bit at 'offset' set to 1. | setBit | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/IntLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/IntLib.py | Apache-2.0 |
def clearBit(intType=("IntPin", 0), offset=("IntPin", 0)):
"""Returns an integer with the bit at 'offset' cleared."""
mask = ~(1 << offset)
return intType & mask | Returns an integer with the bit at 'offset' cleared. | clearBit | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/IntLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/IntLib.py | Apache-2.0 |
def toggleBit(intType=("IntPin", 0), offset=("IntPin", 0)):
"""Returns an integer with the bit at 'offset' inverted, 0 -> 1 and 1 -> 0."""
mask = 1 << offset
return intType ^ mask | Returns an integer with the bit at 'offset' inverted, 0 -> 1 and 1 -> 0. | toggleBit | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/IntLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/IntLib.py | Apache-2.0 |
def inRange(
Value=(
"AnyPin",
None,
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.SUPPORTED_DATA_TYPES: ["FloatPin", "IntPin"],
},
),
RangeMin=(
"AnyPin",
None,
{
... | Returns true if value is between Min and Max (V >= Min && V <= Max) If InclusiveMin is true, value needs to be equal or larger than Min, else it needs to be larger If InclusiveMax is true, value needs to be smaller or equal than Max, else it needs to be smaller
| inRange | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/MathAbstractLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/MathAbstractLib.py | Apache-2.0 |
def mapRangeClamped(
Value=("FloatPin", 0.0),
InRangeA=("FloatPin", 0.0),
InRangeB=("FloatPin", 0.0),
OutRangeA=("FloatPin", 0.0),
OutRangeB=("FloatPin", 0.0),
):
"""Returns Value mapped from one range into another where the Value is clamped to the Input Range.\
... | Returns Value mapped from one range into another where the Value is clamped to the Input Range. (e.g. 0.5 normalized from the range 0->1 to 0->50 would result in 25) | mapRangeClamped | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/MathAbstractLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/MathAbstractLib.py | Apache-2.0 |
def abs(
inp=(
"AnyPin",
None,
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.SUPPORTED_DATA_TYPES: ["FloatPin", "IntPin"],
},
)
):
"""Return the absolute value of a number."""
return abs(inp) | Return the absolute value of a number. | abs | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/MathAbstractLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/MathAbstractLib.py | Apache-2.0 |
def copysign(
x=(
"AnyPin",
0,
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.SUPPORTED_DATA_TYPES: ["FloatPin", "IntPin"],
},
),
y=(
"AnyPin",
0,
{
PinSpecifiers.C... | Return `x` with the sign of `y`. On a platform that supports signed zeros, `copysign(1.0, -0.0)` returns `-1.0`. | copysign | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | Apache-2.0 |
def fmod(
x=(
"AnyPin",
0,
{
PinSpecifiers.CONSTRAINT: "1",
PinSpecifiers.SUPPORTED_DATA_TYPES: ["FloatPin", "IntPin"],
},
),
y=(
"AnyPin",
0,
{
PinSpecifiers.CONST... | Return `fmod(x, y)`, as defined by the platform C library. | fmod | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | Apache-2.0 |
def modf(
x=("FloatPin", 0.0), f=(REF, ("FloatPin", 0.0)), i=(REF, ("FloatPin", 0.0))
):
"""Return the fractional and integer parts of `x`. Both results carry the sign of `x` and are floats."""
t = math.modf(x)
f(t[0])
i(t[1]) | Return the fractional and integer parts of `x`. Both results carry the sign of `x` and are floats. | modf | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | Apache-2.0 |
def factorial(x=("IntPin", 0), result=(REF, ("BoolPin", False))):
"""Return `x` factorial. Raises ValueError if `x` is not integral or is negative."""
try:
f = math.factorial(x)
result(True)
return f
except:
result(False)
return -1 | Return `x` factorial. Raises ValueError if `x` is not integral or is negative. | factorial | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | Apache-2.0 |
def fsum(arr=("FloatPin", []), result=(REF, ("BoolPin", False))):
"""Return an accurate floating point sum of values in the iterable. Avoids loss of precision by tracking multiple intermediate partial sums."""
try:
s = math.fsum([i for i in arr])
result(True)
return s... | Return an accurate floating point sum of values in the iterable. Avoids loss of precision by tracking multiple intermediate partial sums. | fsum | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | Apache-2.0 |
def log(
x=("FloatPin", 1.0), base=("FloatPin", math.e), result=(REF, ("BoolPin", False))
):
"""Return the logarithm of `x` to the given base, calculated as `log(x)/log(base)`."""
try:
result(True)
return math.log(x, base)
except:
result(False)
... | Return the logarithm of `x` to the given base, calculated as `log(x)/log(base)`. | log | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | Apache-2.0 |
def log1p(x=("FloatPin", 1.0), result=(REF, ("BoolPin", False))):
"""Return the natural logarithm of `1+x` (base e). The result is calculated in a way which is accurate for `x` near zero."""
try:
result(True)
return math.log1p(x)
except:
result(False)
... | Return the natural logarithm of `1+x` (base e). The result is calculated in a way which is accurate for `x` near zero. | log1p | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | Apache-2.0 |
def log10(x=("FloatPin", 1.0), result=(REF, ("BoolPin", False))):
"""Return the base-10 logarithm of `x`. This is usually more accurate than `log(x, 10)`."""
try:
result(True)
return math.log10(x)
except:
result(False)
return -1 | Return the base-10 logarithm of `x`. This is usually more accurate than `log(x, 10)`. | log10 | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | Apache-2.0 |
def acosh(x=("FloatPin", 0.0), Result=(REF, ("BoolPin", False))):
"""Return the inverse hyperbolic cosine of `x`."""
try:
Result(True)
return math.acosh(x)
except:
Result(False)
return -1 | Return the inverse hyperbolic cosine of `x`. | acosh | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | Apache-2.0 |
def atanh(x=("FloatPin", 0.0), Result=(REF, ("BoolPin", False))):
"""Return the inverse hyperbolic tangent of `x`."""
try:
Result(True)
return math.atanh(x)
except:
Result(False)
return -1 | Return the inverse hyperbolic tangent of `x`. | atanh | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | Apache-2.0 |
def lgamma(x=("FloatPin", 0.0), Result=(REF, ("BoolPin", False))):
"""Return the natural logarithm of the absolute value of the Gamma function at `x`."""
try:
Result(True)
return math.lgamma(x)
except:
Result(False)
return -1 | Return the natural logarithm of the absolute value of the Gamma function at `x`. | lgamma | python | pedroCabrera/PyFlow | PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/MathLib.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.