code: def get_indegree_mapper(conf):
      """
      Input:
          src0 \t rela0 \t dst0
          src1 \t rela1 \t dst1
          src2 \t rela2 \t dst2
          src0 \t nfeat
  
      Output:
          dst0 \t 0 \t nfeat
          dst0 \t 1 \t src0
          dst0 \t 1 \t src1
          dst0 \t 1 \t src2
      """
      for line in sys.stdin:
          # src, dst_or_nfeat = line.strip().split('\t')
          slots = line.strip().split("\t")
          # if len(dst_or_nfeat.split(' ')) > 2:  # nfeat
          if len(slots) == 2:
              src, dst_or_nfeat = slots[0], slots[1]
              sys.stdout.write("%s\t0\t%s\n" % (src, dst_or_nfeat))
          else:
              src, dst_or_nfeat = slots[0], slots[2]
              sys.stdout.write("%s\t1\t%s\n" % (dst_or_nfeat, src))
              if conf.bidirect:
                  sys.stdout.write("%s\t1\t%s\n" % (src, dst_or_nfeat))
  
file_path: PGL/examples/kddcup2021/WikiKG90M/post_smoothing/rotate/hadoop_prep.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  from __future__ import absolute_import
  import sys
  import yaml
  from easydict import EasyDict
  import argparse
  import numpy
  import json
  import six
label_desc: Use image node_id 2 for calling a global function with example usage: get_indegree_mapper(conf) without return types