Skip to content

Commit 7b79df4

Browse files
committed
Add some type hints
1 parent 484466b commit 7b79df4

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

openmc_plotter/docks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ def updateNuclides(self):
670670
self.model.appliedNuclides = tuple(applied_nuclides)
671671

672672
if 'total' in applied_nuclides:
673-
self.model.appliedNuclides = ['total',]
673+
self.model.appliedNuclides = ('total',)
674674
for nuclide, nuclide_box in self.nuclide_map.items():
675675
if nuclide != 'total':
676676
nuclide_box.setFlags(QtCore.Qt.ItemIsUserCheckable)

openmc_plotter/plotmodel.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
from __future__ import annotations
12
from ast import literal_eval
23
from collections import defaultdict
34
import copy
45
import hashlib
56
import itertools
6-
import os
7-
from pathlib import Path
87
import pickle
98
import threading
9+
from typing import Literal, Tuple
1010

1111
from PySide6.QtWidgets import QItemDelegate, QColorDialog, QLineEdit, QMessageBox
1212
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, QSize, QEvent
@@ -60,6 +60,8 @@
6060
'Std. Dev.': 'std_dev',
6161
'Rel. Error': 'rel_err'}
6262

63+
TallyValueType = Literal['mean', 'std_dev', 'rel_err']
64+
6365

6466
def hash_file(path):
6567
# return the md5 hash of a file
@@ -386,7 +388,7 @@ def create_tally_image(self, view=None):
386388
"""
387389
Parameters
388390
----------
389-
view :
391+
view : PlotView
390392
View used to set bounds of the tally data
391393
392394
Returns
@@ -635,7 +637,10 @@ def _create_distribcell_image(self, tally, tally_value, scores, nuclides, cellin
635637

636638
return image_data, None, data_min, data_max
637639

638-
def _create_tally_mesh_image(self, tally, tally_value, scores, nuclides, view=None):
640+
def _create_tally_mesh_image(
641+
self, tally: openmc.Tally, tally_value: TallyValueType,
642+
scores: Tuple[str], nuclides: Tuple[str], view: PlotView = None
643+
):
639644
# some variables used throughout
640645
if view is None:
641646
view = self.currentView

0 commit comments

Comments
 (0)