-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: adjustments after running "pre-commit run --all-files"
- Loading branch information
Showing
36 changed files
with
1,684 additions
and
1,371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,6 @@ | |
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Generic single-database configuration. | ||
Generic single-database configuration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,148 @@ | ||
"""initial tables | ||
Revision ID: ad6bf02d324d | ||
Revises: | ||
Revises: | ||
Create Date: 2024-01-11 12:28:20.802398 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = 'ad6bf02d324d' | ||
revision: str = "ad6bf02d324d" | ||
down_revision: Union[str, None] = None | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('competitor', | ||
sa.Column('label', sa.String(length=255), nullable=False), | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('uuid', sa.Uuid(), nullable=False), | ||
sa.Column('created', sa.DateTime(), nullable=False), | ||
sa.Column('updated', sa.DateTime(), nullable=False), | ||
sa.CheckConstraint("NOT(TRIM(label) LIKE '')", name='competitor_label_not_empty_nor_whitespace_only'), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.UniqueConstraint('uuid') | ||
op.create_table( | ||
"competitor", | ||
sa.Column("label", sa.String(length=255), nullable=False), | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("uuid", sa.Uuid(), nullable=False), | ||
sa.Column("created", sa.DateTime(), nullable=False), | ||
sa.Column("updated", sa.DateTime(), nullable=False), | ||
sa.CheckConstraint( | ||
"NOT(TRIM(label) LIKE '')", | ||
name="competitor_label_not_empty_nor_whitespace_only", | ||
), | ||
sa.PrimaryKeyConstraint("id"), | ||
sa.UniqueConstraint("uuid"), | ||
) | ||
op.create_table('tournament', | ||
sa.Column('label', sa.String(length=255), nullable=False), | ||
sa.Column('matches_creation', sa.DateTime(), nullable=True), | ||
sa.Column('number_competitors', sa.Integer(), nullable=True), | ||
sa.Column('starting_round', sa.Integer(), nullable=True), | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('uuid', sa.Uuid(), nullable=False), | ||
sa.Column('created', sa.DateTime(), nullable=False), | ||
sa.Column('updated', sa.DateTime(), nullable=False), | ||
sa.CheckConstraint("NOT(TRIM(label) LIKE '')", name='tournament_label_not_empty_nor_whitespace_only'), | ||
sa.CheckConstraint('( matches_creation IS NULL AND number_competitors IS NULL AND starting_round IS NULL) OR ( matches_creation IS NOT NULL AND number_competitors IS NOT NULL AND starting_round IS NOT NULL AND number_competitors >= 1 AND starting_round >= 0)', name='tournament_all_null_or_all_set_under_conditions'), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.UniqueConstraint('uuid') | ||
op.create_table( | ||
"tournament", | ||
sa.Column("label", sa.String(length=255), nullable=False), | ||
sa.Column("matches_creation", sa.DateTime(), nullable=True), | ||
sa.Column("number_competitors", sa.Integer(), nullable=True), | ||
sa.Column("starting_round", sa.Integer(), nullable=True), | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("uuid", sa.Uuid(), nullable=False), | ||
sa.Column("created", sa.DateTime(), nullable=False), | ||
sa.Column("updated", sa.DateTime(), nullable=False), | ||
sa.CheckConstraint( | ||
"NOT(TRIM(label) LIKE '')", | ||
name="tournament_label_not_empty_nor_whitespace_only", | ||
), | ||
sa.CheckConstraint( | ||
"( matches_creation IS NULL AND number_competitors IS NULL AND starting_round IS NULL) OR ( matches_creation IS NOT NULL AND number_competitors IS NOT NULL AND starting_round IS NOT NULL AND number_competitors >= 1 AND starting_round >= 0)", | ||
name="tournament_all_null_or_all_set_under_conditions", | ||
), | ||
sa.PrimaryKeyConstraint("id"), | ||
sa.UniqueConstraint("uuid"), | ||
) | ||
op.create_table('match', | ||
sa.Column('tournament_id', sa.Integer(), nullable=False), | ||
sa.Column('round', sa.Integer(), nullable=False), | ||
sa.Column('position', sa.Integer(), nullable=False), | ||
sa.Column('competitor_a_id', sa.Integer(), nullable=True), | ||
sa.Column('competitor_b_id', sa.Integer(), nullable=True), | ||
sa.Column('result_registration', sa.DateTime(), nullable=True), | ||
sa.Column('winner_id', sa.Integer(), nullable=True), | ||
sa.Column('loser_id', sa.Integer(), nullable=True), | ||
sa.Column('id', sa.Integer(), nullable=False), | ||
sa.Column('uuid', sa.Uuid(), nullable=False), | ||
sa.Column('created', sa.DateTime(), nullable=False), | ||
sa.Column('updated', sa.DateTime(), nullable=False), | ||
sa.CheckConstraint('( competitor_a_id IS NULL AND competitor_b_id IS NULL) OR ( competitor_a_id <> competitor_b_id)', name='match_non_null_competitors_cannot_be_the_same'), | ||
sa.CheckConstraint('( result_registration IS NULL AND loser_id is NULL) OR ( result_registration IS NOT NULL AND loser_id is NULL) OR ( result_registration IS NOT NULL AND loser_id IS NOT NULL)', name='match_result_registration_loser'), | ||
sa.CheckConstraint('( result_registration IS NULL AND winner_id is NULL) OR ( result_registration IS NOT NULL AND winner_id IS NOT NULL)', name='match_result_registration_winner'), | ||
sa.CheckConstraint('( round = 0 AND position < 2) OR ( round > 0 AND position < pow(2, round))', name='match_round_position_values'), | ||
sa.CheckConstraint('position >= 0', name='match_position_non_negative'), | ||
sa.CheckConstraint('round >= 0', name='match_round_non_negative'), | ||
sa.ForeignKeyConstraint(['competitor_a_id'], ['competitor.id'], ), | ||
sa.ForeignKeyConstraint(['competitor_b_id'], ['competitor.id'], ), | ||
sa.ForeignKeyConstraint(['loser_id'], ['competitor.id'], ), | ||
sa.ForeignKeyConstraint(['tournament_id'], ['tournament.id'], ), | ||
sa.ForeignKeyConstraint(['winner_id'], ['competitor.id'], ), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.UniqueConstraint('tournament_id', 'round', 'position', name='match_tournament_round_position_unique'), | ||
sa.UniqueConstraint('uuid') | ||
op.create_table( | ||
"match", | ||
sa.Column("tournament_id", sa.Integer(), nullable=False), | ||
sa.Column("round", sa.Integer(), nullable=False), | ||
sa.Column("position", sa.Integer(), nullable=False), | ||
sa.Column("competitor_a_id", sa.Integer(), nullable=True), | ||
sa.Column("competitor_b_id", sa.Integer(), nullable=True), | ||
sa.Column("result_registration", sa.DateTime(), nullable=True), | ||
sa.Column("winner_id", sa.Integer(), nullable=True), | ||
sa.Column("loser_id", sa.Integer(), nullable=True), | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("uuid", sa.Uuid(), nullable=False), | ||
sa.Column("created", sa.DateTime(), nullable=False), | ||
sa.Column("updated", sa.DateTime(), nullable=False), | ||
sa.CheckConstraint( | ||
"( competitor_a_id IS NULL AND competitor_b_id IS NULL) OR ( competitor_a_id <> competitor_b_id)", | ||
name="match_non_null_competitors_cannot_be_the_same", | ||
), | ||
sa.CheckConstraint( | ||
"( result_registration IS NULL AND loser_id is NULL) OR ( result_registration IS NOT NULL AND loser_id is NULL) OR ( result_registration IS NOT NULL AND loser_id IS NOT NULL)", | ||
name="match_result_registration_loser", | ||
), | ||
sa.CheckConstraint( | ||
"( result_registration IS NULL AND winner_id is NULL) OR ( result_registration IS NOT NULL AND winner_id IS NOT NULL)", | ||
name="match_result_registration_winner", | ||
), | ||
sa.CheckConstraint( | ||
"( round = 0 AND position < 2) OR ( round > 0 AND position < pow(2, round))", | ||
name="match_round_position_values", | ||
), | ||
sa.CheckConstraint("position >= 0", name="match_position_non_negative"), | ||
sa.CheckConstraint("round >= 0", name="match_round_non_negative"), | ||
sa.ForeignKeyConstraint( | ||
["competitor_a_id"], | ||
["competitor.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["competitor_b_id"], | ||
["competitor.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["loser_id"], | ||
["competitor.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["tournament_id"], | ||
["tournament.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["winner_id"], | ||
["competitor.id"], | ||
), | ||
sa.PrimaryKeyConstraint("id"), | ||
sa.UniqueConstraint( | ||
"tournament_id", | ||
"round", | ||
"position", | ||
name="match_tournament_round_position_unique", | ||
), | ||
sa.UniqueConstraint("uuid"), | ||
) | ||
op.create_table('tournament_competitor', | ||
sa.Column('tournament_id', sa.Integer(), nullable=False), | ||
sa.Column('competitor_id', sa.Integer(), nullable=False), | ||
sa.Column('next_match_id', sa.Integer(), nullable=True), | ||
sa.Column('created', sa.DateTime(), nullable=False), | ||
sa.Column('updated', sa.DateTime(), nullable=False), | ||
sa.ForeignKeyConstraint(['competitor_id'], ['competitor.id'], ), | ||
sa.ForeignKeyConstraint(['next_match_id'], ['match.id'], ), | ||
sa.ForeignKeyConstraint(['tournament_id'], ['tournament.id'], ), | ||
sa.PrimaryKeyConstraint('tournament_id', 'competitor_id') | ||
op.create_table( | ||
"tournament_competitor", | ||
sa.Column("tournament_id", sa.Integer(), nullable=False), | ||
sa.Column("competitor_id", sa.Integer(), nullable=False), | ||
sa.Column("next_match_id", sa.Integer(), nullable=True), | ||
sa.Column("created", sa.DateTime(), nullable=False), | ||
sa.Column("updated", sa.DateTime(), nullable=False), | ||
sa.ForeignKeyConstraint( | ||
["competitor_id"], | ||
["competitor.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["next_match_id"], | ||
["match.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["tournament_id"], | ||
["tournament.id"], | ||
), | ||
sa.PrimaryKeyConstraint("tournament_id", "competitor_id"), | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table('tournament_competitor') | ||
op.drop_table('match') | ||
op.drop_table('tournament') | ||
op.drop_table('competitor') | ||
op.drop_table("tournament_competitor") | ||
op.drop_table("match") | ||
op.drop_table("tournament") | ||
op.drop_table("competitor") | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2024.1.1 | ||
2024.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
__version__ = ( | ||
__import__('pathlib').Path(__file__).parent / 'VERSION' | ||
).read_text().strip() | ||
(__import__("pathlib").Path(__file__).parent / "VERSION").read_text().strip() | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
|
||
from matamata.settings import settings | ||
|
||
|
||
engine = create_engine(settings.DATABASE_URL) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
from .base import Base, TimestampedBase, IdUuidBase, IdUuidTimestampedBase | ||
from .base import Base, IdUuidBase, IdUuidTimestampedBase, TimestampedBase | ||
from .competitor import Competitor | ||
from .match import Match | ||
from .tournament import Tournament | ||
from .tournament_competitor import TournamentCompetitor | ||
|
||
__all__ = [ | ||
"Base", | ||
"Competitor", | ||
"IdUuidBase", | ||
"IdUuidTimestampedBase", | ||
"Match", | ||
"TimestampedBase", | ||
"Tournament", | ||
"TournamentCompetitor", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
COMPETITOR_LABEL_CONSTRAINT = 'competitor_label_not_empty_nor_whitespace_only' | ||
MATCH_ROUND_CONSTRAINT = 'match_round_non_negative' | ||
MATCH_ROUND_POSITION_CONSTRAINT = 'match_round_position_values' | ||
MATCH_POSITION_CONSTRAINT = 'match_position_non_negative' | ||
MATCH_TOURNAMENT_ROUND_POSITION_UNIQUE_CONSTRAINT = 'match_tournament_round_position_unique' | ||
MATCH_NON_NULL_COMPETITORS_CANNOT_BE_THE_SAME = 'match_non_null_competitors_cannot_be_the_same' | ||
MATCH_RESULT_REGISTRATION_MUST_REGISTER_A_WINNER = 'match_result_registration_winner' | ||
MATCH_RESULT_REGISTRATION_MIGHT_REGISTER_A_LOSER = 'match_result_registration_loser' | ||
TOURNAMENT_LABEL_CONSTRAINT = 'tournament_label_not_empty_nor_whitespace_only' | ||
TOURNAMENT_START_ATTRS_CONSTRAINT = 'tournament_all_null_or_all_set_under_conditions' | ||
COMPETITOR_LABEL_CONSTRAINT = "competitor_label_not_empty_nor_whitespace_only" | ||
MATCH_ROUND_CONSTRAINT = "match_round_non_negative" | ||
MATCH_ROUND_POSITION_CONSTRAINT = "match_round_position_values" | ||
MATCH_POSITION_CONSTRAINT = "match_position_non_negative" | ||
MATCH_TOURNAMENT_ROUND_POSITION_UNIQUE_CONSTRAINT = ( | ||
"match_tournament_round_position_unique" | ||
) | ||
MATCH_NON_NULL_COMPETITORS_CANNOT_BE_THE_SAME = ( | ||
"match_non_null_competitors_cannot_be_the_same" | ||
) | ||
MATCH_RESULT_REGISTRATION_MUST_REGISTER_A_WINNER = "match_result_registration_winner" | ||
MATCH_RESULT_REGISTRATION_MIGHT_REGISTER_A_LOSER = "match_result_registration_loser" | ||
TOURNAMENT_LABEL_CONSTRAINT = "tournament_label_not_empty_nor_whitespace_only" | ||
TOURNAMENT_START_ATTRS_CONSTRAINT = "tournament_all_null_or_all_set_under_conditions" |
Oops, something went wrong.