parameters: (request:HttpRequest, project_id)
return_statement: return JsonResponse(rows, safe=False)
docstring: Given a list of connectors, a list of presynaptic skeletons and a list of
      postsynatic skeletons, return a list of rows, one per synaptic connection,
      in the same format as one_to_many_synapses. The list of connectors (cids),
      pre-skeletons (pre) and post-skeletons (post) is optional.
docstring_summary: Given a list of connectors, a list of presynaptic skeletons and a list of
      postsynatic skeletons, return a list of rows, one per synaptic connection,
      in the same format as one_to_many_synapses. The list of connectors (cids),
      pre-skeletons (pre) and post-skeletons (post) is optional.
docstring_tokens: Given a list of connectors a list of presynaptic skeletons and a list of postsynatic skeletons return a list of rows one per synaptic connection in the same format as one_to_many_synapses . The list of connectors ( cids ) pre - skeletons ( pre ) and post - skeletons ( post ) is optional .
function: def connectors_info(request:HttpRequest, project_id) -> JsonResponse:
      """
      Given a list of connectors, a list of presynaptic skeletons and a list of
      postsynatic skeletons, return a list of rows, one per synaptic connection,
      in the same format as one_to_many_synapses. The list of connectors (cids),
      pre-skeletons (pre) and post-skeletons (post) is optional.
      """
  
      cids = get_request_list(request.POST, 'cids', map_fn=int)
      skids = get_request_list(request.POST, 'skids', map_fn=int)
      skids_pre = get_request_list(request.POST, 'pre', map_fn=int)
      skids_post = get_request_list(request.POST, 'post', map_fn=int)
  
      cursor = connection.cursor()
  
      if skids_pre or skids_post:
          if skids:
              raise ValueError("The skids parameter can't be used together with "
                      "pre and/or post.")
  
      relations = get_relation_to_id_map(project_id, ('presynaptic_to', 'postsynaptic_to'), cursor)
  
      # Construct base query
      query_parts = ['''
          SELECT DISTINCT
                 tc1.connector_id, c.location_x, c.location_y, c.location_z,
                 tc1.treenode_id, tc1.skeleton_id, tc1.confidence, tc1.user_id,
                 t1.location_x, t1.location_y, t1.location_z,
                 tc2.treenode_id, tc2.skeleton_id, tc2.confidence, tc2.user_id,
                 t2.location_x, t2.location_y, t2.location_z
          FROM connector c
      ''']
  
      query_params:List = []
  
      # Add connector filter, if requested
      if cids:
          cid_template = ",".join(("(%s)",) * len(cids))
          query_parts.append(f'''
              JOIN (VALUES {cid_template}) rc(id) ON c.id = rc.id
          ''')
          query_params.extend(cids)
  
      # Get first partner of connection
      query_parts.append('''
          JOIN treenode_connector tc1 ON tc1.connector_id = c.id
          JOIN treenode t1 ON tc1.treenode_id = t1.id
      ''')
  
      # Add pre-synaptic skeleton filter, if requested
      if skids_pre:
          pre_skid_template = ",".join(("(%s)",) * len(skids_pre))
          query_parts.append(f'''
              JOIN (VALUES {pre_skid_template}) sk_pre(id) ON tc1.skeleton_id = sk_pre.id
          ''')
          query_params.extend(skids_pre)
  
      # Get second partner of connection
      query_parts.append('''
          JOIN treenode_connector tc2 ON tc2.connector_id = c.id
          JOIN treenode t2 ON tc2.treenode_id = t2.id
      ''')
  
      # Add post-synaptic skeleton filter, if requested
      if skids_post:
          post_skid_template = ",".join(("(%s)",) * len(skids_post))
          query_parts.append(f'''
              JOIN (VALUES {post_skid_template}) sk_post(id) ON tc2.skeleton_id = sk_post.id
          ''')
          query_params.extend(skids_post)
  
      # Add generic skeleton filters
      if skids:
          skid_template = ",".join(("(%s)",) * len(skids))
          query_parts.append(f'''
              JOIN (VALUES {skid_template}) sk(id) ON tc1.skeleton_id = sk.id OR tc2.skeleton_id = sk.id
          ''')
          query_params.extend(skids)
  
      # Prevent self-joins of connector partners
      query_parts.append('''
          WHERE tc1.id != tc2.id
      ''')
  
      # The result is expected to be stictly pre-synaptic and post-synaptic at the
      # moment.
      query_parts.append('''
          AND tc1.relation_id = %s
          AND tc2.relation_id = %s
      ''')
      query_params.append(relations['presynaptic_to'])
      query_params.append(relations['postsynaptic_to'])
  
      if skids:
          query_parts.append('''
              AND tc1.treenode_id < tc2.treenode_id
          ''')
  
      query_parts.append('''
          ORDER BY tc2.skeleton_id
      ''')
  
      cursor.execute("\n".join(query_parts), query_params)
  
      rows = tuple((row[0], (row[1], row[2], row[3]),
                    row[4], row[5], row[6], row[7],
                    (row[8], row[9], row[10]),
                    row[11], row[12], row[13], row[14],
                    (row[15], row[16], row[17])) for row in cursor.fetchall())
  
      return JsonResponse(rows, safe=False)
function_tokens: def connectors_info ( request : HttpRequest , project_id ) -> JsonResponse : cids = get_request_list ( request . POST , 'cids' , map_fn = int ) skids = get_request_list ( request . POST , 'skids' , map_fn = int ) skids_pre = get_request_list ( request . POST , 'pre' , map_fn = int ) skids_post = get_request_list ( request . POST , 'post' , map_fn = int ) cursor = connection . cursor ( ) if skids_pre or skids_post : if skids : raise ValueError ( "The skids parameter can't be used together with " "pre and/or post." ) relations = get_relation_to_id_map ( project_id , ( 'presynaptic_to' , 'postsynaptic_to' ) , cursor ) # Construct base query query_parts = [ '''
          SELECT DISTINCT
                 tc1.connector_id, c.location_x, c.location_y, c.location_z,
                 tc1.treenode_id, tc1.skeleton_id, tc1.confidence, tc1.user_id,
                 t1.location_x, t1.location_y, t1.location_z,
                 tc2.treenode_id, tc2.skeleton_id, tc2.confidence, tc2.user_id,
                 t2.location_x, t2.location_y, t2.location_z
          FROM connector c
      ''' ] query_params : List = [ ] # Add connector filter, if requested if cids : cid_template = "," . join ( ( "(%s)" , ) * len ( cids ) ) query_parts . append ( f'''
              JOIN (VALUES {cid_template}) rc(id) ON c.id = rc.id
          ''' ) query_params . extend ( cids ) # Get first partner of connection query_parts . append ( '''
          JOIN treenode_connector tc1 ON tc1.connector_id = c.id
          JOIN treenode t1 ON tc1.treenode_id = t1.id
      ''' ) # Add pre-synaptic skeleton filter, if requested if skids_pre : pre_skid_template = "," . join ( ( "(%s)" , ) * len ( skids_pre ) ) query_parts . append ( f'''
              JOIN (VALUES {pre_skid_template}) sk_pre(id) ON tc1.skeleton_id = sk_pre.id
          ''' ) query_params . extend ( skids_pre ) # Get second partner of connection query_parts . append ( '''
          JOIN treenode_connector tc2 ON tc2.connector_id = c.id
          JOIN treenode t2 ON tc2.treenode_id = t2.id
      ''' ) # Add post-synaptic skeleton filter, if requested if skids_post : post_skid_template = "," . join ( ( "(%s)" , ) * len ( skids_post ) ) query_parts . append ( f'''
              JOIN (VALUES {post_skid_template}) sk_post(id) ON tc2.skeleton_id = sk_post.id
          ''' ) query_params . extend ( skids_post ) # Add generic skeleton filters if skids : skid_template = "," . join ( ( "(%s)" , ) * len ( skids ) ) query_parts . append ( f'''
              JOIN (VALUES {skid_template}) sk(id) ON tc1.skeleton_id = sk.id OR tc2.skeleton_id = sk.id
          ''' ) query_params . extend ( skids ) # Prevent self-joins of connector partners query_parts . append ( '''
          WHERE tc1.id != tc2.id
      ''' ) # The result is expected to be stictly pre-synaptic and post-synaptic at the # moment. query_parts . append ( '''
          AND tc1.relation_id = %s
          AND tc2.relation_id = %s
      ''' ) query_params . append ( relations [ 'presynaptic_to' ] ) query_params . append ( relations [ 'postsynaptic_to' ] ) if skids : query_parts . append ( '''
              AND tc1.treenode_id < tc2.treenode_id
          ''' ) query_parts . append ( '''
          ORDER BY tc2.skeleton_id
      ''' ) cursor . execute ( "\n" . join ( query_parts ) , query_params ) rows = tuple ( ( row [ 0 ] , ( row [ 1 ] , row [ 2 ] , row [ 3 ] ) , row [ 4 ] , row [ 5 ] , row [ 6 ] , row [ 7 ] , ( row [ 8 ] , row [ 9 ] , row [ 10 ] ) , row [ 11 ] , row [ 12 ] , row [ 13 ] , row [ 14 ] , ( row [ 15 ] , row [ 16 ] , row [ 17 ] ) ) for row in cursor . fetchall ( ) ) return JsonResponse ( rows , safe = False )