Example #1
0
    def signature(self, node, add_space=False):
        write_comma = CommaWriter(self.write, add_space_at_beginning=add_space)
        padding = [None] * (len(node.args) - len(node.defaults))

        for arg, default in zip(node.args, padding + node.defaults):
            self.signature_arg(arg, default, write_comma)

        self.signature_spec_arg(node, 'vararg', write_comma, prefix='*')
        self.signature_kwonlyargs(node, write_comma)
        self.signature_spec_arg(node, 'kwarg', write_comma, prefix='**')
Example #2
0
 def call_signature(self, args, keywords, starargs, kwargs):
     write_comma = CommaWriter(self.write)
     self.call_signature_part(args, self.call_arg, write_comma)
     self.call_signature_part(keywords, self.call_keyword, write_comma)
     self.call_signature_part(starargs, self.call_starargs, write_comma)
     self.call_signature_part(kwargs, self.call_kwarg, write_comma)
Example #3
0
 def visit_Import(self, node):
     write_comma = CommaWriter(self.write)
     self.write('import ')
     for item in node.names:
         write_comma()
         self.visit(item)