# Path: mididings/units/base.py
# class _Filter(_Unit, _Selector):
#     """
#     Wrapper class for all filters.
#     """
#     def __init__(self, unit):
#         _Unit.__init__(self, unit)
# 
#     def __invert__(self):
#         """
#         Invert the filter (still act on the same event types, unary
#         operator ~).
#         """
#         return self.invert()
# 
#     def __neg__(self):
#         """
#         Negate the filter (ignoring event types, unary operator -)
#         """
#         return self.negate()
# 
#     def invert(self):
#         return _InvertedFilter(self, False)
# 
#     def negate(self):
#         return _InvertedFilter(self, True)
# 
#     def build(self):
#         return self
# 
#     def build_negated(self):
#         return self.negate()


import _mididings
import mididings.util as _util
import mididings.overload as _overload
import mididings.arguments as _arguments
import mididings.unitrepr as _unitrepr
import functools as _functools
from mididings.units.base import _Filter
# -*- coding: utf-8 -*-
#
# mididings
#
# Copyright (C) 2008-2014  Dominic Sacré  <dominic.sacre@gmx.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#






@_unitrepr.accept(_arguments.flatten(_util.port_number), add_varargs=True)
def PortFilter(ports):
    """
    PortFilter(ports, ...)

    Filter events by port name or number. The *ports* argument can be a single
    port or a list of multiple ports.
    """

# Path: mididings/units/base.py
# class _Filter(_Unit, _Selector):
#     """
#     Wrapper class for all filters.
#     """
#     def __init__(self, unit):
#         _Unit.__init__(self, unit)
# 
#     def __invert__(self):
#         """
#         Invert the filter (still act on the same event types, unary
#         operator ~).
#         """
#         return self.invert()
# 
#     def __neg__(self):
#         """
#         Negate the filter (ignoring event types, unary operator -)
#         """
#         return self.negate()
# 
#     def invert(self):
#         return _InvertedFilter(self, False)
# 
#     def negate(self):
#         return _InvertedFilter(self, True)
# 
#     def build(self):
#         return self
# 
#     def build_negated(self):
#         return self.negate()


# Path: mididings/units/filters.py
import _mididings
import mididings.util as _util
import mididings.overload as _overload
import mididings.arguments as _arguments
import mididings.unitrepr as _unitrepr
import functools as _functools
from mididings.units.base import _Filter

# -*- coding: utf-8 -*-
#
# mididings
#
# Copyright (C) 2008-2014  Dominic Sacré  <dominic.sacre@gmx.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#






@_unitrepr.accept(_arguments.flatten(_util.port_number), add_varargs=True)
def PortFilter(ports):
    """
    PortFilter(ports, ...)

    Filter events by port name or number. The *ports* argument can be a single
    port or a list of multiple ports.
    """

    return _Filter(_mididings.PortFilter(map(_util.actual, ports)))