Ejemplo n.º 1
0
def simple_building() -> business.Building:
    third = fractions.Fraction(1) / 3
    model = business.Building([
        business.Flat(
            name="1",
            original_name="1",
            fraction=third,
            owners=[business.Owner("Petr Novák")],
            persons={"Petr Novák"},
        ),
        business.Flat(
            name="2",
            original_name="2",
            fraction=third,
            owners=[business.Owner("Jana Nová")],
            persons={"Jana Nová"},
        ),
        business.Flat(
            name="3",
            original_name="3",
            fraction=third,
            owners=[business.Owner("Oldřich Starý")],
            persons={"Oldřich Starý"},
        ),
    ])
    model.add_person("Radoslava Květná")
    model.represent_flat("3", "Radoslava Květná")
    return model
Ejemplo n.º 2
0
def test_complete_flat() -> None:
    model = business.Building(
        [create_flat("777/1"),
         create_flat("777/2"),
         create_flat("778/3")])
    cmd = __main__.AppCmd(model)

    possibilities = cmd.complete_flat("777", "flat 777/", 9, 9)

    assert possibilities == ["777/1", "777/2"]
Ejemplo n.º 3
0
def test_complete_remove() -> None:
    model = business.Building([
        create_flat("777/1",
                    represented=business.Person("Radoslava Květná",
                                                datetime.min))
    ])
    cmd = __main__.AppCmd(model)
    model.add_person("Peter Pan")

    possibilities = cmd.complete_remove("", "remove ", 9, 9)

    assert possibilities == ["777/1", "Peter Pan"]
Ejemplo n.º 4
0
def main(argv: List[str]) -> None:
    locale.setlocale(locale.LC_ALL, "cs_CZ.UTF-8")
    parser = argparse.ArgumentParser(
        description="Prepare list for signatures.")
    parser.add_argument(
        "flats",
        type=argparse.FileType("rb"),
        help="the json file with flats definition",
    )

    args = parser.parse_args(argv)
    flats = utils.from_json_to_flats(json.load(args.flats))
    building = business.Building(flats=flats)
    reports.write_signatures(building, "signatures.html")
Ejemplo n.º 5
0
def building_with_one_owner() -> business.Building:
    share = fractions.Fraction(1) / 2
    return business.Building([
        business.Flat(
            name="1",
            original_name="1",
            fraction=share,
            owners=[business.Owner("Petr Novák")],
            persons={"Petr Novák"},
        ),
        business.Flat(
            name="2",
            original_name="2",
            fraction=share,
            owners=[business.Owner("Petr Novák"),
                    business.Owner("Jana Nová")],
            persons={"Petr Novák", "Jana Nová"},
        ),
    ])
Ejemplo n.º 6
0
def main() -> None:
    locale.setlocale(locale.LC_ALL, "cs_CZ.UTF-8")
    parser = argparse.ArgumentParser(
        description="Records presence and votes on a gathering.")
    parser.add_argument(
        "flats",
        type=argparse.FileType("rb"),
        help="the json file with flats definition",
    )
    parser.add_argument(
        "--log",
        metavar="logfile",
        type=argparse.FileType("r+"),
        help="the csv file with actions definition",
    )
    args = parser.parse_args()
    setup_readline_if_available()
    json_flats = json.load(args.flats)
    model = business.Building(utils.from_json_to_flats(json_flats))
    default_filename = CommandLogger.default_logname(args.flats.name)
    logfile = open_or_create_logfile(args.log, model, default_filename)
    model.register_logger(CommandLogger(logfile))
    AppCmd(model).cmdloop()