コード例 #1
0
def hand_header(request):
    """Parse hand history header only defined in hand_text
    and returns a PokerStarsHandHistory instance.
    """
    hh = PokerStarsHandHistory(request.instance.hand_text)
    hh.parse_header()
    return hh
コード例 #2
0
ファイル: test_stars.py プロジェクト: MichalKononenko/poker
def hand_header(request):
    """Parse hand history header only defined in hand_text
    and returns a PokerStarsHandHistory instance.
    """
    hh = PokerStarsHandHistory(request.instance.hand_text)
    hh.parse_header()
    return hh
コード例 #3
0
def hand(request):
    """Parse handhistory defined in hand_text class attribute
    and returns a PokerStarsHandHistory instance.
    """
    hh = PokerStarsHandHistory(request.instance.hand_text)
    hh.parse()
    return hh
コード例 #4
0
ファイル: test_stars.py プロジェクト: VinQbator/poker
def test_parse_all_hands():
    for idx, hand in enumerate(
        {k: v
         for k, v in stars_hands.__dict__.items() if 'HAND' in k}.values()):
        print('HAND%s' % (idx + 1))
        hh = PokerStarsHandHistory(hand)
        hh.parse()
コード例 #5
0
ファイル: test_stars.py プロジェクト: MichalKononenko/poker
def hand(request):
    """Parse handhistory defined in hand_text class attribute
    and returns a PokerStarsHandHistory instance.
    """
    hh = PokerStarsHandHistory(request.instance.hand_text)
    hh.parse()
    return hh
コード例 #6
0
ファイル: test_stars.py プロジェクト: VinQbator/poker
def test_file_and_string_same(testdir):
    file_path = str(testdir.joinpath('handhistory/hand8.txt'))
    hh_file = PokerStarsHandHistory.from_file(file_path)
    hh_str = PokerStarsHandHistory(stars_hands.HAND8)
    print(bytes(hh_file.raw, encoding='utf-8'), '\n',
          bytes(hh_str.raw, encoding='utf-8'))
    #assert len(hh_file.raw) == len(hh_str.raw)
    #assert hh_file.raw == hh_str.raw
    hh_file._split_raw()
    hh_str._split_raw()
    print(hh_file._splitted, '\n', hh_str._splitted)
    assert hh_file._splitted == hh_str._splitted
コード例 #7
0
ファイル: untitled0.py プロジェクト: Rotaka92/poker-1
a = list(Hand)
len(a)  #169 Hands 

Combo('7s6s') > Combo('6d5d')

#Ranges
from poker import Range
Range('XX').to_ascii()
print(Range('22+ A2+ KT+ QJs+ 32 42 52 62 72').to_ascii())



#Hand history parsing
from poker.room.pokerstars import PokerStarsHandHistory
# First step, only raw hand history is saved, no parsing will happen yet
hh = PokerStarsHandHistory(HAND1)

#hh = PokerStarsHandHistory.from_file('C:\\Users\\Robin\\Desktop\\pkr2\\poker-1\\tests\handhistory\\2hand.txt')

# You need to explicitly parse. This will parse the whole hh at once.
hh.parse()

#date in type: datetime
a = hh.date

#identification number of the hand
b = hh.ident

#what type was the game
c = hh.game_type
コード例 #8
0
def get_parsed_flop_hand14():
    hand_text = stars_hands.HAND14
    hh = PokerStarsHandHistory(hand_text)
    hh.parse()
    return hh
コード例 #9
0
def get_parsed_hand():
    hand_text = stars_hands.HAND12
    hh = PokerStarsHandHistory(hand_text)
    hh.parse()
    return hh
コード例 #10
0
def test_open_from_file(testdir):
    bbb_path = str(testdir.joinpath('handhistory/bbb.txt'))
    hh = PokerStarsHandHistory.from_file(bbb_path)
    hh.parse()
    assert hh.ident == '138364355489'
    assert type(hh.raw) is unicode
コード例 #11
0
ファイル: conftest.py プロジェクト: icyblade/poker
def all_stars_hands(request):
    """Parse all hands from test_data and returns a PokerStarsHandHistory instance."""
    hh = PokerStarsHandHistory(request.param)
    hh.parse()
    return hh
コード例 #12
0
ファイル: test_stars.py プロジェクト: MichalKononenko/poker
def test_open_from_file(testdir):
    bbb_path = str(testdir.joinpath('handhistory/bbb.txt'))
    hh = PokerStarsHandHistory.from_file(bbb_path)
    hh.parse()
    assert hh.ident == '138364355489'
    assert type(hh.raw) is unicode
コード例 #13
0
ファイル: conftest.py プロジェクト: lmacken/poker
def all_stars_hands(request):
    """Parse all hands from test_data and returns a PokerStarsHandHistory instance."""
    hh = PokerStarsHandHistory(request.param)
    hh.parse()
    return hh
コード例 #14
0
def test_open_from_bb_file(test_dir):
    bbb_path = str(test_dir.joinpath("handhistory/bbb.txt"))
    hh = PokerStarsHandHistory.from_file(bbb_path)
    hh.parse()
    assert hh.ident == "138364355489"
    assert type(hh.raw) is str
コード例 #15
0
ファイル: test_stars.py プロジェクト: VinQbator/poker
def test_no_hero():
    hh = PokerStarsHandHistory(stars_hands.HAND6)
    hh.parse()
コード例 #16
0
ファイル: test_stars.py プロジェクト: kakty3/poker
 def hand(hand_text):
     hh = PokerStarsHandHistory(hand_text)
     hh.parse()
     return hh