Skip to content

Commit

Permalink
Fix sourcegen compatibility with Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Sep 29, 2022
1 parent 07d5f8b commit e794706
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion interfaces/sourcegen/sourcegen/_HeaderFileParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from pathlib import Path
import re
from typing import List

from ._dataclasses import HeaderFile, Func, Param

Expand All @@ -28,7 +29,7 @@ def _parse_func(cls, c_func: str) -> Func:
name = front[-1]
return Func(ret_type, name, params)

def __init__(self, path: Path, ignore_funcs: list[str] = None):
def __init__(self, path: Path, ignore_funcs: List[str] = None):
self._path = path
self._ignore_funcs = ignore_funcs

Expand Down
3 changes: 2 additions & 1 deletion interfaces/sourcegen/sourcegen/_SourceGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from abc import ABCMeta, abstractmethod
from pathlib import Path
from typing import List

from ._dataclasses import HeaderFile

Expand All @@ -15,5 +16,5 @@ def __init__(self, out_dir: Path, config: dict):
pass

@abstractmethod
def generate_source(self, headers_files: list[HeaderFile]):
def generate_source(self, headers_files: List[HeaderFile]):
pass
5 changes: 3 additions & 2 deletions interfaces/sourcegen/sourcegen/_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from dataclasses import dataclass
from pathlib import Path
from typing import List
import re
from ._helpers import with_unpack_iter

Expand All @@ -23,7 +24,7 @@ class Func:

ret_type: str
name: str
params: list[Param]
params: List[Param]


@dataclass(frozen=True)
Expand All @@ -32,4 +33,4 @@ class HeaderFile:
"""Represents information about a parsed C header file"""

path: Path
funcs: list[Func]
funcs: List[Func]

0 comments on commit e794706

Please sign in to comment.