<commit_before>import platform
import re

from dnload.common import is_verbose

########################################
# PlatformVar ##########################
########################################

class PlatformVar:
    """Platform-dependent variable."""

    def __init__(self, name, osname = None, osarch = None):
        """Initialize platform variable."""
        self.__name = name
        self.__osname = osname
        if not self.__osname:
            self.__osname = g_osname
        self.__osarch = osarch
        if not self.__osarch:
            self.__osarch = g_osarch

    def get(self):
        """Get value associated with the name."""
        if self.__name not in g_platform_variables:
            raise RuntimeError("unknown platform variable '%s'" % (self.__name))
        current_var = g_platform_variables[self.__name]
        combinations = get_platform_combinations(self.__osname, self.__osarch)
        for ii in combinations:
            if ii in current_var:
                return current_var[ii]
        raise ValueError("current platform %s not supported for variable '%s'" % (str(combinations), self.__name))

    def deconstructable(self):
        """Tell if this platform value can be deconstructed."""
        return isinstance(self.get(), int)

    def __int__(self):
        """Convert to integer."""
        ret = self.get()
        if not isinstance(ret, int):
            raise ValueError("not an integer platform variable")
        return ret
<commit_msg>Resolve osarch/osname later than suggested.<commit_after>import platform
import re

from dnload.common import is_verbose

########################################
# PlatformVar ##########################
########################################

class PlatformVar:
    """Platform-dependent variable."""

    def __init__(self, name, osname = None, osarch = None):
        """Initialize platform variable."""
        self.__name = name
        self.__osname = osname
        self.__osarch = osarch

    def get(self):
        """Get value associated with the name."""
        if self.__name not in g_platform_variables:
            raise RuntimeError("unknown platform variable '%s'" % (self.__name))
        current_var = g_platform_variables[self.__name]
        osname = self.__osname
        if osname is None:
            osname = g_osname
        osarch = self.__osarch
        if osarch is None:
            osarch = g_osarch
        combinations = get_platform_combinations(osname, osarch)
        for ii in combinations:
            if ii in current_var:
                return current_var[ii]
        raise ValueError("current platform %s not supported for variable '%s'" % (str(combinations), self.__name))

    def deconstructable(self):
        """Tell if this platform value can be deconstructed."""
        return isinstance(self.get(), int)

    def __int__(self):
        """Convert to integer."""
        ret = self.get()
        if not isinstance(ret, int):
            raise ValueError("not an integer platform variable")
        return ret

{'fraction_non_alphanumeric': 0.15600522193211488, 'fraction_numerical': 0.0, 'mean_word_length': 2.697225572979493, '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': '7020677', 'n_tokens_mistral': 769, 'n_tokens_neox': 759, 'n_words': 242}