Repository: joweich/chat-miner

Issue:
Can't run the parser
Is there a specific Python version that should be used to run this parser? I can't run this, every time I solve an issue I have another one. I'm currently using Python 3.10.0.

Discussion:
codecov-commenter: ## [Codecov](https://app.codecov.io/gh/joweich/chat-miner/pull/104?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonas+Weich) Report
Patch and project coverage have no change.
> Comparison is base [(`d3ef04f`)](https://app.codecov.io/gh/joweich/chat-miner/commit/d3ef04fe7fc3714e6d2400a7c0e1509cada109de?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonas+Weich) 71.58% compared to head [(`17c64f7`)](https://app.codecov.io/gh/joweich/chat-miner/pull/104?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonas+Weich) 71.58%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please [install the GitHub App Integration](https://github.com/apps/codecov) for your organization. [Read more](https://about.codecov.io/blog/codecov-is-updating-its-github-integration/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonas+Weich).

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##             main     #104   +/-   ##
=======================================
  Coverage   71.58%   71.58%           
=======================================
  Files           1        1           
  Lines         278      278           
=======================================
  Hits          199      199           
  Misses         79       79           
```

| [Flag](https://app.codecov.io/gh/joweich/chat-miner/pull/104/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonas+Weich) | Coverage Δ | |
|---|---|---|
| [unittests](https://app.codecov.io/gh/joweich/chat-miner/pull/104/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonas+Weich) | `71.58% <ø> (ø)` | |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonas+Weich#carryforward-flags-in-the-pull-request-comment) to find out more.



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/joweich/chat-miner/pull/104?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonas+Weich).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jonas+Weich).


Patch:
diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml
index e0337f5..dd58d3f 100644
--- a/.github/workflows/pylint.yml
+++ b/.github/workflows/pylint.yml
@@ -7,7 +7,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        python-version: ["3.8", "3.9", "3.10"]
+        python-version: ["3.8", "3.9", "3.10", "3.11"]
     steps:
     - uses: actions/checkout@v3
     - name: Set up Python ${{ matrix.python-version }}
diff --git a/chatminer/visualizations.py b/chatminer/visualizations.py
index 53e817f..6c0b24b 100644
--- a/chatminer/visualizations.py
+++ b/chatminer/visualizations.py
@@ -1,27 +1,11 @@
 import calendar
 import datetime
-import sys
-from collections.abc import Iterable, Sequence
-from random import Random
-from typing import (
-    Any,
-    Callable,
-    List,
-    Literal,
-    Optional,
-    Set,
-    Tuple,
-    TypedDict,
-    Union,
-    Unpack,
-)
 
 import matplotlib.pyplot as plt
 import numpy as np
 import pandas as pd
 from dateutil.relativedelta import relativedelta
-from matplotlib.colors import ColorConverter, Colormap, ListedColormap
-from matplotlib.lines import Line2D
+from matplotlib.colors import ColorConverter, ListedColormap
 from matplotlib.patches import Circle, Polygon, RegularPolygon
 from matplotlib.path import Path
 from matplotlib.projections import register_projection
@@ -31,20 +15,17 @@ from matplotlib.transforms import Affine2D
 from mpl_toolkits.axes_grid1 import make_axes_locatable
 from wordcloud import STOPWORDS, WordCloud
 
-StrSeries = pd.Series[str] if sys.version_info >= (3, 10) else pd.Series
-IntSeries = pd.Series[int] if sys.version_info >= (3, 10) else pd.Series
-
 
 def sunburst(
     df: pd.DataFrame,
-    color: str = "C0",
-    edgecolor: str = "black",
-    linewidth: float = 0.5,
-    highlight_max: bool = False,
-    isolines: Optional[List[Union[float, int]]] = None,
-    isolines_relative: bool = True,
-    ax: Optional[PolarAxes] = None,
-    authors: Optional[Union[Set[str], List[str], Tuple[str, ...], StrSeries]] = None,
+    color="C0",
+    edgecolor="black",
+    linewidth=0.5,
+    highlight_max=False,
+    isolines=None,
+    isolines_relative=True,
+    ax=None,
+    authors=None,
 ) -> PolarAxes:
     if authors:
         df = df[df["author"].isin(authors)]
@@ -117,59 +98,17 @@ def sunburst(
     return ax
 
 
-ColorFunc = Callable[
-    [
-        Optional[str],
-        Optional[int],
-        Optional[Tuple[int, int]],
-        Optional[int],
-        Optional[str],
-        Optional[Random],
-    ],
-    None,
-]
-
-
-class WordCloudKwargs(TypedDict, total=False):
-    font_path: str
-    width: int
-    height: int
-    margin: int
-    prefer_horizontal: float
-    mask: np.ndarray[Any, Any]  # type: ignore
-    scale: int
-    color_func: ColorFunc
-    max_words: int
-    min_font_size: int
-    random_state: Random
-    background_color: str
-    max_font_size: int
-    font_step: int
-    mode: str
-    relative_scaling: str
-    regexp: str
-    collocations: bool
-    colormap: Union[str, Colormap]
-    normalize_plurals: bool
-    contour_width: int
-    contour_color: str
-    repeat: bool
-    include_numbers: bool
-    min_word_length: int
-    collocation_threshold: int
-
-
 def wordcloud(
-    df: pd.DataFrame,
-    ax: Optional[plt.Axes] = None,
-    stopwords: Optional[Iterable[str]] = None,
-    authors: Optional[Union[Set[str], List[str], Tuple[str, ...], StrSeries]] = None,
-    **kwargs: Unpack[WordCloudKwargs],
+    df,
+    ax=None,
+    stopwords=None,
+    authors=None,
+    **kwargs,
 ) -> plt.Axes:
     if authors:
         df = df[df["author"].isin(authors)]
 
-    messages: List[List[str]] = [mess.split() for mess in df["message"].values]
+    messages = [mess.split() for mess in df["message"].values]
     words = [word.lower() for sublist in messages for word in sublist]
 
     if stopwords:
@@ -194,20 +133,18 @@ def wordcloud(
 def calendar_heatmap(
     df: pd.DataFrame,
     year: int,
-    vmin: IntSeries | None = None,
-    vmax: IntSeries | None = None,
-    cmap: str | Colormap = "Blues",
-    fillcolor: str = "whitesmoke",
-    linewidth: int = 1,
-    linecolor: plt.Color | None = None,
-    daylabels: Sequence[str] = calendar.day_abbr[:],
-    dayticks: bool = True,
-    monthlabels: Sequence[str] = calendar.month_abbr[1:],
-    monthticks: bool = True,
-    monthly_border: bool = False,
-    ax: plt.Axes | None = None,
-    authors: set[str] | List[str] | tuple[str, ...] | StrSeries | None = None,
-    **kwargs,  # I give up on typing this
+    vmin=None,
+    vmax=None,
+    cmap="Blues",
+    fillcolor="whitesmoke",
+    linewidth=1,
+    linecolor=None,
+    daylabels=calendar.day_abbr[:],
+    dayticks=True,
+    monthly_border=False,
+    ax=None,
+    authors=None,
+    **kwargs,
 ) -> plt.Axes:
     """
     Adapted from https://github.com/MarvinT/calmap.
@@ -331,11 +268,11 @@ def calendar_heatmap(
 
 
 def radar(
-    df: pd.DataFrame,
-    color: str = "C0",
-    alpha: float = 0.3,
-    ax: plt.Axes | None = None,
-    authors: set[str] | List[str] | tuple[str, ...] | StrSeries | None = None,
+    df,
+    color="C0",
+    alpha=0.3,
+    ax=None,
+    authors=None,
 ) -> plt.Axes:
     if authors:
         df = df[df["author"].isin(authors)]
@@ -362,7 +299,7 @@ def radar(
     return ax
 
 
-def radar_factory(num_vars: int, frame: Literal["circle", "polygon"] = "circle"):
+def radar_factory(num_vars, frame="circle"):
     """
     Source: https://matplotlib.org/stable/gallery/specialty_plots/radar_chart.html
     """
@@ -398,7 +335,7 @@ def radar_factory(num_vars: int, frame: Literal["circle", "polygon"] = "circle")
                 self._close_line(line)
 
         @staticmethod
-        def _close_line(line: Line2D):
+        def _close_line(line):
             x, y = line.get_data()
             # FIXME: markers at x[0], y[0] get doubled-up
             if x[0] != x[-1]:
@@ -406,7 +343,7 @@ def radar_factory(num_vars: int, frame: Literal["circle", "polygon"] = "circle")
                 y = np.append(y, y[0])
                 line.set_data(x, y)
 
-        def set_varlabels(self, labels: tuple[str, ...] | None):
+        def set_varlabels(self, labels):
             self.set_thetagrids(np.degrees(theta), labels)
 
         def _gen_axes_patch(self):


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index c5721bf..b791e27 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -7,7 +7,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        python-version: ["3.8", "3.9", "3.10"]
+        python-version: ["3.8", "3.9", "3.10", "3.11"]
     steps:
     - uses: actions/checkout@v3
     - name: Set up Python ${{ matrix.python-version }}
diff --git a/test/test_instagram.py b/test/test_instagram.py
index c07c383..852e88e 100644
--- a/test/test_instagram.py
+++ b/test/test_instagram.py
@@ -11,7 +11,6 @@ def test_instagram():
     df_test = pd.read_csv(
         "test/instagram/testlog_target.csv",
         parse_dates=["timestamp"],
-        infer_datetime_format=True,
     )
     assert_frame_equal(
         df_test[["author", "message", "words", "letters"]],
diff --git a/test/test_whatsapp.py b/test/test_whatsapp.py
index 5459ef5..68b484c 100644
--- a/test/test_whatsapp.py
+++ b/test/test_whatsapp.py
@@ -11,7 +11,6 @@ def assert_equal_from_file(file):
     df_test = pd.read_csv(
         f"test/whatsapp/test_{file}_target.csv",
         parse_dates=["timestamp"],
-        infer_datetime_format=True,
     )
     assert_frame_equal(df_test, df_res, check_dtype=False)
 
diff --git a/test/vis/test_smoketest.py b/test/vis/test_smoketest.py
new file mode 100644
index 0000000..190a318
--- /dev/null
+++ b/test/vis/test_smoketest.py
@@ -0,0 +1,8 @@
+import pytest
+
+
+def test_visualization_import():
+    try:
+        import chatminer.visualizations as vis
+    except ImportError as e:
+        pytest.fail(f"Error importing visualizations: {e}")