Skip to content

Commit 758da48

Browse files
committed
feat: add context_string function for formatted context information
1 parent b0e66ca commit 758da48

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/write_standard_name_table.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ def convert_text_to_link(text_str):
6161
return link_str
6262

6363
########################################################################
64+
def context_string(context):
65+
"""Return a formatted string for context information."""
66+
if context is None:
67+
return ''
68+
return f' at {context.filename}:{context.linenum}'
69+
6470
def standard_name_to_long_name(prop_dict, context=None):
6571
"""Translate a standard_name to its default long_name
6672
>>> standard_name_to_long_name({'standard_name':'cloud_optical_depth_layers_from_0p55mu_to_0p99mu'})

0 commit comments

Comments
 (0)