Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import pkg_resources
import pyglet
from pyno import window
from .element import Element
from .processor import Processor
from .draw import labelsGroup
from .utils import font
from .field import Field
class Sub(Processor, Element):
'''
Sub is a main pyno element, in fact it is a pyno file with in/outputs
'''
def __init__(self, window, x, y, batch, color=(200, 200, 200), code=None,
connects=None, size=(300, 150), id=None):
Element.__init__(self, x, y, color, batch, id)
Processor.init_processor(self, window.global_scope) # node has a processor for calculation
self.editor_size = size
if connects:
self.connected_to = connects
self.code = None
if not code:
from .element import Element
from .processor import Processor
from .draw import labelsGroup
from .utils import font
# Fix compatibility in typing module for Python < 3.7
if sys.hexversion < 0x030700F0:
try:
typing.ForwardRef = typing._ForwardRef
except:
pass
class Node(Element, Processor):
'''
Node is a main Pyno element, in fact it is a function with in/outputs
'''
def __init__(self, window, x, y, batch, color=(200, 200, 200), code="",
connects=None, size=(300, 150), id=None):
Element.__init__(self, x, y, color, batch, id)
Processor.init_processor(self, window.global_scope) # node has a processor for calculation
self.window = window
self.editor_size = size
self.code = code
if connects:
self.connected_to = connects
def processor(self):
return Processor.processor(self, self.connected_to, self.outputs)