From: Jérôme Benoit Date: Wed, 12 Jun 2024 10:26:07 +0000 (+0200) Subject: refactor(ocpp-server): add a few types X-Git-Tag: v1.3.7~70 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=c7f80bf972e52fd1afa315ffdf02ff603f6b9e8b;p=e-mobility-charging-stations-simulator.git refactor(ocpp-server): add a few types Signed-off-by: Jérôme Benoit --- diff --git a/package.json b/package.json index 60506acb..1361e037 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "@typescript-eslint/eslint-plugin": "^7.13.0", "@typescript-eslint/parser": "^7.13.0", "auto-changelog": "^2.4.0", - "c8": "^10.0.0", + "c8": "^10.1.1", "clinic": "^13.0.0", "cross-env": "^7.0.3", "esbuild": "^0.21.5", @@ -146,7 +146,7 @@ "expect": "^29.7.0", "glob": "^10.4.1", "husky": "^9.0.11", - "lint-staged": "^15.2.5", + "lint-staged": "^15.2.6", "prettier": "^3.3.2", "release-it": "^17.3.0", "rimraf": "^5.0.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 34302f9e..648f6154 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -113,8 +113,8 @@ importers: specifier: ^2.4.0 version: 2.4.0(encoding@0.1.13) c8: - specifier: ^10.0.0 - version: 10.0.0 + specifier: ^10.1.1 + version: 10.1.1 clinic: specifier: ^13.0.0 version: 13.0.0(encoding@0.1.13) @@ -170,8 +170,8 @@ importers: specifier: ^9.0.11 version: 9.0.11 lint-staged: - specifier: ^15.2.5 - version: 15.2.5 + specifier: ^15.2.6 + version: 15.2.6 prettier: specifier: ^3.3.2 version: 3.3.2 @@ -1861,8 +1861,8 @@ packages: resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==} engines: {node: '>=18'} - c8@10.0.0: - resolution: {integrity: sha512-rdQecjxw16P8kwgMBjruaQyfF+R2o/mucCCK4VPktwq2HFMWLOHGyUasb46+WlUOVJX94d6dZolcJxzjCzWmXg==} + c8@10.1.1: + resolution: {integrity: sha512-+aAvpNMwnzncW27XsEf2eMrGTF8HXIGZ24UQ1dW679+8SQ/UvDXxHNoKwMohcI9ZVj0xl/bI4/meqxvIWOBYaw==} engines: {node: '>=18'} hasBin: true @@ -2563,8 +2563,8 @@ packages: ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} - electron-to-chromium@1.4.798: - resolution: {integrity: sha512-by9J2CiM9KPGj9qfp5U4FcPSbXJG7FNzqnYaY4WLzX+v2PHieVGmnsA4dxfpGE3QEC7JofpPZmn7Vn1B9NR2+Q==} + electron-to-chromium@1.4.799: + resolution: {integrity: sha512-3D3DwWkRTzrdEpntY0hMLYwj7SeBk1138CkPE8sBDSj3WzrzOiG2rHm3luw8jucpf+WiyLBCZyU9lMHyQI9M9Q==} elliptic@6.5.5: resolution: {integrity: sha512-7EjbcmUm17NQFu4Pmgmq2olYMj8nwMnpcddByChSUjArp8F5DQWcIcpriwO4ZToLNAJig0yiyjswfyGNje/ixw==} @@ -3061,8 +3061,8 @@ packages: for-each@0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} - foreground-child@3.1.1: - resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} + foreground-child@3.2.0: + resolution: {integrity: sha512-CrWQNaEl1/6WeZoarcM9LHupTo3RpZO2Pdk1vktwzPiQTsJnAKJmm3TACKeG5UZbWDfaH2AbvYxzP96y0MT7fA==} engines: {node: '>=14'} forever-agent@0.6.1: @@ -4021,8 +4021,8 @@ packages: lines-and-columns@1.2.4: resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} - lint-staged@15.2.5: - resolution: {integrity: sha512-j+DfX7W9YUvdzEZl3Rk47FhDF6xwDBV5wwsCPw6BwWZVPYJemusQmvb9bRsW23Sqsaa+vRloAWogbK4BUuU2zA==} + lint-staged@15.2.6: + resolution: {integrity: sha512-M/3PdijFXT/A5lnbSK3EQNLbIIrkE00JZaD39r7t4kfFOqT1Ly9LgSZSMMtvQ3p2/C8Nyj/ou0vkNHmEwqoB8g==} engines: {node: '>=18.12.0'} hasBin: true @@ -5190,8 +5190,8 @@ packages: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - rfdc@1.3.1: - resolution: {integrity: sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==} + rfdc@1.4.1: + resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==} rimraf@3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} @@ -8194,7 +8194,7 @@ snapshots: browserslist@4.23.1: dependencies: caniuse-lite: 1.0.30001632 - electron-to-chromium: 1.4.798 + electron-to-chromium: 1.4.799 node-releases: 2.0.14 update-browserslist-db: 1.0.16(browserslist@4.23.1) @@ -8227,12 +8227,12 @@ snapshots: dependencies: run-applescript: 7.0.0 - c8@10.0.0: + c8@10.1.1: dependencies: '@bcoe/v8-coverage': 0.2.3 '@istanbuljs/schema': 0.1.3 find-up: 5.0.0 - foreground-child: 3.1.1 + foreground-child: 3.2.0 istanbul-lib-coverage: 3.2.2 istanbul-lib-report: 3.0.1 istanbul-reports: 3.1.7 @@ -9010,7 +9010,7 @@ snapshots: ee-first@1.1.1: {} - electron-to-chromium@1.4.798: {} + electron-to-chromium@1.4.799: {} elliptic@6.5.5: dependencies: @@ -9719,7 +9719,7 @@ snapshots: dependencies: is-callable: 1.2.7 - foreground-child@3.1.1: + foreground-child@3.2.0: dependencies: cross-spawn: 7.0.3 signal-exit: 4.1.0 @@ -9889,7 +9889,7 @@ snapshots: glob@10.4.1: dependencies: - foreground-child: 3.1.1 + foreground-child: 3.2.0 jackspeak: 3.4.0 minimatch: 9.0.4 minipass: 7.1.2 @@ -10712,7 +10712,7 @@ snapshots: lines-and-columns@1.2.4: {} - lint-staged@15.2.5: + lint-staged@15.2.6: dependencies: chalk: 5.3.0 commander: 12.1.0 @@ -10733,7 +10733,7 @@ snapshots: colorette: 2.0.20 eventemitter3: 5.0.1 log-update: 6.0.0 - rfdc: 1.3.1 + rfdc: 1.4.1 wrap-ansi: 9.0.0 local-pkg@0.5.0: @@ -11993,7 +11993,7 @@ snapshots: reusify@1.0.4: {} - rfdc@1.3.1: {} + rfdc@1.4.1: {} rimraf@3.0.2: dependencies: diff --git a/tests/ocpp-server/server.py b/tests/ocpp-server/server.py index 02e3a96f..8c1c8dfb 100644 --- a/tests/ocpp-server/server.py +++ b/tests/ocpp-server/server.py @@ -43,7 +43,8 @@ class ChargePoint(ocpp.v201.ChargePoint): return ocpp.v201.call_result.Heartbeat(current_time=datetime.now(timezone.utc).isoformat()) @on(Action.StatusNotification) - async def on_status_notification(self, timestamp, evse_id, connector_id, connector_status, + async def on_status_notification(self, timestamp, evse_id: int, connector_id: int, + connector_status, **kwargs): logging.info("Received StatusNotification") return ocpp.v201.call_result.StatusNotification() @@ -56,7 +57,8 @@ class ChargePoint(ocpp.v201.ChargePoint): ) @on(Action.TransactionEvent) - async def on_transaction_event(self, event_type, timestamp, trigger_reason, seq_no, + async def on_transaction_event(self, event_type: TransactionEventType, timestamp, + trigger_reason, seq_no: int, transaction_info, **kwargs): match event_type: case TransactionEventType.started: @@ -74,7 +76,7 @@ class ChargePoint(ocpp.v201.ChargePoint): return ocpp.v201.call_result.TransactionEvent() @on(Action.MeterValues) - async def on_meter_values(self, evse_id, meter_value, **kwargs): + async def on_meter_values(self, evse_id: int, meter_value, **kwargs): logging.info("Received MeterValues") return ocpp.v201.call_result.MeterValues()