Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
e-kwsm committed Dec 20, 2023
1 parent b08b4b3 commit 0130215
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/yaml/constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ def construct_pairs(self, node, deep=False):

@classmethod
def add_constructor(cls, tag, constructor):
if not 'yaml_constructors' in cls.__dict__:
if 'yaml_constructors' not in cls.__dict__:
cls.yaml_constructors = cls.yaml_constructors.copy()
cls.yaml_constructors[tag] = constructor

@classmethod
def add_multi_constructor(cls, tag_prefix, multi_constructor):
if not 'yaml_multi_constructors' in cls.__dict__:
if 'yaml_multi_constructors' not in cls.__dict__:
cls.yaml_multi_constructors = cls.yaml_multi_constructors.copy()
cls.yaml_multi_constructors[tag_prefix] = multi_constructor

Expand Down
4 changes: 2 additions & 2 deletions lib/yaml/representer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ def represent_data(self, data):

@classmethod
def add_representer(cls, data_type, representer):
if not 'yaml_representers' in cls.__dict__:
if 'yaml_representers' not in cls.__dict__:
cls.yaml_representers = cls.yaml_representers.copy()
cls.yaml_representers[data_type] = representer

@classmethod
def add_multi_representer(cls, data_type, representer):
if not 'yaml_multi_representers' in cls.__dict__:
if 'yaml_multi_representers' not in cls.__dict__:
cls.yaml_multi_representers = cls.yaml_multi_representers.copy()
cls.yaml_multi_representers[data_type] = representer

Expand Down
4 changes: 2 additions & 2 deletions lib/yaml/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self):

@classmethod
def add_implicit_resolver(cls, tag, regexp, first):
if not 'yaml_implicit_resolvers' in cls.__dict__:
if 'yaml_implicit_resolvers' not in cls.__dict__:
implicit_resolvers = {}
for key in cls.yaml_implicit_resolvers:
implicit_resolvers[key] = cls.yaml_implicit_resolvers[key][:]
Expand All @@ -48,7 +48,7 @@ def add_path_resolver(cls, tag, path, kind=None):
# a mapping value that corresponds to a scalar key which content is
# equal to the `index_check` value. An integer `index_check` matches
# against a sequence value with the index equal to `index_check`.
if not 'yaml_path_resolvers' in cls.__dict__:
if 'yaml_path_resolvers' not in cls.__dict__:
cls.yaml_path_resolvers = cls.yaml_path_resolvers.copy()
new_path = []
for element in path:
Expand Down

0 comments on commit 0130215

Please sign in to comment.