MCPcopy
hub / github.com/pydantic/pydantic / get_argument_name

Method get_argument_name

pydantic/json_schema.py:1953–1969  ·  view source on GitHub ↗

Retrieves the name of an argument. Args: argument: The core schema. Returns: The name of the argument.

(self, argument: core_schema.ArgumentsParameter | core_schema.ArgumentsV3Parameter)

Source from the content-addressed store, hash-verified

1951 return json_schema
1952
1953 def get_argument_name(self, argument: core_schema.ArgumentsParameter | core_schema.ArgumentsV3Parameter) -> str:
1954 """Retrieves the name of an argument.
1955
1956 Args:
1957 argument: The core schema.
1958
1959 Returns:
1960 The name of the argument.
1961 """
1962 name = argument['name']
1963 if self.by_alias:
1964 alias = argument.get('alias')
1965 if isinstance(alias, str):
1966 name = alias
1967 else:
1968 pass # might want to do something else?
1969 return name
1970
1971 def arguments_v3_schema(self, schema: core_schema.ArgumentsV3Schema) -> JsonSchemaValue:
1972 """Generates a JSON schema that matches a schema that defines a function's arguments.

Callers 3

kw_arguments_schemaMethod · 0.95
p_arguments_schemaMethod · 0.95
arguments_v3_schemaMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected