package Ġdebug attach Ċ Ċ import Ġcom . intellij . execution . configurations . General CommandLine Ċ import Ġcom . intellij . execution . exec utors . Default Debug Executor Ċ import Ġcom . intellij . execution . process . Process Handler Ċ import Ġcom . intellij . execution . runners . Execution Environment Ċ import Ġcom . intellij . execution . runners . Execution Environment Builder Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . jetbrains . python . Python Helper Ċ import Ġcom . jetbrains . python . debugger . attach . Py Attach To Process CommandLine State Ċ import Ġcom . jetbrains . python . run . Python Configuration Type Ċ import Ġcom . jetbrains . python . run . Python Run Configuration Ċ import Ġcom . jetbrains . python . run . Python Script CommandLine State Ċ import Ġcom . jetbrains . python . sdk . Python Env Util Ċ import Ġsettings . Application Settings Ċ import Ġsettings . Project Settings Ċ import Ġjava . nio . file . Paths Ċ Ċ class ĠMay a Attach To Process Cli State ( run Config : ĠPython Run Configuration , Ġenv : ĠExecution Environment ) Ġ: ĊĠĠĠ ĠPython Script CommandLine State ( run Config , Ġenv ) Ġ{ ĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġfun Ġcreate ( project : ĠProject , Ġsdk Path : ĠString , Ġport : ĠInt , Ġpid : ĠInt , Ġmay a Sdk : ĠApplication Settings . Sdk Info ): ĠMay a Attach To Process Cli State Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġconf Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠPython Configuration Type . getInstance (). factory . create Template Configuration ( project ) Ġas ĠPython Run Configuration ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġenv Ġ= ĠExecution Environment Builder . create ( project , ĠDefault Debug Executor . get Debug Executor Instance (), Ġconf ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. build () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġproject Settings Ġ= ĠProject Settings . getInstance ( project ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmc Port Ġ= Ġmay a Sdk . port ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġdebugger Path Ġ= ĠPython Helper . DEBUG GER . python Path Entry ĊĊĠĠĠĠĠĠĠĠĠĠĠ ĠPython Env Util . addTo Python Path ( conf . envs , ĠlistOf ( env . project . basePath )) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġconf . working Directory Ġ= Ġenv . project . basePath ĊĠĠĠĠĠĠĠĠĠĠĠ Ġconf . sdk Home Ġ= Ġsdk Path ĊĠĠĠĠĠĠĠĠĠĠĠ Ġconf . is Use Module Sdk Ġ= Ġfalse ĊĠĠĠĠĠĠĠĠĠĠĠ Ġconf . script Name Ġ= ĠPaths . get ( project Settings . python Cache Path . toString (), Ġ" attach _ py dev d . py "). toString () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġconf . script Parameters Ġ= Ġ"-- port Ġ$ port Ġ-- pid Ġ$ pid Ġ-- mc Port Ġ$ mc Port Ġ-- py dev Path Ġ\"$ debugger Path \"" ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn ĠMay a Attach To Process Cli State ( conf , Ġenv ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġdo Create Process ( command Line : ĠGeneral CommandLine ?): ĠProcess Handler Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġhandler Ġ= Ġsuper . do Create Process ( command Line ) ĊĠĠĠĠĠĠĠ Ġreturn ĠPy Attach To Process CommandLine State . Py Remote Debug Process Handler ( handler ) ĊĠĠĠ Ġ} Ċ } ĊĊ