original_docstring: Set required imports for the python script at self.script_path
docstring: Set required imports for the python script at self.script_path
docstring_tokens: Set required imports for the python script at self . script_path
code: def _set_imports(self):
          """Set required imports for the python script at self.script_path"""
          # Get the names of packages imported in the script
          import_names = pipreqs.get_all_imports(os.path.dirname(self.script_path))
  
          # Of those names, store that ones that are available via pip
          self._pip_imports = pipreqs.get_imports_info(import_names)
  
          # If some imports were left out, store their names
          pip_names = set([i["name"] for i in self.pip_imports])
          self._missing_imports = list(set(import_names) - pip_names)
  
          if len(import_names) != (len(self.pip_imports) + len(self.github_installs)):
              # And warn the user
              mod_logger.warning(
                  "Warning, some imports not found by pipreqs. You will "
                  "need to edit the Dockerfile by hand, e.g by installing "
                  "from github. You need to install the following packages "
                  "{missing!s}".format(missing=self.missing_imports)
              )
code_tokens: def _set_imports ( self ) : import_names = pipreqs . get_all_imports ( os . path . dirname ( self . script_path ) ) self . _pip_imports = pipreqs . get_imports_info ( import_names ) pip_names = set ( [ i [ "name" ] for i in self . pip_imports ] ) self . _missing_imports = list ( set ( import_names ) - pip_names ) if len ( import_names ) != ( len ( self . pip_imports ) + len ( self . github_installs ) ) : mod_logger . warning ( "Warning, some imports not found by pipreqs. You will " "need to edit the Dockerfile by hand, e.g by installing " "from github. You need to install the following packages " "{missing!s}" . format ( missing = self . missing_imports ) )
short_docstring: Set required imports for the python script at self.script_path
short_docstring_tokens: Set required imports for the python script at self . script_path
comment: """Set required imports for the python script at self.script_path"""$SEP$# Get the names of packages imported in the script$SEP$# Of those names, store that ones that are available via pip$SEP$# If some imports were left out, store their names$SEP$# And warn the user