Skip to content

Commit

Permalink
🔧 Adapt type hinting to Python 3.9 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mbercx committed Nov 21, 2024
1 parent 35a1cbc commit d1a64cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/qe_tools/outputs/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
"""Base parser for the outputs of Quantum ESPRESSO."""

from typing import Union
import abc


Expand All @@ -9,7 +10,7 @@ class BaseOutput(abc.ABC):
Abstract class for the outputs of Quantum ESPRESSO.
"""

def __init__(self, outputs: dict | None = None, executable: str | None = None):
def __init__(self, outputs: Union[dict, None] = None, executable: str | None = None):
self.outputs = outputs
self.executable = executable

Expand Down
4 changes: 2 additions & 2 deletions src/qe_tools/outputs/pw.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class PwOutput(BaseOutput):
"""Output of the Quantum ESPRESSO pw.x code."""

def __init__(self, outputs: dict | None = None):
def __init__(self, outputs: Union[dict, None] = None):
super().__init__(outputs=outputs, executable='pw.x')

@classmethod
Expand Down Expand Up @@ -42,7 +42,7 @@ def from_dir(cls, directory: Union[str, Path], filetype: str = 'both'):

if filetype in ['both', 'xml']:
if file.suffix == '.xml':
parser_xml = PwXMLParser.from_file(filename=file)
parser_xml = PwXMLParser.from_file(filename=file.as_posix())
parser_xml.parse()
d_out_xml = parser_xml.dict_out

Expand Down

0 comments on commit d1a64cf

Please sign in to comment.