Skip to content

Commit 8d7f3d3

Browse files
committed
rewrite module docstring
1 parent 87dc43a commit 8d7f3d3

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

demos/project_root.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# ---
2+
# jupyter:
3+
# jupytext:
4+
# formats: py:percent
5+
# text_representation:
6+
# extension: .py
7+
# format_name: percent
8+
# format_version: '1.3'
9+
# jupytext_version: 1.16.4
10+
# kernelspec:
11+
# display_name: ssb-fagfunksjoner
12+
# language: python
13+
# name: ssb-fagfunksjoner
14+
# ---
15+
16+
# %%
17+
from fagfunksjoner import ProjectRoot
18+
import os
19+
20+
# %%
21+
print(os.getcwd())
22+
23+
# %%
24+
proj_root = ProjectRoot()
25+
26+
# %%
27+
print(proj_root.path)
28+
29+
# %%

demos/versions_dapla.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
# %%
2929
testfile_paths = [
3030
"file_v1.parquet",
31+
"file_v1__DOC.json",
32+
"file_v12__DOC.json",
3133
"file_v2.parquet",
3234
"file_v11.parquet",
3335
"otherfile_v3.parquet",
@@ -46,20 +48,23 @@
4648

4749

4850
# %%
49-
files = fs.glob(f"{base_path}/{folder_name}/*.parquet")
51+
files = fs.glob(f"{base_path}/{folder_name}/*")
5052
files # noqa: B018
5153

5254
# %%
5355
versions.get_latest_fileversions(files)
5456

57+
# %%
58+
versions.latest_version_path("/buckets/produkt/versions_paths_fagfunksjoner/file_v12__DOC")
59+
5560
# %%
5661
versions.next_version_path(
5762
"/buckets/produkt/versions_paths_fagfunksjoner/file_v1.parquet"
5863
)
5964

6065
# %%
6166
versions.next_version_path(
62-
"gs://ssb-dapla-felles-data-produkt-prod/versions_paths_fagfunksjoner/file_v1.parquet"
67+
"gs://ssb-dapla-felles-data-produkt-prod/versions_paths_fagfunksjoner/otherfile_v1.parquet"
6368
)
6469

6570
# %%

src/fagfunksjoner/paths/versions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
"""This module works with filepaths, and is especially aimed at GCS and Dapla.
1+
"""This module works with filepaths and the versioning convention at SSB.
22
3-
But it works locally as well if standard for versionizing datafiles are implemented.
43
The main purpose is fileversions according to Statistics Norway standards.
4+
The aim is to help versioning up and getting the latest version of paths in use on storage.
5+
6+
The module is not targeted at files that do not follow the naming convention of versions,
7+
for example the __DOC.json-files, will not work, because they do not end with "_v1" before the file extension.
58
"""
69

710
import glob

0 commit comments

Comments
 (0)