Skip to content

Commit 153268c

Browse files
committed
⬆️ Bump to Python 3.9
Run pyupgrade: pyupgrade --py39-plus --keep-runtime-typing --keep-percent-format $(find . -name '*.py')
1 parent a31db48 commit 153268c

File tree

9 files changed

+15
-19
lines changed

9 files changed

+15
-19
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- uses: actions/checkout@v4
3232
- uses: actions/setup-python@v5
3333
with:
34-
python-version: '3.8'
34+
python-version: '3.9'
3535
- uses: actions/setup-node@v4
3636
with:
3737
node-version: '12'

.github/workflows/code-quality.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/checkout@v4
1212
- uses: actions/setup-python@v5
1313
with:
14-
python-version: '3.8'
14+
python-version: '3.9'
1515
- uses: isort/isort-action@v1
1616
with:
1717
requirementsFiles: requirements/dev.txt
@@ -26,7 +26,7 @@ jobs:
2626
- uses: actions/checkout@v4
2727
- uses: actions/setup-python@v5
2828
with:
29-
python-version: '3.8'
29+
python-version: '3.9'
3030
- name: Install dependencies
3131
run: |
3232
pip install -r requirements/dev.txt

.github/workflows/quick-start.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [push]
44

55
jobs:
66
run:
7-
runs-on: ubuntu-20.04
7+
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v4
1010
- name: Download docker-compose file

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Stage 1 - Compile needed python dependencies
2-
FROM python:3.8-buster AS build
2+
FROM python:3.9-buster AS build
33

44
RUN apt-get update && apt-get install -y --no-install-recommends \
55
libpq-dev \
@@ -29,7 +29,7 @@ RUN npm run build
2929

3030

3131
# Stage 3 - Build docker image suitable for execution and deployment
32-
FROM python:3.8-buster AS production
32+
FROM python:3.9-buster AS production
3333

3434
# Stage 3.1 - Set up the needed production dependencies
3535
# install all the dependencies for GeoDjango

src/objects/api/kanalen.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from collections import defaultdict
2-
from typing import Dict
32

43
from django.conf import settings
54
from django.db import models
@@ -21,7 +20,7 @@ def __init__(
2120
# check that we're refering to existing fields
2221
self.kenmerken = kenmerken or ()
2322

24-
def get_kenmerken(self, obj: models.Model, data: Dict = None) -> Dict:
23+
def get_kenmerken(self, obj: models.Model, data: dict = None) -> dict:
2524
data = data or {}
2625
return {
2726
kenmerk: data.get("type") or obj.object.object_type.url

src/objects/api/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from datetime import date
2-
from typing import Dict, Union
2+
from typing import Union
33

44
from djchoices import DjangoChoices
55

@@ -47,7 +47,7 @@ def display_choice_values_for_help_text(choices: DjangoChoices) -> str:
4747
return "\n".join(items)
4848

4949

50-
def merge_patch(target: JSONValue, patch: JSONValue) -> Dict[str, JSONValue]:
50+
def merge_patch(target: JSONValue, patch: JSONValue) -> dict[str, JSONValue]:
5151
"""Merge two objects together recursively.
5252
5353
This is inspired by https://datatracker.ietf.org/doc/html/rfc7396 - JSON Merge Patch,

src/objects/typing.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from typing import Dict, List, Union
1+
from typing import Union
22

33
JSONPrimitive = Union[str, int, None, float, bool]
44

5-
JSONValue = Union[JSONPrimitive, "JSONObject", List["JSONValue"]]
5+
JSONValue = Union[JSONPrimitive, "JSONObject", list["JSONValue"]]
66

7-
JSONObject = Dict[str, JSONValue]
7+
JSONObject = dict[str, JSONValue]

src/objects/utils/autoschema.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import List
2-
31
from django.conf import settings
42
from django.utils.translation import gettext_lazy as _
53

@@ -119,7 +117,7 @@ def get_content_type_headers(self) -> list:
119117
)
120118
]
121119

122-
def get_fields_params(self) -> List[OpenApiParameter]:
120+
def get_fields_params(self) -> list[OpenApiParameter]:
123121
if self.method != "GET":
124122
return []
125123

src/objects/utils/serializers.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import logging
22
from collections import defaultdict
3-
from typing import Dict, List, Tuple
43

54
from glom import SKIP, GlomError, glom
65
from rest_framework import fields, serializers
@@ -35,13 +34,13 @@ def build_spec_field(spec, name, value, ui):
3534
spec[name] = value if ui else spec_val
3635

3736

38-
def get_field_names(data: Dict[str, fields.Field]) -> List[str]:
37+
def get_field_names(data: dict[str, fields.Field]) -> list[str]:
3938
"""return list of names for all serializer fields. Supports nesting"""
4039
names_and_sources = get_field_names_and_sources(data)
4140
return [name for name, source in names_and_sources]
4241

4342

44-
def get_field_names_and_sources(data: Dict[str, fields.Field]) -> List[Tuple[str, str]]:
43+
def get_field_names_and_sources(data: dict[str, fields.Field]) -> list[tuple[str, str]]:
4544
"""return list of (name, source) for all serializer fields. Supports nesting"""
4645
names_and_sources = []
4746
for key, value in data.items():

0 commit comments

Comments
 (0)