diff options
| author | deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com> | 2025-02-21 04:22:25 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-21 04:22:25 +0000 |
| commit | 7cc98bff4095bd06838c8aa6d18cf5f62aff1979 (patch) | |
| tree | 84aed299417974437ab2dddecb561c7af7955a28 /gdpr_obfuscator/read.py | |
| parent | 9bdeb7d3e8e68aa5da3ab29ec41b6ffd334be2b9 (diff) | |
| download | gdpr-obfuscator-7cc98bff4095bd06838c8aa6d18cf5f62aff1979.tar.gz gdpr-obfuscator-7cc98bff4095bd06838c8aa6d18cf5f62aff1979.zip | |
refactor: change methods not using its bound instance to staticmethods
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).
Diffstat (limited to 'gdpr_obfuscator/read.py')
| -rw-r--r-- | gdpr_obfuscator/read.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gdpr_obfuscator/read.py b/gdpr_obfuscator/read.py index e527a4f..27f2a3d 100644 --- a/gdpr_obfuscator/read.py +++ b/gdpr_obfuscator/read.py @@ -37,7 +37,8 @@ class DataReader: read_csv_content = self.read_string(content) return read_csv_content - def read_string(self, content: str) -> List[Dict[str, str]]: + @staticmethod + def read_string(content: str) -> List[Dict[str, str]]: """ A method to read CSV data from a string and return the data as a list of dictionaries. |
