diff options
| author | Alex Schofield <git@ajschof.me> | 2025-02-21 02:36:13 +0000 |
|---|---|---|
| committer | Alex Schofield <git@ajschof.me> | 2025-02-21 02:36:13 +0000 |
| commit | 78b18bb9effde45e9f104ec6b5add6eb149d0fe9 (patch) | |
| tree | cfa95e1d5e971839293337a4a94f12afaafd25c2 /gdpr_obfuscator/read.py | |
| parent | 6e17fcd7a99f6405dad105d83381f80e5951fc83 (diff) | |
| download | gdpr-obfuscator-78b18bb9effde45e9f104ec6b5add6eb149d0fe9.tar.gz gdpr-obfuscator-78b18bb9effde45e9f104ec6b5add6eb149d0fe9.zip | |
don't create byte stream in read methods
Diffstat (limited to 'gdpr_obfuscator/read.py')
| -rw-r--r-- | gdpr_obfuscator/read.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/gdpr_obfuscator/read.py b/gdpr_obfuscator/read.py index a486447..d51c6f3 100644 --- a/gdpr_obfuscator/read.py +++ b/gdpr_obfuscator/read.py @@ -19,12 +19,8 @@ class DataReader: dictionaries. """ - try: - with open(path, mode="r", encoding="utf-8") as f: - reader = csv.DictReader(f) - return [dict(row) for row in reader] - except Exception as e: - pass + with open(path, mode="r", encoding="utf-8") as f: + return self.read_string(f.read()) def read_s3(self, path) -> List[Dict[str, str]]: """ @@ -38,7 +34,7 @@ class DataReader: response = client.get_object(Bucket=bucket, Key=key) content = response["Body"].read().decode("utf-8") read_csv_content = self.read_string(content) - return self.utils.create_byte_stream(read_csv_content) + return read_csv_content def read_string(self, content: str) -> List[Dict[str, str]]: """ |
