Skip to content

Commit

Permalink
Updated code to Python 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
ccie18643 committed Nov 8, 2023
1 parent 144aac8 commit 9d2a014
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
5 changes: 2 additions & 3 deletions pytcp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import os
import struct
import sys
from typing import Tuple

from pytcp import config
from pytcp.lib import stack
Expand All @@ -51,7 +50,7 @@
IFF_NO_PI = 0x1000


def initialize_tap(*, tap_name: str) -> Tuple[int, int]:
def initialize_tap(*, tap_name: str) -> tuple[int, int]:
"""
Initialize the TAP interface.
"""
Expand Down Expand Up @@ -80,7 +79,7 @@ class TcpIpStack:
def __init__(
self,
*,
fd: Tuple[int, int],
fd: tuple[int, int],
mac_address: str | None = None,
ip4_address: str | None = None,
ip4_gateway: str | None = None,
Expand Down
3 changes: 2 additions & 1 deletion pytcp/protocols/tcp/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@

import random
import threading
from collections.abc import Callable
from enum import Enum, auto
from typing import TYPE_CHECKING, Any, Callable
from typing import TYPE_CHECKING, Any

from pytcp import config
from pytcp.lib import stack
Expand Down
4 changes: 2 additions & 2 deletions pytcp/subsystems/rx_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import select
import threading
import time
from typing import TYPE_CHECKING, Optional
from typing import TYPE_CHECKING

from pytcp.lib.logger import log
from pytcp.lib.packet import PacketRx
Expand Down Expand Up @@ -107,7 +107,7 @@ def __thread_receive(self) -> None:

__debug__ and log("stack", "Stopped RX ring")

def dequeue(self) -> Optional[PacketRx]:
def dequeue(self) -> PacketRx | None:
"""
Dequeue inboutd frame from RX ring.
"""
Expand Down
3 changes: 2 additions & 1 deletion pytcp/subsystems/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@

import threading
import time
from typing import Any, Callable
from collections.abc import Callable
from typing import Any

from pytcp.lib.logger import log

Expand Down
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ pyre-check
build
twine
ipython
pyupgrade

0 comments on commit 9d2a014

Please sign in to comment.