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 abspath( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Return an absolute version of a path. On most platforms, this is equivalent to calling the function normpath()""" return osPath.abspath(path)
Return an absolute version of a path. On most platforms, this is equivalent to calling the function normpath()
abspath
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def basename( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Return the base name of pathname path. This is the second element of the pair returned by passing path to the function split(). Note that the result of this function is different from the Unix basename pro...
Return the base name of pathname path. This is the second element of the pair returned by passing path to the function split(). Note that the result of this function is different from the Unix basename program; where basename for '/foo/bar/' returns 'bar', the basename() function returns an empty string ('')
basename
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def dirname( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Return the directory name of pathname path. This is the first element of the pair returned by passing path to the function split().""" return osPath.dirname(path)
Return the directory name of pathname path. This is the first element of the pair returned by passing path to the function split().
dirname
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def exists( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Return True if path refers to an existing path. Returns False for broken symbolic links. On some platforms, this function may return False if permission is not granted to execute os.stat() on the requested f...
Return True if path refers to an existing path. Returns False for broken symbolic links. On some platforms, this function may return False if permission is not granted to execute os.stat() on the requested file, even if the path physically exists.
exists
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def lexists( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Return True if path refers to an existing path. Returns True for broken symbolic links. Equivalent to exists() on platforms lacking os.lstat().""" return osPath.lexists(path)
Return True if path refers to an existing path. Returns True for broken symbolic links. Equivalent to exists() on platforms lacking os.lstat().
lexists
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def expandvars( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Return the argument with environment variables expanded. Substrings of the form $name or ${name} are replaced by the value of environment variable name. Malformed variable names and references to non-exi...
Return the argument with environment variables expanded. Substrings of the form $name or ${name} are replaced by the value of environment variable name. Malformed variable names and references to non-existing variables are left unchanged. On Windows, %name% expansions are supported in addition to $name and ${na...
expandvars
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def getatime( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Return the time of last access of path. The return value is a number giving the number of seconds since the epoch (see the time module). Raise os.error if the file does not exist or is inaccessible.""" ...
Return the time of last access of path. The return value is a number giving the number of seconds since the epoch (see the time module). Raise os.error if the file does not exist or is inaccessible.
getatime
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def getmtime( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Return the time of last modification of path. The return value is a number giving the number of seconds since the epoch (see the time module). Raise os.error if the file does not exist or is inaccessible."...
Return the time of last modification of path. The return value is a number giving the number of seconds since the epoch (see the time module). Raise os.error if the file does not exist or is inaccessible.
getmtime
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def getsize( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Return the size, in bytes, of path. Raise os.error if the file does not exist or is inaccessible.""" return osPath.getctime(path)
Return the size, in bytes, of path. Raise os.error if the file does not exist or is inaccessible.
getsize
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def isabs( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Return True if path is an absolute pathname. On Unix, that means it begins with a slash, on Windows that it begins with a (back)slash after chopping off a potential drive letter.""" return osPath.isab...
Return True if path is an absolute pathname. On Unix, that means it begins with a slash, on Windows that it begins with a (back)slash after chopping off a potential drive letter.
isabs
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def isFile( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Return True if path is an existing regular file. This follows symbolic links, so both islink() and isfile() can be true for the same path.""" return osPath.isfile(path)
Return True if path is an existing regular file. This follows symbolic links, so both islink() and isfile() can be true for the same path.
isFile
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def isDir( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Return True if path is an existing directory. This follows symbolic links, so both islink() and isdir() can be true for the same path.""" return osPath.isdir(path)
Return True if path is an existing directory. This follows symbolic links, so both islink() and isdir() can be true for the same path.
isDir
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def islink( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Return True if path refers to a directory entry that is a symbolic link. Always False if symbolic links are not supported by the Python runtime.""" return osPath.islink(path)
Return True if path refers to a directory entry that is a symbolic link. Always False if symbolic links are not supported by the Python runtime.
islink
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def join( base=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}), paths=("StringPin", []), ): """Join one or more path components intelligently. The return value is the concatenation of path and any members of *paths with exactly one directory separator (os.sep) following...
Join one or more path components intelligently. The return value is the concatenation of path and any members of *paths with exactly one directory separator (os.sep) following each non-empty part except the last, meaning that the result will only end in a separator if the last part is empty. If a component is an absolu...
join
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def normcase( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Normalize the case of a pathname. On Unix and Mac OS X, this returns the path unchanged; on case-insensitive filesystems, it converts the path to lowercase. On Windows, it also converts forward slashes to ...
Normalize the case of a pathname. On Unix and Mac OS X, this returns the path unchanged; on case-insensitive filesystems, it converts the path to lowercase. On Windows, it also converts forward slashes to backward slashes.
normcase
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def normpath( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Normalize a pathname by collapsing redundant separators and up-level references so that A//B, A/B/, A/./B and A/foo/../B all become A/B. This string manipulation may change the meaning of a path that conta...
Normalize a pathname by collapsing redundant separators and up-level references so that A//B, A/B/, A/./B and A/foo/../B all become A/B. This string manipulation may change the meaning of a path that contains symbolic links. On Windows, it converts forward slashes to backward slashes. To normalize case, use normcase().
normpath
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def realpath( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Return the canonical path of the specified filename, eliminating any symbolic links encountered in the path (if they are supported by the operating system).""" return osPath.realpath(path)
Return the canonical path of the specified filename, eliminating any symbolic links encountered in the path (if they are supported by the operating system).
realpath
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def relpath( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}), start=("StringPin", os.curdir), ): """Return a relative filepath to path either from the current directory or from an optional start directory. This is a path computation: the filesystem is not accessed ...
Return a relative filepath to path either from the current directory or from an optional start directory. This is a path computation: the filesystem is not accessed to confirm the existence or nature of path or start. start defaults to os.curdir. Availability: Windows, Unix.
relpath
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def split( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}), head=(REF, ("StringPin", "")), tail=(REF, ("StringPin", "")), ): """Split the pathname path into a pair, (head, tail) where tail is the last pathname component and head is everything leading up to ...
Split the pathname path into a pair, (head, tail) where tail is the last pathname component and head is everything leading up to that. The tail part will never contain a slash; if path ends in a slash, tail will be empty. If there is no slash in path, head will be empty. If path is empty, both head and tail are empty. ...
split
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def splitdrive( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}), drive=(REF, ("StringPin", "")), tail=(REF, ("StringPin", "")), ): """Split the pathname path into a pair (drive, tail) where drive is either a drive specification or the empty string. On syste...
Split the pathname path into a pair (drive, tail) where drive is either a drive specification or the empty string. On systems which do not use drive specifications, drive will always be the empty string. In all cases, drive + tail will be the same as path.
splitdrive
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def splitext( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}), root=(REF, ("StringPin", "")), ext=(REF, ("StringPin", "")), ): """Split the pathname path into a pair (root, ext) such that root + ext == path, and ext is empty or begins with a period and cont...
Split the pathname path into a pair (root, ext) such that root + ext == path, and ext is empty or begins with a period and contains at most one period. Leading periods on the basename are ignored; splitext('.cshrc') returns ('.cshrc', '').
splitext
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def splitunc( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}), unc=(REF, ("StringPin", "")), rest=(REF, ("StringPin", "")), ): """Split the pathname path into a pair (unc, rest) so that unc is the UNC mount point (such as r'\\host\mount'), if present, and r...
Split the pathname path into a pair (unc, rest) so that unc is the UNC mount point (such as r'\host\mount'), if present, and rest the rest of the path (such as r'\path ile.ext'). For paths containing drive letters, unc will always be the empty string.
splitunc
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def walk( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}), topdown=("BoolPin", False), files=(REF, ("StringPin", [])), folders=(REF, ("StringPin", [])), ): """Lists files and directories on Path recursive""" paths = [] pfiles = [] ...
Lists files and directories on Path recursive
walk
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def listDir( path=("StringPin", "", {PinSpecifiers.INPUT_WIDGET_VARIANT: "PathWidget"}) ): """Lists files and directories on Path""" return [osPath.join(path, x) for x in os.listdir(path)]
Lists files and directories on Path
listDir
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/FunctionLibraries/PathLib.py
Apache-2.0
def onGraphInputPinCreated(self, outPin): """Reaction when pin added to graphInputs node :param outPin: output pin on graphInputs node :type outPin: :class:`~PyFlow.Core.PinBase.PinBase` """ # add companion pin for graphInputs node's output pin subgraphInputPin = self.c...
Reaction when pin added to graphInputs node :param outPin: output pin on graphInputs node :type outPin: :class:`~PyFlow.Core.PinBase.PinBase`
onGraphInputPinCreated
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Nodes/compound.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Nodes/compound.py
Apache-2.0
def onGraphOutputPinCreated(self, inPin): """Reaction when pin added to graphOutputs node :param inPin: input pin on graphOutputs node :type inPin: :class:`~PyFlow.Core.PinBase.PinBase` """ # add companion pin for graphOutputs node's input pin subgraphOutputPin = self.c...
Reaction when pin added to graphOutputs node :param inPin: input pin on graphOutputs node :type inPin: :class:`~PyFlow.Core.PinBase.PinBase`
onGraphOutputPinCreated
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Nodes/compound.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Nodes/compound.py
Apache-2.0
def __init__(self, name, owningNode, direction, **kwargs): """ :param name: Pin name :type name: string :param owningNode: Owning Node :type owningNode: :py:class:`PyFlow.Core.NodeBase.NodeBase` :param direction: PinDirection , can be input or output :type directi...
:param name: Pin name :type name: string :param owningNode: Owning Node :type owningNode: :py:class:`PyFlow.Core.NodeBase.NodeBase` :param direction: PinDirection , can be input or output :type direction: :py:class:`PyFlow.Core.Common.PinDirection`
__init__
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
Apache-2.0
def setTypeFromData(self, data): """Initialize DataType from actual data Iterates all defined Pin and compares type(data) with Pin.internalDataStructure() to find a valid DataType :param data: Actual data to search Pin/dataType from """ for pin in [pin for pin in getAllPinClass...
Initialize DataType from actual data Iterates all defined Pin and compares type(data) with Pin.internalDataStructure() to find a valid DataType :param data: Actual data to search Pin/dataType from
setTypeFromData
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
Apache-2.0
def updateError(self, traversed=None, updateNeis=False): """Check if pin dataType is "AnyPin" and if it is, checks if it can change Type on connection, and if it can, marked as error. Is an iterative Function that traverses connected and constrained Pins :param traversed: Current Iterated neigh...
Check if pin dataType is "AnyPin" and if it is, checks if it can change Type on connection, and if it can, marked as error. Is an iterative Function that traverses connected and constrained Pins :param traversed: Current Iterated neighbors, defaults to [] :type traversed: list, optional ...
updateError
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
Apache-2.0
def serialize(self): """Stores The data to Json Appends current value and currentDataType to default :py:func:`PyFlow.Core.PinBase.PinBase.serialize` method :returns: json data :rtype: dict """ dt = super(AnyPin, self).serialize() constrainedType = self.activeDat...
Stores The data to Json Appends current value and currentDataType to default :py:func:`PyFlow.Core.PinBase.PinBase.serialize` method :returns: json data :rtype: dict
serialize
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
Apache-2.0
def deserialize(self, jsonData): """Reconstruct Pin from saved jsonData :param jsonData: Input Json Saved data :type jsonData: dict """ super(AnyPin, self).deserialize(jsonData) if "currDataType" in jsonData: self.setType(jsonData["currDataType"]) pi...
Reconstruct Pin from saved jsonData :param jsonData: Input Json Saved data :type jsonData: dict
deserialize
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
Apache-2.0
def pinConnected(self, other): """Pin Connection been Made We update Error here to search for nonInitialized Pins in current Node, and in connected Nodes if initializing :param other: Pin that has been connected to this Pin. :type other: :py:class:`PyFlow.Core.PinBase.PinBase` ...
Pin Connection been Made We update Error here to search for nonInitialized Pins in current Node, and in connected Nodes if initializing :param other: Pin that has been connected to this Pin. :type other: :py:class:`PyFlow.Core.PinBase.PinBase`
pinConnected
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
Apache-2.0
def aboutToConnect(self, other): """Function called before real connection but after :py:func:`PyFlow.Core.Common.canConnectPins` returns True We traverse connected and constrained Pins here to search if we can change Pin dataType, and if we can we traverse again changing all the necessary data...
Function called before real connection but after :py:func:`PyFlow.Core.Common.canConnectPins` returns True We traverse connected and constrained Pins here to search if we can change Pin dataType, and if we can we traverse again changing all the necessary datatypes in connected Graph Pins. :par...
aboutToConnect
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
Apache-2.0
def pinDisconnected(self, other): """Pin has been disconnected We update error here and checkFor errors in owning Node :param other: Pin that has been disconnected to this Pin. :type other: :py:class:`PyFlow.Core.PinBase.PinBase` """ super(AnyPin, self).pinDisconnected(...
Pin has been disconnected We update error here and checkFor errors in owning Node :param other: Pin that has been disconnected to this Pin. :type other: :py:class:`PyFlow.Core.PinBase.PinBase`
pinDisconnected
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
Apache-2.0
def updateOnConnectionCallback(pin, dataType, init=False, other=None): """Method Called in traverse function :py:func:`PyFlow.Core.Common.traverseConstrainedPins` This Function is called for all the connected Pins to the initial Pin calling it. Here we traverse all pins and call :py:func:`AnyPi...
Method Called in traverse function :py:func:`PyFlow.Core.Common.traverseConstrainedPins` This Function is called for all the connected Pins to the initial Pin calling it. Here we traverse all pins and call :py:func:`AnyPin.setType` for all of them. We also intersect all the connected pins allow...
updateOnConnectionCallback
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
Apache-2.0
def checkFree(self, checked=None, selfCheck=True): """Recursive Function to find if all connected Pins are of type :py:class:`AnyPin` and canChange On connection, so basically it checks if a Pin is free to change its dataType to another one :param checked: Already visited Pins, defaults to [] ...
Recursive Function to find if all connected Pins are of type :py:class:`AnyPin` and canChange On connection, so basically it checks if a Pin is free to change its dataType to another one :param checked: Already visited Pins, defaults to [] :type checked: list, optional :param selfCheck:...
checkFree
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
Apache-2.0
def allowedDataTypes( self, checked=None, dataTypes=None, selfCheck=True, defaults=False ): """Recursive Function to intersect allowedDatatypes of all connected pins. :param checked: Already visited Pins, defaults to [] :type checked: list, optional :param dataTypes: Interse...
Recursive Function to intersect allowedDatatypes of all connected pins. :param checked: Already visited Pins, defaults to [] :type checked: list, optional :param dataTypes: Intersected dataTypes, defaults to [] :type dataTypes: list, optional :param selfCheck: Define if check Pi...
allowedDataTypes
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
Apache-2.0
def initType(self, dataType, initializing=False): """Same as :py:func:`AnyPin.aboutToConnect` but instead of using another Pin using a dataType name :param dataType: New DataType we want the pin to become :type dataType: string :param initializing: If initializing AnyPin can have same ...
Same as :py:func:`AnyPin.aboutToConnect` but instead of using another Pin using a dataType name :param dataType: New DataType we want the pin to become :type dataType: string :param initializing: If initializing AnyPin can have same strength as other types, if not, "AnyPin" Pin will always be ...
initType
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
Apache-2.0
def setType(self, dataType): """Here is where :py:class:`AnyPin` here-dates all the properties from other defined dataTypes and act like those :param dataType: New DataType :type dataType: string :returns: True if success setting dataType :rtype: bool """ if self...
Here is where :py:class:`AnyPin` here-dates all the properties from other defined dataTypes and act like those :param dataType: New DataType :type dataType: string :returns: True if success setting dataType :rtype: bool
setType
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Pins/AnyPin.py
Apache-2.0
def addLoggingLevel(levelName, levelNum, methodName=None): """ Comprehensively adds a new logging level to the `logging` module and the currently configured logging class. `levelName` becomes an attribute of the `logging` module with the value `levelNum`. `methodName` becomes a convenience method f...
Comprehensively adds a new logging level to the `logging` module and the currently configured logging class. `levelName` becomes an attribute of the `logging` module with the value `levelNum`. `methodName` becomes a convenience method for both `logging` itself and the class returned by `logging.ge...
addLoggingLevel
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/Tools/LoggerTool.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/Tools/LoggerTool.py
Apache-2.0
def __init__(self, owningNode, raw_pin): """UI wrapper for :class:`PyFlow.Packages.PyFlowBase.Pins.AnyPin` :param owningNode: Owning node :type owningNode: :class:`PyFlow.UI.Canvas.NodeBase` :param raw_pin: PinBase reference :type raw_pin: :class:`PyFlow.Packages.PyFlowBase.Pins...
UI wrapper for :class:`PyFlow.Packages.PyFlowBase.Pins.AnyPin` :param owningNode: Owning node :type owningNode: :class:`PyFlow.UI.Canvas.NodeBase` :param raw_pin: PinBase reference :type raw_pin: :class:`PyFlow.Packages.PyFlowBase.Pins.AnyPin.AnyPin`
__init__
python
pedroCabrera/PyFlow
PyFlow/Packages/PyFlowBase/UI/UIAnyPin.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Packages/PyFlowBase/UI/UIAnyPin.py
Apache-2.0
def getGraphArguments(data, parser): """Adds arguments to parser using graph input nodes :param data: Parsed json graph :type data: dict :param parser: ArgumentParser class instance :type parser: ArgumentParser """ typeMapping = {"BoolPin": bool, "StringPin": str, "IntPin": int, "FloatPin":...
Adds arguments to parser using graph input nodes :param data: Parsed json graph :type data: dict :param parser: ArgumentParser class instance :type parser: ArgumentParser
getGraphArguments
python
pedroCabrera/PyFlow
PyFlow/Scripts/__init__.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Scripts/__init__.py
Apache-2.0
def finalizeRename(self, accepted=False): """Called by :class:`~PyFlow.UI.Canvas.UINodeBase.NodeName` If user pressed :kbd:`escape` name before editing will be restored. If User pressed :kbd:`enter` or removed focus rename action will be accepted and node will be renamed and name will be checke...
Called by :class:`~PyFlow.UI.Canvas.UINodeBase.NodeName` If user pressed :kbd:`escape` name before editing will be restored. If User pressed :kbd:`enter` or removed focus rename action will be accepted and node will be renamed and name will be checked for uniqueness. :param accepted: Whether u...
finalizeRename
python
pedroCabrera/PyFlow
PyFlow/UI/Canvas/UINodeBase.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Canvas/UINodeBase.py
Apache-2.0
def getTopMostOwningCollapsedComment(self): """Returns top most owning comment. If bCollapsed=True, it will stop when first collapsed comment is found. """ if self.owningCommentNode is None: return None # build chain of comments collapse states topMostComment = self.o...
Returns top most owning comment. If bCollapsed=True, it will stop when first collapsed comment is found.
getTopMostOwningCollapsedComment
python
pedroCabrera/PyFlow
PyFlow/UI/Canvas/UINodeBase.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Canvas/UINodeBase.py
Apache-2.0
def __init__(self, owningNode, raw_pin): """UI wrapper for :class:`PyFlow.Core.PinBase` :param owningNode: Owning node :type owningNode: :class:`PyFlow.UI.Canvas.NodeBase` :param raw_pin: PinBase reference :type raw_pin: :class:`PyFlow.Core.PinBase.PinBase` """ ...
UI wrapper for :class:`PyFlow.Core.PinBase` :param owningNode: Owning node :type owningNode: :class:`PyFlow.UI.Canvas.NodeBase` :param raw_pin: PinBase reference :type raw_pin: :class:`PyFlow.Core.PinBase.PinBase`
__init__
python
pedroCabrera/PyFlow
PyFlow/UI/Canvas/UIPinBase.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Canvas/UIPinBase.py
Apache-2.0
def pinCenter(self): """Point relative to pin widget, where circle is drawn.""" frame = QtCore.QRectF(QtCore.QPointF(0, 0), self.geometry().size()) halfPinSize = self.pinSize / 2 pinX = self.pinSize pinY = frame.height() / 2 if not self.bLabelHidden: if self....
Point relative to pin widget, where circle is drawn.
pinCenter
python
pedroCabrera/PyFlow
PyFlow/UI/Canvas/UIPinBase.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Canvas/UIPinBase.py
Apache-2.0
def kill(self, *args, **kwargs): """this will be called after raw pin is deleted """ scene = self.scene() if scene is None: del self return if self._rawPin.direction == PinDirection.Input: self.owningNode().inputsLayout.removeItem(self) ...
this will be called after raw pin is deleted
kill
python
pedroCabrera/PyFlow
PyFlow/UI/Canvas/UIPinBase.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Canvas/UIPinBase.py
Apache-2.0
def parseFunctionFile(self, defname): #https://nedbatchelder.com/text/python-parsers.html #Maybe use Code Parser ''' Function Dictionary Structure ["Name"] - Function Name ["Order"] - Order in Appearanc...
Function Dictionary Structure ["Name"] - Function Name ["Order"] - Order in Appearance ["Meta"] - Meta Data ["Inputs"] - Pin Input List ["...
parseFunctionFile
python
pedroCabrera/PyFlow
PyFlow/UI/Forms/PackageBuilder/PackageBuilder.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Forms/PackageBuilder/PackageBuilder.py
Apache-2.0
def on_tblFInputPins_clicked(self, index): '''print(index) print("Click", self.ui.tblFInputPins.model().index(index.row(), 0).data()) print("Row %d and Column %d was clicked" % (index.row(), index.column())) print(self.ui.tblFInputPins.model().data(index, QtCore.Qt.UserRole))''' ...
print(index) print("Click", self.ui.tblFInputPins.model().index(index.row(), 0).data()) print("Row %d and Column %d was clicked" % (index.row(), index.column())) print(self.ui.tblFInputPins.model().data(index, QtCore.Qt.UserRole))
on_tblFInputPins_clicked
python
pedroCabrera/PyFlow
PyFlow/UI/Forms/PackageBuilder/PackageBuilder.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Forms/PackageBuilder/PackageBuilder.py
Apache-2.0
def loadInit(self, f): '''["Class Imports", "Pins", "Functions", "Nodes", "Factories", "Prefs widgets", "Foo Dict", "Node Dict", "Pin Dict", "Toolbar Dict", "Export", "Preferred Widgets", "Base Package"]''' packageRoot = Packages.__path__[0] s...
["Class Imports", "Pins", "Functions", "Nodes", "Factories", "Prefs widgets", "Foo Dict", "Node Dict", "Pin Dict", "Toolbar Dict", "Export", "Preferred Widgets", "Base Package"]
loadInit
python
pedroCabrera/PyFlow
PyFlow/UI/Forms/PackageBuilder/PackageBuilder.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Forms/PackageBuilder/PackageBuilder.py
Apache-2.0
def get_filepaths(self, directory): """ https://realpython.com/working-with-files-in-python/ This function will generate the file names in a directory tree by walking the tree either top-down or bottom-up. For each directory in the tree rooted at directory top (including top its...
ERROR: type should be string, got "\n https://realpython.com/working-with-files-in-python/\n\n This function will generate the file names in a directory\n tree by walking the tree either top-down or bottom-up. For each\n directory in the tree rooted at directory top (including top itself),\n it yields a 3-tuple (dirpath, dirnames, filenames).\n\n # List all files in a directory using os.listdir\n basepath = 'my_directory/'\n for entry in os.listdir(basepath):\n if os.path.isfile(os.path.join(basepath, entry)):\n print(entry)\n\n # List all files in a directory using scandir()\n basepath = 'my_directory/'\n with os.scandir(basepath) as entries:\n for entry in entries:\n if entry.is_file():\n print(entry.name)\n\n from pathlib import Path\n\n # List all files in directory using pathlib\n basepath = Path('my_directory/')\n files_in_basepath = (entry for entry in basepath.iterdir() if entry.is_file())\n for item in files_in_basepath:\n print(item.name)\n\n "
get_filepaths
python
pedroCabrera/PyFlow
PyFlow/UI/Forms/RibbonBuilder/frmRibbonBuilder.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Forms/RibbonBuilder/frmRibbonBuilder.py
Apache-2.0
def restoreState(self, settings): """Called when application loaded Restore any saved state here. Same as **saveState**, settings group already selected, so just call **value** method to access data .. code-block:: :linenos: def restoreState(self, setti...
Called when application loaded Restore any saved state here. Same as **saveState**, settings group already selected, so just call **value** method to access data .. code-block:: :linenos: def restoreState(self, settings): super(ScreenshotTool, s...
restoreState
python
pedroCabrera/PyFlow
PyFlow/UI/Tool/Tool.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Tool/Tool.py
Apache-2.0
def convex_hull(points): """Computes the convex hull of a set of 2D points. Input: an iterable sequence of (x, y) pairs representing the points. Output: a list of vertices of the convex hull in counter-clockwise order, starting from the vertex with the lexicographically smallest coordinates. Impl...
Computes the convex hull of a set of 2D points. Input: an iterable sequence of (x, y) pairs representing the points. Output: a list of vertices of the convex hull in counter-clockwise order, starting from the vertex with the lexicographically smallest coordinates. Implements Andrew's monotone chain a...
convex_hull
python
pedroCabrera/PyFlow
PyFlow/UI/Utils/ConvexHull.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Utils/ConvexHull.py
Apache-2.0
def format(color, style=""): """Return a QTextCharFormat with the given attributes. """ _color = QColor() _color.setNamedColor(color) _format = QTextCharFormat() _format.setForeground(_color) if "bold" in style: _format.setFontWeight(QFont.Bold) if "italic" in style: _fo...
Return a QTextCharFormat with the given attributes.
format
python
pedroCabrera/PyFlow
PyFlow/UI/Utils/PythonSyntax.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Utils/PythonSyntax.py
Apache-2.0
def highlightBlock(self, text): """Apply syntax highlighting to the given block of text. """ # Do other syntax formatting for expression, nth, format in self.rules: index = expression.indexIn(text, 0) while index >= 0: # We actually want the index...
Apply syntax highlighting to the given block of text.
highlightBlock
python
pedroCabrera/PyFlow
PyFlow/UI/Utils/PythonSyntax.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Utils/PythonSyntax.py
Apache-2.0
def updateApp(self): """calls update method all widgets in the app and calls app.setStyleSheet """ topWindow = self.appInstance if self.appInstance.currentSoftware == "standalone": topWindow = QtWidgets.QApplication.instance() if self.SetAppStyleSheet[0] > 0: ...
calls update method all widgets in the app and calls app.setStyleSheet
updateApp
python
pedroCabrera/PyFlow
PyFlow/UI/Utils/stylesheet.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Utils/stylesheet.py
Apache-2.0
def nodes(self): """returns all ui nodes dict including compounds """ result = {} for rawNode in self.graphManager.getAllNodes(): uiNode = rawNode.getWrapper() if uiNode is None: print("{0} has not UI wrapper".format(rawNode.name)) if r...
returns all ui nodes dict including compounds
nodes
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/BlueprintCanvas.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/BlueprintCanvas.py
Apache-2.0
def pins(self): """Returns UI pins dict {uuid: UIPinBase} """ result = {} for node in self.graphManager.getAllNodes(): for pin in node.pins: result[pin.uid] = pin.getWrapper()() return result
Returns UI pins dict {uuid: UIPinBase}
pins
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/BlueprintCanvas.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/BlueprintCanvas.py
Apache-2.0
def validateConnections(self, graph): """Hides show if needed. Changes endpoints positions if needed """ checked = set() for node in graph.getNodesList(): uiNode = node.getWrapper() for pin in uiNode.UIPins.values(): for connection in pin.uiConnect...
Hides show if needed. Changes endpoints positions if needed
validateConnections
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/BlueprintCanvas.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/BlueprintCanvas.py
Apache-2.0
def addNode(self, uiNode, jsonTemplate, parentGraph=None): """Adds node to a graph :param uiNode: Raw node wrapper :type uiNode: :class:`~PyFlow.UI.Canvas.UINodeBase.UINodeBase` """ uiNode.canvasRef = weakref.ref(self) self.scene().addItem(uiNode) assert jsonTe...
Adds node to a graph :param uiNode: Raw node wrapper :type uiNode: :class:`~PyFlow.UI.Canvas.UINodeBase.UINodeBase`
addNode
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/BlueprintCanvas.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/BlueprintCanvas.py
Apache-2.0
def __init__(self, parent, factor, *args, **kwargs): """ :param parent: parent Widget :type parent: QtWidget :param factor: amount to increment the value :type factor: float/int """ super(inputDragger, self).__init__(*args, **kwargs) self.parent = parent ...
:param parent: parent Widget :type parent: QtWidget :param factor: amount to increment the value :type factor: float/int
__init__
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def __init__( self, labelText="", type="float", buttons=False, decimals=3, draggerSteps=FLOAT_SLIDER_DRAG_STEPS, *args, **kwargs, ): """ :param type: Choose if create a float or int spinBox, defaults to "float" :type type: str, ...
:param type: Choose if create a float or int spinBox, defaults to "float" :type type: str, optional :param buttons: Show or hidden right up/Down Buttons, defaults to False :type buttons: bool, optional :param decimals: Number of decimals if type is "float", defaults to 3 ...
__init__
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def __init__( self, parent, type="float", style=0, name=None, sliderRange=(-100.0, 100.0), defaultValue=0.0, draggerSteps=FLOAT_SLIDER_DRAG_STEPS, *args, ): """ :param parent: Parent Widget :type parent: QtWidgets.QWidge...
:param parent: Parent Widget :type parent: QtWidgets.QWidget :param type: Choose if create a float or int Slider, defaults to "float" :type type: str, optional :param style: Choose looking style, 0 is a full colored xsi style slider, and 1 is a normal colored slider, defaults to...
__init__
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def setDisplayMinimum(self, value): """Sets the Minimum value for display options, real min value don't touched, if current value is less than this display value,Widget automatically recalculates minDisplay :param value: New Display MinValue :type value: float/int """ # self._di...
Sets the Minimum value for display options, real min value don't touched, if current value is less than this display value,Widget automatically recalculates minDisplay :param value: New Display MinValue :type value: float/int
setDisplayMinimum
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def setDisplayMaximum(self, value): """Sets the Maximum value for display options, real max value don't touched, if current value is bigger than this display value,Widget automatically recalculates maxDisplay :param value: New Display MaxValue :type value: float/int """ # self._...
Sets the Maximum value for display options, real max value don't touched, if current value is bigger than this display value,Widget automatically recalculates maxDisplay :param value: New Display MaxValue :type value: float/int
setDisplayMaximum
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def __init__(self, parent, *args): """ :param parent: Parent QtWidget :type parent: QtWidgets.QWidget """ super(pyf_HueSlider, self).__init__( parent=parent, sliderRange=(0.0, 1.0), draggerSteps=[0.1, 0.01, 0.001], *args, ) ...
:param parent: Parent QtWidget :type parent: QtWidgets.QWidget
__init__
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def setColor(self, color): """Sets the current start color where hue will be calculated from :param color: Float list in range 0-1 representing rgb colors :type color: [float,float,float] """ if isinstance(color, list) and len(color) == 3: self.color = QtGui.QColor( ...
Sets the current start color where hue will be calculated from :param color: Float list in range 0-1 representing rgb colors :type color: [float,float,float]
setColor
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def getHue(self, hue): """Compute hue based on input value in range 0-1 :param hue: U value where to calculate hue :type hue: float :returns: Float list in range 0-1 representing rgb colors :rtype: [float,float,float] """ c = QtGui.QColor(self.defColor) ...
Compute hue based on input value in range 0-1 :param hue: U value where to calculate hue :type hue: float :returns: Float list in range 0-1 representing rgb colors :rtype: [float,float,float]
getHue
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def __init__( self, parent, color1=(0, 0, 0), color2=(255, 255, 255), sliderRange=(0.0, 255.0), draggerSteps=(5.0, 1.0, 0.25), *args, ): """ :param parent: Parent QtWidget :type parent: QtWidgets.QWidget :param color1: Start Co...
:param parent: Parent QtWidget :type parent: QtWidgets.QWidget :param color1: Start Color in range 0-255 , defaults to (0, 0, 0) :type color1: (int,int,int), optional :param color2: End Color in range 0-255, defaults to (255, 255, 255) :type color2: (int,int,int), optio...
__init__
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def getColor(self): """Computes the current Color :returns: Int list in range 0-255 representing rgb colors :rtype: [int, int, int] """ r, g, b = self.color1.getRGB() r1, g1, b1 = self.color2.getRGB() r2 = (r1 - r) * self.mappedValue() + r g2 = (g1 - g)...
Computes the current Color :returns: Int list in range 0-255 representing rgb colors :rtype: [int, int, int]
getColor
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def __init__( self, parent=None, startColor=(0, 0, 0), type="float", alpha=False, h=50, *args ): """ :param parent: Parent Widget :type parent: QtWidgets.QWidget :param startColor: Initialization color, defaults to (0, 0, 0) :type startColor: list(float/int), optional...
:param parent: Parent Widget :type parent: QtWidgets.QWidget :param startColor: Initialization color, defaults to (0, 0, 0) :type startColor: list(float/int), optional :param type: Choose if create a float or int Slider, defaults to "float" :type type: str, optional ...
__init__
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def setColor(self, color): """Sets the current color :param color: Input color to use :type color: list(int/float) """ self.RSlider.setMappedValue(color[0]) self.GSlider.setMappedValue(color[1]) self.BSlider.setMappedValue(color[2]) if len(color) > 3: ...
Sets the current color :param color: Input color to use :type color: list(int/float)
setColor
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def __init__(self, raw_tick, parent=None): """ :param raw_tick: Input Core Tick :type raw_tick: :obj:`PyFlow.Core.structs.Tick` :param parent: Parent QWidget :type parent: QtWidgets.QWidget, optional """ super(uiTick, self).__init__(parent) self.setAcceptH...
:param raw_tick: Input Core Tick :type raw_tick: :obj:`PyFlow.Core.structs.Tick` :param parent: Parent QWidget :type parent: QtWidgets.QWidget, optional
__init__
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def setColor(self, color): """Sets Color value :param color: New Color Value in 0-255 range :type color: [int,int,int] """ try: r, g, b = color except: r, g, b = 0, 0, 0 self.setV([r, g, b]) self._color = QtGui.QColor().fromRgb(r, ...
Sets Color value :param color: New Color Value in 0-255 range :type color: [int,int,int]
setColor
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def __init__(self, raw_ramp, parent=None, bezier=False): """ :param raw_ramp: Core ramp that will perform the interpolation :type raw_ramp: :obj:`PyFlow.Core.structs.splineRamp` :param parent: Parent QWidget :type parent: QtWidgets.QWidget, optional :param bezier: Initial...
:param raw_ramp: Core ramp that will perform the interpolation :type raw_ramp: :obj:`PyFlow.Core.structs.splineRamp` :param parent: Parent QWidget :type parent: QtWidgets.QWidget, optional :param bezier: Initialize as linear or bezier, defaults to False :type bezier: boo...
__init__
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def updateFromRaw(self): """Updates Ui representation of the internal :obj:`PyFlow.Core.structs.splineRamp` """ try: for item in self.items(): self._scene.removeItem(item) del item for x in self._rawRamp.sortedItems(): self....
Updates Ui representation of the internal :obj:`PyFlow.Core.structs.splineRamp`
updateFromRaw
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def __getitem__(self, index): """ :param index: What UiTick to get, ordered by U :type index: int :returns: Ui Tick :rtype: :obj:`UiTick` """ if index in range(0, len(self.items())): return self.sortedItems()[index] else: return Non...
:param index: What UiTick to get, ordered by U :type index: int :returns: Ui Tick :rtype: :obj:`UiTick`
__getitem__
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def sortedItems(self): """Returns all the :obj:`UiTick` in the ramp sorted by x position :returns: all :obj:`UiTick` in the ramp :rtype: list(:obj:`UiTick`) """ itms = list(self.items()) itms.sort(key=lambda x: x.getU()) return itms
Returns all the :obj:`UiTick` in the ramp sorted by x position :returns: all :obj:`UiTick` in the ramp :rtype: list(:obj:`UiTick`)
sortedItems
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def addItem(self, u=0, v=0, raw_item=None): """Adds a new Item to the ramp :param u: X position for the item, defaults to 0 :type u: float, optional :param v: Y position for the item, defaults to 0 :type v: float, optional :param raw_item: Existing :obj:`PyFlow.Core.stru...
Adds a new Item to the ramp :param u: X position for the item, defaults to 0 :type u: float, optional :param v: Y position for the item, defaults to 0 :type v: float, optional :param raw_item: Existing :obj:`PyFlow.Core.structs.Tick` to link with, if none, one new created , defa...
addItem
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def setU(self, u, index=-1): """Sets the X position for the selected item if no index provided :param u: New x position :type u: float :param index: Index of the tick to set the value in, ordered by current X position, if -1 will try to set value in all selected Ticks, defaults to -1 ...
Sets the X position for the selected item if no index provided :param u: New x position :type u: float :param index: Index of the tick to set the value in, ordered by current X position, if -1 will try to set value in all selected Ticks, defaults to -1 :type index: int, optional ...
setU
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def setV(self, v, index=-1): """Sets the Y position for the selected item if no index provided :param v: New y position :type v: float :param index: Index of the tick to set the value in, ordered by current X position, if -1 will try to set value in all selected Ticks, defaults to -1 ...
Sets the Y position for the selected item if no index provided :param v: New y position :type v: float :param index: Index of the tick to set the value in, ordered by current X position, if -1 will try to set value in all selected Ticks, defaults to -1 :type index: int, optional ...
setV
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def addItem(self, u=0, v=(0, 0, 0), raw_item=None): """Adds a new Item to the ramp :param u: X position for the item, defaults to 0 :type u: float, optional :param v: color value for the item, defaults to (0,0,0) :type v: [float,float,float], optional :param raw_item: Ex...
Adds a new Item to the ramp :param u: X position for the item, defaults to 0 :type u: float, optional :param v: color value for the item, defaults to (0,0,0) :type v: [float,float,float], optional :param raw_item: Existing :obj:`PyFlow.Core.structs.Tick` to link with, if none, o...
addItem
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def setColor(self, color, index=-1): """Sets the color value for the selected item if no index provided :param color: New color :type color: [float,float,float] :param index: Index of the tick to set the value in, ordered by current X position, if -1 will try to set value in all selecte...
Sets the color value for the selected item if no index provided :param color: New color :type color: [float,float,float] :param index: Index of the tick to set the value in, ordered by current X position, if -1 will try to set value in all selected Ticks, defaults to -1 :type index: int...
setColor
python
pedroCabrera/PyFlow
PyFlow/UI/Widgets/QtSliders.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/UI/Widgets/QtSliders.py
Apache-2.0
def onerror(func, path, exc_info): """ Error handler for ``shutil.rmtree``. If the error is due to an access error (read only file) it attempts to add write permission and then retries. If the error is for another reason it re-raises the error. Usage : ``shutil.rmtree(path, onerror=onerro...
Error handler for ``shutil.rmtree``. If the error is due to an access error (read only file) it attempts to add write permission and then retries. If the error is for another reason it re-raises the error. Usage : ``shutil.rmtree(path, onerror=onerror)``
onerror
python
pedroCabrera/PyFlow
PyFlow/Wizards/PkgGen.py
https://github.com/pedroCabrera/PyFlow/blob/master/PyFlow/Wizards/PkgGen.py
Apache-2.0
def process_history(history: list[Conversation]): """ Process the input history to extract the query and the history pairs. Args: History(list[Conversation]): A list of Conversation objects representing all conversations. Returns: query(str): The current user input st...
Process the input history to extract the query and the history pairs. Args: History(list[Conversation]): A list of Conversation objects representing all conversations. Returns: query(str): The current user input string. history_pairs(list[(str,str)]): A list ...
process_history
python
THUDM/CogVLM
composite_demo/client.py
https://github.com/THUDM/CogVLM/blob/master/composite_demo/client.py
Apache-2.0
def generate_stream(self, history: list, grounding: bool = False, model_use: str = 'agent_chat', **parameters: Any ) -> Iterable[TextGenerationStreamResponse]: """ Generates a stream o...
Generates a stream of text responses based on the input history and selected model. This method facilitates a chat-like interaction with the models. Depending on the model selected and whether grounding is enabled, it alters the behavior of the text generation process. Args: ...
generate_stream
python
THUDM/CogVLM
composite_demo/client.py
https://github.com/THUDM/CogVLM/blob/master/composite_demo/client.py
Apache-2.0
def preprocess_text(history: list[Conversation], ) -> str: """ Prepares the conversation history for processing by concatenating the content of each turn. Args: history (list[Conversation]): The conversation history, a list of Conversation objects. Returns: str: A single string that co...
Prepares the conversation history for processing by concatenating the content of each turn. Args: history (list[Conversation]): The conversation history, a list of Conversation objects. Returns: str: A single string that concatenates the content of each conversation turn, followed by ...
preprocess_text
python
THUDM/CogVLM
composite_demo/conversation.py
https://github.com/THUDM/CogVLM/blob/master/composite_demo/conversation.py
Apache-2.0
def postprocess_text(template: str, text: str) -> str: """ Post-processes the generated text by incorporating it into a given template. Args: template (str): A template string containing a placeholder for the generated text. text (str): The generated text to be incorporated into the template...
Post-processes the generated text by incorporating it into a given template. Args: template (str): A template string containing a placeholder for the generated text. text (str): The generated text to be incorporated into the template. Returns: str: The template with the generated t...
postprocess_text
python
THUDM/CogVLM
composite_demo/conversation.py
https://github.com/THUDM/CogVLM/blob/master/composite_demo/conversation.py
Apache-2.0
def postprocess_image(text: str, img: Image) -> (str, Image): """ Processes the given text to identify and draw bounding boxes on the provided image. This function searches for patterns in the text that represent coordinates for bounding boxes and draws rectangles on the image at these coordinates. Each...
Processes the given text to identify and draw bounding boxes on the provided image. This function searches for patterns in the text that represent coordinates for bounding boxes and draws rectangles on the image at these coordinates. Each box is drawn in a different color for distinction. Args: ...
postprocess_image
python
THUDM/CogVLM
composite_demo/conversation.py
https://github.com/THUDM/CogVLM/blob/master/composite_demo/conversation.py
Apache-2.0
def translate_baidu(translate_text, source_lan, target_lan): """ Translates text using Baidu's translation service. (if you are not use English) This function sends a request to the Baidu translation API to translate the provided text from the source language to the target language. ...
Translates text using Baidu's translation service. (if you are not use English) This function sends a request to the Baidu translation API to translate the provided text from the source language to the target language. Args: translate_text (str): The text to be translated....
translate_baidu
python
THUDM/CogVLM
composite_demo/conversation.py
https://github.com/THUDM/CogVLM/blob/master/composite_demo/conversation.py
Apache-2.0
def to_tensor(value): """Converts lists or numpy arrays to tensors.""" if isinstance(value, list): return torch.tensor(value) elif isinstance(value, np.ndarray): return torch.from_numpy(value) return value
Converts lists or numpy arrays to tensors.
to_tensor
python
THUDM/CogVLM
finetune_demo/evaluate_cogagent_demo.py
https://github.com/THUDM/CogVLM/blob/master/finetune_demo/evaluate_cogagent_demo.py
Apache-2.0
def concatenate_tensors(attribute, key): """Concatenates tensors for a specific attribute and key.""" if attribute is None: return torch.cat([ex[key] for ex in examples if isinstance(ex[key], torch.Tensor)]) else: return torch.cat([ex[attribute][key] for ex in examples if...
Concatenates tensors for a specific attribute and key.
concatenate_tensors
python
THUDM/CogVLM
finetune_demo/evaluate_cogagent_demo.py
https://github.com/THUDM/CogVLM/blob/master/finetune_demo/evaluate_cogagent_demo.py
Apache-2.0
async def lifespan(app: FastAPI): """ An asynchronous context manager for managing the lifecycle of the FastAPI app. It ensures that GPU memory is cleared after the app's lifecycle ends, which is essential for efficient resource management in GPU environments. """ yield if torch.cuda.is_availabl...
An asynchronous context manager for managing the lifecycle of the FastAPI app. It ensures that GPU memory is cleared after the app's lifecycle ends, which is essential for efficient resource management in GPU environments.
lifespan
python
THUDM/CogVLM
openai_demo/openai_api.py
https://github.com/THUDM/CogVLM/blob/master/openai_demo/openai_api.py
Apache-2.0
async def list_models(): """ An endpoint to list available models. It returns a list of model cards. This is useful for clients to query and understand what models are available for use. """ model_card = ModelCard(id="cogvlm-chat-17b") # can be replaced by your model id like cogagent-chat-18b r...
An endpoint to list available models. It returns a list of model cards. This is useful for clients to query and understand what models are available for use.
list_models
python
THUDM/CogVLM
openai_demo/openai_api.py
https://github.com/THUDM/CogVLM/blob/master/openai_demo/openai_api.py
Apache-2.0
async def predict(model_id: str, params: dict): """ Handle streaming predictions. It continuously generates responses for a given input stream. This is particularly useful for real-time, continuous interactions with the model. """ global model, tokenizer choice_data = ChatCompletionResponseStr...
Handle streaming predictions. It continuously generates responses for a given input stream. This is particularly useful for real-time, continuous interactions with the model.
predict
python
THUDM/CogVLM
openai_demo/openai_api.py
https://github.com/THUDM/CogVLM/blob/master/openai_demo/openai_api.py
Apache-2.0
def generate_cogvlm(model: PreTrainedModel, tokenizer: PreTrainedTokenizer, params: dict): """ Generates a response using the CogVLM model. It processes the chat history and image data, if any, and then invokes the model to generate a response. """ for response in generate_stream_cogvlm(model, toke...
Generates a response using the CogVLM model. It processes the chat history and image data, if any, and then invokes the model to generate a response.
generate_cogvlm
python
THUDM/CogVLM
openai_demo/openai_api.py
https://github.com/THUDM/CogVLM/blob/master/openai_demo/openai_api.py
Apache-2.0
def generate_stream_cogvlm(model: PreTrainedModel, tokenizer: PreTrainedTokenizer, params: dict): """ Generates a stream of responses using the CogVLM model in inference mode. It's optimized to handle continuous input-output interactions with the model in a streaming manner. """ messages = params["m...
Generates a stream of responses using the CogVLM model in inference mode. It's optimized to handle continuous input-output interactions with the model in a streaming manner.
generate_stream_cogvlm
python
THUDM/CogVLM
openai_demo/openai_api.py
https://github.com/THUDM/CogVLM/blob/master/openai_demo/openai_api.py
Apache-2.0
def __init__(self, args, vitclass): ''' args: the args to initialize the vit model vitclass: the class of VIT model, must be a subclass of BaseModel project_dim: the dimension of the projection layer default_load: the default load path for the vit model ...
args: the args to initialize the vit model vitclass: the class of VIT model, must be a subclass of BaseModel project_dim: the dimension of the projection layer default_load: the default load path for the vit model model_parallel_size: the model parallel size ...
__init__
python
THUDM/CogVLM
utils/models/cogagent_model.py
https://github.com/THUDM/CogVLM/blob/master/utils/models/cogagent_model.py
Apache-2.0
def normalize_img_path(img: str): """Normalizes the image path for output.""" if os.name == 'nt': # On Windows, the JSON.dump ends up outputting un-escaped backslash breaking # the ability to read colors.json. Windows supports forward slash, so we can # use that for now return im...
Normalizes the image path for output.
normalize_img_path
python
dylanaraps/pywal
pywal/colors.py
https://github.com/dylanaraps/pywal/blob/master/pywal/colors.py
MIT
def colors_to_dict(colors, img): """Convert list of colors to pywal format.""" return { "wallpaper": normalize_img_path(img), "alpha": util.Color.alpha_num, "special": { "background": colors[0], "foreground": colors[15], "cursor": colors[15] }...
Convert list of colors to pywal format.
colors_to_dict
python
dylanaraps/pywal
pywal/colors.py
https://github.com/dylanaraps/pywal/blob/master/pywal/colors.py
MIT