apache / apache/airflow

Remove duplicate @staticmethod in file_task_handler.py

Open
#64,477 3 comments 0 reactions 1 assignee Claimed by @KengoWada View on GitHub
area:core kind:bug
Dominant language
Python
Stars
46.9k
Forks
17.8k
Avg merge
2d 9h
Merged PRs (30d)
472

Description

### Apache Airflow version

3.1.8

### What happened and how to reproduce it?

While reviewing the code base, I noticed that the `_get_pod_namespace` method is decorated with `@staticmethod` twice. This appears to be redundant, as applying `@staticmethod` once is sufficient and additional applications do not change behavior.

This does not cause a runtime error, but it introduces unnecessary duplication and may confuse readers or contributors into thinking there is a special reason for the double decoration.

**Steps to reproduce**
- Navigate to the [file](https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/utils/log/file_task_handler.py) containing `_get_pod_namespace`
- Locate the method definition:
```py
@staticmethod
@staticmethod
def _get_pod_namespace(ti: TaskInstance | TaskInstanceHistory):
...
```
- Observe that `@staticmethod` is applied twice to the same method.

### What you think should happen instead?

This is likely an oversight introduced during a refactor or code edit. Since applying `@staticmethod` multiple times does not raise an error or change behavior, the duplication would not be caught by tests or linters unless specifically checked.

As a result, the redundant decorator remained in the codebase without affecting functionality, but adds unnecessary duplication and may cause confusion for readers.

### Operating System

_No response_

### Versions of Apache Airflow Providers

_No response_

### Deployment

Docker-Compose

### Deployment details

_No response_

### Anything else?

_No response_

### Are you willing to submit PR?

- [x] Yes I am willing to submit a PR!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.