From 7c3331527a4ce2a8a1702153e3e80c2495134085 Mon Sep 17 00:00:00 2001 From: leonard biermann Date: Thu, 22 Aug 2024 12:24:36 +0200 Subject: [PATCH 1/5] =?UTF-8?q?pr=C3=B8ver=20=C3=A5=20se=20om=20dette=20fi?= =?UTF-8?q?kser=20missing=20stubs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index a121dc8..ec4479c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2371,17 +2371,20 @@ xml = ["lxml (>=4.9.2)"] [[package]] name = "pandas-stubs" -version = "2.1.4.231227" +version = "2.2.2.240603" description = "Type annotations for pandas" optional = false python-versions = ">=3.9" files = [ - {file = "pandas_stubs-2.1.4.231227-py3-none-any.whl", hash = "sha256:211fc23e6ae87073bdf41dbf362c4a4d85e1e3477cb078dbac3da6c7fdaefba8"}, - {file = "pandas_stubs-2.1.4.231227.tar.gz", hash = "sha256:3ea29ef001e9e44985f5ebde02d4413f94891ef6ec7e5056fb07d125be796c23"}, + {file = "pandas_stubs-2.2.2.240603-py3-none-any.whl", hash = "sha256:e08ce7f602a4da2bff5a67475ba881c39f2a4d4f7fccc1cba57c6f35a379c6c0"}, + {file = "pandas_stubs-2.2.2.240603.tar.gz", hash = "sha256:2dcc86e8fa6ea41535a4561c1f08b3942ba5267b464eff2e99caeee66f9e4cd1"}, ] [package.dependencies] -numpy = {version = ">=1.26.0", markers = "python_version < \"3.13\""} +numpy = [ + {version = ">=1.23.5", markers = "python_version >= \"3.9\" and python_version < \"3.12\""}, + {version = ">=1.26.0", markers = "python_version >= \"3.12\" and python_version < \"3.13\""}, +] types-pytz = ">=2022.1.1" [[package]] From 102cebc040919cf63c26b8f6c62dbbf613a5c896 Mon Sep 17 00:00:00 2001 From: leonard biermann Date: Thu, 22 Aug 2024 12:31:24 +0200 Subject: [PATCH 2/5] =?UTF-8?q?pr=C3=B8ver=20med=20oppdatert=20pandas-stub?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 19 ++++++++----------- pyproject.toml | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/poetry.lock b/poetry.lock index ec4479c..65a8049 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2371,20 +2371,17 @@ xml = ["lxml (>=4.9.2)"] [[package]] name = "pandas-stubs" -version = "2.2.2.240603" +version = "2.2.2.240807" description = "Type annotations for pandas" optional = false python-versions = ">=3.9" files = [ - {file = "pandas_stubs-2.2.2.240603-py3-none-any.whl", hash = "sha256:e08ce7f602a4da2bff5a67475ba881c39f2a4d4f7fccc1cba57c6f35a379c6c0"}, - {file = "pandas_stubs-2.2.2.240603.tar.gz", hash = "sha256:2dcc86e8fa6ea41535a4561c1f08b3942ba5267b464eff2e99caeee66f9e4cd1"}, + {file = "pandas_stubs-2.2.2.240807-py3-none-any.whl", hash = "sha256:893919ad82be4275f0d07bb47a95d08bae580d3fdea308a7acfcb3f02e76186e"}, + {file = "pandas_stubs-2.2.2.240807.tar.gz", hash = "sha256:64a559725a57a449f46225fbafc422520b7410bff9252b661a225b5559192a93"}, ] [package.dependencies] -numpy = [ - {version = ">=1.23.5", markers = "python_version >= \"3.9\" and python_version < \"3.12\""}, - {version = ">=1.26.0", markers = "python_version >= \"3.12\" and python_version < \"3.13\""}, -] +numpy = ">=1.23.5" types-pytz = ">=2022.1.1" [[package]] @@ -3955,13 +3952,13 @@ files = [ [[package]] name = "types-pytz" -version = "2024.1.0.20240203" +version = "2024.1.0.20240417" description = "Typing stubs for pytz" optional = false python-versions = ">=3.8" files = [ - {file = "types-pytz-2024.1.0.20240203.tar.gz", hash = "sha256:c93751ee20dfc6e054a0148f8f5227b9a00b79c90a4d3c9f464711a73179c89e"}, - {file = "types_pytz-2024.1.0.20240203-py3-none-any.whl", hash = "sha256:9679eef0365db3af91ef7722c199dbb75ee5c1b67e3c4dd7bfbeb1b8a71c21a3"}, + {file = "types-pytz-2024.1.0.20240417.tar.gz", hash = "sha256:6810c8a1f68f21fdf0f4f374a432487c77645a0ac0b31de4bf4690cf21ad3981"}, + {file = "types_pytz-2024.1.0.20240417-py3-none-any.whl", hash = "sha256:8335d443310e2db7b74e007414e74c4f53b67452c0cb0d228ca359ccfba59659"}, ] [[package]] @@ -4223,4 +4220,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "7fb314888865335dfddab0ba52d753980216f5d49f788053852013dfc755fd27" +content-hash = "50200ac034f143bdf585b8e12c0b4d5e18b2d0ae9efb6637b5cfab545e51ea67" diff --git a/pyproject.toml b/pyproject.toml index 8eeb72b..b7701ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,7 @@ click = ">=8.0.1" pandas = "^2.2.0" pendulum = "^3.0.0" dapla-toolbelt = "^2.0.19" +pandas-stubs = "^2.2.2.240807" [tool.poetry.group.dev.dependencies] pygments = ">=2.10.0" @@ -38,7 +39,6 @@ sphinx-click = ">=3.0.2" typeguard = ">=2.13.3" xdoctest = { extras = ["colors"], version = ">=0.15.10" } myst-parser = { version = ">=0.16.1" } -pandas-stubs = "<=2.2.2.240603" [tool.pytest.ini_options] From c51440a815b451734e34ea38dfd4b763c0d30fda Mon Sep 17 00:00:00 2001 From: leonard biermann Date: Thu, 22 Aug 2024 12:57:03 +0200 Subject: [PATCH 3/5] fikset mypy-feil --- src/ssb_konjunk/fame.py | 8 ++++---- src/ssb_konjunk/saving.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ssb_konjunk/fame.py b/src/ssb_konjunk/fame.py index 3d61145..9ec964c 100644 --- a/src/ssb_konjunk/fame.py +++ b/src/ssb_konjunk/fame.py @@ -13,7 +13,7 @@ fs = FileClient.get_gcs_file_system() -def change_date_format_fame(series: pd.Series) -> pd.Series: +def change_date_format_fame(series: pd.Series[str]) -> pd.Series[str]: """Function for turning ISO-8601 to fame time format. Args: @@ -31,9 +31,9 @@ def change_date_format_fame(series: pd.Series) -> pd.Series: def write_out_fame_format_txt( - names: pd.Series, - dates: pd.Series, - values: pd.Series, + names: pd.Series[str], + dates: pd.Series[str], + values: pd.Series[float], gcp_path: str, ) -> None: """Function to write out txt file in fame format. diff --git a/src/ssb_konjunk/saving.py b/src/ssb_konjunk/saving.py index 4dd82ce..9ef20f8 100644 --- a/src/ssb_konjunk/saving.py +++ b/src/ssb_konjunk/saving.py @@ -305,7 +305,7 @@ def write_ssb_file( # Veirfy name of datatilstand and base filename file_name = _verify_base_filename(file_name) # Verify 'datatilstand' if not the kortnavn is temp or oppdrag - if not kortnavn.lower().isin(["temp", "oppdrag"]): + if not kortnavn.lower() in ["temp", "oppdrag"]: datatilstand = _verify_datatilstand(datatilstand) # Get the filepath, only without version number and filetype file_path = _structure_ssb_filepath( From 024a5ec0a028ce2b4c95254124c03f6c451985a0 Mon Sep 17 00:00:00 2001 From: leonard biermann Date: Thu, 22 Aug 2024 13:00:50 +0200 Subject: [PATCH 4/5] fikset mypy-feil2 --- src/ssb_konjunk/saving.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ssb_konjunk/saving.py b/src/ssb_konjunk/saving.py index 9ef20f8..d61bcb3 100644 --- a/src/ssb_konjunk/saving.py +++ b/src/ssb_konjunk/saving.py @@ -305,7 +305,7 @@ def write_ssb_file( # Veirfy name of datatilstand and base filename file_name = _verify_base_filename(file_name) # Verify 'datatilstand' if not the kortnavn is temp or oppdrag - if not kortnavn.lower() in ["temp", "oppdrag"]: + if kortnavn.lower() not in ["temp", "oppdrag"]: datatilstand = _verify_datatilstand(datatilstand) # Get the filepath, only without version number and filetype file_path = _structure_ssb_filepath( From 8c767440fe499ad448c4e0d6352f39ccbf2afe9e Mon Sep 17 00:00:00 2001 From: leonard biermann Date: Thu, 22 Aug 2024 13:18:28 +0200 Subject: [PATCH 5/5] la til intermediate navn for series --- src/ssb_konjunk/fame.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ssb_konjunk/fame.py b/src/ssb_konjunk/fame.py index 9ec964c..d88cbe4 100644 --- a/src/ssb_konjunk/fame.py +++ b/src/ssb_konjunk/fame.py @@ -17,15 +17,15 @@ def change_date_format_fame(series: pd.Series[str]) -> pd.Series[str]: """Function for turning ISO-8601 to fame time format. Args: - series: A pandas series containing string for dates in format ISO-8601(YYYY-mm-dd). + series: A pandas series containing strings for dates in format ISO-8601(YYYY-mm-dd). Returns: - pd.Series: A pandas series with dates in fame format(YYYY:M:D) + pd.Series: A pandas series with dates in fame format (YYYY:M:D) """ - series = pd.to_datetime(series) + series_dt = pd.to_datetime(series) # Series of datetime64 # Format the datetime column as "YYYY:M:D" - series = series.dt.strftime("%Y:%-m:%-d") + series = series_dt.dt.strftime("%Y:%-m:%-d") return series