summaryrefslogtreecommitdiff
path: root/bcdd
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-07-17 23:19:21 +0200
committeremkael <emkael@tlen.pl>2019-07-17 23:19:21 +0200
commit886f8f4c9de8e4433987ac2b3b6edcf021f7d309 (patch)
tree90035e5e11c795a1cbdcf51fc247a72f41e84d7f /bcdd
parent3926c5ee36cc3339ecf1fe5ca8750dc8b17363a0 (diff)
Fixes for C#->Python port of regex matches iteration
Diffstat (limited to 'bcdd')
-rw-r--r--bcdd/DDTable.py4
-rw-r--r--bcdd/PBNBoard.py10
-rw-r--r--bcdd/ParScore.py6
3 files changed, 10 insertions, 10 deletions
diff --git a/bcdd/DDTable.py b/bcdd/DDTable.py
index c4fc030..db4ef76 100644
--- a/bcdd/DDTable.py
+++ b/bcdd/DDTable.py
@@ -56,10 +56,10 @@ class DDTable(object):
ability = self._board.get_ability()
abilities = self._board.validate_ability(ability)
for player_ability in abilities:
- player = player_ability.groups(1)[0]
+ player = player_ability[0]
player_id = BCalcWrapper.PLAYERS.index(player)
denom_id = 4
- for tricks in player_ability.group(2):
+ for tricks in player_ability[1]:
result[player_id][denom_id] = int(tricks, 16)
denom_id -= 1
return self._validate_table(result)
diff --git a/bcdd/PBNBoard.py b/bcdd/PBNBoard.py
index 4d8f72f..35d4466 100644
--- a/bcdd/PBNBoard.py
+++ b/bcdd/PBNBoard.py
@@ -73,18 +73,18 @@ class PBNBoard(object):
return self.get_field('Dealer')
def validate_ability(self, ability):
- matches = self.ability_pattern.match(ability)
- if not matches:
+ matches = self.ability_pattern.findall(ability)
+ if not len(matches):
self._has_ability = False
raise DDTableInvalidException('Invalid Ability line: ' + ability)
players = []
for match in matches:
- if match.group(1) in players:
+ if match[0] in players:
self._has_ability = False
raise DDTableInvalidException(
- 'Duplicate entry in Ability: ' + match.group(0))
+ 'Duplicate entry in Ability: ' + match[0])
else:
- players.append(match.group(1))
+ players.append(match[1])
self._has_ability = False
return matches
diff --git a/bcdd/ParScore.py b/bcdd/ParScore.py
index b0c9674..e23a839 100644
--- a/bcdd/ParScore.py
+++ b/bcdd/ParScore.py
@@ -47,10 +47,10 @@ class ParScore(object):
return ParContract() # pass-out
contract = ParContract(
int(par_match.group(1)),
- par_match.Group(2)[0],
- par_match.Group(4)[0],
+ par_match.group(2)[0],
+ par_match.group(4)[0],
'D' == par_match.group(3),
- int(par_match.groups(5)))
+ int(par_match.group(5)))
return contract.validate()
def _determine_vulnerability(self, vulnerability, declarer):