Skip to content

Commit

Permalink
Eliminate even more implicit optional (#1845)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrudd2 authored Oct 19, 2023
1 parent e7b177d commit 3e03c51
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
5 changes: 3 additions & 2 deletions pymodbus/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
Released under the the BSD license
"""
from __future__ import annotations

import logging
from binascii import b2a_hex
from logging import NullHandler as __null
from typing import Union

from pymodbus.utilities import hexlify_packets

Expand All @@ -17,7 +18,7 @@


def pymodbus_apply_logging_config(
level: Union[str, int] = logging.DEBUG, log_file_name: str = None
level: str | int = logging.DEBUG, log_file_name: str | None = None
):
"""Apply basic logging configuration used by default by Pymodbus maintainers.
Expand Down
10 changes: 6 additions & 4 deletions pymodbus/repl/client/helper.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""Helper Module for REPL actions."""
from __future__ import annotations

import inspect

# pylint: disable=missing-type-doc
import json
from collections import OrderedDict
from typing import Any, Dict, List, Union
from typing import Any

import pygments
from prompt_toolkit import print_formatted_text
Expand Down Expand Up @@ -59,7 +61,7 @@
"set_timeout",
"get_serial_settings",
]
CLIENT_ATTRIBUTES: List[str] = []
CLIENT_ATTRIBUTES: list[str] = []


class Command:
Expand Down Expand Up @@ -229,8 +231,8 @@ def get_commands(client):
class Result:
"""Represent result command."""

function_code: int = None
data: Union[Dict[int, Any], Any] = None
function_code: int | None = None
data: dict[int, Any] | Any = None

def __init__(self, result):
"""Initialize.
Expand Down
8 changes: 4 additions & 4 deletions pymodbus/server/reactive/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ class ReactiveModbusSlaveContext(ModbusSlaveContext):

def __init__(
self,
discrete_inputs: BaseModbusDataBlock = None,
coils: BaseModbusDataBlock = None,
input_registers: BaseModbusDataBlock = None,
holding_registers: BaseModbusDataBlock = None,
discrete_inputs: BaseModbusDataBlock,
coils: BaseModbusDataBlock,
input_registers: BaseModbusDataBlock,
holding_registers: BaseModbusDataBlock,
zero_mode: bool = False,
randomize: int = 0,
change_rate: int = 0,
Expand Down

0 comments on commit 3e03c51

Please sign in to comment.