Skip to content

Commit

Permalink
updated files for importing MISSING_INT
Browse files Browse the repository at this point in the history
  • Loading branch information
Alek050 committed Apr 16, 2024
1 parent 882c2a7 commit b109ae9
Show file tree
Hide file tree
Showing 25 changed files with 29 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import pandas as pd

from databallpy.data_parsers import Metadata
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.logging import create_logger
from databallpy.utils.tz_modification import utc_to_local_datetime
from databallpy.utils.utils import MISSING_INT

LOGGER = create_logger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
_update_metadata,
)
from databallpy.events import DribbleEvent, PassEvent, ShotEvent
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.logging import create_logger
from databallpy.utils.utils import MISSING_INT, _to_float, _to_int
from databallpy.utils.utils import _to_float, _to_int

LOGGER = create_logger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion databallpy/data_parsers/event_data_parsers/opta_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

from databallpy.data_parsers import Metadata
from databallpy.events import BaseOnBallEvent, DribbleEvent, PassEvent, ShotEvent
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.logging import create_logger
from databallpy.utils.tz_modification import convert_datetime, utc_to_local_datetime
from databallpy.utils.utils import MISSING_INT
from databallpy.utils.warnings import DataBallPyWarning

LOGGER = create_logger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from databallpy.data_parsers.metadata import Metadata
from databallpy.events import DribbleEvent, PassEvent, ShotEvent
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.logging import create_logger
from databallpy.utils.utils import MISSING_INT

LOGGER = create_logger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion databallpy/data_parsers/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import numpy as np
import pandas as pd

from databallpy.utils.constants import MISSING_INT
from databallpy.utils.logging import create_logger
from databallpy.utils.utils import MISSING_INT

LOGGER = create_logger(__name__)

Expand Down
3 changes: 2 additions & 1 deletion databallpy/data_parsers/metrica_metadata_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from bs4 import BeautifulSoup

from databallpy.data_parsers import Metadata
from databallpy.utils.utils import MISSING_INT, _to_float, _to_int
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.utils import _to_float, _to_int


def _get_td_channels(metadata_loc: str, metadata: Metadata) -> pd.DataFrame:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
_insert_missing_rows,
_normalize_playing_direction_tracking,
)
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.logging import create_logger
from databallpy.utils.tz_modification import utc_to_local_datetime
from databallpy.utils.utils import MISSING_INT, _to_float, _to_int
from databallpy.utils.utils import _to_float, _to_int

LOGGER = create_logger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
_insert_missing_rows,
_normalize_playing_direction_tracking,
)
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.logging import create_logger
from databallpy.utils.tz_modification import localize_datetime
from databallpy.utils.utils import MISSING_INT

LOGGER = create_logger(__name__)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pandas as pd

from databallpy.utils.utils import MISSING_INT
from databallpy.utils.constants import MISSING_INT


def _add_periods_to_tracking_data(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pandas as pd

from databallpy.data_parsers.metadata import Metadata
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.errors import DataBallPyError
from databallpy.utils.utils import MISSING_INT


def _adjust_start_end_frames(td: pd.DataFrame, metadata: Metadata) -> Metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pandas as pd

from databallpy.data_parsers.metadata import Metadata
from databallpy.utils.utils import MISSING_INT
from databallpy.utils.constants import MISSING_INT


def _to_matchtime(secs: int, max_m: int, start_m: int) -> str:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import pandas as pd

from databallpy.utils.utils import MISSING_INT
from databallpy.utils.constants import MISSING_INT


def _insert_missing_rows(df: pd.DataFrame, col: str) -> pd.DataFrame:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pandas as pd

from databallpy.features.differentiate import _differentiate
from databallpy.utils.utils import MISSING_INT
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.warnings import DataBallPyWarning


Expand Down
2 changes: 1 addition & 1 deletion databallpy/events/pass_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from databallpy.events.base_event import BaseOnBallEvent
from databallpy.features.angle import get_smallest_angle
from databallpy.features.pressure import get_pressure_on_player
from databallpy.utils.utils import MISSING_INT
from databallpy.utils.constants import MISSING_INT


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion databallpy/events/shot_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from databallpy.features.angle import get_smallest_angle
from databallpy.features.pressure import get_pressure_on_player
from databallpy.models.utils import scale_and_predict_logreg
from databallpy.utils.utils import MISSING_INT
from databallpy.utils.constants import MISSING_INT


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion databallpy/features/team_possession.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pandas as pd

from databallpy.utils.constants import MISSING_INT
from databallpy.utils.logging import create_logger
from databallpy.utils.utils import MISSING_INT

LOGGER = create_logger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion databallpy/get_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from databallpy.events import BaseOnBallEvent, PassEvent
from databallpy.match import Match
from databallpy.utils.align_player_ids import align_player_ids
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.logging import create_logger
from databallpy.utils.utils import MISSING_INT

LOGGER = create_logger(__name__)

Expand Down
3 changes: 2 additions & 1 deletion databallpy/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from tqdm import tqdm

from databallpy.events import DribbleEvent, PassEvent, ShotEvent
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.errors import DataBallPyError
from databallpy.utils.logging import create_logger
from databallpy.utils.match_utils import (
Expand All @@ -20,7 +21,7 @@
pre_compute_synchronisation_variables,
synchronise_tracking_and_event_data,
)
from databallpy.utils.utils import MISSING_INT, get_next_possession_frame
from databallpy.utils.utils import get_next_possession_frame
from databallpy.utils.warnings import DataBallPyWarning

LOGGER = create_logger(__name__)
Expand Down
9 changes: 0 additions & 9 deletions databallpy/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
# flake8: noqa

from databallpy.utils.anonymise_match import anonymise_match
from databallpy.utils.errors import DataBallPyError
from databallpy.utils.filters import *
from databallpy.utils.logging import *
from databallpy.utils.tz_modification import *
from databallpy.utils.utils import *
from databallpy.utils.warnings import DataBallPyWarning
2 changes: 1 addition & 1 deletion databallpy/utils/anonymise_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from pandas._libs.tslibs.timestamps import Timestamp

from databallpy.match import Match
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.errors import DataBallPyError
from databallpy.utils.utils import MISSING_INT


def anonymise_match(
Expand Down
1 change: 1 addition & 0 deletions databallpy/utils/constants.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
MISSING_INT = -999
"""The value to use for missing integers in the data."""
3 changes: 2 additions & 1 deletion databallpy/utils/synchronise_tracking_and_event_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

from databallpy.features import get_smallest_angle
from databallpy.features.differentiate import _differentiate
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.logging import create_logger
from databallpy.utils.match_utils import player_id_to_column_id
from databallpy.utils.utils import MISSING_INT, sigmoid
from databallpy.utils.utils import sigmoid

logger = create_logger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tests/expected_outcomes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from databallpy.data_parsers.metadata import Metadata
from databallpy.events import DribbleEvent, PassEvent, ShotEvent
from databallpy.utils.utils import MISSING_INT
from databallpy.utils.constants import MISSING_INT

TD_TRACAB = pd.DataFrame(
{
Expand Down
2 changes: 1 addition & 1 deletion tests/test_get_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
)
from databallpy.get_match import get_match, get_open_match, get_saved_match
from databallpy.match import Match
from databallpy.utils.utils import MISSING_INT
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.warnings import DataBallPyWarning
from expected_outcomes import (
DRIBBLE_EVENTS_METRICA,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

from databallpy.get_match import get_match
from databallpy.match import Match
from databallpy.utils.constants import MISSING_INT
from databallpy.utils.errors import DataBallPyError
from databallpy.utils.utils import MISSING_INT
from databallpy.utils.warnings import DataBallPyWarning
from expected_outcomes import (
DRIBBLE_EVENTS_OPTA_TRACAB,
Expand Down

0 comments on commit b109ae9

Please sign in to comment.