<commit_before>from astropy.table import Table
import os


class AuxService:

    renames = {}
    ignored_columns = []
    transforms = {}
    basename = 'AUX_SERVICE'

    def __init__(self, auxdir='/fact/aux'):
        self.auxdir = auxdir
        self.filename_template = os.path.join(
            self.auxdir, '{date:%Y}',  '{date:%m}', '{date:%d}',
            '{date:%Y%m%d}.' + self.basename + '.fits'
        )

    def read(self, date):

        filename = self.filename_template.format(date=date)
        df = Table.read(filename).to_pandas()

        df.drop(self.ignored_columns, axis=1, inplace=True)
        df.rename(columns=self.renames, inplace=True)

        for key, transform in self.transforms.items():
            df[key] = transform(df[key])

        return df<commit_msg>Add method to read from filename<commit_after>from astropy.table import Table
import os


class AuxService:

    renames = {}
    ignored_columns = []
    transforms = {}
    basename = 'AUX_SERVICE'

    def __init__(self, auxdir='/fact/aux'):
        self.auxdir = auxdir
        self.filename_template = os.path.join(
            self.auxdir, '{date:%Y}',  '{date:%m}', '{date:%d}',
            '{date:%Y%m%d}.' + self.basename + '.fits'
        )

    def read_file(self, filename):
        df = Table.read(filename).to_pandas()

        df.drop(self.ignored_columns, axis=1, inplace=True)
        df.rename(columns=self.renames, inplace=True)

        for key, transform in self.transforms.items():
            df[key] = transform(df[key])

        return df

    def read_date(self, date):

        filename = self.filename_template.format(date=date)
        return self.read_file(filename)
{'fraction_non_alphanumeric': 0.14243498817966904, 'fraction_numerical': 0.001182033096926714, 'mean_word_length': 2.5642105263157893, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4308966', 'n_tokens_mistral': 555, 'n_tokens_neox': 549, 'n_words': 105}