Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions tools/bridgebots_tools/practice_deals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
import sys
from pathlib import Path

import sys
from pathlib import Path

import click

from bridgebots import build_lin_str, build_lin_url
Expand Down
31 changes: 31 additions & 0 deletions tools/bridgebots_tools/strip_lin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import sys
from pathlib import Path

import click

from bridgebots import build_lin_str, parse_multi_lin
from bridgebots.lin import LinType


@click.command()
@click.argument("input_file", type=click.Path(exists=True, file_okay=True, dir_okay=False, path_type=Path))
@click.argument(
"output_file", type=click.Path(exists=False, file_okay=True, dir_okay=False, path_type=Path), required=False
)
def strip_lin(input_file: Path, output_file: Path):
deal_records = parse_multi_lin(input_file)

# Write boards to file (or stdout)
output_handle = open(output_file, "a") if output_file else sys.stdout
try:
for deal_record in deal_records:
for board_record in deal_record.board_records:
output_handle.write(build_lin_str(deal_record.deal, board_record, LinType.MULTI))
output_handle.write("\n")
finally:
if output_file:
output_handle.close()


if __name__ == "__main__":
strip_lin()
2 changes: 1 addition & 1 deletion tools/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "bridgebots_tools"
version = "0.0.3"
version = "0.0.4.dev1"
description = "Tools which utilize the Bridgebots package to process data"
authors = ["Forrest Rice <forrest.d.rice@gmail.com>"]
license = "MIT"
Expand Down