import os


def hdfs_make_qualified(path):
    return path if 'CF_HADOOP_DEFAULT_FS' not in os.environ else os.environ['CF_HADOOP_DEFAULT_FS'] + path

import os
import re


def hdfs_make_qualified(path):
    return path if (re.match(r'[.]*://[.]*', path) or 'CF_HADOOP_DEFAULT_FS' not in os.environ) \
        else os.environ['CF_HADOOP_DEFAULT_FS'] + path

Update python script util to detect if paths are already fully qualified
Update python script util to detect if paths are already fully qualified

  import os
+ import re
  
  
  def hdfs_make_qualified(path):
-     return path if 'CF_HADOOP_DEFAULT_FS' not in os.environ else os.environ['CF_HADOOP_DEFAULT_FS'] + path
+     return path if (re.match(r'[.]*://[.]*', path) or 'CF_HADOOP_DEFAULT_FS' not in os.environ) \
+         else os.environ['CF_HADOOP_DEFAULT_FS'] + path
  
Update python script util to detect if paths are already fully qualified
## Code Before:
import os


def hdfs_make_qualified(path):
    return path if 'CF_HADOOP_DEFAULT_FS' not in os.environ else os.environ['CF_HADOOP_DEFAULT_FS'] + path

## Instruction:
Update python script util to detect if paths are already fully qualified
## Code After:
import os
import re


def hdfs_make_qualified(path):
    return path if (re.match(r'[.]*://[.]*', path) or 'CF_HADOOP_DEFAULT_FS' not in os.environ) \
        else os.environ['CF_HADOOP_DEFAULT_FS'] + path
