Skip to content

Commit

Permalink
fix comment and render_elements type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed May 11, 2023
1 parent 0054358 commit 6751512
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 42 deletions.
32 changes: 0 additions & 32 deletions NOTES.txt

This file was deleted.

15 changes: 5 additions & 10 deletions src/ibek/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Functions for rendering lines in the boot script using Jinja2
"""

from typing import Callable, List, Optional
from typing import Callable, List, Optional, Union

from jinja2 import Template

Expand Down Expand Up @@ -41,14 +41,7 @@ def render_text(self, instance: Entity, text: str, once=False, suffix="") -> str
else:
return ""

# run the result through jinja again so we can refer to args for arg defaults
# e.g.
#
# - type: str
# name: IPACid
# description: IPAC identifier
# default: "IPAC{{ slot }}"

# Render Jinja entries in the text
jinja_template = Template(text)
result = jinja_template.render(instance.__context__) # type: ignore

Expand Down Expand Up @@ -165,7 +158,9 @@ def render_post_ioc_init(self, instance: Entity) -> Optional[str]:

return script

def render_elements(self, ioc: IOC, method: Callable) -> str:
def render_elements(
self, ioc: IOC, method: Callable[[Entity], Union[str, None]]
) -> str:
"""
Render elements of a given IOC instance based on calling the correct method
"""
Expand Down

0 comments on commit 6751512

Please sign in to comment.