/usr/share/pyshared/pybridge/bridge/symbols.py is in pybridge-common 0.3.0-7.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | # PyBridge -- online contract bridge made easy.
# Copyright (C) 2004-2007 PyBridge Project.
#
# 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""
This module contains enumeration types used for the implementation of bridge.
The particular ordering of the values in each enumeration is assumed throughout
PyBridge, so it is vital that the order is not changed.
"""
from twisted.spread import pb
from pybridge.enum import Enum, EnumValue
class WeakEnumValue(EnumValue, pb.Copyable, pb.RemoteCopy):
"""A variant of EnumValue which may be copied across the network.
Since the enumtype reference (an Enum object) cannot be maintained when this
object is copied, it is discarded. An undesirable side-effect is that
comparisons between WeakEnumValue objects with identical indexes and keys
(but belonging to different Enum types) will result in True.
"""
enumtype = property(lambda self: None)
def __repr__(self):
return "WeakEnumValue(%s, %s)" % (self.index, self.key)
def __cmp__(self, other):
try:
assert self.key == other.key
result = cmp(self.index, other.index)
except (AssertionError, AttributeError):
result = NotImplemented
return result
def getStateToCopy(self):
return (self.index, self.key)
def setCopyableState(self, (index, key)):
# self = WeakEnumValue(None, index, key)
self.__init__(None, index, key)
pb.setUnjellyableForClass(WeakEnumValue, WeakEnumValue)
# Bid levels and strains (denominations).
Level = Enum('One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven',
value_type=WeakEnumValue)
Strain = Enum('Club', 'Diamond', 'Heart', 'Spade', 'NoTrump',
value_type=WeakEnumValue)
# Card ranks and suits.
Rank = Enum('Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine',
'Ten', 'Jack', 'Queen', 'King', 'Ace', value_type=WeakEnumValue)
Suit = Enum('Club', 'Diamond', 'Heart', 'Spade', value_type=WeakEnumValue)
# Player compass positions, in clockwise order.
Direction = Enum('North', 'East', 'South', 'West', value_type=WeakEnumValue)
# Vulnerability indicators.
Vulnerable = Enum('None', 'NorthSouth', 'EastWest', 'All',
value_type=WeakEnumValue)
|