Skip to content

Commit 89e6e02

Browse files
authored
Merge pull request #19 from josteinl/f/support_several_character_set_encodings
Update the lock file
2 parents cda7c6d + b31c776 commit 89e6e02

File tree

12 files changed

+1184
-847
lines changed

12 files changed

+1184
-847
lines changed

.github/workflows/branch.yaml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ jobs:
66
strategy:
77
fail-fast: false
88
matrix:
9-
python-version: ['3.9', '3.10', '3.11']
10-
poetry-version: ['1.6.1']
9+
python-version: ['3.11', '3.12', '3.13']
10+
poetry-version: ['2.0.1']
1111
os: [ubuntu-latest]
1212
runs-on: ${{ matrix.os }}
1313
steps:
@@ -29,8 +29,8 @@ jobs:
2929
strategy:
3030
fail-fast: false
3131
matrix:
32-
python-version: ['3.9', '3.10', '3.11']
33-
poetry-version: ['1.6.1']
32+
python-version: ['3.11', '3.12', '3.13']
33+
poetry-version: ['2.0.1']
3434
os: [ubuntu-latest]
3535
runs-on: ${{ matrix.os }}
3636
steps:
@@ -44,17 +44,13 @@ jobs:
4444
poetry-version: ${{ matrix.poetry-version }}
4545
- name: Install dependencies
4646
run: poetry install
47-
- name: Run black
48-
run: poetry run black . --check
49-
# - name: Run isort
50-
# run: poetry run isort . --check-only --profile black
51-
# - name: Run flake8
52-
# run: poetry run flake8 .
47+
- name: Run ruff
48+
run: poetry run ruff format --check
5349
- name: Run mypy
5450
run: poetry run mypy .
5551
- name: Run bandit
5652
run: poetry run bandit .
5753
- name: Run safety
5854
run: poetry run safety check
5955
- name: Check for acceptable licenses
60-
run: poetry run pip-licenses --allow-only="MIT License;BSD License;Python Software Foundation License;Apache Software License;Mozilla Public License 2.0 (MPL 2.0)"
56+
run: poetry run pip-licenses --allow-only="MIT License;BSD License;Python Software Foundation License;Apache Software License;Mozilla Public License 2.0 (MPL 2.0);The Unlicense (Unlicense);ISC License (ISCL)"

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ jobs:
99
strategy:
1010
fail-fast: false
1111
matrix:
12-
python-version: ['3.11']
13-
poetry-version: ['1.6.1']
12+
python-version: ['3.13']
13+
poetry-version: ['2.0.1']
1414
os: [ubuntu-latest]
1515
runs-on: ${{ matrix.os }}
1616
steps:

CHANGES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Python KOF Parser Package
22

3+
## Version 0.1.2
4+
_2025-01-17_
5+
6+
Add
7+
8+
- Add support for all EPSG SRIDs (that the coordinate-projector package supports).
9+
310
## Version 0.1.1
411
_2023-11-09_
512

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
44
[![security: safety](https://img.shields.io/badge/security-safety-yellow.svg)](https://github.com/pyupio/safety)
5-
[![code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
5+
[![code style](https://img.shields.io/badge/style-ruff-41B5BE)](https://github.com/astral-sh/ruff)
66
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
7-
[![python](https://img.shields.io/badge/Python-3.11-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
7+
[![python](https://img.shields.io/badge/Python-3.12-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
88

99

1010
Python package for parsing and generating KOF files.
@@ -90,9 +90,9 @@ print(kof_string)
9090

9191
Before you start, install:
9292

93-
- Python 3.9 or higher
94-
- Poetry 1.6.1
95-
- black code formatter
93+
- Python 3.11 or higher
94+
- Poetry 2
95+
- Ruff formatter
9696

9797
## Clone this repository
9898

poetry.lock

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

pyproject.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ src = ["src", "tests"]
1919

2020
[tool.poetry]
2121
name = "kof-parser"
22-
version = "0.1.1"
22+
version = "0.1.2"
2323
description = "A KOF file parser. Follows Norkart's KOF 2.0 specification from 2005."
2424
license = "MIT"
2525
authors = ["Magnus Mariero <[email protected]>", "Jostein Leira <[email protected]>"]
@@ -38,13 +38,12 @@ packages = [
3838

3939

4040
[tool.poetry.dependencies]
41-
python = ">=3.9,<4"
42-
pydantic = "^2.4.2"
43-
coordinate-projector = ">=0.0.9"
41+
python = ">=3.11,<4"
42+
pydantic = "^2.10"
43+
coordinate-projector = "^0.0.11"
4444
charset-normalizer = "*"
4545

4646
[tool.poetry.group.dev.dependencies]
47-
black = "*"
4847
pytest = "*"
4948
pytest-cov = "*"
5049
mypy = "*"

src/kof_parser/kof.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Common super class for the KOFReader() and KOFWriter() classes
33
"""
4+
45
import csv
56
from pathlib import Path
67
from typing import Dict, Optional

src/kof_parser/model.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
from typing import Optional
2-
31
from pydantic import BaseModel, Field
42

53

64
class Location(BaseModel):
75
name: str = ""
8-
methods: list[str] = []
9-
point_easting: Optional[float] = None
10-
point_northing: Optional[float] = None
11-
point_z: Optional[float] = Field(None, ge=-10000, le=10000)
12-
srid: Optional[int] = None
6+
methods: list[str] = Field(default_factory=list)
7+
point_easting: float | None = None
8+
point_northing: float | None = None
9+
point_z: float | None = Field(None, ge=-10000, le=10000)
10+
srid: int | None = None
11+
12+
def __repr__(self):
13+
return f"<{self.__class__.__name__} {self.name} ({self.point_easting}, {self.point_northing}, {self.point_z})>"

src/kof_parser/parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
This is the parser service.
33
"""
4+
45
from io import BytesIO, TextIOWrapper
56
from typing import Optional, Any
67

src/kof_parser/writer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from typing import List, Optional
2-
from datetime import datetime
2+
from datetime import datetime, UTC
33
from uuid import UUID
44

55
from kof_parser import Kof
@@ -36,7 +36,7 @@ def create_admin_block(self, project_name: str, srid: int, swap_easting_northing
3636
# 00 Oppdrag Dato Ver K.sys Komm $11100000000 Observatør
3737
# 01 EXP 31012022 2 22 0000 $22100000000 NN
3838
"""
39-
date = datetime.utcnow().strftime("%d%m%Y")
39+
date = datetime.now(UTC).strftime("%d%m%Y")
4040
version = "1"
4141
sosi_code = self.get_code(srid=srid) or ""
4242
municipality = ""
@@ -73,7 +73,7 @@ def create_kof_header_lines(project_id: UUID, project_name, srid: int) -> str:
7373
header = " 00 KOF Export from NGI Field Manager\n"
7474
header += f" 00 Project: {project_id}. Name: {project_name}\n"
7575
header += f" 00 Spatial Reference ID (SRID): {srid}\n"
76-
header += f" 00 Export date (UTC): {datetime.utcnow()}\n"
76+
header += f" 00 Export date (UTC): {datetime.now(UTC)}\n"
7777

7878
return header
7979

0 commit comments

Comments
 (0)