parameters: (self, dir_path, resource_path="", is_only_python_files_accepted=False)
docstring: Add a directory recursively to be packed with the job at runtime.
  
          Args:
            dir_path (str):  path of directory to add
            resource_path (str):  path to directory at runtime
            is_only_python_files_accepted (bool):  if True, only .py/.pyc files are accepted
  
          Raises:
            ValueError:  if invalid arguments are given
docstring_summary: Add a directory recursively to be packed with the job at runtime.
docstring_tokens: Add a directory recursively to be packed with the job at runtime .
function: def add_directory(self, dir_path, resource_path="", is_only_python_files_accepted=False):
          """
          Add a directory recursively to be packed with the job at runtime.
  
          Args:
            dir_path (str):  path of directory to add
            resource_path (str):  path to directory at runtime
            is_only_python_files_accepted (bool):  if True, only .py/.pyc files are accepted
  
          Raises:
            ValueError:  if invalid arguments are given
          """
          if not os.path.isdir(dir_path):
              raise ValueError('Path "%s" is not a valid directory' % dir_path)
          normed = os.path.normpath(os.path.abspath(dir_path)) + '/'
          for root, subdirs, files in os.walk(normed):
              if not root.startswith(normed):
                  raise ValueError("Invalid path, there may be a bug.")
  
              if any(path.startswith(".") for path in root[len(normed):].split(os.sep)):
                  continue
  
              relative_path = root[len(normed): len(root)]
              for filename in files:
                  if filename.startswith("."):
                      continue
                  if not is_only_python_files_accepted \
                          or os.path.splitext(filename)[1] == ".py" \
                          or os.path.splitext(filename)[1] == ".pyc":
                      file_path = os.path.join(root, filename)
                      path_in_resource = os.path.join(resource_path, relative_path, filename)
                      self.add_file(file_path, path_in_resource)
function_tokens: def add_directory ( self , dir_path , resource_path = "" , is_only_python_files_accepted = False ) : if not os . path . isdir ( dir_path ) : raise ValueError ( 'Path "%s" is not a valid directory' % dir_path ) normed = os . path . normpath ( os . path . abspath ( dir_path ) ) + '/' for root , subdirs , files in os . walk ( normed ) : if not root . startswith ( normed ) : raise ValueError ( "Invalid path, there may be a bug." ) if any ( path . startswith ( "." ) for path in root [ len ( normed ) : ] . split ( os . sep ) ) : continue relative_path = root [ len ( normed ) : len ( root ) ] for filename in files : if filename . startswith ( "." ) : continue if not is_only_python_files_accepted or os . path . splitext ( filename ) [ 1 ] == ".py" or os . path . splitext ( filename ) [ 1 ] == ".pyc" : file_path = os . path . join ( root , filename ) path_in_resource = os . path . join ( resource_path , relative_path , filename ) self . add_file ( file_path , path_in_resource )