MCPcopy Create free account
hub / github.com/ceph/ceph / __call__

Method __call__

src/script/ptl-tool.py:1956–1971  ·  view source on GitHub ↗
(self, parser, namespace, values, option_string=None)

Source from the content-addressed store, hash-verified

1954 """
1955
1956 def __call__(self, parser, namespace, values, option_string=None):
1957 # 1. Get the list that's already stored in the namespace.
1958 # 'default=[]' in add_argument ensures this is always a list.
1959 current = getattr(namespace, self.dest)
1960
1961 # 2. Split the new value(s) by comma
1962 # Use strip() to remove any whitespace around items
1963 new_items = [item.strip() for item in values.split(',')]
1964
1965 # 3. Extend the existing list with the new items
1966 if isinstance(current, list):
1967 current.extend(new_items)
1968 elif isinstance(current, set):
1969 current.update(new_items)
1970 else:
1971 raise NotImplementedError("type not supported")
1972
1973def main():
1974 epilog_text = textwrap.dedent("""

Callers

nothing calls this directly

Calls 3

extendMethod · 0.80
splitMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected