MCPcopy Create free account
hub / github.com/datacamp/pythonwhat / get_call_part

Method get_call_part

pythonwhat/parsing.py:367–383  ·  view source on GitHub ↗
(self, node)

Source from the content-addressed store, hash-verified

365 self.raw_name = node.id
366
367 def get_call_part(self, node):
368 args = [self.get_pos_arg_part(n, ii) for ii, n in enumerate(node.args)]
369 keywords = [self.get_kw_arg_part(n) for n in node.keywords]
370 return {
371 "node": node,
372 # TODO: right now, args and keywords can be indexed by pos or name.
373 # Note that a pos args name is its position.
374 # Problems will arise if SCT tests a position, but the submission
375 # has too few positional arguments, since it will then grab a kw arg :(
376 # This is not necessarily a bad thing, but instructors would need to be
377 # Careful deciding when to test a pos arg, and when to test using kw.
378 # Could use check_pos_args with pos_args entry below to solve.
379 "args": IndexedDict((n["name"], n) for n in [*args, *keywords]),
380 #'pos_args': args,
381 #'keywords': keywords,
382 "name": self.raw_name,
383 }
384
385 @staticmethod
386 def get_pos_arg_part(arg, indx_pos):

Callers 1

visit_CallMethod · 0.95

Calls 3

get_pos_arg_partMethod · 0.95
get_kw_arg_partMethod · 0.95
IndexedDictClass · 0.85

Tested by

no test coverage detected