<commit_before>"""
Base ThermoState module
"""
from CoolProp.CoolProp import PropsSI
from pint import UnitRegistry
from pint.unit import UnitsContainer, UnitDefinition
from pint.converters import ScaleConverter

units = UnitRegistry()
Q_ = units.Quantity
units.define(UnitDefinition('percent', 'pct', (), ScaleConverter(1.0/100.0)))


class StateError(Exception):
    pass


class State(object):
    """Basic State manager for thermodyanmic states

    Parameters
    ----------
    substance : `str`
        One of the substances supported by CoolProp
    T : `pint.UnitRegistry.Quantity`
        Temperature
    p : `pint.UnitRegistry.Quantity`
        Pressure
    u : `pint.UnitRegistry.Quantity`
        Mass-specific internal energy
    s : `pint.UnitRegistry.Quantity`
        Mass-specific entropy
    v : `pint.UnitRegistry.Quantity`
        Mass-specific volume
    h : `pint.UnitRegistry.Quantity`
        Mass-specific enthalpy
    x : `pint.UnitRegistry.Quantity`
        Quality
    """
    allowed_subs = ['AIR', 'AMMONIA', 'WATER', 'PROPANE', 'R134A', 'R22']

    allowed_pairs = [
        'Tp', 'Ts', 'Tv', 'Tx',
        'pT', 'pu', 'ps', 'pv', 'ph', 'px',
        'up', 'us', 'uv',
        'sT', 'sp', 'su', 'sv', 'sh',
        'vT', 'vp', 'vu', 'vs', 'vh',
        'hp', 'hs', 'hv',
    ]

    dimensions = {
        'T': UnitsContainer({'[temperature]': 1.0}),
        'p': UnitsContainer({'[mass]': 1.0, '[length]': -1.0, '[time]': -2.0}),
        'u': UnitsContainer({'[length]': 2.0, '[time]': -2.0}),
        's': UnitsContainer({'[length]': 2.0, '[time]': -2.0, '[temperature]': -1.0}),
        'v': UnitsContainer({'[length]': 3.0, '[mass]': -1.0}),
        'h': UnitsContainer({'[length]': 2.0, '[time]': -2.0}),
        'x': UnitsContainer({}),
    }

    SI_units = {
        'T': 'kelvin',<commit_msg>Remove us and su as allowable pairs<commit_after>"""
Base ThermoState module
"""
from CoolProp.CoolProp import PropsSI
from pint import UnitRegistry
from pint.unit import UnitsContainer, UnitDefinition
from pint.converters import ScaleConverter

units = UnitRegistry()
Q_ = units.Quantity
units.define(UnitDefinition('percent', 'pct', (), ScaleConverter(1.0/100.0)))


class StateError(Exception):
    pass


class State(object):
    """Basic State manager for thermodyanmic states

    Parameters
    ----------
    substance : `str`
        One of the substances supported by CoolProp
    T : `pint.UnitRegistry.Quantity`
        Temperature
    p : `pint.UnitRegistry.Quantity`
        Pressure
    u : `pint.UnitRegistry.Quantity`
        Mass-specific internal energy
    s : `pint.UnitRegistry.Quantity`
        Mass-specific entropy
    v : `pint.UnitRegistry.Quantity`
        Mass-specific volume
    h : `pint.UnitRegistry.Quantity`
        Mass-specific enthalpy
    x : `pint.UnitRegistry.Quantity`
        Quality
    """
    allowed_subs = ['AIR', 'AMMONIA', 'WATER', 'PROPANE', 'R134A', 'R22']

    allowed_pairs = [
        'Tp', 'Ts', 'Tv', 'Tx',
        'pT', 'pu', 'ps', 'pv', 'ph', 'px',
        'up', 'uv',
        'sT', 'sp', 'sv', 'sh',
        'vT', 'vp', 'vu', 'vs', 'vh',
        'hp', 'hs', 'hv',
    ]

    dimensions = {
        'T': UnitsContainer({'[temperature]': 1.0}),
        'p': UnitsContainer({'[mass]': 1.0, '[length]': -1.0, '[time]': -2.0}),
        'u': UnitsContainer({'[length]': 2.0, '[time]': -2.0}),
        's': UnitsContainer({'[length]': 2.0, '[time]': -2.0, '[temperature]': -1.0}),
        'v': UnitsContainer({'[length]': 3.0, '[mass]': -1.0}),
        'h': UnitsContainer({'[length]': 2.0, '[time]': -2.0}),
        'x': UnitsContainer({}),
    }

    SI_units = {
        'T': 'kelvin',
{'fraction_non_alphanumeric': 0.19498910675381265, 'fraction_numerical': 0.020152505446623094, 'mean_word_length': 2.759467758444217, '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': '2458396', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1233, 'n_words': 297}