Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions 21 Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -1709,7 +1709,7 @@ def _signature_get_partial(wrapped_sig, partial, extra_args=()):
"""

old_params = wrapped_sig.parameters
new_params = OrderedDict(old_params.items())
new_params = dict(old_params.items())

partial_args = partial.args or ()
partial_keywords = partial.keywords or {}
Expand Down Expand Up @@ -1768,10 +1768,10 @@ def _signature_get_partial(wrapped_sig, partial, extra_args=()):

if param.kind is _POSITIONAL_OR_KEYWORD:
new_param = new_params[param_name].replace(kind=_KEYWORD_ONLY)
del new_params[param_name]
new_params[param_name] = new_param
new_params.move_to_end(param_name)
elif param.kind in (_KEYWORD_ONLY, _VAR_KEYWORD):
new_params.move_to_end(param_name)
new_params[param_name] = new_params.pop(param_name) # move `param_name` to an end
elif param.kind is _VAR_POSITIONAL:
new_params.pop(param.name)

Expand Down Expand Up @@ -2560,7 +2560,7 @@ class BoundArguments:

Has the following public attributes:

* arguments : OrderedDict
* arguments : dict
An ordered mutable mapping of parameters' names to arguments' values.
Does not contain arguments' default values.
* signature : Signature
Expand Down Expand Up @@ -2660,7 +2660,7 @@ def apply_defaults(self):
# Signature.bind_partial().
continue
new_arguments.append((name, val))
self.arguments = OrderedDict(new_arguments)
self.arguments = dict(new_arguments)

def __eq__(self, other):
if self is other:
Expand Down Expand Up @@ -2691,7 +2691,7 @@ class Signature:

A Signature object has the following public attributes and methods:

* parameters : OrderedDict
* parameters : dict
An ordered mapping of parameters' names to the corresponding
Parameter objects (keyword-only arguments are in the same order
as listed in `code.co_varnames`).
Expand Down Expand Up @@ -2721,10 +2721,10 @@ def __init__(self, parameters=None, *, return_annotation=_empty,
"""

if parameters is None:
params = OrderedDict()
params = {}
else:
if __validate_parameters__:
params = OrderedDict()
params = {}
top_kind = _POSITIONAL_ONLY
kind_defaults = False

Expand Down Expand Up @@ -2759,8 +2759,7 @@ def __init__(self, parameters=None, *, return_annotation=_empty,

params[name] = param
else:
params = OrderedDict(((param.name, param)
for param in parameters))
params = {param.name: param for param in parameters}

self._parameters = types.MappingProxyType(params)
self._return_annotation = return_annotation
Expand Down Expand Up @@ -2836,7 +2835,7 @@ def __eq__(self, other):
def _bind(self, args, kwargs, *, partial=False):
"""Private method. Don't use directly."""

arguments = OrderedDict()
arguments = {}

parameters = iter(self.parameters.values())
parameters_ex = ()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove imports of OrderedDict in the module `inspect`
Morty Proxy This is a proxified and sanitized view of the page, visit original site.