Skip to content

Commit 50609b2

Browse files
committed
Fix pycharm type hinting
1 parent c86ea61 commit 50609b2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

generator-templates/model.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import re # noqa: F401
88
import six
99

1010
from {{packageName}}.configuration import Configuration
11+
# this line was added to enable pycharm type hinting
12+
from {{packageName}}.models import *
1113

1214

1315
{{#models}}

regula/documentreader/webclient/ext/models/text.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Optional
1+
from typing import Optional, List
22

33
from regula.documentreader.webclient.ext.models.text_field import TextField
44
from regula.documentreader.webclient.gen.models.text import Text as GenText
@@ -17,3 +17,14 @@ def get_field_value(self, field_type: int, lcid=0) -> Optional[str]:
1717
if field:
1818
return "todo"
1919
return None
20+
21+
@property
22+
def field_list(self) -> List[TextField]:
23+
# fix type hinting
24+
return super().field_list
25+
26+
@field_list.setter
27+
def field_list(self, field_list: List[TextField]):
28+
if self.local_vars_configuration.client_side_validation and field_list is None:
29+
raise ValueError("Invalid value for `field_list`, must not be `None`")
30+
self._field_list = field_list

0 commit comments

Comments
 (0)