Nested `with` statements can be merged into a single compound `with` statement.
This issue is raised only when there are no other statements between the nested `with` statements.
Merging collapsible `with` statements can decrease cognitive complexity, improving code readability.
The method doesn't use its bound instance. Decorate this method with `@staticmethod` decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods [here](https://docs.python.org/3/library/functions.html#staticmethod).
Nested `if` statements can be collapsed into a single `if` statement by separating their condition using `and` operator.
Merging collapsible `if` statements increases the code's readability.
`subprocess.run` uses a default of `check=False`, which means that a nonzero exit code will be
ignored by default, instead of raising an exception.
You can ignore this issue if this behaviour is intended.
Do not use a mutable like `list` or `dictionary` as a default value to an argument. Python’s default arguments are evaluated once when the function is defined. Using a mutable default argument and mutating it will mutate that object for all future calls to the function as well.
The use of `else` or `elif` becomes redundant and can be dropped if the last statement under the leading `if` / `elif` block is a `return` statement.
In the case of an `elif` after `return`, it can be written as a separate `if` block.
For `else` blocks after `return`, the statements can be shifted out of `else`. Please refer to the examples below for reference.
Refactoring the code this way can improve code-readability and make it easier to maintain.
Using the `len` function to check if a sequence is empty is not idiomatic and can be less performant than checking the truthiness of the object. `len` doesn't know the context in which it is called, so if computing the length means traversing the entire sequence, it must; it doesn't know that the result is just being compared to 0.
The use of `else` or `elif` becomes redundant and can be dropped if the last statement under the leading `if` / `elif` block is a `return` statement.
In the case of an `elif` after `return`, it can be written as a separate `if` block.
For `else` blocks after `return`, the statements can be shifted out of `else`. Please refer to the examples below for reference.
Refactoring the code this way can improve code-readability and make it easier to maintain.