Skip to content

Commit 1d37859

Browse files
authored
Merge pull request #99 from statisticsnorway/update-from-template
Update to release 2024.9.10 of template
2 parents fe925d0 + f3c3350 commit 1d37859

File tree

8 files changed

+1581
-1531
lines changed

8 files changed

+1581
-1531
lines changed

.cruft.json

Lines changed: 2 additions & 2 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": "f7f5ee76f498f10dd72f7f263516aeaff20b0b3a",
4-
"checkout": "2024.4.9",
3+
"commit": "e6f0ca2794354d16838cf36d97bee2f9f70d3142",
4+
"checkout": "2024.9.10",
55
"context": {
66
"cookiecutter": {
77
"project_name": "ssb-fagfunksjoner",

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
poetry --version
3535
3636
- name: Set up Python
37-
uses: actions/setup-python@v5.1.1
37+
uses: actions/setup-python@v5.2.0
3838
with:
3939
python-version: "3.12"
4040
cache: "poetry"

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
fetch-depth: 2
2222

2323
- name: Set up Python
24-
uses: actions/setup-python@v5.1.1
24+
uses: actions/setup-python@v5.2.0
2525
with:
2626
python-version: "3.12"
2727

@@ -61,11 +61,11 @@ jobs:
6161
6262
- name: Publish package on PyPI
6363
if: steps.check-version.outputs.tag
64-
uses: pypa/gh-action-pypi-publish@v1.9.0
64+
uses: pypa/gh-action-pypi-publish@v1.10.1
6565

6666
- name: Publish package on TestPyPI
6767
if: (!steps.check-version.outputs.tag)
68-
uses: pypa/gh-action-pypi-publish@v1.9.0
68+
uses: pypa/gh-action-pypi-publish@v1.10.1
6969
with:
7070
repository-url: https://test.pypi.org/legacy/
7171

.github/workflows/tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
uses: actions/checkout@v4
3939

4040
- name: Set up Python ${{ matrix.python }}
41-
uses: actions/setup-python@v5.1.1
41+
uses: actions/setup-python@v5.2.0
4242
with:
4343
python-version: ${{ matrix.python }}
4444

@@ -103,6 +103,7 @@ jobs:
103103
with:
104104
name: coverage-data-${{ matrix.os }}-${{ matrix.python }}
105105
path: ".coverage.*"
106+
include-hidden-files: true
106107

107108
- name: Upload documentation
108109
if: matrix.session == 'docs-build'
@@ -121,7 +122,7 @@ jobs:
121122
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
122123

123124
- name: Set up Python
124-
uses: actions/setup-python@v5.1.1
125+
uses: actions/setup-python@v5.2.0
125126
with:
126127
python-version: "3.12"
127128

@@ -168,4 +169,4 @@ jobs:
168169
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
169170
# No need to run SonarCloud analysis if dependabot update or token not defined
170171
if: env.SONAR_TOKEN != '' && (github.actor != 'dependabot[bot]')
171-
uses: SonarSource/sonarcloud-github-action@v2.3.0
172+
uses: SonarSource/sonarcloud-github-action@v3.0.0

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,6 @@ rsconnect/
208208
# Blaise specific ignores
209209
*.bdix
210210
*.bdbx
211+
212+
# PyCharm
213+
.idea/

poetry.lock

Lines changed: 1555 additions & 1514 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ pretty = true
9090
show_column_numbers = true
9191
show_error_context = true
9292
exclude = ["tests", "docs", "noxfile.py"]
93+
warn_unused_ignores = false # Remove when not supporting python 3.10
9394

9495
[[tool.mypy.overrides]]
9596
module = [

src/fagfunksjoner/data/pyarrow.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@ def cast_pyarrow_table_schema(data: pa.Table, schema: pa.Schema) -> pa.Table:
1313
Returns:
1414
pa.Table: A new pyarrow table with correct schema.
1515
"""
16+
# Pyarrow has only partial type hints. All type: ignore in this function has been
17+
# checked with the pyarrow documentation, and the implementation is correct.
1618
newdata = []
1719
newnames = []
1820
for field in schema:
19-
if type(field.type) is pa.DictionaryType:
20-
new = data.column(field.name).dictionary_encode().cast(field.type)
21+
if type(field.type) is pa.DictionaryType: # type: ignore
22+
new = data.column(field.name).dictionary_encode().cast(field.type) # type: ignore
2123
else:
22-
new = data.column(field.name).cast(field.type)
24+
new = data.column(field.name).cast(field.type) # type: ignore
2325
newdata.append(new)
2426
newnames.append(field.name)
25-
return pa.table(newdata, names=newnames)
27+
return pa.table(newdata, names=newnames) # type: ignore
2628

2729

2830
def restructur_pyarrow_schema(
@@ -46,17 +48,19 @@ def restructur_pyarrow_schema(
4648
pa.Schema: A new pyarrow schema that has the same order as the in use schema,
4749
but with the correct datatypes from the schema that we want.
4850
"""
51+
# Pyarrow has only partial type hints. All type: ignore in this function has been
52+
# checked with the pyarrow documentation, and the implementation is correct.
4953
for col in inuse_schema.names:
5054
assert col in wanted_schema.names
5155
newfields = []
5256
for name in inuse_schema.names:
5357
inuse_field_index = inuse_schema.get_field_index(name)
5458
wanted_field_index = wanted_schema.get_field_index(name)
55-
inuse_field = inuse_schema.field(inuse_field_index)
56-
wanted_field = wanted_schema.field(wanted_field_index)
59+
inuse_field = inuse_schema.field(inuse_field_index) # type: ignore
60+
wanted_field = wanted_schema.field(wanted_field_index) # type:ignore
5761

58-
if type(inuse_field.type) is type(wanted_field.type):
59-
newfields.append(inuse_field.with_type(wanted_field.type))
62+
if type(inuse_field.type) is type(wanted_field.type): # type: ignore
63+
newfields.append(inuse_field.with_type(wanted_field.type)) # type: ignore
6064
else:
6165
newfields.append(wanted_field)
6266
return pa.schema(newfields)

0 commit comments

Comments
 (0)