Skip to content

Commit 5e76c32

Browse files
authored
Merge pull request #201 from statisticsnorway/cruft-update
Update to template version 2026.1.7
2 parents 907c4d1 + b3c6f89 commit 5e76c32

39 files changed

+938
-914
lines changed

.cookiecutter.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"_commit": "1b94f545381a9ce08e205e7451d7a4f07eaef142",
23
"_copy_without_render": [
34
"*.rst_t"
45
],
@@ -20,5 +21,5 @@
2021
"license": "MIT",
2122
"package_name": "fagfunksjoner",
2223
"project_name": "ssb-fagfunksjoner",
23-
"version": "0.1.10"
24+
"version": "1.1.2"
2425
}

.cruft.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"template": "https://github.com/statisticsnorway/ssb-pypitemplate.git",
3-
"commit": "9e3c49f6680d4c400567c39d70b768f0a322c95e",
4-
"checkout": "2025.7.18",
3+
"commit": "1b94f545381a9ce08e205e7451d7a4f07eaef142",
4+
"checkout": "2026.1.7",
55
"context": {
66
"cookiecutter": {
77
"project_name": "ssb-fagfunksjoner",
@@ -12,7 +12,7 @@
1212
"author": "Carl F. Corneil",
1313
"email": "cfc@ssb.no",
1414
"github_organization": "statisticsnorway",
15-
"version": "0.1.10",
15+
"version": "1.1.2",
1616
"license": "MIT",
1717
"development_status": "Development Status :: 4 - Beta",
1818
"code_quality_level": "Medium",
@@ -26,7 +26,7 @@
2626
"trim_blocks": true
2727
},
2828
"_template": "https://github.com/statisticsnorway/ssb-pypitemplate.git",
29-
"_commit": "9e3c49f6680d4c400567c39d70b768f0a322c95e"
29+
"_commit": "1b94f545381a9ce08e205e7451d7a4f07eaef142"
3030
}
3131
},
3232
"directory": null

.darglint

Lines changed: 0 additions & 2 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ demos/*.xml
3737
# See https://adr.ssb.no/0020-lagringsformat-for-jupyter-notebooks/
3838
*.ipynb
3939

40+
# Exclude generated documentation
41+
/docs/_build/
42+
4043

4144
# The section below is from the GitHub .gitignore template for Python:
4245
# https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ repos:
6262
entry: check-ast
6363
language: system
6464
types: [python]
65-
- id: darglint
66-
name: darglint
67-
entry: darglint
65+
- id: pydoclint
66+
name: pydoclint
67+
entry: pydoclint
6868
language: system
6969
types: [python]
7070
- id: ruff

README.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,13 @@ Check if you are on Dapla or in prodsone.
5050
```python
5151
from fagfunksjoner import check_env
5252

53-
5453
check_env()
5554
```
5655

5756
Navigate to the root of your project and back again. Do stuff while in root, like importing local functions.
5857
```python
5958
from fagfunksjoner import ProjectRoot
6059

61-
6260
with ProjectRoot():
6361
... # Do your local imports here...
6462
```
@@ -69,7 +67,6 @@ Setting up password with saspy
6967
```python
7068
from fagfunksjoner.prodsone import saspy_ssb
7169

72-
7370
saspy_ssb.set_password() # Follow the instructions to set the password
7471
saspy_ssb.saspy_df_from_path("path")
7572
```
@@ -80,7 +77,6 @@ import logging
8077

8178
from fagfunksjoner.log.statlogger import StatLogger
8279

83-
8480
# Ved å opprette StatLogger så "hijacker" den den vanlige loggeren
8581
root_logger = StatLogger(log_file="custom_log_file.log")
8682
# I tillegg sørger vi for at den ikke blir ryddet bort av Python, ved å assigne den til en variabel?
@@ -95,7 +91,6 @@ logger.info("This is an info message")
9591
```python
9692
from fagfunksjoner import make_klass_xml_codelist
9793

98-
9994
make_klass_xml_codelist(path="kjoenn.xml",
10095
codes=["1", "2"],
10196
names_bokmaal=["Mann", "Kvinne"])
@@ -109,7 +104,6 @@ import pandas as pd
109104

110105
from fagfunksjoner import round_up
111106

112-
113107
print(round(2.5, 0), round_up(2.5, 0))
114108

115109
round_up(pd.Series([1.5, 2.5, 3.5]), 0) # Datatype blir Int64 når man runder til 0 desimaler
@@ -132,7 +126,6 @@ Aggregate on all exclusive combinations of codes in certain columns (maybe befor
132126
```python
133127
from fagfunksjoner import all_combos_agg
134128

135-
136129
ialt_koder = {
137130
"skolefylk": "01-99",
138131
"almyrk": "00",
@@ -151,7 +144,6 @@ To aggregate on NON-EXCLUSIVE combinations of codes in certain columns, use the
151144
```python
152145
from fagfunksjoner import all_combos_agg_inclusive
153146

154-
155147
category_mappings = {
156148
"Alder": {
157149
"15-24": range(15, 25),
@@ -202,7 +194,6 @@ Perform mapping using SsbFormat. Behaves like a dictionary. Has functionality fo
202194
```python
203195
from fagfunksjoner import SsbFormat
204196

205-
206197
age_frmt = {
207198
'low-18': '-18',
208199
'19-25': '19-25',
@@ -224,7 +215,6 @@ print(df['age_group'].value_counts())
224215
# save format
225216
from fagfunksjoner.formats import store_format
226217

227-
228218
store_format(path+'format_name_p2025-02.json')
229219

230220
# or
@@ -234,7 +224,6 @@ ssb_age_frmt.store(path + 'format_name_p2025-02.json', force=True)
234224
# read format/import format (dictionary saved as .json) as SsbFormat
235225
from fagfunksjoner.formats import get_format
236226

237-
238227
some_frmt = get_format(path+'format_name.json')
239228
```
240229

@@ -245,7 +234,6 @@ We have "flat files", which are not comma seperated. These need metadata to corr
245234
```python
246235
from fagfunksjoner import open_path_datadok
247236

248-
249237
archive_object = open_path_datadok("$TBF/project/arkiv/filename/g2022g2023")
250238
# The object now has several important attributes
251239
archive_object.df # The Dataframe of the archived data
@@ -274,7 +262,6 @@ from dotenv import load_dotenv
274262

275263
from fagfunksjoner.prodsone import Oracle
276264

277-
278265
load_dotenv()
279266

280267
query = "select vare, pris from my_db_table"
@@ -296,7 +283,6 @@ from dotenv import load_dotenv
296283

297284
from fagfunksjoner.prodsone import Oracle
298285

299-
300286
load_dotenv()
301287

302288
query = "select vare, pris from my_db_table"
@@ -319,7 +305,6 @@ from dotenv import load_dotenv
319305

320306
from fagfunksjoner.prodsone import Oracle
321307

322-
323308
load_dotenv()
324309

325310
df = pd.DataFrame(

demos/all_combos_demo.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@
1616
# %%
1717
import os
1818

19-
2019
os.chdir("../")
2120
# %%
2221
import pandas as pd
2322
from IPython.display import display
2423

2524
from fagfunksjoner import all_combos_agg
2625

27-
2826
data = {
2927
"alder": [20, 60, 33, 33, 20],
3028
"kommune": ["0301", "3001", "0301", "5401", "0301"],

demos/datadok_extract.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
# %%
1616
from fagfunksjoner import open_path_datadok
1717

18-
1918
# %%
2019
tiar = "$UTD/gjfor_vgo/arkiv/tiar/g2013g2023"
2120
arkivfil = open_path_datadok(tiar)

demos/demo_klass_xml.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from fagfunksjoner.data.klass_xml import make_klass_xml_codelist
22

3-
43
# ### Using the main parameters
54

65
# Define your classification codes and names

demos/project_root.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
from fagfunksjoner import ProjectRoot
2020

21-
2221
# %%
2322
print(os.getcwd())
2423

0 commit comments

Comments
 (0)