<commit_before>"""
This file defines the Port classes used in NineML

:copyright: Copyright 2010-2013 by the Python lib9ML team, see AUTHORS.
:license: BSD-3, see LICENSE for details.
"""
from abc import ABCMeta
from . import BaseALObject
from nineml.abstraction_layer.units import dimensionless
from nineml.utils import ensure_valid_identifier
from nineml.exceptions import NineMLRuntimeError


class Port(BaseALObject):

    """
    Base class for |AnalogSendPorts|, |AnalogReceivePorts|,
    |EventSendPorts|, |EventReceivePorts| and |AnalogReducePorts|.

    In general, a port has a ``name``, which can be used to reference it,
    and a ``mode``, which specifies whether it sends or receives information.

    Generally, a send port can be connected to receive port to allow different
    components to communicate.

    |AnalogSendPorts| and |EventSendPorts| can be connected to any number of
    |AnalogReceivePorts| and |EventReceivePorts| respectively, but each
    |AnalogReceivePort| and |EventReceivePort| can only be connected to a
    single |AnalogSendPort| and |EventSendPort| respectively.

    """
    __metaclass__ = ABCMeta  # Ensure abstract base class isn't instantiated

    defining_attributes = ('name',)
    index_key = 'Port'

    def __init__(self, name):
        """ Port Constructor.

        `name` -- The name of the port, as a `string`
        """
        name = name.strip()
        ensure_valid_identifier(name)
        self._name = name

    @property
    def name(self):
        """The name of the port, local to the current component"""<commit_msg>fixed bug with annotations of analog ports<commit_after>"""
This file defines the Port classes used in NineML

:copyright: Copyright 2010-2013 by the Python lib9ML team, see AUTHORS.
:license: BSD-3, see LICENSE for details.
"""
from abc import ABCMeta
from . import BaseALObject
from nineml.abstraction_layer.units import dimensionless
from nineml.utils import ensure_valid_identifier
from nineml.exceptions import NineMLRuntimeError


class Port(BaseALObject):

    """
    Base class for |AnalogSendPorts|, |AnalogReceivePorts|,
    |EventSendPorts|, |EventReceivePorts| and |AnalogReducePorts|.

    In general, a port has a ``name``, which can be used to reference it,
    and a ``mode``, which specifies whether it sends or receives information.

    Generally, a send port can be connected to receive port to allow different
    components to communicate.

    |AnalogSendPorts| and |EventSendPorts| can be connected to any number of
    |AnalogReceivePorts| and |EventReceivePorts| respectively, but each
    |AnalogReceivePort| and |EventReceivePort| can only be connected to a
    single |AnalogSendPort| and |EventSendPort| respectively.

    """
    __metaclass__ = ABCMeta  # Ensure abstract base class isn't instantiated

    defining_attributes = ('name',)
    index_key = 'Port'

    def __init__(self, name):
        """ Port Constructor.

        `name` -- The name of the port, as a `string`
        """
        super(Port, self).__init__()
        name = name.strip()
        ensure_valid_identifier(name)
        self._name = name

    @property
    def name(self):
        """The name of the port, local to the current component"""
{'fraction_non_alphanumeric': 0.08148148148148149, 'fraction_numerical': 0.006172839506172839, 'mean_word_length': 3.616809116809117, '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': '952174', 'n_tokens_mistral': 956, 'n_tokens_neox': 906, 'n_words': 349}