ssb-konjunk 0.1.16__tar.gz → 0.1.18__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,7 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: ssb-konjunk
3
- Version: 0.1.16
3
+ Version: 0.1.18
4
4
  Summary: SSB Konjunk
5
- Home-page: https://github.com/statisticsnorway/ssb-konjunk
6
5
  License: MIT
7
6
  Author: Edvard Garmannslund
8
7
  Author-email: ged@ssb.no
@@ -15,12 +14,13 @@ Classifier: Programming Language :: Python :: 3.11
15
14
  Classifier: Programming Language :: Python :: 3.12
16
15
  Classifier: Programming Language :: Python :: 3.13
17
16
  Requires-Dist: click (>=8.0.1)
18
- Requires-Dist: dapla-toolbelt (>=2.0.19,<3.0.0)
19
- Requires-Dist: pandas (>=2.2.0,<3.0.0)
20
- Requires-Dist: pandas-stubs (>=2.2.2.240807,<3.0.0.0)
21
- Requires-Dist: pendulum (>=3.0.0,<4.0.0)
17
+ Requires-Dist: dapla-toolbelt (>=2.0.20)
18
+ Requires-Dist: pandas (>=2.2.0)
19
+ Requires-Dist: pandas-stubs (>=2.2.2.240807)
20
+ Requires-Dist: pendulum (>=3.0.0)
22
21
  Project-URL: Changelog, https://github.com/statisticsnorway/ssb-konjunk/releases
23
22
  Project-URL: Documentation, https://statisticsnorway.github.io/ssb-konjunk
23
+ Project-URL: Homepage, https://github.com/statisticsnorway/ssb-konjunk
24
24
  Project-URL: Repository, https://github.com/statisticsnorway/ssb-konjunk
25
25
  Description-Content-Type: text/markdown
26
26
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ssb-konjunk"
3
- version = "0.1.16"
3
+ version = "0.1.18"
4
4
  description = "SSB Konjunk"
5
5
  authors = ["Edvard Garmannslund <ged@ssb.no>"]
6
6
  license = "MIT"
@@ -14,12 +14,12 @@ classifiers = ["Development Status :: 1 - Planning"]
14
14
  Changelog = "https://github.com/statisticsnorway/ssb-konjunk/releases"
15
15
 
16
16
  [tool.poetry.dependencies]
17
- python = "^3.10"
17
+ python = ">=3.10, <4.0"
18
18
  click = ">=8.0.1"
19
- pandas = "^2.2.0"
20
- pendulum = "^3.0.0"
21
- dapla-toolbelt = "^2.0.19"
22
- pandas-stubs = "^2.2.2.240807"
19
+ pandas = ">=2.2.0"
20
+ pendulum = ">=3.0.0"
21
+ dapla-toolbelt = ">=2.0.20"
22
+ pandas-stubs = ">=2.2.2.240807"
23
23
 
24
24
  [tool.poetry.group.dev.dependencies]
25
25
  pygments = ">=2.10.0"
@@ -71,7 +71,7 @@ show_error_context = true
71
71
  force-exclude = true # Apply excludes to pre-commit
72
72
  show-fixes = true
73
73
  src = ["src", "tests"]
74
- target-version = "py310" # Minimum Python version supported
74
+ target-version = "py311" # Minimum Python version supported
75
75
  include = ["*.py", "*.pyi", "**/pyproject.toml", "*.ipynb"]
76
76
  extend-exclude = [
77
77
  "__pycache__",
@@ -99,8 +99,11 @@ ignore = [
99
99
  "ANN202", # Don't requiere return type annotation for private functions.
100
100
  "ANN401", # Allow type annotation with type Any.
101
101
  "D100", # Supress undocumented-public-module. Only doc of public api required.
102
+ "FBT001", # Allow boolean positional arguments in a function.
103
+ "FBT002", # Allow boolean default positional arguments in a function.
102
104
  "E402", # Supress module-import-not-at-top-of-file, needed in jupyter notebooks.
103
105
  "E501", # Supress line-too-long warnings: trust black's judgement on this one.
106
+ "PLR2004", # Allow to compare with unnamed numerical constants.
104
107
  ]
105
108
 
106
109
  [tool.ruff.lint.isort]
@@ -112,6 +115,9 @@ max-complexity = 15
112
115
  [tool.ruff.lint.pydocstyle]
113
116
  convention = "google" # You can also use "numpy".
114
117
 
118
+ [tool.ruff.lint.pylint]
119
+ max-args = 8
120
+
115
121
  [tool.ruff.lint.pep8-naming]
116
122
  classmethod-decorators = ["classmethod", "validator", "root_validator", "pydantic.validator"]
117
123
 
@@ -272,6 +272,60 @@ def validate_day(day: int | str) -> str:
272
272
  return str(day)
273
273
 
274
274
 
275
+ def quarter_for_month(month: str | int) -> int:
276
+ """Find corresponding quarter for a month.
277
+
278
+ Args:
279
+ month: Month to find corresponding quarter for.
280
+
281
+ Returns:
282
+ int: The corresponding quarter.
283
+
284
+ Raises:
285
+ ValueError: If invalid month
286
+ """
287
+ month = int(month)
288
+
289
+ if month < 1 or month > 12:
290
+ raise ValueError(f"Invalid month: {month}")
291
+
292
+ if month < 4:
293
+ return 1
294
+ elif month < 7:
295
+ return 2
296
+ elif month < 10:
297
+ return 3
298
+ else:
299
+ return 4
300
+
301
+
302
+ def months_in_quarter(quarter: int | str) -> list[int]:
303
+ """Return the three months in the quarter.
304
+
305
+ Args:
306
+ quarter: the relevant quarter.
307
+
308
+ Returns:
309
+ list: a list with the months in the quarter.
310
+
311
+ Raises:
312
+ ValueError: If invalid quarter.
313
+ """
314
+ quarter = int(quarter)
315
+
316
+ if quarter < 1 or quarter > 4:
317
+ raise ValueError(f"Invalid quarter: {quarter}")
318
+
319
+ if quarter == 1:
320
+ return [1, 2, 3]
321
+ elif quarter == 2:
322
+ return [4, 5, 6]
323
+ elif quarter == 3:
324
+ return [7, 8, 9]
325
+ else:
326
+ return [10, 11, 12]
327
+
328
+
275
329
  def set_publishing_date() -> str:
276
330
  """Set the date for publication of tables.
277
331
 
File without changes
File without changes