bridgeobjects 0.1.29__tar.gz → 0.1.31__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. bridgeobjects-0.1.29/PKG-INFO → bridgeobjects-0.1.31/HISTORY.md +13 -41
  2. bridgeobjects-0.1.31/PKG-INFO +41 -0
  3. {bridgeobjects-0.1.29 → bridgeobjects-0.1.31}/README.md +10 -10
  4. {bridgeobjects-0.1.29 → bridgeobjects-0.1.31}/bridgeobjects/__init__.py +15 -15
  5. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/_parse_lin_string.py +0 -2
  6. bridgeobjects-0.1.31/bridgeobjects/_version.py +1 -0
  7. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/constants.py +3 -1
  8. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/hand.py +3 -2
  9. bridgeobjects-0.1.31/bridgeobjects/src/.vscode/settings.json +4 -0
  10. bridgeobjects-0.1.31/pyproject.toml +15 -0
  11. bridgeobjects-0.1.29/bridgeobjects/_version.py +0 -1
  12. bridgeobjects-0.1.29/bridgeobjects/tests/__init__.py +0 -0
  13. bridgeobjects-0.1.29/bridgeobjects/tests/test_auctions.py +0 -97
  14. bridgeobjects-0.1.29/bridgeobjects/tests/test_boards.py +0 -581
  15. bridgeobjects-0.1.29/bridgeobjects/tests/test_calls.py +0 -242
  16. bridgeobjects-0.1.29/bridgeobjects/tests/test_cards.py +0 -185
  17. bridgeobjects-0.1.29/bridgeobjects/tests/test_contracts.py +0 -151
  18. bridgeobjects-0.1.29/bridgeobjects/tests/test_data/lin_input_file_1.lin +0 -33
  19. bridgeobjects-0.1.29/bridgeobjects/tests/test_data/pbn_auction_1.pbn +0 -47
  20. bridgeobjects-0.1.29/bridgeobjects/tests/test_data/pbn_auction_2.pbn +0 -47
  21. bridgeobjects-0.1.29/bridgeobjects/tests/test_data/pbn_input_3.pbn +0 -120
  22. bridgeobjects-0.1.29/bridgeobjects/tests/test_data/pbn_input_file_1.pbn +0 -1287
  23. bridgeobjects-0.1.29/bridgeobjects/tests/test_data/pbn_output_file_1.pbn +0 -29
  24. bridgeobjects-0.1.29/bridgeobjects/tests/test_data/rbn_input_file_1.rbn +0 -24
  25. bridgeobjects-0.1.29/bridgeobjects/tests/test_data/rbn_output_file_1.rbn +0 -124
  26. bridgeobjects-0.1.29/bridgeobjects/tests/test_denominations.py +0 -139
  27. bridgeobjects-0.1.29/bridgeobjects/tests/test_events.py +0 -66
  28. bridgeobjects-0.1.29/bridgeobjects/tests/test_hands.py +0 -946
  29. bridgeobjects-0.1.29/bridgeobjects/tests/test_lin.py +0 -218
  30. bridgeobjects-0.1.29/bridgeobjects/tests/test_pbn.py +0 -233
  31. bridgeobjects-0.1.29/bridgeobjects/tests/test_rbn.py +0 -215
  32. bridgeobjects-0.1.29/bridgeobjects/tests/test_scores.py +0 -449
  33. bridgeobjects-0.1.29/bridgeobjects/tests/test_suits.py +0 -134
  34. bridgeobjects-0.1.29/bridgeobjects/tests/test_trick.py +0 -61
  35. bridgeobjects-0.1.29/bridgeobjects.egg-info/PKG-INFO +0 -360
  36. bridgeobjects-0.1.29/bridgeobjects.egg-info/SOURCES.txt +0 -51
  37. bridgeobjects-0.1.29/bridgeobjects.egg-info/dependency_links.txt +0 -1
  38. bridgeobjects-0.1.29/bridgeobjects.egg-info/top_level.txt +0 -1
  39. bridgeobjects-0.1.29/setup.cfg +0 -4
  40. bridgeobjects-0.1.29/setup.py +0 -57
  41. {bridgeobjects-0.1.29 → bridgeobjects-0.1.31}/LICENSE.txt +0 -0
  42. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/_create_pbn_string.py +0 -0
  43. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/_file_constants.py +0 -0
  44. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/_parse_pbn_string.py +0 -0
  45. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/_parse_rbn_string.py +0 -0
  46. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/auction.py +0 -0
  47. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/board.py +0 -0
  48. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/call.py +0 -0
  49. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/card.py +0 -0
  50. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/contract.py +0 -0
  51. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/denomination.py +0 -0
  52. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/event.py +0 -0
  53. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/file_operations.py +0 -0
  54. {bridgeobjects-0.1.29 → bridgeobjects-0.1.31}/bridgeobjects/src/__init__.py +0 -0
  55. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/suit.py +0 -0
  56. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/suit_base.py +0 -0
  57. {bridgeobjects-0.1.29/bridgeobjects/src → bridgeobjects-0.1.31/bridgeobjects}/trick.py +0 -0
@@ -1,46 +1,15 @@
1
- Metadata-Version: 2.1
2
- Name: bridgeobjects
3
- Version: 0.1.29
4
- Summary: A collection of modules that allows the user to access objects used
5
- Home-page: https://psionman@bitbucket.org/psionman/bridgeobjects.git
6
- Download-URL: https://pypi.org/project/bridgeobjects/
7
- Author: jeff watkins
8
- Author-email: support@bidforgame.com
9
- License: MIT
10
- Keywords: bridge,duplicate bridge,contract bridge,hand,board,suit,auction,contract,card
11
- Description-Content-Type: text/markdown
12
- License-File: LICENSE.txt
13
-
14
- # bridgeobjects
15
- A collection of modules that allows the user to utilise objects used in bridge games, for example, a board or a contract.
16
-
17
- The classes form a natural hierarchy:
18
-
19
- event
20
- └── board
21
- ├── auction
22
- │   └── call
23
- │   └── denomination
24
- ├── contract
25
- ├── hand
26
- │   └── card
27
- │   └── suit
28
- └── trick
29
-
30
- (However, some classes are natural subsidiaries not represented in this classification, for example, there are four cards in a trick.)
31
-
32
-
33
- The objects can be created using a simple, self explanatory, human readable set of definitions
34
- by using Portable Bridge Notation (PBN) (http://www.tistis.nl/pbn/) or
35
- Richard’s Bridge Notation (RBN) (http://www.rpbridge.net/7a12.htm).
36
-
37
- ## Installation
38
- ```bash
39
- pip install bridgeobjects
40
- ```
1
+ # History
41
2
 
3
+ Version 0.1.32 - 21 July 2025
4
+
5
+ 1. Remove icecream
6
+ ------------------------------
7
+
8
+
9
+ 1. Initailse hand shape
10
+
11
+ ------
42
12
 
43
- # History
44
13
  Version 0.1.29 07 Mar 2024
45
14
 
46
15
  1. Rationalise modifier in contract
@@ -52,6 +21,8 @@ Version 0.1.28 01 Feb 2024
52
21
  1. Refactor hand
53
22
  2. File load pbn to handle BBO files
54
23
 
24
+ ------
25
+
55
26
  Version 0.1.27 7 Jan 2024
56
27
 
57
28
  1. Fix calls in Auction
@@ -358,3 +329,4 @@ Version 0.0.0 - August 2020
358
329
  Created and uploaded
359
330
 
360
331
  ---
332
+
@@ -0,0 +1,41 @@
1
+ Metadata-Version: 2.3
2
+ Name: bridgeobjects
3
+ Version: 0.1.31
4
+ Summary: A collection of modules that allows the user to utilise objects used in bridge games, for example, a board or a contract.
5
+ Author: Jeff
6
+ Author-email: jeffwatkins2000@gmail.com
7
+ Requires-Python: >=3.11
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Description-Content-Type: text/markdown
13
+
14
+ # bridgeobjects
15
+ A collection of modules that allows the user to utilise objects used in bridge games, for example, a board or a contract.
16
+
17
+ The classes form a natural hierarchy:
18
+
19
+ event
20
+ └── board
21
+ ├── auction
22
+ │   └── call
23
+ │   └── denomination
24
+ ├── contract
25
+ ├── hand
26
+ │   └── card
27
+ │   └── suit
28
+ └── trick
29
+
30
+ (However, some classes are natural subsidiaries not represented in this classification, for example, there are four cards in a trick.)
31
+
32
+
33
+ The objects can be created using a simple, self explanatory, human readable set of definitions
34
+ by using Portable Bridge Notation (PBN) (http://www.tistis.nl/pbn/) or
35
+ Richard’s Bridge Notation (RBN) (http://www.rpbridge.net/7a12.htm).
36
+
37
+ ## Installation
38
+ ```bash
39
+ pip install bridgeobjects
40
+ ```
41
+
@@ -3,16 +3,16 @@ A collection of modules that allows the user to utilise objects used in bridge g
3
3
 
4
4
  The classes form a natural hierarchy:
5
5
 
6
- event
7
- └── board
8
- ├── auction
9
- │   └── call
10
- │   └── denomination
11
- ├── contract
12
- ├── hand
13
- │   └── card
14
- │   └── suit
15
- └── trick
6
+ event
7
+ └── board
8
+ ├── auction
9
+ │   └── call
10
+ │   └── denomination
11
+ ├── contract
12
+ ├── hand
13
+ │   └── card
14
+ │   └── suit
15
+ └── trick
16
16
 
17
17
  (However, some classes are natural subsidiaries not represented in this classification, for example, there are four cards in a trick.)
18
18
 
@@ -17,22 +17,22 @@
17
17
  trick: four cards played which one pair wins:
18
18
  file_operations: a module to load or save events in a PBN, RBN or LIN format.
19
19
  """
20
- from icecream import ic, install
21
- ic.configureOutput(includeContext=True)
22
- install()
20
+ # from icecream import ic, install
21
+ # ic.configureOutput(includeContext=True)
22
+ # install()
23
23
 
24
- from bridgeobjects.src.constants import *
25
- from bridgeobjects.src.board import *
26
- from bridgeobjects.src.hand import *
27
- from bridgeobjects.src.card import *
28
- from bridgeobjects.src.suit import *
29
- from bridgeobjects.src.auction import *
30
- from bridgeobjects.src.contract import *
31
- from bridgeobjects.src.call import *
32
- from bridgeobjects.src.event import *
33
- from bridgeobjects.src.trick import *
34
- from bridgeobjects.src.file_operations import *
35
- from bridgeobjects.src.denomination import *
24
+ from bridgeobjects.constants import *
25
+ from bridgeobjects.board import *
26
+ from bridgeobjects.hand import *
27
+ from bridgeobjects.card import *
28
+ from bridgeobjects.suit import *
29
+ from bridgeobjects.auction import *
30
+ from bridgeobjects.contract import *
31
+ from bridgeobjects.call import *
32
+ from bridgeobjects.event import *
33
+ from bridgeobjects.trick import *
34
+ from bridgeobjects.file_operations import *
35
+ from bridgeobjects.denomination import *
36
36
 
37
37
  from ._version import __version__
38
38
  VERSION = __version__
@@ -25,10 +25,8 @@ from .suit import Suit
25
25
  from .hand import Hand
26
26
  from .card import Card
27
27
  from .constants import SEATS
28
- # from ._file_constants import
29
28
  from ._file_constants import LIN_VULNERABILITY_CONVERSION
30
29
 
31
- from termcolor import cprint
32
30
 
33
31
  MODULE_COLOUR = 'red'
34
32
 
@@ -0,0 +1 @@
1
+ __version__ = '0.1.31'
@@ -3,7 +3,7 @@
3
3
  __all__ = ['SEATS', 'ROLES', 'VULNERABLE', 'VULNERABILITY',
4
4
  'CALLS', 'CONTRACTS', 'SUIT_NAMES', 'DENOMINATION_NAMES',
5
5
  'RANKS', 'SUITS', 'BALANCED_SHAPES', 'SEMI_BALANCED_SHAPES',
6
- 'SHAPES', 'SHAPE_PROBABILITIES', 'HONOUR_POINTS',
6
+ 'SHAPES', 'SHAPE_PROBABILITIES', 'HONOUR_POINTS', 'SUIT_SYMBOLS',
7
7
  'CARD_NAMES', 'CARD_VALUES', 'DISPLAY_SUIT_ORDER']
8
8
 
9
9
  from .suit import Clubs, Diamonds, Hearts, Spades
@@ -68,6 +68,8 @@ RANKS = ['x', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A']
68
68
 
69
69
  #: Suits dictionary
70
70
  SUITS = {'C': Clubs(), 'D': Diamonds(), 'H': Hearts(), 'S': Spades()}
71
+ # unicode
72
+ SUIT_SYMBOLS = {'S': '\u2660', 'H': '\u2665', 'D': '\u2666', 'C': '\u2663'}
71
73
 
72
74
  DISPLAY_SUIT_ORDER = 'SHCD'
73
75
 
@@ -3,7 +3,7 @@
3
3
  from .card import Card
4
4
  from .denomination import Denomination
5
5
  from .suit import Suit, Spades, Hearts, Diamonds, Clubs
6
- from .constants import (SUIT_NAMES, RANKS, SUITS, HONOUR_POINTS,
6
+ from .constants import (SUIT_NAMES, RANKS, SUITS, HONOUR_POINTS, SEATS,
7
7
  BALANCED_SHAPES, SEMI_BALANCED_SHAPES,
8
8
  CARD_NAMES, DISPLAY_SUIT_ORDER)
9
9
 
@@ -13,6 +13,7 @@ __all__ = ['Hand']
13
13
  CANDIDATES_4441 = {'S': SUITS['H'], 'H': SUITS['S'],
14
14
  'D': SUITS['H'], 'C': SUITS['S']}
15
15
 
16
+
16
17
  class Hand(object):
17
18
  """
18
19
  A hand object for the bridgeobjects module.
@@ -57,7 +58,7 @@ class Hand(object):
57
58
 
58
59
  # attributes set once the cards are known for the hand
59
60
  self._high_card_points = -1
60
- self._shape: list[int] = []
61
+ self._shape: list[int] = [0 for seat in SEATS]
61
62
  self._equal_long_suits = False
62
63
  self._suits_by_length = None
63
64
  self._longest_suit = None
@@ -0,0 +1,4 @@
1
+ {
2
+ "python.linting.flake8Enabled": true,
3
+ "python.linting.enabled": true
4
+ }
@@ -0,0 +1,15 @@
1
+ [tool.poetry]
2
+ name = "bridgeobjects"
3
+ version = "0.1.31"
4
+ description = "A collection of modules that allows the user to utilise objects used in bridge games, for example, a board or a contract."
5
+ authors = ["Jeff <jeffwatkins2000@gmail.com>"]
6
+ readme = "README.md"
7
+ include = ["HISTORY.md"]
8
+
9
+
10
+ [tool.poetry.dependencies]
11
+ python = ">=3.11"
12
+
13
+ [build-system]
14
+ requires = ["poetry-core"]
15
+ build-backend = "poetry.core.masonry.api"
@@ -1 +0,0 @@
1
- __version__ = '0.1.29'
File without changes
@@ -1,97 +0,0 @@
1
- """A set of tests for the bridgeobjects Auction class."""
2
-
3
- import pytest
4
- from pathlib import Path
5
-
6
- from ..src.auction import Auction
7
- from ..src.call import Call
8
- from ..src.file_operations import load_pbn
9
-
10
- DATA_PATH = 'tests/test_data/'
11
- load_path = Path(DATA_PATH, 'pbn_auction_1.pbn')
12
- event = load_pbn(load_path)[0]
13
- test_auction = event.boards[0].auction
14
-
15
- """
16
- 1D 1S 3H =1= 4S
17
- 4NT =2= X Pass Pass
18
- 5C X 5H X
19
- Pass Pass Pass
20
-
21
- auction.calls = [
22
- Call('1D'), Call('1S'), Call('3H'), Call('4S'),
23
- Call('4NT'), Call('D'), Call('P'), Call('P'),
24
- Call('5C'), Call('D'), Call('5H'), Call('D'),
25
- Call('P'), Call('P'), Call('P'),
26
- ]
27
- """
28
-
29
-
30
- def test_first_caller_valid():
31
- """Test the first caller validation"""
32
- with pytest.raises(ValueError):
33
- Auction(first_caller='L')
34
-
35
-
36
- def test_calls_valid():
37
- """Test the call validation"""
38
- with pytest.raises(TypeError):
39
- auction = Auction(calls=3)
40
- with pytest.raises(ValueError):
41
- auction = Auction(calls=['0NT'])
42
- auction = Auction(calls=['1NT', 'P', 'P', 'P'])
43
- assert auction.calls == [Call('1NT'), Call('P'), Call('P'), Call('P')]
44
-
45
-
46
- def test_auction_caller():
47
- """Ensure that the auction caller is correct."""
48
- auction = Auction(first_caller='N')
49
- assert auction.first_caller == 'N'
50
-
51
-
52
- def test_auction_caller_assign():
53
- """Ensure that the auction caller assignment is correct."""
54
- auction = Auction()
55
- auction.first_caller = 'N'
56
- assert auction.first_caller == 'N'
57
-
58
-
59
- def test_auction_repr():
60
- """Ensure that the auction __repr__ is correct."""
61
- assert repr(test_auction) == 'Auction: 1D, 1S, 3H, 4S, 4NT, D, P, P, 5C, D, 5H, D, P, P, P'
62
-
63
-
64
- def test_auction_str():
65
- """Ensure that the auction __str__ is correct."""
66
- assert str(test_auction) == 'Auction: 1D, 1S, 3H, 4S, 4NT, D, P, P, 5C, D, 5H, D, P, P, P'
67
-
68
-
69
- def test_auction_note_keys():
70
- """Ensure that the auction note_keys is correct."""
71
- assert test_auction.note_keys == ['', '', '1', '', '2', '', '', '', '', '', '', '', '', '', '']
72
-
73
-
74
- def test_auction_note_key_validation():
75
- """Ensure that the auction note key setter is correct."""
76
- with pytest.raises(TypeError):
77
- auction = Auction()
78
- auction.note_keys = '1'
79
- with pytest.raises(TypeError):
80
- auction = Auction()
81
- auction.note_keys = [1, 2, 3]
82
-
83
-
84
- def test_auction_note_key_setter():
85
- """Ensure that the auction note key setter is correct."""
86
- auction = Auction()
87
- auction.note_keys = ['', '', '1', '']
88
- assert auction.note_keys == ['', '', '1', '']
89
-
90
-
91
- def test_auction_notes_setter():
92
- """Ensure that the auction notes setter is correct."""
93
- with pytest.raises(TypeError):
94
- auction = Auction()
95
- auction.notes = '1'
96
- auction = Auction()
97
- auction.notes = {'1': 'test note 1'}