Skip to content

Commit

Permalink
Merge pull request #280 from klauer/mnt_remove_evalcontextfilter
Browse files Browse the repository at this point in the history
CLN: remove evalcontextfilter usage
  • Loading branch information
klauer authored Mar 24, 2022
2 parents baddfd5 + 048fa1d commit bd25291
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
url = https://github.com/pcdshub/lcls-twincat-pmps.git
[submodule "tests/projects/lcls-plc-kfe-gmd-vac-ext-io"]
path = pytmc/tests/projects/lcls-plc-kfe-gmd-vac-ext-io
url = git://github.com/n-wbrown/lcls-plc-kfe-gmd-vac.git
url = https://github.com/n-wbrown/lcls-plc-kfe-gmd-vac.git
9 changes: 3 additions & 6 deletions pytmc/bin/stcmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,13 @@ def jinja_filters(**user_config):
'All jinja filters'
# TODO all can be cached based on object, if necessary

@jinja2.evalcontextfilter
def epics_prefix(eval_ctx, obj):
def epics_prefix(obj):
return get_name(obj, user_config)[0]

@jinja2.evalcontextfilter
def epics_suffix(eval_ctx, obj):
def epics_suffix(obj):
return get_name(obj, user_config)[1]

@jinja2.evalcontextfilter
def pragma(eval_ctx, obj, key, default=''):
def pragma(obj, key, default=''):
item_and_config = pragmas.expand_configurations_from_chain([obj])
if item_and_config:
item_to_config = dict(item_and_config[0])
Expand Down
12 changes: 4 additions & 8 deletions pytmc/bin/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,25 +254,21 @@ def get_jinja_filters(**user_config):
if 'prefix' not in user_config:
user_config['prefix'] = 'PREFIX'

@jinja2.evalcontextfilter
def epics_prefix(eval_ctx, obj):
def epics_prefix(obj):
return stcmd.get_name(obj, user_config)[0]

@jinja2.evalcontextfilter
def epics_suffix(eval_ctx, obj):
def epics_suffix(obj):
return stcmd.get_name(obj, user_config)[1]

@jinja2.evalcontextfilter
def pragma(eval_ctx, obj, key, default=''):
def pragma(obj, key, default=''):
item_and_config = pragmas.expand_configurations_from_chain([obj])
if item_and_config:
item_to_config = dict(item_and_config[0])
config = pragmas.squash_configs(*item_to_config.values())
return config.get(key, default)
return default

@jinja2.evalcontextfilter
def title_fill(eval_ctx, text, fill_char):
def title_fill(text, fill_char):
return fill_char * len(text)

return {
Expand Down

0 comments on commit bd25291

Please sign in to comment.