Getting output socket name and using it for input socket name in compositor i'm trying to do an automated naming system for my file outputs in blender compositor, i want the file output input's socket to get the name of the input of their respective links. I'm not really getting how (new in python). So far my script looks like 

import bpy
import os

# Get absolute path:
filepath = bpy.context.scene.render.filepath
absolutepath = bpy.path.abspath(filepath)

# Split it
path = os.path.normpath(absolutepath)
parts = path.split(os.sep)

absolutepath = os.sep.join(parts[:-2])

# Get name of th input
name01 = bpy.data.node_groups["CYCLES MULTIPASS CREATION"].outputs[0].name

# set the path for all file output nodes:
for scene in bpy.data.scenes:
    for node in scene.node_tree.nodes:

        if node.type == 'OUTPUT_FILE':
            node.base_path = absolutepath
            node.file_slots[0].path = "\_shadow\_" + "nom" + "_" + name01


But this is "absolute" version of what i'm trying to do, the input socket name is not relative to the output socket name of the previous node... Somebody has an idea ? thank you very much !
To get the name of the socket a node's input is linked to:

#using the File output node from your example
link = node.inputs[0].links[0] #gets the link from the input
socket_name = link.from_socket.name #returns the name of the socket the link is from