MCPcopy Index your code
hub / github.com/python/cpython / uncomment_region_event

Method uncomment_region_event

Lib/idlelib/format.py:300–317  ·  view source on GitHub ↗

Uncomment each line in region. Remove ## or # in the first positions of a line. If the comment is not in the beginning position, this command will have no effect.

(self, event=None)

Source from the content-addressed store, hash-verified

298 return "break"
299
300 def uncomment_region_event(self, event=None):
301 """Uncomment each line in region.
302
303 Remove ## or # in the first positions of a line. If the comment
304 is not in the beginning position, this command will have no effect.
305 """
306 head, tail, chars, lines = self.get_region()
307 for pos in range(len(lines)):
308 line = lines[pos]
309 if not line:
310 continue
311 if line[:2] == '##':
312 line = line[2:]
313 elif line[:1] == '#':
314 line = line[1:]
315 lines[pos] = line
316 self.set_region(head, tail, chars, lines)
317 return "break"
318
319 def tabify_region_event(self, event=None):
320 "Convert leading spaces to tabs for each line in selected region."

Callers

nothing calls this directly

Calls 2

get_regionMethod · 0.95
set_regionMethod · 0.95

Tested by

no test coverage detected