Skip to content

Commit

Permalink
fixing deprecated pattern ruamel yaml loader
Browse files Browse the repository at this point in the history
  • Loading branch information
dinkelk committed Nov 20, 2023
1 parent 103cd6a commit 0d7ae32
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion gen/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ def _loadYaml(yaml_text):
warnings.simplefilter("ignore", yaml.error.UnsafeLoaderWarning)
# with open(self.full_filename, 'r') as stream:
try:
return yaml.load(yaml_text, Loader=yaml.RoundTripLoader)
yml = yaml.YAML(typ='rt')
return yml.load(yaml_text)
# import sys
# sys.stderr.write(str(self.data) + "\n")
# sys.stderr.write(str(type(self.data)) + "\n")
Expand Down
2 changes: 1 addition & 1 deletion gen/models/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def inner(*args, **kwargs):
# Decorator which catches a model exception and addes
# a line number if the argument of the function contains
# an attribue "lc.line" which is the line number attribute
# of a rout trip loaded yaml dictionary from ruamel.yaml
# of a round trip loaded yaml dictionary from ruamel.yaml
def throw_exception_with_lineno(func):
def inner(*args, **kwargs):
try:
Expand Down
3 changes: 2 additions & 1 deletion redo/bin/yaml_sloc_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def _loadYaml(yaml_text):
import warnings

warnings.simplefilter("ignore", yaml.error.UnsafeLoaderWarning)
return yaml.load(yaml_text, Loader=yaml.RoundTripLoader)
yml = yaml.YAML(typ='rt')
return yml.load(yaml_text)

# Open and read the yaml file:
with open(yaml_file, "r") as f:
Expand Down

0 comments on commit 0d7ae32

Please sign in to comment.