<commit_before>import os
import ast
import copy
from pprint import pformat


class FileObject(object):
    """ Class for keeping track of files.

    Attributes:
        modules (dict): dict of current modules with `alias: module_name`, `key:value pairs`.
        aliases (dict): dict of current modules with `alias: original_name`, `key:value pairs`.
        node (:mod:`ast.AST`): AST node for entire file.
        name (string): File name.
        classes (list): :class:`ClassObject` items defined in the current file.
        relative_namespace (string): The namespace for the current file,
            taken from the relative path of the current file
        ignore (set): Functions to be ignored, as defined in a `.cg_ignore` text file.
    """
    def __init__(self, file_name, modules=None, aliases=None):
        self.modules = copy.deepcopy(modules) if modules else {}
        self.aliases = copy.deepcopy(aliases) if aliases else {}
        self.name = file_name
        self.full_path = os.path.abspath(file_name)
        with open(self.full_path, 'r') as input_file:
            self.node = ast.parse(input_file.read(), filename=self.name)
        self.classes = []
        self.relative_namespace = self.name.split('.')[0].replace('/', '.')
        self.ignore = set()<commit_msg>Use os.path functions for better cross-platform compatibility<commit_after>import os
import ast
import copy
from pprint import pformat


class FileObject(object):
    """ Class for keeping track of files.

    Attributes:
        modules (dict): dict of current modules with `alias: module_name`, `key:value pairs`.
        aliases (dict): dict of current modules with `alias: original_name`, `key:value pairs`.
        node (:mod:`ast.AST`): AST node for entire file.
        name (string): File name.
        classes (list): :class:`ClassObject` items defined in the current file.
        relative_namespace (string): The namespace for the current file,
            taken from the relative path of the current file
        ignore (set): Functions to be ignored, as defined in a `.cg_ignore` text file.
    """
    def __init__(self, file_name, modules=None, aliases=None):
        self.modules = copy.deepcopy(modules) if modules else {}
        self.aliases = copy.deepcopy(aliases) if aliases else {}
        self.name = file_name
        self.full_path = os.path.abspath(file_name)
        with open(self.full_path, 'r') as input_file:
            self.node = ast.parse(input_file.read(), filename=self.name)
        self.classes = []
        self.relative_namespace = os.path.splitext(self.name)[0].replace(os.path.sep, '.')
        self.ignore = set()
{'fraction_non_alphanumeric': 0.1096871466264606, 'fraction_numerical': 0.0007538635506973238, 'mean_word_length': 2.961194029850746, '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': '1639853', 'n_tokens_mistral': 748, 'n_tokens_neox': 737, 'n_words': 251}