id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 51 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
250,600 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders._get_bottom_line_coordinates | def _get_bottom_line_coordinates(self):
"""Returns start and stop coordinates of bottom line"""
rect_x, rect_y, rect_width, rect_height = self.rect
start_point = rect_x, rect_y + rect_height
end_point = rect_x + rect_width, rect_y + rect_height
return start_point, end_point | python | def _get_bottom_line_coordinates(self):
rect_x, rect_y, rect_width, rect_height = self.rect
start_point = rect_x, rect_y + rect_height
end_point = rect_x + rect_width, rect_y + rect_height
return start_point, end_point | [
"def",
"_get_bottom_line_coordinates",
"(",
"self",
")",
":",
"rect_x",
",",
"rect_y",
",",
"rect_width",
",",
"rect_height",
"=",
"self",
".",
"rect",
"start_point",
"=",
"rect_x",
",",
"rect_y",
"+",
"rect_height",
"end_point",
"=",
"rect_x",
"+",
"rect_widt... | Returns start and stop coordinates of bottom line | [
"Returns",
"start",
"and",
"stop",
"coordinates",
"of",
"bottom",
"line"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1151-L1159 |
250,601 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders._get_bottom_line_color | def _get_bottom_line_color(self):
"""Returns color rgb tuple of bottom line"""
color = self.cell_attributes[self.key]["bordercolor_bottom"]
return tuple(c / 255.0 for c in color_pack2rgb(color)) | python | def _get_bottom_line_color(self):
color = self.cell_attributes[self.key]["bordercolor_bottom"]
return tuple(c / 255.0 for c in color_pack2rgb(color)) | [
"def",
"_get_bottom_line_color",
"(",
"self",
")",
":",
"color",
"=",
"self",
".",
"cell_attributes",
"[",
"self",
".",
"key",
"]",
"[",
"\"bordercolor_bottom\"",
"]",
"return",
"tuple",
"(",
"c",
"/",
"255.0",
"for",
"c",
"in",
"color_pack2rgb",
"(",
"col... | Returns color rgb tuple of bottom line | [
"Returns",
"color",
"rgb",
"tuple",
"of",
"bottom",
"line"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1171-L1175 |
250,602 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders._get_right_line_color | def _get_right_line_color(self):
"""Returns color rgb tuple of right line"""
color = self.cell_attributes[self.key]["bordercolor_right"]
return tuple(c / 255.0 for c in color_pack2rgb(color)) | python | def _get_right_line_color(self):
color = self.cell_attributes[self.key]["bordercolor_right"]
return tuple(c / 255.0 for c in color_pack2rgb(color)) | [
"def",
"_get_right_line_color",
"(",
"self",
")",
":",
"color",
"=",
"self",
".",
"cell_attributes",
"[",
"self",
".",
"key",
"]",
"[",
"\"bordercolor_right\"",
"]",
"return",
"tuple",
"(",
"c",
"/",
"255.0",
"for",
"c",
"in",
"color_pack2rgb",
"(",
"color... | Returns color rgb tuple of right line | [
"Returns",
"color",
"rgb",
"tuple",
"of",
"right",
"line"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1177-L1181 |
250,603 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_b | def get_b(self):
"""Returns the bottom border of the cell"""
start_point, end_point = self._get_bottom_line_coordinates()
width = self._get_bottom_line_width()
color = self._get_bottom_line_color()
return CellBorder(start_point, end_point, width, color) | python | def get_b(self):
start_point, end_point = self._get_bottom_line_coordinates()
width = self._get_bottom_line_width()
color = self._get_bottom_line_color()
return CellBorder(start_point, end_point, width, color) | [
"def",
"get_b",
"(",
"self",
")",
":",
"start_point",
",",
"end_point",
"=",
"self",
".",
"_get_bottom_line_coordinates",
"(",
")",
"width",
"=",
"self",
".",
"_get_bottom_line_width",
"(",
")",
"color",
"=",
"self",
".",
"_get_bottom_line_color",
"(",
")",
... | Returns the bottom border of the cell | [
"Returns",
"the",
"bottom",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1193-L1200 |
250,604 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_r | def get_r(self):
"""Returns the right border of the cell"""
start_point, end_point = self._get_right_line_coordinates()
width = self._get_right_line_width()
color = self._get_right_line_color()
return CellBorder(start_point, end_point, width, color) | python | def get_r(self):
start_point, end_point = self._get_right_line_coordinates()
width = self._get_right_line_width()
color = self._get_right_line_color()
return CellBorder(start_point, end_point, width, color) | [
"def",
"get_r",
"(",
"self",
")",
":",
"start_point",
",",
"end_point",
"=",
"self",
".",
"_get_right_line_coordinates",
"(",
")",
"width",
"=",
"self",
".",
"_get_right_line_width",
"(",
")",
"color",
"=",
"self",
".",
"_get_right_line_color",
"(",
")",
"re... | Returns the right border of the cell | [
"Returns",
"the",
"right",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1202-L1209 |
250,605 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_t | def get_t(self):
"""Returns the top border of the cell"""
cell_above = CellBorders(self.cell_attributes,
*self.cell.get_above_key_rect())
return cell_above.get_b() | python | def get_t(self):
cell_above = CellBorders(self.cell_attributes,
*self.cell.get_above_key_rect())
return cell_above.get_b() | [
"def",
"get_t",
"(",
"self",
")",
":",
"cell_above",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_above_key_rect",
"(",
")",
")",
"return",
"cell_above",
".",
"get_b",
"(",
")"
] | Returns the top border of the cell | [
"Returns",
"the",
"top",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1211-L1216 |
250,606 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_l | def get_l(self):
"""Returns the left border of the cell"""
cell_left = CellBorders(self.cell_attributes,
*self.cell.get_left_key_rect())
return cell_left.get_r() | python | def get_l(self):
cell_left = CellBorders(self.cell_attributes,
*self.cell.get_left_key_rect())
return cell_left.get_r() | [
"def",
"get_l",
"(",
"self",
")",
":",
"cell_left",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_left_key_rect",
"(",
")",
")",
"return",
"cell_left",
".",
"get_r",
"(",
")"
] | Returns the left border of the cell | [
"Returns",
"the",
"left",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1218-L1223 |
250,607 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_tl | def get_tl(self):
"""Returns the top left border of the cell"""
cell_above_left = CellBorders(self.cell_attributes,
*self.cell.get_above_left_key_rect())
return cell_above_left.get_r() | python | def get_tl(self):
cell_above_left = CellBorders(self.cell_attributes,
*self.cell.get_above_left_key_rect())
return cell_above_left.get_r() | [
"def",
"get_tl",
"(",
"self",
")",
":",
"cell_above_left",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_above_left_key_rect",
"(",
")",
")",
"return",
"cell_above_left",
".",
"get_r",
"(",
")"
] | Returns the top left border of the cell | [
"Returns",
"the",
"top",
"left",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1225-L1230 |
250,608 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_tr | def get_tr(self):
"""Returns the top right border of the cell"""
cell_above = CellBorders(self.cell_attributes,
*self.cell.get_above_key_rect())
return cell_above.get_r() | python | def get_tr(self):
cell_above = CellBorders(self.cell_attributes,
*self.cell.get_above_key_rect())
return cell_above.get_r() | [
"def",
"get_tr",
"(",
"self",
")",
":",
"cell_above",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_above_key_rect",
"(",
")",
")",
"return",
"cell_above",
".",
"get_r",
"(",
")"
] | Returns the top right border of the cell | [
"Returns",
"the",
"top",
"right",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1232-L1237 |
250,609 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_rt | def get_rt(self):
"""Returns the right top border of the cell"""
cell_above_right = CellBorders(self.cell_attributes,
*self.cell.get_above_right_key_rect())
return cell_above_right.get_b() | python | def get_rt(self):
cell_above_right = CellBorders(self.cell_attributes,
*self.cell.get_above_right_key_rect())
return cell_above_right.get_b() | [
"def",
"get_rt",
"(",
"self",
")",
":",
"cell_above_right",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_above_right_key_rect",
"(",
")",
")",
"return",
"cell_above_right",
".",
"get_b",
"(",
")"
] | Returns the right top border of the cell | [
"Returns",
"the",
"right",
"top",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1239-L1244 |
250,610 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_rb | def get_rb(self):
"""Returns the right bottom border of the cell"""
cell_right = CellBorders(self.cell_attributes,
*self.cell.get_right_key_rect())
return cell_right.get_b() | python | def get_rb(self):
cell_right = CellBorders(self.cell_attributes,
*self.cell.get_right_key_rect())
return cell_right.get_b() | [
"def",
"get_rb",
"(",
"self",
")",
":",
"cell_right",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_right_key_rect",
"(",
")",
")",
"return",
"cell_right",
".",
"get_b",
"(",
")"
] | Returns the right bottom border of the cell | [
"Returns",
"the",
"right",
"bottom",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1246-L1251 |
250,611 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_br | def get_br(self):
"""Returns the bottom right border of the cell"""
cell_below = CellBorders(self.cell_attributes,
*self.cell.get_below_key_rect())
return cell_below.get_r() | python | def get_br(self):
cell_below = CellBorders(self.cell_attributes,
*self.cell.get_below_key_rect())
return cell_below.get_r() | [
"def",
"get_br",
"(",
"self",
")",
":",
"cell_below",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_below_key_rect",
"(",
")",
")",
"return",
"cell_below",
".",
"get_r",
"(",
")"
] | Returns the bottom right border of the cell | [
"Returns",
"the",
"bottom",
"right",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1253-L1258 |
250,612 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_bl | def get_bl(self):
"""Returns the bottom left border of the cell"""
cell_below_left = CellBorders(self.cell_attributes,
*self.cell.get_below_left_key_rect())
return cell_below_left.get_r() | python | def get_bl(self):
cell_below_left = CellBorders(self.cell_attributes,
*self.cell.get_below_left_key_rect())
return cell_below_left.get_r() | [
"def",
"get_bl",
"(",
"self",
")",
":",
"cell_below_left",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_below_left_key_rect",
"(",
")",
")",
"return",
"cell_below_left",
".",
"get_r",
"(",
")"
] | Returns the bottom left border of the cell | [
"Returns",
"the",
"bottom",
"left",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1260-L1265 |
250,613 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_lb | def get_lb(self):
"""Returns the left bottom border of the cell"""
cell_left = CellBorders(self.cell_attributes,
*self.cell.get_left_key_rect())
return cell_left.get_b() | python | def get_lb(self):
cell_left = CellBorders(self.cell_attributes,
*self.cell.get_left_key_rect())
return cell_left.get_b() | [
"def",
"get_lb",
"(",
"self",
")",
":",
"cell_left",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_left_key_rect",
"(",
")",
")",
"return",
"cell_left",
".",
"get_b",
"(",
")"
] | Returns the left bottom border of the cell | [
"Returns",
"the",
"left",
"bottom",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1267-L1272 |
250,614 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.get_lt | def get_lt(self):
"""Returns the left top border of the cell"""
cell_above_left = CellBorders(self.cell_attributes,
*self.cell.get_above_left_key_rect())
return cell_above_left.get_b() | python | def get_lt(self):
cell_above_left = CellBorders(self.cell_attributes,
*self.cell.get_above_left_key_rect())
return cell_above_left.get_b() | [
"def",
"get_lt",
"(",
"self",
")",
":",
"cell_above_left",
"=",
"CellBorders",
"(",
"self",
".",
"cell_attributes",
",",
"*",
"self",
".",
"cell",
".",
"get_above_left_key_rect",
"(",
")",
")",
"return",
"cell_above_left",
".",
"get_b",
"(",
")"
] | Returns the left top border of the cell | [
"Returns",
"the",
"left",
"top",
"border",
"of",
"the",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1274-L1279 |
250,615 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | CellBorders.gen_all | def gen_all(self):
"""Generator of all borders"""
borderfuncs = [
self.get_b, self.get_r, self.get_t, self.get_l,
self.get_tl, self.get_tr, self.get_rt, self.get_rb,
self.get_br, self.get_bl, self.get_lb, self.get_lt,
]
for borderfunc in borderfuncs:... | python | def gen_all(self):
borderfuncs = [
self.get_b, self.get_r, self.get_t, self.get_l,
self.get_tl, self.get_tr, self.get_rt, self.get_rb,
self.get_br, self.get_bl, self.get_lb, self.get_lt,
]
for borderfunc in borderfuncs:
yield borderfunc() | [
"def",
"gen_all",
"(",
"self",
")",
":",
"borderfuncs",
"=",
"[",
"self",
".",
"get_b",
",",
"self",
".",
"get_r",
",",
"self",
".",
"get_t",
",",
"self",
".",
"get_l",
",",
"self",
".",
"get_tl",
",",
"self",
".",
"get_tr",
",",
"self",
".",
"ge... | Generator of all borders | [
"Generator",
"of",
"all",
"borders"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1281-L1291 |
250,616 | manns/pyspread | pyspread/src/lib/_grid_cairo_renderer.py | GridCellBorderCairoRenderer.draw | def draw(self):
"""Draws cell border to context"""
# Lines should have a square cap to avoid ugly edges
self.context.set_line_cap(cairo.LINE_CAP_SQUARE)
self.context.save()
self.context.rectangle(*self.rect)
self.context.clip()
cell_borders = CellBorders(self.c... | python | def draw(self):
# Lines should have a square cap to avoid ugly edges
self.context.set_line_cap(cairo.LINE_CAP_SQUARE)
self.context.save()
self.context.rectangle(*self.rect)
self.context.clip()
cell_borders = CellBorders(self.cell_attributes, self.key, self.rect)
... | [
"def",
"draw",
"(",
"self",
")",
":",
"# Lines should have a square cap to avoid ugly edges",
"self",
".",
"context",
".",
"set_line_cap",
"(",
"cairo",
".",
"LINE_CAP_SQUARE",
")",
"self",
".",
"context",
".",
"save",
"(",
")",
"self",
".",
"context",
".",
"r... | Draws cell border to context | [
"Draws",
"cell",
"border",
"to",
"context"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/_grid_cairo_renderer.py#L1316-L1332 |
250,617 | manns/pyspread | pyspread/src/gui/_grid_renderer.py | GridRenderer._draw_cursor | def _draw_cursor(self, dc, grid, row, col,
pen=None, brush=None):
"""Draws cursor as Rectangle in lower right corner"""
# If in full screen mode draw no cursor
if grid.main_window.IsFullScreen():
return
key = row, col, grid.current_table
rect = ... | python | def _draw_cursor(self, dc, grid, row, col,
pen=None, brush=None):
# If in full screen mode draw no cursor
if grid.main_window.IsFullScreen():
return
key = row, col, grid.current_table
rect = grid.CellToRect(row, col)
rect = self.get_merged_rect(g... | [
"def",
"_draw_cursor",
"(",
"self",
",",
"dc",
",",
"grid",
",",
"row",
",",
"col",
",",
"pen",
"=",
"None",
",",
"brush",
"=",
"None",
")",
":",
"# If in full screen mode draw no cursor",
"if",
"grid",
".",
"main_window",
".",
"IsFullScreen",
"(",
")",
... | Draws cursor as Rectangle in lower right corner | [
"Draws",
"cursor",
"as",
"Rectangle",
"in",
"lower",
"right",
"corner"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid_renderer.py#L91-L157 |
250,618 | manns/pyspread | pyspread/src/gui/_grid_renderer.py | GridRenderer.update_cursor | def update_cursor(self, dc, grid, row, col):
"""Whites out the old cursor and draws the new one"""
old_row, old_col = self.old_cursor_row_col
bgcolor = get_color(config["background_color"])
self._draw_cursor(dc, grid, old_row, old_col,
pen=wx.Pen(bgcolor), br... | python | def update_cursor(self, dc, grid, row, col):
old_row, old_col = self.old_cursor_row_col
bgcolor = get_color(config["background_color"])
self._draw_cursor(dc, grid, old_row, old_col,
pen=wx.Pen(bgcolor), brush=wx.Brush(bgcolor))
self._draw_cursor(dc, grid, row,... | [
"def",
"update_cursor",
"(",
"self",
",",
"dc",
",",
"grid",
",",
"row",
",",
"col",
")",
":",
"old_row",
",",
"old_col",
"=",
"self",
".",
"old_cursor_row_col",
"bgcolor",
"=",
"get_color",
"(",
"config",
"[",
"\"background_color\"",
"]",
")",
"self",
"... | Whites out the old cursor and draws the new one | [
"Whites",
"out",
"the",
"old",
"cursor",
"and",
"draws",
"the",
"new",
"one"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid_renderer.py#L159-L168 |
250,619 | manns/pyspread | pyspread/src/gui/_grid_renderer.py | GridRenderer.get_merged_rect | def get_merged_rect(self, grid, key, rect):
"""Returns cell rect for normal or merged cells and None for merged"""
row, col, tab = key
# Check if cell is merged:
cell_attributes = grid.code_array.cell_attributes
merge_area = cell_attributes[(row, col, tab)]["merge_area"]
... | python | def get_merged_rect(self, grid, key, rect):
row, col, tab = key
# Check if cell is merged:
cell_attributes = grid.code_array.cell_attributes
merge_area = cell_attributes[(row, col, tab)]["merge_area"]
if merge_area is None:
return rect
else:
# W... | [
"def",
"get_merged_rect",
"(",
"self",
",",
"grid",
",",
"key",
",",
"rect",
")",
":",
"row",
",",
"col",
",",
"tab",
"=",
"key",
"# Check if cell is merged:",
"cell_attributes",
"=",
"grid",
".",
"code_array",
".",
"cell_attributes",
"merge_area",
"=",
"cel... | Returns cell rect for normal or merged cells and None for merged | [
"Returns",
"cell",
"rect",
"for",
"normal",
"or",
"merged",
"cells",
"and",
"None",
"for",
"merged"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid_renderer.py#L175-L202 |
250,620 | manns/pyspread | pyspread/src/gui/_grid_renderer.py | GridRenderer._get_drawn_rect | def _get_drawn_rect(self, grid, key, rect):
"""Replaces drawn rect if the one provided by wx is incorrect
This handles merged rects including those that are partly off screen.
"""
rect = self.get_merged_rect(grid, key, rect)
if rect is None:
# Merged cell is drawn
... | python | def _get_drawn_rect(self, grid, key, rect):
rect = self.get_merged_rect(grid, key, rect)
if rect is None:
# Merged cell is drawn
if grid.is_merged_cell_drawn(key):
# Merging cell is outside view
row, col, __ = key = self.get_merging_cell(grid, key)... | [
"def",
"_get_drawn_rect",
"(",
"self",
",",
"grid",
",",
"key",
",",
"rect",
")",
":",
"rect",
"=",
"self",
".",
"get_merged_rect",
"(",
"grid",
",",
"key",
",",
"rect",
")",
"if",
"rect",
"is",
"None",
":",
"# Merged cell is drawn",
"if",
"grid",
".",... | Replaces drawn rect if the one provided by wx is incorrect
This handles merged rects including those that are partly off screen. | [
"Replaces",
"drawn",
"rect",
"if",
"the",
"one",
"provided",
"by",
"wx",
"is",
"incorrect"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid_renderer.py#L204-L222 |
250,621 | manns/pyspread | pyspread/src/gui/_grid_renderer.py | GridRenderer._get_draw_cache_key | def _get_draw_cache_key(self, grid, key, drawn_rect, is_selected):
"""Returns key for the screen draw cache"""
row, col, tab = key
cell_attributes = grid.code_array.cell_attributes
zoomed_width = drawn_rect.width / self.zoom
zoomed_height = drawn_rect.height / self.zoom
... | python | def _get_draw_cache_key(self, grid, key, drawn_rect, is_selected):
row, col, tab = key
cell_attributes = grid.code_array.cell_attributes
zoomed_width = drawn_rect.width / self.zoom
zoomed_height = drawn_rect.height / self.zoom
# Button cells shall not be executed for preview
... | [
"def",
"_get_draw_cache_key",
"(",
"self",
",",
"grid",
",",
"key",
",",
"drawn_rect",
",",
"is_selected",
")",
":",
"row",
",",
"col",
",",
"tab",
"=",
"key",
"cell_attributes",
"=",
"grid",
".",
"code_array",
".",
"cell_attributes",
"zoomed_width",
"=",
... | Returns key for the screen draw cache | [
"Returns",
"key",
"for",
"the",
"screen",
"draw",
"cache"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid_renderer.py#L224-L261 |
250,622 | manns/pyspread | pyspread/src/gui/_grid_renderer.py | GridRenderer._get_cairo_bmp | def _get_cairo_bmp(self, mdc, key, rect, is_selected, view_frozen):
"""Returns a wx.Bitmap of cell key in size rect"""
bmp = wx.EmptyBitmap(rect.width, rect.height)
mdc.SelectObject(bmp)
mdc.SetBackgroundMode(wx.SOLID)
mdc.SetBackground(wx.WHITE_BRUSH)
mdc.Clear()
... | python | def _get_cairo_bmp(self, mdc, key, rect, is_selected, view_frozen):
bmp = wx.EmptyBitmap(rect.width, rect.height)
mdc.SelectObject(bmp)
mdc.SetBackgroundMode(wx.SOLID)
mdc.SetBackground(wx.WHITE_BRUSH)
mdc.Clear()
mdc.SetDeviceOrigin(0, 0)
context = wx.lib.wxcair... | [
"def",
"_get_cairo_bmp",
"(",
"self",
",",
"mdc",
",",
"key",
",",
"rect",
",",
"is_selected",
",",
"view_frozen",
")",
":",
"bmp",
"=",
"wx",
".",
"EmptyBitmap",
"(",
"rect",
".",
"width",
",",
"rect",
".",
"height",
")",
"mdc",
".",
"SelectObject",
... | Returns a wx.Bitmap of cell key in size rect | [
"Returns",
"a",
"wx",
".",
"Bitmap",
"of",
"cell",
"key",
"in",
"size",
"rect"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid_renderer.py#L263-L299 |
250,623 | manns/pyspread | pyspread/src/gui/_grid_renderer.py | GridRenderer.Draw | def Draw(self, grid, attr, dc, rect, row, col, isSelected):
"""Draws the cell border and content using pycairo"""
key = row, col, grid.current_table
# If cell is merge draw the merging cell if invisibile
if grid.code_array.cell_attributes[key]["merge_area"]:
key = self.get_... | python | def Draw(self, grid, attr, dc, rect, row, col, isSelected):
key = row, col, grid.current_table
# If cell is merge draw the merging cell if invisibile
if grid.code_array.cell_attributes[key]["merge_area"]:
key = self.get_merging_cell(grid, key)
drawn_rect = self._get_drawn_r... | [
"def",
"Draw",
"(",
"self",
",",
"grid",
",",
"attr",
",",
"dc",
",",
"rect",
",",
"row",
",",
"col",
",",
"isSelected",
")",
":",
"key",
"=",
"row",
",",
"col",
",",
"grid",
".",
"current_table",
"# If cell is merge draw the merging cell if invisibile",
"... | Draws the cell border and content using pycairo | [
"Draws",
"the",
"cell",
"border",
"and",
"content",
"using",
"pycairo"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_grid_renderer.py#L301-L365 |
250,624 | manns/pyspread | pyspread/src/lib/gpg.py | choose_key | def choose_key(gpg_private_keys):
"""Displays gpg key choice and returns key"""
uid_strings_fp = []
uid_string_fp2key = {}
current_key_index = None
for i, key in enumerate(gpg_private_keys):
fingerprint = key['fingerprint']
if fingerprint == config["gpg_key_fingerprint"]:
... | python | def choose_key(gpg_private_keys):
uid_strings_fp = []
uid_string_fp2key = {}
current_key_index = None
for i, key in enumerate(gpg_private_keys):
fingerprint = key['fingerprint']
if fingerprint == config["gpg_key_fingerprint"]:
current_key_index = i
for uid_string ... | [
"def",
"choose_key",
"(",
"gpg_private_keys",
")",
":",
"uid_strings_fp",
"=",
"[",
"]",
"uid_string_fp2key",
"=",
"{",
"}",
"current_key_index",
"=",
"None",
"for",
"i",
",",
"key",
"in",
"enumerate",
"(",
"gpg_private_keys",
")",
":",
"fingerprint",
"=",
"... | Displays gpg key choice and returns key | [
"Displays",
"gpg",
"key",
"choice",
"and",
"returns",
"key"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/gpg.py#L53-L95 |
250,625 | manns/pyspread | pyspread/src/lib/gpg.py | _register_key | def _register_key(fingerprint, gpg):
"""Registers key in config"""
for private_key in gpg.list_keys(True):
try:
if str(fingerprint) == private_key['fingerprint']:
config["gpg_key_fingerprint"] = \
repr(private_key['fingerprint'])
except KeyError:
... | python | def _register_key(fingerprint, gpg):
for private_key in gpg.list_keys(True):
try:
if str(fingerprint) == private_key['fingerprint']:
config["gpg_key_fingerprint"] = \
repr(private_key['fingerprint'])
except KeyError:
pass | [
"def",
"_register_key",
"(",
"fingerprint",
",",
"gpg",
")",
":",
"for",
"private_key",
"in",
"gpg",
".",
"list_keys",
"(",
"True",
")",
":",
"try",
":",
"if",
"str",
"(",
"fingerprint",
")",
"==",
"private_key",
"[",
"'fingerprint'",
"]",
":",
"config",... | Registers key in config | [
"Registers",
"key",
"in",
"config"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/gpg.py#L98-L107 |
250,626 | manns/pyspread | pyspread/src/lib/gpg.py | has_no_password | def has_no_password(gpg_secret_keyid):
"""Returns True iif gpg_secret_key has a password"""
if gnupg is None:
return False
gpg = gnupg.GPG()
s = gpg.sign("", keyid=gpg_secret_keyid, passphrase="")
try:
return s.status == "signature created"
except AttributeError:
# Thi... | python | def has_no_password(gpg_secret_keyid):
if gnupg is None:
return False
gpg = gnupg.GPG()
s = gpg.sign("", keyid=gpg_secret_keyid, passphrase="")
try:
return s.status == "signature created"
except AttributeError:
# This may happen on Windows
if hasattr(s, "stderr"):
... | [
"def",
"has_no_password",
"(",
"gpg_secret_keyid",
")",
":",
"if",
"gnupg",
"is",
"None",
":",
"return",
"False",
"gpg",
"=",
"gnupg",
".",
"GPG",
"(",
")",
"s",
"=",
"gpg",
".",
"sign",
"(",
"\"\"",
",",
"keyid",
"=",
"gpg_secret_keyid",
",",
"passphr... | Returns True iif gpg_secret_key has a password | [
"Returns",
"True",
"iif",
"gpg_secret_key",
"has",
"a",
"password"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/gpg.py#L110-L124 |
250,627 | manns/pyspread | pyspread/src/lib/gpg.py | genkey | def genkey(key_name=None):
"""Creates a new standard GPG key
Parameters
----------
ui: Bool
\tIf True, then a new key is created when required without user interaction
"""
if gnupg is None:
return
gpg_key_param_list = [
('key_type', 'DSA'),
('key_length', '20... | python | def genkey(key_name=None):
if gnupg is None:
return
gpg_key_param_list = [
('key_type', 'DSA'),
('key_length', '2048'),
('subkey_type', 'ELG-E'),
('subkey_length', '2048'),
('expire_date', '0'),
]
gpg = gnupg.GPG()
gpg.encoding = 'utf-8'
# Chec... | [
"def",
"genkey",
"(",
"key_name",
"=",
"None",
")",
":",
"if",
"gnupg",
"is",
"None",
":",
"return",
"gpg_key_param_list",
"=",
"[",
"(",
"'key_type'",
",",
"'DSA'",
")",
",",
"(",
"'key_length'",
",",
"'2048'",
")",
",",
"(",
"'subkey_type'",
",",
"'E... | Creates a new standard GPG key
Parameters
----------
ui: Bool
\tIf True, then a new key is created when required without user interaction | [
"Creates",
"a",
"new",
"standard",
"GPG",
"key"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/gpg.py#L127-L221 |
250,628 | manns/pyspread | pyspread/src/lib/gpg.py | fingerprint2keyid | def fingerprint2keyid(fingerprint):
"""Returns keyid from fingerprint for private keys"""
if gnupg is None:
return
gpg = gnupg.GPG()
private_keys = gpg.list_keys(True)
keyid = None
for private_key in private_keys:
if private_key['fingerprint'] == config["gpg_key_fingerprint"]:... | python | def fingerprint2keyid(fingerprint):
if gnupg is None:
return
gpg = gnupg.GPG()
private_keys = gpg.list_keys(True)
keyid = None
for private_key in private_keys:
if private_key['fingerprint'] == config["gpg_key_fingerprint"]:
keyid = private_key['keyid']
break... | [
"def",
"fingerprint2keyid",
"(",
"fingerprint",
")",
":",
"if",
"gnupg",
"is",
"None",
":",
"return",
"gpg",
"=",
"gnupg",
".",
"GPG",
"(",
")",
"private_keys",
"=",
"gpg",
".",
"list_keys",
"(",
"True",
")",
"keyid",
"=",
"None",
"for",
"private_key",
... | Returns keyid from fingerprint for private keys | [
"Returns",
"keyid",
"from",
"fingerprint",
"for",
"private",
"keys"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/gpg.py#L224-L239 |
250,629 | manns/pyspread | pyspread/src/lib/gpg.py | sign | def sign(filename):
"""Returns detached signature for file"""
if gnupg is None:
return
gpg = gnupg.GPG()
with open(filename, "rb") as signfile:
keyid = fingerprint2keyid(config["gpg_key_fingerprint"])
if keyid is None:
msg = "No private key for GPG fingerprint '{}... | python | def sign(filename):
if gnupg is None:
return
gpg = gnupg.GPG()
with open(filename, "rb") as signfile:
keyid = fingerprint2keyid(config["gpg_key_fingerprint"])
if keyid is None:
msg = "No private key for GPG fingerprint '{}'."
raise ValueError(msg.format(con... | [
"def",
"sign",
"(",
"filename",
")",
":",
"if",
"gnupg",
"is",
"None",
":",
"return",
"gpg",
"=",
"gnupg",
".",
"GPG",
"(",
")",
"with",
"open",
"(",
"filename",
",",
"\"rb\"",
")",
"as",
"signfile",
":",
"keyid",
"=",
"fingerprint2keyid",
"(",
"conf... | Returns detached signature for file | [
"Returns",
"detached",
"signature",
"for",
"file"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/gpg.py#L242-L259 |
250,630 | manns/pyspread | pyspread/src/lib/gpg.py | verify | def verify(sigfilename, filefilename=None):
"""Verifies a signature, returns True if successful else False."""
if gnupg is None:
return False
gpg = gnupg.GPG()
with open(sigfilename, "rb") as sigfile:
verified = gpg.verify_file(sigfile, filefilename)
pyspread_keyid = fingerpr... | python | def verify(sigfilename, filefilename=None):
if gnupg is None:
return False
gpg = gnupg.GPG()
with open(sigfilename, "rb") as sigfile:
verified = gpg.verify_file(sigfile, filefilename)
pyspread_keyid = fingerprint2keyid(config["gpg_key_fingerprint"])
if verified.valid and ... | [
"def",
"verify",
"(",
"sigfilename",
",",
"filefilename",
"=",
"None",
")",
":",
"if",
"gnupg",
"is",
"None",
":",
"return",
"False",
"gpg",
"=",
"gnupg",
".",
"GPG",
"(",
")",
"with",
"open",
"(",
"sigfilename",
",",
"\"rb\"",
")",
"as",
"sigfile",
... | Verifies a signature, returns True if successful else False. | [
"Verifies",
"a",
"signature",
"returns",
"True",
"if",
"successful",
"else",
"False",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/lib/gpg.py#L262-L278 |
250,631 | manns/pyspread | pyspread/src/model/model.py | CellAttributes._len_table_cache | def _len_table_cache(self):
"""Returns the length of the table cache"""
length = 0
for table in self._table_cache:
length += len(self._table_cache[table])
return length | python | def _len_table_cache(self):
length = 0
for table in self._table_cache:
length += len(self._table_cache[table])
return length | [
"def",
"_len_table_cache",
"(",
"self",
")",
":",
"length",
"=",
"0",
"for",
"table",
"in",
"self",
".",
"_table_cache",
":",
"length",
"+=",
"len",
"(",
"self",
".",
"_table_cache",
"[",
"table",
"]",
")",
"return",
"length"
] | Returns the length of the table cache | [
"Returns",
"the",
"length",
"of",
"the",
"table",
"cache"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L250-L258 |
250,632 | manns/pyspread | pyspread/src/model/model.py | CellAttributes._update_table_cache | def _update_table_cache(self):
"""Clears and updates the table cache to be in sync with self"""
self._table_cache.clear()
for sel, tab, val in self:
try:
self._table_cache[tab].append((sel, val))
except KeyError:
self._table_cache[tab] = [... | python | def _update_table_cache(self):
self._table_cache.clear()
for sel, tab, val in self:
try:
self._table_cache[tab].append((sel, val))
except KeyError:
self._table_cache[tab] = [(sel, val)]
assert len(self) == self._len_table_cache() | [
"def",
"_update_table_cache",
"(",
"self",
")",
":",
"self",
".",
"_table_cache",
".",
"clear",
"(",
")",
"for",
"sel",
",",
"tab",
",",
"val",
"in",
"self",
":",
"try",
":",
"self",
".",
"_table_cache",
"[",
"tab",
"]",
".",
"append",
"(",
"(",
"s... | Clears and updates the table cache to be in sync with self | [
"Clears",
"and",
"updates",
"the",
"table",
"cache",
"to",
"be",
"in",
"sync",
"with",
"self"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L260-L270 |
250,633 | manns/pyspread | pyspread/src/model/model.py | CellAttributes.get_merging_cell | def get_merging_cell(self, key):
"""Returns key of cell that merges the cell key
or None if cell key not merged
Parameters
----------
key: 3-tuple of Integer
\tThe key of the cell that is merged
"""
row, col, tab = key
# Is cell merged
... | python | def get_merging_cell(self, key):
row, col, tab = key
# Is cell merged
merge_area = self[key]["merge_area"]
if merge_area:
return merge_area[0], merge_area[1], tab | [
"def",
"get_merging_cell",
"(",
"self",
",",
"key",
")",
":",
"row",
",",
"col",
",",
"tab",
"=",
"key",
"# Is cell merged",
"merge_area",
"=",
"self",
"[",
"key",
"]",
"[",
"\"merge_area\"",
"]",
"if",
"merge_area",
":",
"return",
"merge_area",
"[",
"0"... | Returns key of cell that merges the cell key
or None if cell key not merged
Parameters
----------
key: 3-tuple of Integer
\tThe key of the cell that is merged | [
"Returns",
"key",
"of",
"cell",
"that",
"merges",
"the",
"cell",
"key"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L272-L290 |
250,634 | manns/pyspread | pyspread/src/model/model.py | DataArray._get_data | def _get_data(self):
"""Returns dict of data content.
Keys
----
shape: 3-tuple of Integer
\tGrid shape
grid: Dict of 3-tuples to strings
\tCell content
attributes: List of 3-tuples
\tCell attributes
row_heights: Dict of 2-tuples to float
... | python | def _get_data(self):
data = {}
data["shape"] = self.shape
data["grid"] = {}.update(self.dict_grid)
data["attributes"] = [ca for ca in self.cell_attributes]
data["row_heights"] = self.row_heights
data["col_widths"] = self.col_widths
data["macros"] = self.macros
... | [
"def",
"_get_data",
"(",
"self",
")",
":",
"data",
"=",
"{",
"}",
"data",
"[",
"\"shape\"",
"]",
"=",
"self",
".",
"shape",
"data",
"[",
"\"grid\"",
"]",
"=",
"{",
"}",
".",
"update",
"(",
"self",
".",
"dict_grid",
")",
"data",
"[",
"\"attributes\"... | Returns dict of data content.
Keys
----
shape: 3-tuple of Integer
\tGrid shape
grid: Dict of 3-tuples to strings
\tCell content
attributes: List of 3-tuples
\tCell attributes
row_heights: Dict of 2-tuples to float
\t(row, tab): row_height... | [
"Returns",
"dict",
"of",
"data",
"content",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L388-L418 |
250,635 | manns/pyspread | pyspread/src/model/model.py | DataArray._set_data | def _set_data(self, **kwargs):
"""Sets data from given parameters
Old values are deleted.
If a paremeter is not given, nothing is changed.
Parameters
----------
shape: 3-tuple of Integer
\tGrid shape
grid: Dict of 3-tuples to strings
\tCell cont... | python | def _set_data(self, **kwargs):
if "shape" in kwargs:
self.shape = kwargs["shape"]
if "grid" in kwargs:
self.dict_grid.clear()
self.dict_grid.update(kwargs["grid"])
if "attributes" in kwargs:
self.attributes[:] = kwargs["attributes"]
if "... | [
"def",
"_set_data",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"\"shape\"",
"in",
"kwargs",
":",
"self",
".",
"shape",
"=",
"kwargs",
"[",
"\"shape\"",
"]",
"if",
"\"grid\"",
"in",
"kwargs",
":",
"self",
".",
"dict_grid",
".",
"clear",
"("... | Sets data from given parameters
Old values are deleted.
If a paremeter is not given, nothing is changed.
Parameters
----------
shape: 3-tuple of Integer
\tGrid shape
grid: Dict of 3-tuples to strings
\tCell content
attributes: List of 3-tuples
... | [
"Sets",
"data",
"from",
"given",
"parameters"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L420-L461 |
250,636 | manns/pyspread | pyspread/src/model/model.py | DataArray.get_row_height | def get_row_height(self, row, tab):
"""Returns row height"""
try:
return self.row_heights[(row, tab)]
except KeyError:
return config["default_row_height"] | python | def get_row_height(self, row, tab):
try:
return self.row_heights[(row, tab)]
except KeyError:
return config["default_row_height"] | [
"def",
"get_row_height",
"(",
"self",
",",
"row",
",",
"tab",
")",
":",
"try",
":",
"return",
"self",
".",
"row_heights",
"[",
"(",
"row",
",",
"tab",
")",
"]",
"except",
"KeyError",
":",
"return",
"config",
"[",
"\"default_row_height\"",
"]"
] | Returns row height | [
"Returns",
"row",
"height"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L465-L472 |
250,637 | manns/pyspread | pyspread/src/model/model.py | DataArray.get_col_width | def get_col_width(self, col, tab):
"""Returns column width"""
try:
return self.col_widths[(col, tab)]
except KeyError:
return config["default_col_width"] | python | def get_col_width(self, col, tab):
try:
return self.col_widths[(col, tab)]
except KeyError:
return config["default_col_width"] | [
"def",
"get_col_width",
"(",
"self",
",",
"col",
",",
"tab",
")",
":",
"try",
":",
"return",
"self",
".",
"col_widths",
"[",
"(",
"col",
",",
"tab",
")",
"]",
"except",
"KeyError",
":",
"return",
"config",
"[",
"\"default_col_width\"",
"]"
] | Returns column width | [
"Returns",
"column",
"width"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L474-L481 |
250,638 | manns/pyspread | pyspread/src/model/model.py | DataArray._set_shape | def _set_shape(self, shape):
"""Deletes all cells beyond new shape and sets dict_grid shape
Parameters
----------
shape: 3-tuple of Integer
\tTarget shape for grid
"""
# Delete each cell that is beyond new borders
old_shape = self.shape
deleted... | python | def _set_shape(self, shape):
# Delete each cell that is beyond new borders
old_shape = self.shape
deleted_cells = {}
if any(new_axis < old_axis
for new_axis, old_axis in zip(shape, old_shape)):
for key in self.dict_grid.keys():
if any(key_ele ... | [
"def",
"_set_shape",
"(",
"self",
",",
"shape",
")",
":",
"# Delete each cell that is beyond new borders",
"old_shape",
"=",
"self",
".",
"shape",
"deleted_cells",
"=",
"{",
"}",
"if",
"any",
"(",
"new_axis",
"<",
"old_axis",
"for",
"new_axis",
",",
"old_axis",
... | Deletes all cells beyond new shape and sets dict_grid shape
Parameters
----------
shape: 3-tuple of Integer
\tTarget shape for grid | [
"Deletes",
"all",
"cells",
"beyond",
"new",
"shape",
"and",
"sets",
"dict_grid",
"shape"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L568-L603 |
250,639 | manns/pyspread | pyspread/src/model/model.py | DataArray.get_last_filled_cell | def get_last_filled_cell(self, table=None):
"""Returns key for the bottommost rightmost cell with content
Parameters
----------
table: Integer, defaults to None
\tLimit search to this table
"""
maxrow = 0
maxcol = 0
for row, col, tab in self.di... | python | def get_last_filled_cell(self, table=None):
maxrow = 0
maxcol = 0
for row, col, tab in self.dict_grid:
if table is None or tab == table:
maxrow = max(row, maxrow)
maxcol = max(col, maxcol)
return maxrow, maxcol, table | [
"def",
"get_last_filled_cell",
"(",
"self",
",",
"table",
"=",
"None",
")",
":",
"maxrow",
"=",
"0",
"maxcol",
"=",
"0",
"for",
"row",
",",
"col",
",",
"tab",
"in",
"self",
".",
"dict_grid",
":",
"if",
"table",
"is",
"None",
"or",
"tab",
"==",
"tab... | Returns key for the bottommost rightmost cell with content
Parameters
----------
table: Integer, defaults to None
\tLimit search to this table | [
"Returns",
"key",
"for",
"the",
"bottommost",
"rightmost",
"cell",
"with",
"content"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L607-L625 |
250,640 | manns/pyspread | pyspread/src/model/model.py | DataArray.cell_array_generator | def cell_array_generator(self, key):
"""Generator traversing cells specified in key
Parameters
----------
key: Iterable of Integer or slice
\tThe key specifies the cell keys of the generator
"""
for i, key_ele in enumerate(key):
# Get first element... | python | def cell_array_generator(self, key):
for i, key_ele in enumerate(key):
# Get first element of key that is a slice
if type(key_ele) is SliceType:
slc_keys = xrange(*key_ele.indices(self.dict_grid.shape[i]))
key_list = list(key)
key_list[i]... | [
"def",
"cell_array_generator",
"(",
"self",
",",
"key",
")",
":",
"for",
"i",
",",
"key_ele",
"in",
"enumerate",
"(",
"key",
")",
":",
"# Get first element of key that is a slice",
"if",
"type",
"(",
"key_ele",
")",
"is",
"SliceType",
":",
"slc_keys",
"=",
"... | Generator traversing cells specified in key
Parameters
----------
key: Iterable of Integer or slice
\tThe key specifies the cell keys of the generator | [
"Generator",
"traversing",
"cells",
"specified",
"in",
"key"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L720-L752 |
250,641 | manns/pyspread | pyspread/src/model/model.py | DataArray._shift_rowcol | def _shift_rowcol(self, insertion_point, no_to_insert):
"""Shifts row and column sizes when a table is inserted or deleted"""
# Shift row heights
new_row_heights = {}
del_row_heights = []
for row, tab in self.row_heights:
if tab > insertion_point:
n... | python | def _shift_rowcol(self, insertion_point, no_to_insert):
# Shift row heights
new_row_heights = {}
del_row_heights = []
for row, tab in self.row_heights:
if tab > insertion_point:
new_row_heights[(row, tab + no_to_insert)] = \
self.row_heig... | [
"def",
"_shift_rowcol",
"(",
"self",
",",
"insertion_point",
",",
"no_to_insert",
")",
":",
"# Shift row heights",
"new_row_heights",
"=",
"{",
"}",
"del_row_heights",
"=",
"[",
"]",
"for",
"row",
",",
"tab",
"in",
"self",
".",
"row_heights",
":",
"if",
"tab... | Shifts row and column sizes when a table is inserted or deleted | [
"Shifts",
"row",
"and",
"column",
"sizes",
"when",
"a",
"table",
"is",
"inserted",
"or",
"deleted"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L754-L791 |
250,642 | manns/pyspread | pyspread/src/model/model.py | DataArray._get_adjusted_merge_area | def _get_adjusted_merge_area(self, attrs, insertion_point, no_to_insert,
axis):
"""Returns updated merge area
Parameters
----------
attrs: Dict
\tCell attribute dictionary that shall be adjusted
insertion_point: Integer
\tPont on ... | python | def _get_adjusted_merge_area(self, attrs, insertion_point, no_to_insert,
axis):
assert axis in range(2)
if "merge_area" not in attrs or attrs["merge_area"] is None:
return
top, left, bottom, right = attrs["merge_area"]
selection = Selection(... | [
"def",
"_get_adjusted_merge_area",
"(",
"self",
",",
"attrs",
",",
"insertion_point",
",",
"no_to_insert",
",",
"axis",
")",
":",
"assert",
"axis",
"in",
"range",
"(",
"2",
")",
"if",
"\"merge_area\"",
"not",
"in",
"attrs",
"or",
"attrs",
"[",
"\"merge_area\... | Returns updated merge area
Parameters
----------
attrs: Dict
\tCell attribute dictionary that shall be adjusted
insertion_point: Integer
\tPont on axis, before which insertion takes place
no_to_insert: Integer >= 0
\tNumber of rows/cols/tabs that shall be... | [
"Returns",
"updated",
"merge",
"area"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L822-L883 |
250,643 | manns/pyspread | pyspread/src/model/model.py | DataArray.set_row_height | def set_row_height(self, row, tab, height):
"""Sets row height"""
try:
old_height = self.row_heights.pop((row, tab))
except KeyError:
old_height = None
if height is not None:
self.row_heights[(row, tab)] = float(height) | python | def set_row_height(self, row, tab, height):
try:
old_height = self.row_heights.pop((row, tab))
except KeyError:
old_height = None
if height is not None:
self.row_heights[(row, tab)] = float(height) | [
"def",
"set_row_height",
"(",
"self",
",",
"row",
",",
"tab",
",",
"height",
")",
":",
"try",
":",
"old_height",
"=",
"self",
".",
"row_heights",
".",
"pop",
"(",
"(",
"row",
",",
"tab",
")",
")",
"except",
"KeyError",
":",
"old_height",
"=",
"None",... | Sets row height | [
"Sets",
"row",
"height"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1078-L1088 |
250,644 | manns/pyspread | pyspread/src/model/model.py | DataArray.set_col_width | def set_col_width(self, col, tab, width):
"""Sets column width"""
try:
old_width = self.col_widths.pop((col, tab))
except KeyError:
old_width = None
if width is not None:
self.col_widths[(col, tab)] = float(width) | python | def set_col_width(self, col, tab, width):
try:
old_width = self.col_widths.pop((col, tab))
except KeyError:
old_width = None
if width is not None:
self.col_widths[(col, tab)] = float(width) | [
"def",
"set_col_width",
"(",
"self",
",",
"col",
",",
"tab",
",",
"width",
")",
":",
"try",
":",
"old_width",
"=",
"self",
".",
"col_widths",
".",
"pop",
"(",
"(",
"col",
",",
"tab",
")",
")",
"except",
"KeyError",
":",
"old_width",
"=",
"None",
"i... | Sets column width | [
"Sets",
"column",
"width"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1090-L1100 |
250,645 | manns/pyspread | pyspread/src/model/model.py | CodeArray._make_nested_list | def _make_nested_list(self, gen):
"""Makes nested list from generator for creating numpy.array"""
res = []
for ele in gen:
if ele is None:
res.append(None)
elif not is_string_like(ele) and is_generator_like(ele):
# Nested generator
... | python | def _make_nested_list(self, gen):
res = []
for ele in gen:
if ele is None:
res.append(None)
elif not is_string_like(ele) and is_generator_like(ele):
# Nested generator
res.append(self._make_nested_list(ele))
else:
... | [
"def",
"_make_nested_list",
"(",
"self",
",",
"gen",
")",
":",
"res",
"=",
"[",
"]",
"for",
"ele",
"in",
"gen",
":",
"if",
"ele",
"is",
"None",
":",
"res",
".",
"append",
"(",
"None",
")",
"elif",
"not",
"is_string_like",
"(",
"ele",
")",
"and",
... | Makes nested list from generator for creating numpy.array | [
"Makes",
"nested",
"list",
"from",
"generator",
"for",
"creating",
"numpy",
".",
"array"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1174-L1190 |
250,646 | manns/pyspread | pyspread/src/model/model.py | CodeArray._get_assignment_target_end | def _get_assignment_target_end(self, ast_module):
"""Returns position of 1st char after assignment traget.
If there is no assignment, -1 is returned
If there are more than one of any ( expressions or assigments)
then a ValueError is raised.
"""
if len(ast_module.body)... | python | def _get_assignment_target_end(self, ast_module):
if len(ast_module.body) > 1:
raise ValueError("More than one expression or assignment.")
elif len(ast_module.body) > 0 and \
type(ast_module.body[0]) is ast.Assign:
if len(ast_module.body[0].targets) != 1:
... | [
"def",
"_get_assignment_target_end",
"(",
"self",
",",
"ast_module",
")",
":",
"if",
"len",
"(",
"ast_module",
".",
"body",
")",
">",
"1",
":",
"raise",
"ValueError",
"(",
"\"More than one expression or assignment.\"",
")",
"elif",
"len",
"(",
"ast_module",
".",... | Returns position of 1st char after assignment traget.
If there is no assignment, -1 is returned
If there are more than one of any ( expressions or assigments)
then a ValueError is raised. | [
"Returns",
"position",
"of",
"1st",
"char",
"after",
"assignment",
"traget",
"."
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1192-L1212 |
250,647 | manns/pyspread | pyspread/src/model/model.py | CodeArray._get_updated_environment | def _get_updated_environment(self, env_dict=None):
"""Returns globals environment with 'magic' variable
Parameters
----------
env_dict: Dict, defaults to {'S': self}
\tDict that maps global variable name to value
"""
if env_dict is None:
env_dict = ... | python | def _get_updated_environment(self, env_dict=None):
if env_dict is None:
env_dict = {'S': self}
env = globals().copy()
env.update(env_dict)
return env | [
"def",
"_get_updated_environment",
"(",
"self",
",",
"env_dict",
"=",
"None",
")",
":",
"if",
"env_dict",
"is",
"None",
":",
"env_dict",
"=",
"{",
"'S'",
":",
"self",
"}",
"env",
"=",
"globals",
"(",
")",
".",
"copy",
"(",
")",
"env",
".",
"update",
... | Returns globals environment with 'magic' variable
Parameters
----------
env_dict: Dict, defaults to {'S': self}
\tDict that maps global variable name to value | [
"Returns",
"globals",
"environment",
"with",
"magic",
"variable"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1214-L1230 |
250,648 | manns/pyspread | pyspread/src/model/model.py | CodeArray._eval_cell | def _eval_cell(self, key, code):
"""Evaluates one cell and returns its result"""
# Flatten helper function
def nn(val):
"""Returns flat numpy arraz without None values"""
try:
return numpy.array(filter(None, val.flat))
except AttributeError:
... | python | def _eval_cell(self, key, code):
# Flatten helper function
def nn(val):
"""Returns flat numpy arraz without None values"""
try:
return numpy.array(filter(None, val.flat))
except AttributeError:
# Probably no numpy array
... | [
"def",
"_eval_cell",
"(",
"self",
",",
"key",
",",
"code",
")",
":",
"# Flatten helper function",
"def",
"nn",
"(",
"val",
")",
":",
"\"\"\"Returns flat numpy arraz without None values\"\"\"",
"try",
":",
"return",
"numpy",
".",
"array",
"(",
"filter",
"(",
"Non... | Evaluates one cell and returns its result | [
"Evaluates",
"one",
"cell",
"and",
"returns",
"its",
"result"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1232-L1340 |
250,649 | manns/pyspread | pyspread/src/model/model.py | CodeArray.pop | def pop(self, key):
"""Pops dict_grid with undo and redo support
Parameters
----------
key: 3-tuple of Integer
\tCell key that shall be popped
"""
try:
self.result_cache.pop(repr(key))
except KeyError:
pass
return DataA... | python | def pop(self, key):
try:
self.result_cache.pop(repr(key))
except KeyError:
pass
return DataArray.pop(self, key) | [
"def",
"pop",
"(",
"self",
",",
"key",
")",
":",
"try",
":",
"self",
".",
"result_cache",
".",
"pop",
"(",
"repr",
"(",
"key",
")",
")",
"except",
"KeyError",
":",
"pass",
"return",
"DataArray",
".",
"pop",
"(",
"self",
",",
"key",
")"
] | Pops dict_grid with undo and redo support
Parameters
----------
key: 3-tuple of Integer
\tCell key that shall be popped | [
"Pops",
"dict_grid",
"with",
"undo",
"and",
"redo",
"support"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1342-L1358 |
250,650 | manns/pyspread | pyspread/src/model/model.py | CodeArray.reload_modules | def reload_modules(self):
"""Reloads modules that are available in cells"""
import src.lib.charts as charts
from src.gui.grid_panels import vlcpanel_factory
modules = [charts, bz2, base64, re, ast, sys, wx, numpy, datetime]
for module in modules:
reload(module) | python | def reload_modules(self):
import src.lib.charts as charts
from src.gui.grid_panels import vlcpanel_factory
modules = [charts, bz2, base64, re, ast, sys, wx, numpy, datetime]
for module in modules:
reload(module) | [
"def",
"reload_modules",
"(",
"self",
")",
":",
"import",
"src",
".",
"lib",
".",
"charts",
"as",
"charts",
"from",
"src",
".",
"gui",
".",
"grid_panels",
"import",
"vlcpanel_factory",
"modules",
"=",
"[",
"charts",
",",
"bz2",
",",
"base64",
",",
"re",
... | Reloads modules that are available in cells | [
"Reloads",
"modules",
"that",
"are",
"available",
"in",
"cells"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1360-L1368 |
250,651 | manns/pyspread | pyspread/src/model/model.py | CodeArray.clear_globals | def clear_globals(self):
"""Clears all newly assigned globals"""
base_keys = ['cStringIO', 'IntType', 'KeyValueStore', 'undoable',
'is_generator_like', 'is_string_like', 'bz2', 'base64',
'__package__', 're', 'config', '__doc__', 'SliceType',
... | python | def clear_globals(self):
base_keys = ['cStringIO', 'IntType', 'KeyValueStore', 'undoable',
'is_generator_like', 'is_string_like', 'bz2', 'base64',
'__package__', 're', 'config', '__doc__', 'SliceType',
'CellAttributes', 'product', 'ast', '__builtins... | [
"def",
"clear_globals",
"(",
"self",
")",
":",
"base_keys",
"=",
"[",
"'cStringIO'",
",",
"'IntType'",
",",
"'KeyValueStore'",
",",
"'undoable'",
",",
"'is_generator_like'",
",",
"'is_string_like'",
",",
"'bz2'",
",",
"'base64'",
",",
"'__package__'",
",",
"'re'... | Clears all newly assigned globals | [
"Clears",
"all",
"newly",
"assigned",
"globals"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1370-L1384 |
250,652 | manns/pyspread | pyspread/src/model/model.py | CodeArray.execute_macros | def execute_macros(self):
"""Executes all macros and returns result string
Executes macros only when not in safe_mode
"""
if self.safe_mode:
return '', "Safe mode activated. Code not executed."
# Windows exec does not like Windows newline
self.macros = sel... | python | def execute_macros(self):
if self.safe_mode:
return '', "Safe mode activated. Code not executed."
# Windows exec does not like Windows newline
self.macros = self.macros.replace('\r\n', '\n')
# Set up environment for evaluation
globals().update(self._get_updated_envi... | [
"def",
"execute_macros",
"(",
"self",
")",
":",
"if",
"self",
".",
"safe_mode",
":",
"return",
"''",
",",
"\"Safe mode activated. Code not executed.\"",
"# Windows exec does not like Windows newline",
"self",
".",
"macros",
"=",
"self",
".",
"macros",
".",
"replace",
... | Executes all macros and returns result string
Executes macros only when not in safe_mode | [
"Executes",
"all",
"macros",
"and",
"returns",
"result",
"string"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1391-L1459 |
250,653 | manns/pyspread | pyspread/src/model/model.py | CodeArray._sorted_keys | def _sorted_keys(self, keys, startkey, reverse=False):
"""Generator that yields sorted keys starting with startkey
Parameters
----------
keys: Iterable of tuple/list
\tKey sequence that is sorted
startkey: Tuple/list
\tFirst key to be yielded
reverse: Bo... | python | def _sorted_keys(self, keys, startkey, reverse=False):
tuple_key = lambda t: t[::-1]
if reverse:
tuple_cmp = lambda t: t[::-1] > startkey[::-1]
else:
tuple_cmp = lambda t: t[::-1] < startkey[::-1]
searchkeys = sorted(keys, key=tuple_key, reverse=reverse)
... | [
"def",
"_sorted_keys",
"(",
"self",
",",
"keys",
",",
"startkey",
",",
"reverse",
"=",
"False",
")",
":",
"tuple_key",
"=",
"lambda",
"t",
":",
"t",
"[",
":",
":",
"-",
"1",
"]",
"if",
"reverse",
":",
"tuple_cmp",
"=",
"lambda",
"t",
":",
"t",
"[... | Generator that yields sorted keys starting with startkey
Parameters
----------
keys: Iterable of tuple/list
\tKey sequence that is sorted
startkey: Tuple/list
\tFirst key to be yielded
reverse: Bool
\tSort direction reversed if True | [
"Generator",
"that",
"yields",
"sorted",
"keys",
"starting",
"with",
"startkey"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1461-L1488 |
250,654 | manns/pyspread | pyspread/src/model/model.py | CodeArray.findnextmatch | def findnextmatch(self, startkey, find_string, flags, search_result=True):
""" Returns a tuple with the position of the next match of find_string
Returns None if string not found.
Parameters:
-----------
startkey: Start position of search
find_string:String to be sear... | python | def findnextmatch(self, startkey, find_string, flags, search_result=True):
assert "UP" in flags or "DOWN" in flags
assert not ("UP" in flags and "DOWN" in flags)
if search_result:
def is_matching(key, find_string, flags):
code = self(key)
if self.stri... | [
"def",
"findnextmatch",
"(",
"self",
",",
"startkey",
",",
"find_string",
",",
"flags",
",",
"search_result",
"=",
"True",
")",
":",
"assert",
"\"UP\"",
"in",
"flags",
"or",
"\"DOWN\"",
"in",
"flags",
"assert",
"not",
"(",
"\"UP\"",
"in",
"flags",
"and",
... | Returns a tuple with the position of the next match of find_string
Returns None if string not found.
Parameters:
-----------
startkey: Start position of search
find_string:String to be searched for
flags: List of strings, out of
["UP" xor "DOW... | [
"Returns",
"a",
"tuple",
"with",
"the",
"position",
"of",
"the",
"next",
"match",
"of",
"find_string"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/model/model.py#L1532-L1577 |
250,655 | manns/pyspread | pyspread/src/gui/_dialogs.py | IntValidator.Validate | def Validate(self, win):
"""Returns True if Value in digits, False otherwise"""
val = self.GetWindow().GetValue()
for x in val:
if x not in string.digits:
return False
return True | python | def Validate(self, win):
val = self.GetWindow().GetValue()
for x in val:
if x not in string.digits:
return False
return True | [
"def",
"Validate",
"(",
"self",
",",
"win",
")",
":",
"val",
"=",
"self",
".",
"GetWindow",
"(",
")",
".",
"GetValue",
"(",
")",
"for",
"x",
"in",
"val",
":",
"if",
"x",
"not",
"in",
"string",
".",
"digits",
":",
"return",
"False",
"return",
"Tru... | Returns True if Value in digits, False otherwise | [
"Returns",
"True",
"if",
"Value",
"in",
"digits",
"False",
"otherwise"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L99-L108 |
250,656 | manns/pyspread | pyspread/src/gui/_dialogs.py | IntValidator.OnChar | def OnChar(self, event):
"""Eats event if key not in digits"""
key = event.GetKeyCode()
if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255 or \
chr(key) in string.digits:
event.Skip() | python | def OnChar(self, event):
key = event.GetKeyCode()
if key < wx.WXK_SPACE or key == wx.WXK_DELETE or key > 255 or \
chr(key) in string.digits:
event.Skip() | [
"def",
"OnChar",
"(",
"self",
",",
"event",
")",
":",
"key",
"=",
"event",
".",
"GetKeyCode",
"(",
")",
"if",
"key",
"<",
"wx",
".",
"WXK_SPACE",
"or",
"key",
"==",
"wx",
".",
"WXK_DELETE",
"or",
"key",
">",
"255",
"or",
"chr",
"(",
"key",
")",
... | Eats event if key not in digits | [
"Eats",
"event",
"if",
"key",
"not",
"in",
"digits"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L110-L117 |
250,657 | manns/pyspread | pyspread/src/gui/_dialogs.py | ChoiceRenderer.Draw | def Draw(self, grid, attr, dc, rect, row, col, is_selected):
"""Draws the text and the combobox icon"""
render = wx.RendererNative.Get()
# clear the background
dc.SetBackgroundMode(wx.SOLID)
if is_selected:
dc.SetBrush(wx.Brush(wx.BLUE, wx.SOLID))
dc.Se... | python | def Draw(self, grid, attr, dc, rect, row, col, is_selected):
render = wx.RendererNative.Get()
# clear the background
dc.SetBackgroundMode(wx.SOLID)
if is_selected:
dc.SetBrush(wx.Brush(wx.BLUE, wx.SOLID))
dc.SetPen(wx.Pen(wx.BLUE, 1, wx.SOLID))
else:
... | [
"def",
"Draw",
"(",
"self",
",",
"grid",
",",
"attr",
",",
"dc",
",",
"rect",
",",
"row",
",",
"col",
",",
"is_selected",
")",
":",
"render",
"=",
"wx",
".",
"RendererNative",
".",
"Get",
"(",
")",
"# clear the background",
"dc",
".",
"SetBackgroundMod... | Draws the text and the combobox icon | [
"Draws",
"the",
"text",
"and",
"the",
"combobox",
"icon"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L140-L167 |
250,658 | manns/pyspread | pyspread/src/gui/_dialogs.py | CsvParameterWidgets._setup_param_widgets | def _setup_param_widgets(self):
"""Creates the parameter entry widgets and binds them to methods"""
for parameter in self.csv_params:
pname, ptype, plabel, phelp = parameter
label = wx.StaticText(self.parent, -1, plabel)
widget = self.type2widget[ptype](self.parent)... | python | def _setup_param_widgets(self):
for parameter in self.csv_params:
pname, ptype, plabel, phelp = parameter
label = wx.StaticText(self.parent, -1, plabel)
widget = self.type2widget[ptype](self.parent)
# Append choicebox items and bind handler
if pname ... | [
"def",
"_setup_param_widgets",
"(",
"self",
")",
":",
"for",
"parameter",
"in",
"self",
".",
"csv_params",
":",
"pname",
",",
"ptype",
",",
"plabel",
",",
"phelp",
"=",
"parameter",
"label",
"=",
"wx",
".",
"StaticText",
"(",
"self",
".",
"parent",
",",
... | Creates the parameter entry widgets and binds them to methods | [
"Creates",
"the",
"parameter",
"entry",
"widgets",
"and",
"binds",
"them",
"to",
"methods"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L289-L326 |
250,659 | manns/pyspread | pyspread/src/gui/_dialogs.py | CsvParameterWidgets._do_layout | def _do_layout(self):
"""Sizer hell, returns a sizer that contains all widgets"""
sizer_csvoptions = wx.FlexGridSizer(5, 4, 5, 5)
# Adding parameter widgets to sizer_csvoptions
leftpos = wx.LEFT | wx.ADJUST_MINSIZE
rightpos = wx.RIGHT | wx.EXPAND
current_label_margin =... | python | def _do_layout(self):
sizer_csvoptions = wx.FlexGridSizer(5, 4, 5, 5)
# Adding parameter widgets to sizer_csvoptions
leftpos = wx.LEFT | wx.ADJUST_MINSIZE
rightpos = wx.RIGHT | wx.EXPAND
current_label_margin = 0 # smaller for left column
other_label_margin = 15
... | [
"def",
"_do_layout",
"(",
"self",
")",
":",
"sizer_csvoptions",
"=",
"wx",
".",
"FlexGridSizer",
"(",
"5",
",",
"4",
",",
"5",
",",
"5",
")",
"# Adding parameter widgets to sizer_csvoptions",
"leftpos",
"=",
"wx",
".",
"LEFT",
"|",
"wx",
".",
"ADJUST_MINSIZE... | Sizer hell, returns a sizer that contains all widgets | [
"Sizer",
"hell",
"returns",
"a",
"sizer",
"that",
"contains",
"all",
"widgets"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L328-L350 |
250,660 | manns/pyspread | pyspread/src/gui/_dialogs.py | CsvParameterWidgets._update_settings | def _update_settings(self, dialect):
"""Sets the widget settings to those of the chosen dialect"""
# the first parameter is the dialect itself --> ignore
for parameter in self.csv_params[2:]:
pname, ptype, plabel, phelp = parameter
widget = self._widget_from_p(pname, pt... | python | def _update_settings(self, dialect):
# the first parameter is the dialect itself --> ignore
for parameter in self.csv_params[2:]:
pname, ptype, plabel, phelp = parameter
widget = self._widget_from_p(pname, ptype)
if ptype is types.TupleType:
ptype = ... | [
"def",
"_update_settings",
"(",
"self",
",",
"dialect",
")",
":",
"# the first parameter is the dialect itself --> ignore",
"for",
"parameter",
"in",
"self",
".",
"csv_params",
"[",
"2",
":",
"]",
":",
"pname",
",",
"ptype",
",",
"plabel",
",",
"phelp",
"=",
"... | Sets the widget settings to those of the chosen dialect | [
"Sets",
"the",
"widget",
"settings",
"to",
"those",
"of",
"the",
"chosen",
"dialect"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L352-L371 |
250,661 | manns/pyspread | pyspread/src/gui/_dialogs.py | CsvParameterWidgets._widget_from_p | def _widget_from_p(self, pname, ptype):
"""Returns a widget from its ptype and pname"""
widget_name = self.type2widget[ptype].__name__.lower()
widget_name = "_".join([widget_name, pname])
return getattr(self, widget_name) | python | def _widget_from_p(self, pname, ptype):
widget_name = self.type2widget[ptype].__name__.lower()
widget_name = "_".join([widget_name, pname])
return getattr(self, widget_name) | [
"def",
"_widget_from_p",
"(",
"self",
",",
"pname",
",",
"ptype",
")",
":",
"widget_name",
"=",
"self",
".",
"type2widget",
"[",
"ptype",
"]",
".",
"__name__",
".",
"lower",
"(",
")",
"widget_name",
"=",
"\"_\"",
".",
"join",
"(",
"[",
"widget_name",
"... | Returns a widget from its ptype and pname | [
"Returns",
"a",
"widget",
"from",
"its",
"ptype",
"and",
"pname"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L373-L378 |
250,662 | manns/pyspread | pyspread/src/gui/_dialogs.py | CsvParameterWidgets.OnDialectChoice | def OnDialectChoice(self, event):
"""Updates all param widgets confirming to the selcted dialect"""
dialect_name = event.GetString()
value = list(self.choices['dialects']).index(dialect_name)
if dialect_name == 'sniffer':
if self.csvfilepath is None:
event.S... | python | def OnDialectChoice(self, event):
dialect_name = event.GetString()
value = list(self.choices['dialects']).index(dialect_name)
if dialect_name == 'sniffer':
if self.csvfilepath is None:
event.Skip()
return None
dialect, self.has_header = sn... | [
"def",
"OnDialectChoice",
"(",
"self",
",",
"event",
")",
":",
"dialect_name",
"=",
"event",
".",
"GetString",
"(",
")",
"value",
"=",
"list",
"(",
"self",
".",
"choices",
"[",
"'dialects'",
"]",
")",
".",
"index",
"(",
"dialect_name",
")",
"if",
"dial... | Updates all param widgets confirming to the selcted dialect | [
"Updates",
"all",
"param",
"widgets",
"confirming",
"to",
"the",
"selcted",
"dialect"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L386-L405 |
250,663 | manns/pyspread | pyspread/src/gui/_dialogs.py | CsvParameterWidgets.OnWidget | def OnWidget(self, event):
"""Update the dialect widget to 'user'"""
self.choice_dialects.SetValue(len(self.choices['dialects']) - 1)
event.Skip() | python | def OnWidget(self, event):
"""Update the dialect widget to 'user'"""
self.choice_dialects.SetValue(len(self.choices['dialects']) - 1)
event.Skip() | [
"def",
"OnWidget",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"choice_dialects",
".",
"SetValue",
"(",
"len",
"(",
"self",
".",
"choices",
"[",
"'dialects'",
"]",
")",
"-",
"1",
")",
"event",
".",
"Skip",
"(",
")"
] | Update the dialect widget to 'user | [
"Update",
"the",
"dialect",
"widget",
"to",
"user"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L407-L411 |
250,664 | manns/pyspread | pyspread/src/gui/_dialogs.py | CsvParameterWidgets.get_dialect | def get_dialect(self):
"""Returns a new dialect that implements the current selection"""
parameters = {}
for parameter in self.csv_params[2:]:
pname, ptype, plabel, phelp = parameter
widget = self._widget_from_p(pname, ptype)
if ptype is types.StringType o... | python | def get_dialect(self):
parameters = {}
for parameter in self.csv_params[2:]:
pname, ptype, plabel, phelp = parameter
widget = self._widget_from_p(pname, ptype)
if ptype is types.StringType or ptype is types.UnicodeType:
parameters[pname] = str(widge... | [
"def",
"get_dialect",
"(",
"self",
")",
":",
"parameters",
"=",
"{",
"}",
"for",
"parameter",
"in",
"self",
".",
"csv_params",
"[",
"2",
":",
"]",
":",
"pname",
",",
"ptype",
",",
"plabel",
",",
"phelp",
"=",
"parameter",
"widget",
"=",
"self",
".",
... | Returns a new dialect that implements the current selection | [
"Returns",
"a",
"new",
"dialect",
"that",
"implements",
"the",
"current",
"selection"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L413-L446 |
250,665 | manns/pyspread | pyspread/src/gui/_dialogs.py | CSVPreviewGrid.OnMouse | def OnMouse(self, event):
"""Reduces clicks to enter an edit control"""
self.SetGridCursor(event.Row, event.Col)
self.EnableCellEditControl(True)
event.Skip() | python | def OnMouse(self, event):
self.SetGridCursor(event.Row, event.Col)
self.EnableCellEditControl(True)
event.Skip() | [
"def",
"OnMouse",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"SetGridCursor",
"(",
"event",
".",
"Row",
",",
"event",
".",
"Col",
")",
"self",
".",
"EnableCellEditControl",
"(",
"True",
")",
"event",
".",
"Skip",
"(",
")"
] | Reduces clicks to enter an edit control | [
"Reduces",
"clicks",
"to",
"enter",
"an",
"edit",
"control"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L487-L492 |
250,666 | manns/pyspread | pyspread/src/gui/_dialogs.py | CSVPreviewGrid.OnGridEditorCreated | def OnGridEditorCreated(self, event):
"""Used to capture Editor close events"""
editor = event.GetControl()
editor.Bind(wx.EVT_KILL_FOCUS, self.OnGridEditorClosed)
event.Skip() | python | def OnGridEditorCreated(self, event):
editor = event.GetControl()
editor.Bind(wx.EVT_KILL_FOCUS, self.OnGridEditorClosed)
event.Skip() | [
"def",
"OnGridEditorCreated",
"(",
"self",
",",
"event",
")",
":",
"editor",
"=",
"event",
".",
"GetControl",
"(",
")",
"editor",
".",
"Bind",
"(",
"wx",
".",
"EVT_KILL_FOCUS",
",",
"self",
".",
"OnGridEditorClosed",
")",
"event",
".",
"Skip",
"(",
")"
] | Used to capture Editor close events | [
"Used",
"to",
"capture",
"Editor",
"close",
"events"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L499-L505 |
250,667 | manns/pyspread | pyspread/src/gui/_dialogs.py | CSVPreviewGrid.OnGridEditorClosed | def OnGridEditorClosed(self, event):
"""Event handler for end of output type choice"""
try:
dialect, self.has_header = \
self.parent.csvwidgets.get_dialect()
except TypeError:
event.Skip()
return 0
self.fill_cells(dialect, self.has_he... | python | def OnGridEditorClosed(self, event):
try:
dialect, self.has_header = \
self.parent.csvwidgets.get_dialect()
except TypeError:
event.Skip()
return 0
self.fill_cells(dialect, self.has_header, choices=False) | [
"def",
"OnGridEditorClosed",
"(",
"self",
",",
"event",
")",
":",
"try",
":",
"dialect",
",",
"self",
".",
"has_header",
"=",
"self",
".",
"parent",
".",
"csvwidgets",
".",
"get_dialect",
"(",
")",
"except",
"TypeError",
":",
"event",
".",
"Skip",
"(",
... | Event handler for end of output type choice | [
"Event",
"handler",
"for",
"end",
"of",
"output",
"type",
"choice"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L507-L517 |
250,668 | manns/pyspread | pyspread/src/gui/_dialogs.py | CSVPreviewGrid.get_digest_keys | def get_digest_keys(self):
"""Returns a list of the type choices"""
digest_keys = []
for col in xrange(self.GetNumberCols()):
digest_key = self.GetCellValue(self.has_header, col)
if digest_key == "":
digest_key = self.digest_types.keys()[0]
di... | python | def get_digest_keys(self):
digest_keys = []
for col in xrange(self.GetNumberCols()):
digest_key = self.GetCellValue(self.has_header, col)
if digest_key == "":
digest_key = self.digest_types.keys()[0]
digest_keys.append(digest_key)
return diges... | [
"def",
"get_digest_keys",
"(",
"self",
")",
":",
"digest_keys",
"=",
"[",
"]",
"for",
"col",
"in",
"xrange",
"(",
"self",
".",
"GetNumberCols",
"(",
")",
")",
":",
"digest_key",
"=",
"self",
".",
"GetCellValue",
"(",
"self",
".",
"has_header",
",",
"co... | Returns a list of the type choices | [
"Returns",
"a",
"list",
"of",
"the",
"type",
"choices"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L580-L590 |
250,669 | manns/pyspread | pyspread/src/gui/_dialogs.py | CsvExportDialog.OnButtonApply | def OnButtonApply(self, event):
"""Updates the preview_textctrl"""
try:
dialect, self.has_header = self.csvwidgets.get_dialect()
except TypeError:
event.Skip()
return 0
self.preview_textctrl.fill(data=self.data, dialect=dialect)
event.Skip() | python | def OnButtonApply(self, event):
try:
dialect, self.has_header = self.csvwidgets.get_dialect()
except TypeError:
event.Skip()
return 0
self.preview_textctrl.fill(data=self.data, dialect=dialect)
event.Skip() | [
"def",
"OnButtonApply",
"(",
"self",
",",
"event",
")",
":",
"try",
":",
"dialect",
",",
"self",
".",
"has_header",
"=",
"self",
".",
"csvwidgets",
".",
"get_dialect",
"(",
")",
"except",
"TypeError",
":",
"event",
".",
"Skip",
"(",
")",
"return",
"0",... | Updates the preview_textctrl | [
"Updates",
"the",
"preview_textctrl"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L785-L796 |
250,670 | manns/pyspread | pyspread/src/gui/_dialogs.py | MacroPanel._set_properties | def _set_properties(self):
"""Setup title, size and tooltips"""
self.codetext_ctrl.SetToolTipString(_("Enter python code here."))
self.apply_button.SetToolTipString(_("Apply changes to current macro"))
self.splitter.SetBackgroundStyle(wx.BG_STYLE_COLOUR)
self.result_ctrl.SetMinS... | python | def _set_properties(self):
self.codetext_ctrl.SetToolTipString(_("Enter python code here."))
self.apply_button.SetToolTipString(_("Apply changes to current macro"))
self.splitter.SetBackgroundStyle(wx.BG_STYLE_COLOUR)
self.result_ctrl.SetMinSize((10, 10)) | [
"def",
"_set_properties",
"(",
"self",
")",
":",
"self",
".",
"codetext_ctrl",
".",
"SetToolTipString",
"(",
"_",
"(",
"\"Enter python code here.\"",
")",
")",
"self",
".",
"apply_button",
".",
"SetToolTipString",
"(",
"_",
"(",
"\"Apply changes to current macro\"",... | Setup title, size and tooltips | [
"Setup",
"title",
"size",
"and",
"tooltips"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L868-L874 |
250,671 | manns/pyspread | pyspread/src/gui/_dialogs.py | MacroPanel.OnApply | def OnApply(self, event):
"""Event handler for Apply button"""
# See if we have valid python
try:
ast.parse(self.macros)
except:
# Grab the traceback and print it for the user
s = StringIO()
e = exc_info()
# usr_tb will more th... | python | def OnApply(self, event):
# See if we have valid python
try:
ast.parse(self.macros)
except:
# Grab the traceback and print it for the user
s = StringIO()
e = exc_info()
# usr_tb will more than likely be none because ast throws
... | [
"def",
"OnApply",
"(",
"self",
",",
"event",
")",
":",
"# See if we have valid python",
"try",
":",
"ast",
".",
"parse",
"(",
"self",
".",
"macros",
")",
"except",
":",
"# Grab the traceback and print it for the user",
"s",
"=",
"StringIO",
"(",
")",
"e",
"=",... | Event handler for Apply button | [
"Event",
"handler",
"for",
"Apply",
"button"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L881-L907 |
250,672 | manns/pyspread | pyspread/src/gui/_dialogs.py | MacroPanel.update_result_ctrl | def update_result_ctrl(self, event):
"""Update event result following execution by main window"""
# Check to see if macro window still exists
if not self:
return
printLen = 0
self.result_ctrl.SetValue('')
if hasattr(event, 'msg'):
# Output of scr... | python | def update_result_ctrl(self, event):
# Check to see if macro window still exists
if not self:
return
printLen = 0
self.result_ctrl.SetValue('')
if hasattr(event, 'msg'):
# Output of script (from print statements, for example)
self.result_ctrl.... | [
"def",
"update_result_ctrl",
"(",
"self",
",",
"event",
")",
":",
"# Check to see if macro window still exists",
"if",
"not",
"self",
":",
"return",
"printLen",
"=",
"0",
"self",
".",
"result_ctrl",
".",
"SetValue",
"(",
"''",
")",
"if",
"hasattr",
"(",
"event... | Update event result following execution by main window | [
"Update",
"event",
"result",
"following",
"execution",
"by",
"main",
"window"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L909-L933 |
250,673 | manns/pyspread | pyspread/src/gui/_dialogs.py | DimensionsEntryDialog._ondim | def _ondim(self, dimension, valuestring):
"""Converts valuestring to int and assigns result to self.dim
If there is an error (such as an empty valuestring) or if
the value is < 1, the value 1 is assigned to self.dim
Parameters
----------
dimension: int
\tDimens... | python | def _ondim(self, dimension, valuestring):
try:
self.dimensions[dimension] = int(valuestring)
except ValueError:
self.dimensions[dimension] = 1
self.textctrls[dimension].SetValue(str(1))
if self.dimensions[dimension] < 1:
self.dimensions[dimension]... | [
"def",
"_ondim",
"(",
"self",
",",
"dimension",
",",
"valuestring",
")",
":",
"try",
":",
"self",
".",
"dimensions",
"[",
"dimension",
"]",
"=",
"int",
"(",
"valuestring",
")",
"except",
"ValueError",
":",
"self",
".",
"dimensions",
"[",
"dimension",
"]"... | Converts valuestring to int and assigns result to self.dim
If there is an error (such as an empty valuestring) or if
the value is < 1, the value 1 is assigned to self.dim
Parameters
----------
dimension: int
\tDimension that is to be updated. Must be in [1:4]
v... | [
"Converts",
"valuestring",
"to",
"int",
"and",
"assigns",
"result",
"to",
"self",
".",
"dim"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L1001-L1025 |
250,674 | manns/pyspread | pyspread/src/gui/_dialogs.py | CellEntryDialog.OnOk | def OnOk(self, event):
"""Posts a command event that makes the grid show the entered cell"""
# Get key values from textctrls
key_strings = [self.row_textctrl.GetValue(),
self.col_textctrl.GetValue(),
self.tab_textctrl.GetValue()]
key = []
... | python | def OnOk(self, event):
# Get key values from textctrls
key_strings = [self.row_textctrl.GetValue(),
self.col_textctrl.GetValue(),
self.tab_textctrl.GetValue()]
key = []
for key_string in key_strings:
try:
key.ap... | [
"def",
"OnOk",
"(",
"self",
",",
"event",
")",
":",
"# Get key values from textctrls",
"key_strings",
"=",
"[",
"self",
".",
"row_textctrl",
".",
"GetValue",
"(",
")",
",",
"self",
".",
"col_textctrl",
".",
"GetValue",
"(",
")",
",",
"self",
".",
"tab_text... | Posts a command event that makes the grid show the entered cell | [
"Posts",
"a",
"command",
"event",
"that",
"makes",
"the",
"grid",
"show",
"the",
"entered",
"cell"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L1106-L1125 |
250,675 | manns/pyspread | pyspread/src/gui/_dialogs.py | AboutDialog._set_properties | def _set_properties(self):
"""Setup title and label"""
self.SetTitle(_("About pyspread"))
label = _("pyspread {version}\nCopyright Martin Manns")
label = label.format(version=VERSION)
self.about_label.SetLabel(label) | python | def _set_properties(self):
self.SetTitle(_("About pyspread"))
label = _("pyspread {version}\nCopyright Martin Manns")
label = label.format(version=VERSION)
self.about_label.SetLabel(label) | [
"def",
"_set_properties",
"(",
"self",
")",
":",
"self",
".",
"SetTitle",
"(",
"_",
"(",
"\"About pyspread\"",
")",
")",
"label",
"=",
"_",
"(",
"\"pyspread {version}\\nCopyright Martin Manns\"",
")",
"label",
"=",
"label",
".",
"format",
"(",
"version",
"=",
... | Setup title and label | [
"Setup",
"title",
"and",
"label"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L1163-L1171 |
250,676 | manns/pyspread | pyspread/src/gui/_dialogs.py | PasteAsDialog.get_max_dim | def get_max_dim(self, obj):
"""Returns maximum dimensionality over which obj is iterable <= 2"""
try:
iter(obj)
except TypeError:
return 0
try:
for o in obj:
iter(o)
break
except TypeError:
return... | python | def get_max_dim(self, obj):
try:
iter(obj)
except TypeError:
return 0
try:
for o in obj:
iter(o)
break
except TypeError:
return 1
return 2 | [
"def",
"get_max_dim",
"(",
"self",
",",
"obj",
")",
":",
"try",
":",
"iter",
"(",
"obj",
")",
"except",
"TypeError",
":",
"return",
"0",
"try",
":",
"for",
"o",
"in",
"obj",
":",
"iter",
"(",
"o",
")",
"break",
"except",
"TypeError",
":",
"return",... | Returns maximum dimensionality over which obj is iterable <= 2 | [
"Returns",
"maximum",
"dimensionality",
"over",
"which",
"obj",
"is",
"iterable",
"<",
"=",
"2"
] | 0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0 | https://github.com/manns/pyspread/blob/0e2fd44c2e0f06605efc3058c20a43a8c1f9e7e0/pyspread/src/gui/_dialogs.py#L1473-L1490 |
250,677 | dgraph-io/pydgraph | pydgraph/client_stub.py | DgraphClientStub.alter | def alter(self, operation, timeout=None, metadata=None, credentials=None):
"""Runs alter operation."""
return self.stub.Alter(operation, timeout=timeout, metadata=metadata,
credentials=credentials) | python | def alter(self, operation, timeout=None, metadata=None, credentials=None):
return self.stub.Alter(operation, timeout=timeout, metadata=metadata,
credentials=credentials) | [
"def",
"alter",
"(",
"self",
",",
"operation",
",",
"timeout",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"credentials",
"=",
"None",
")",
":",
"return",
"self",
".",
"stub",
".",
"Alter",
"(",
"operation",
",",
"timeout",
"=",
"timeout",
",",
"... | Runs alter operation. | [
"Runs",
"alter",
"operation",
"."
] | 0fe85f6593cb2148475750bc8555a6fdf509054b | https://github.com/dgraph-io/pydgraph/blob/0fe85f6593cb2148475750bc8555a6fdf509054b/pydgraph/client_stub.py#L43-L46 |
250,678 | dgraph-io/pydgraph | pydgraph/client_stub.py | DgraphClientStub.query | def query(self, req, timeout=None, metadata=None, credentials=None):
"""Runs query operation."""
return self.stub.Query(req, timeout=timeout, metadata=metadata,
credentials=credentials) | python | def query(self, req, timeout=None, metadata=None, credentials=None):
return self.stub.Query(req, timeout=timeout, metadata=metadata,
credentials=credentials) | [
"def",
"query",
"(",
"self",
",",
"req",
",",
"timeout",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"credentials",
"=",
"None",
")",
":",
"return",
"self",
".",
"stub",
".",
"Query",
"(",
"req",
",",
"timeout",
"=",
"timeout",
",",
"metadata",
... | Runs query operation. | [
"Runs",
"query",
"operation",
"."
] | 0fe85f6593cb2148475750bc8555a6fdf509054b | https://github.com/dgraph-io/pydgraph/blob/0fe85f6593cb2148475750bc8555a6fdf509054b/pydgraph/client_stub.py#L48-L51 |
250,679 | dgraph-io/pydgraph | pydgraph/client_stub.py | DgraphClientStub.mutate | def mutate(self, mutation, timeout=None, metadata=None, credentials=None):
"""Runs mutate operation."""
return self.stub.Mutate(mutation, timeout=timeout, metadata=metadata,
credentials=credentials) | python | def mutate(self, mutation, timeout=None, metadata=None, credentials=None):
return self.stub.Mutate(mutation, timeout=timeout, metadata=metadata,
credentials=credentials) | [
"def",
"mutate",
"(",
"self",
",",
"mutation",
",",
"timeout",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"credentials",
"=",
"None",
")",
":",
"return",
"self",
".",
"stub",
".",
"Mutate",
"(",
"mutation",
",",
"timeout",
"=",
"timeout",
",",
"... | Runs mutate operation. | [
"Runs",
"mutate",
"operation",
"."
] | 0fe85f6593cb2148475750bc8555a6fdf509054b | https://github.com/dgraph-io/pydgraph/blob/0fe85f6593cb2148475750bc8555a6fdf509054b/pydgraph/client_stub.py#L53-L56 |
250,680 | dgraph-io/pydgraph | pydgraph/client_stub.py | DgraphClientStub.commit_or_abort | def commit_or_abort(self, ctx, timeout=None, metadata=None,
credentials=None):
"""Runs commit or abort operation."""
return self.stub.CommitOrAbort(ctx, timeout=timeout, metadata=metadata,
credentials=credentials) | python | def commit_or_abort(self, ctx, timeout=None, metadata=None,
credentials=None):
return self.stub.CommitOrAbort(ctx, timeout=timeout, metadata=metadata,
credentials=credentials) | [
"def",
"commit_or_abort",
"(",
"self",
",",
"ctx",
",",
"timeout",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"credentials",
"=",
"None",
")",
":",
"return",
"self",
".",
"stub",
".",
"CommitOrAbort",
"(",
"ctx",
",",
"timeout",
"=",
"timeout",
",... | Runs commit or abort operation. | [
"Runs",
"commit",
"or",
"abort",
"operation",
"."
] | 0fe85f6593cb2148475750bc8555a6fdf509054b | https://github.com/dgraph-io/pydgraph/blob/0fe85f6593cb2148475750bc8555a6fdf509054b/pydgraph/client_stub.py#L58-L62 |
250,681 | dgraph-io/pydgraph | pydgraph/client_stub.py | DgraphClientStub.check_version | def check_version(self, check, timeout=None, metadata=None,
credentials=None):
"""Returns the version of the Dgraph instance."""
return self.stub.CheckVersion(check, timeout=timeout,
metadata=metadata,
cred... | python | def check_version(self, check, timeout=None, metadata=None,
credentials=None):
return self.stub.CheckVersion(check, timeout=timeout,
metadata=metadata,
credentials=credentials) | [
"def",
"check_version",
"(",
"self",
",",
"check",
",",
"timeout",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"credentials",
"=",
"None",
")",
":",
"return",
"self",
".",
"stub",
".",
"CheckVersion",
"(",
"check",
",",
"timeout",
"=",
"timeout",
"... | Returns the version of the Dgraph instance. | [
"Returns",
"the",
"version",
"of",
"the",
"Dgraph",
"instance",
"."
] | 0fe85f6593cb2148475750bc8555a6fdf509054b | https://github.com/dgraph-io/pydgraph/blob/0fe85f6593cb2148475750bc8555a6fdf509054b/pydgraph/client_stub.py#L64-L69 |
250,682 | dgraph-io/pydgraph | pydgraph/client.py | DgraphClient.alter | def alter(self, operation, timeout=None, metadata=None, credentials=None):
"""Runs a modification via this client."""
new_metadata = self.add_login_metadata(metadata)
try:
return self.any_client().alter(operation, timeout=timeout,
metadata=... | python | def alter(self, operation, timeout=None, metadata=None, credentials=None):
new_metadata = self.add_login_metadata(metadata)
try:
return self.any_client().alter(operation, timeout=timeout,
metadata=new_metadata,
... | [
"def",
"alter",
"(",
"self",
",",
"operation",
",",
"timeout",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"credentials",
"=",
"None",
")",
":",
"new_metadata",
"=",
"self",
".",
"add_login_metadata",
"(",
"metadata",
")",
"try",
":",
"return",
"self... | Runs a modification via this client. | [
"Runs",
"a",
"modification",
"via",
"this",
"client",
"."
] | 0fe85f6593cb2148475750bc8555a6fdf509054b | https://github.com/dgraph-io/pydgraph/blob/0fe85f6593cb2148475750bc8555a6fdf509054b/pydgraph/client.py#L71-L87 |
250,683 | dgraph-io/pydgraph | pydgraph/client.py | DgraphClient.txn | def txn(self, read_only=False, best_effort=False):
"""Creates a transaction."""
return txn.Txn(self, read_only=read_only, best_effort=best_effort) | python | def txn(self, read_only=False, best_effort=False):
return txn.Txn(self, read_only=read_only, best_effort=best_effort) | [
"def",
"txn",
"(",
"self",
",",
"read_only",
"=",
"False",
",",
"best_effort",
"=",
"False",
")",
":",
"return",
"txn",
".",
"Txn",
"(",
"self",
",",
"read_only",
"=",
"read_only",
",",
"best_effort",
"=",
"best_effort",
")"
] | Creates a transaction. | [
"Creates",
"a",
"transaction",
"."
] | 0fe85f6593cb2148475750bc8555a6fdf509054b | https://github.com/dgraph-io/pydgraph/blob/0fe85f6593cb2148475750bc8555a6fdf509054b/pydgraph/client.py#L89-L91 |
250,684 | dgraph-io/pydgraph | pydgraph/txn.py | Txn.query | def query(self, query, variables=None, timeout=None, metadata=None,
credentials=None):
"""Adds a query operation to the transaction."""
new_metadata = self._dg.add_login_metadata(metadata)
req = self._common_query(query, variables=variables)
try:
res = self._dc.... | python | def query(self, query, variables=None, timeout=None, metadata=None,
credentials=None):
new_metadata = self._dg.add_login_metadata(metadata)
req = self._common_query(query, variables=variables)
try:
res = self._dc.query(req, timeout=timeout,
... | [
"def",
"query",
"(",
"self",
",",
"query",
",",
"variables",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"credentials",
"=",
"None",
")",
":",
"new_metadata",
"=",
"self",
".",
"_dg",
".",
"add_login_metadata",
"(",
"me... | Adds a query operation to the transaction. | [
"Adds",
"a",
"query",
"operation",
"to",
"the",
"transaction",
"."
] | 0fe85f6593cb2148475750bc8555a6fdf509054b | https://github.com/dgraph-io/pydgraph/blob/0fe85f6593cb2148475750bc8555a6fdf509054b/pydgraph/txn.py#L65-L85 |
250,685 | dgraph-io/pydgraph | pydgraph/txn.py | Txn.mutate | def mutate(self, mutation=None, set_obj=None, del_obj=None, set_nquads=None,
del_nquads=None, commit_now=None, ignore_index_conflict=None,
timeout=None, metadata=None, credentials=None):
"""Adds a mutate operation to the transaction."""
mutation = self._common_mutate(
... | python | def mutate(self, mutation=None, set_obj=None, del_obj=None, set_nquads=None,
del_nquads=None, commit_now=None, ignore_index_conflict=None,
timeout=None, metadata=None, credentials=None):
mutation = self._common_mutate(
mutation=mutation, set_obj=set_obj, del_obj=del_obj... | [
"def",
"mutate",
"(",
"self",
",",
"mutation",
"=",
"None",
",",
"set_obj",
"=",
"None",
",",
"del_obj",
"=",
"None",
",",
"set_nquads",
"=",
"None",
",",
"del_nquads",
"=",
"None",
",",
"commit_now",
"=",
"None",
",",
"ignore_index_conflict",
"=",
"None... | Adds a mutate operation to the transaction. | [
"Adds",
"a",
"mutate",
"operation",
"to",
"the",
"transaction",
"."
] | 0fe85f6593cb2148475750bc8555a6fdf509054b | https://github.com/dgraph-io/pydgraph/blob/0fe85f6593cb2148475750bc8555a6fdf509054b/pydgraph/txn.py#L104-L147 |
250,686 | dgraph-io/pydgraph | pydgraph/txn.py | Txn.commit | def commit(self, timeout=None, metadata=None, credentials=None):
"""Commits the transaction."""
if not self._common_commit():
return
new_metadata = self._dg.add_login_metadata(metadata)
try:
self._dc.commit_or_abort(self._ctx, timeout=timeout,
... | python | def commit(self, timeout=None, metadata=None, credentials=None):
if not self._common_commit():
return
new_metadata = self._dg.add_login_metadata(metadata)
try:
self._dc.commit_or_abort(self._ctx, timeout=timeout,
metadata=new_metadata... | [
"def",
"commit",
"(",
"self",
",",
"timeout",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"credentials",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_common_commit",
"(",
")",
":",
"return",
"new_metadata",
"=",
"self",
".",
"_dg",
".",
"ad... | Commits the transaction. | [
"Commits",
"the",
"transaction",
"."
] | 0fe85f6593cb2148475750bc8555a6fdf509054b | https://github.com/dgraph-io/pydgraph/blob/0fe85f6593cb2148475750bc8555a6fdf509054b/pydgraph/txn.py#L188-L209 |
250,687 | dgraph-io/pydgraph | pydgraph/txn.py | Txn.discard | def discard(self, timeout=None, metadata=None, credentials=None):
"""Discards the transaction."""
if not self._common_discard():
return
new_metadata = self._dg.add_login_metadata(metadata)
try:
self._dc.commit_or_abort(self._ctx, timeout=timeout,
... | python | def discard(self, timeout=None, metadata=None, credentials=None):
if not self._common_discard():
return
new_metadata = self._dg.add_login_metadata(metadata)
try:
self._dc.commit_or_abort(self._ctx, timeout=timeout,
metadata=new_metada... | [
"def",
"discard",
"(",
"self",
",",
"timeout",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"credentials",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_common_discard",
"(",
")",
":",
"return",
"new_metadata",
"=",
"self",
".",
"_dg",
".",
"... | Discards the transaction. | [
"Discards",
"the",
"transaction",
"."
] | 0fe85f6593cb2148475750bc8555a6fdf509054b | https://github.com/dgraph-io/pydgraph/blob/0fe85f6593cb2148475750bc8555a6fdf509054b/pydgraph/txn.py#L232-L250 |
250,688 | dgraph-io/pydgraph | pydgraph/txn.py | Txn.merge_context | def merge_context(self, src=None):
"""Merges context from this instance with src."""
if src is None:
# This condition will be true only if the server doesn't return a
# txn context after a query or mutation.
return
if self._ctx.start_ts == 0:
self... | python | def merge_context(self, src=None):
if src is None:
# This condition will be true only if the server doesn't return a
# txn context after a query or mutation.
return
if self._ctx.start_ts == 0:
self._ctx.start_ts = src.start_ts
elif self._ctx.start... | [
"def",
"merge_context",
"(",
"self",
",",
"src",
"=",
"None",
")",
":",
"if",
"src",
"is",
"None",
":",
"# This condition will be true only if the server doesn't return a",
"# txn context after a query or mutation.",
"return",
"if",
"self",
".",
"_ctx",
".",
"start_ts",... | Merges context from this instance with src. | [
"Merges",
"context",
"from",
"this",
"instance",
"with",
"src",
"."
] | 0fe85f6593cb2148475750bc8555a6fdf509054b | https://github.com/dgraph-io/pydgraph/blob/0fe85f6593cb2148475750bc8555a6fdf509054b/pydgraph/txn.py#L263-L277 |
250,689 | anx-ckreuzberger/django-rest-passwordreset | django_rest_passwordreset/tokens.py | RandomStringTokenGenerator.generate_token | def generate_token(self, *args, **kwargs):
""" generates a pseudo random code using os.urandom and binascii.hexlify """
# determine the length based on min_length and max_length
length = random.randint(self.min_length, self.max_length)
# generate the token using os.urandom and hexlify
... | python | def generate_token(self, *args, **kwargs):
# determine the length based on min_length and max_length
length = random.randint(self.min_length, self.max_length)
# generate the token using os.urandom and hexlify
return binascii.hexlify(
os.urandom(self.max_length)
).dec... | [
"def",
"generate_token",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# determine the length based on min_length and max_length",
"length",
"=",
"random",
".",
"randint",
"(",
"self",
".",
"min_length",
",",
"self",
".",
"max_length",
")",
... | generates a pseudo random code using os.urandom and binascii.hexlify | [
"generates",
"a",
"pseudo",
"random",
"code",
"using",
"os",
".",
"urandom",
"and",
"binascii",
".",
"hexlify"
] | 7118d430d4b21f78a23530c88a33390c9b6a4f95 | https://github.com/anx-ckreuzberger/django-rest-passwordreset/blob/7118d430d4b21f78a23530c88a33390c9b6a4f95/django_rest_passwordreset/tokens.py#L61-L69 |
250,690 | pinax/pinax-blog | pinax/blog/parsers/creole_parser.py | HtmlEmitter.get_text | def get_text(self, node):
"""Try to emit whatever text is in the node."""
try:
return node.children[0].content or ""
except (AttributeError, IndexError):
return node.content or "" | python | def get_text(self, node):
try:
return node.children[0].content or ""
except (AttributeError, IndexError):
return node.content or "" | [
"def",
"get_text",
"(",
"self",
",",
"node",
")",
":",
"try",
":",
"return",
"node",
".",
"children",
"[",
"0",
"]",
".",
"content",
"or",
"\"\"",
"except",
"(",
"AttributeError",
",",
"IndexError",
")",
":",
"return",
"node",
".",
"content",
"or",
"... | Try to emit whatever text is in the node. | [
"Try",
"to",
"emit",
"whatever",
"text",
"is",
"in",
"the",
"node",
"."
] | be1d64946381b47d197b258a488d5de56aacccce | https://github.com/pinax/pinax-blog/blob/be1d64946381b47d197b258a488d5de56aacccce/pinax/blog/parsers/creole_parser.py#L35-L40 |
250,691 | pinax/pinax-blog | pinax/blog/parsers/creole_parser.py | HtmlEmitter.emit_children | def emit_children(self, node):
"""Emit all the children of a node."""
return "".join([self.emit_node(child) for child in node.children]) | python | def emit_children(self, node):
return "".join([self.emit_node(child) for child in node.children]) | [
"def",
"emit_children",
"(",
"self",
",",
"node",
")",
":",
"return",
"\"\"",
".",
"join",
"(",
"[",
"self",
".",
"emit_node",
"(",
"child",
")",
"for",
"child",
"in",
"node",
".",
"children",
"]",
")"
] | Emit all the children of a node. | [
"Emit",
"all",
"the",
"children",
"of",
"a",
"node",
"."
] | be1d64946381b47d197b258a488d5de56aacccce | https://github.com/pinax/pinax-blog/blob/be1d64946381b47d197b258a488d5de56aacccce/pinax/blog/parsers/creole_parser.py#L138-L140 |
250,692 | pinax/pinax-blog | pinax/blog/parsers/creole_parser.py | HtmlEmitter.emit_node | def emit_node(self, node):
"""Emit a single node."""
emit = getattr(self, "%s_emit" % node.kind, self.default_emit)
return emit(node) | python | def emit_node(self, node):
emit = getattr(self, "%s_emit" % node.kind, self.default_emit)
return emit(node) | [
"def",
"emit_node",
"(",
"self",
",",
"node",
")",
":",
"emit",
"=",
"getattr",
"(",
"self",
",",
"\"%s_emit\"",
"%",
"node",
".",
"kind",
",",
"self",
".",
"default_emit",
")",
"return",
"emit",
"(",
"node",
")"
] | Emit a single node. | [
"Emit",
"a",
"single",
"node",
"."
] | be1d64946381b47d197b258a488d5de56aacccce | https://github.com/pinax/pinax-blog/blob/be1d64946381b47d197b258a488d5de56aacccce/pinax/blog/parsers/creole_parser.py#L142-L145 |
250,693 | pinax/pinax-blog | pinax/blog/views.py | ajax_preview | def ajax_preview(request, **kwargs):
"""
Currently only supports markdown
"""
data = {
"html": render_to_string("pinax/blog/_preview.html", {
"content": parse(request.POST.get("markup"))
})
}
return JsonResponse(data) | python | def ajax_preview(request, **kwargs):
data = {
"html": render_to_string("pinax/blog/_preview.html", {
"content": parse(request.POST.get("markup"))
})
}
return JsonResponse(data) | [
"def",
"ajax_preview",
"(",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"{",
"\"html\"",
":",
"render_to_string",
"(",
"\"pinax/blog/_preview.html\"",
",",
"{",
"\"content\"",
":",
"parse",
"(",
"request",
".",
"POST",
".",
"get",
"(",
"\"ma... | Currently only supports markdown | [
"Currently",
"only",
"supports",
"markdown"
] | be1d64946381b47d197b258a488d5de56aacccce | https://github.com/pinax/pinax-blog/blob/be1d64946381b47d197b258a488d5de56aacccce/pinax/blog/views.py#L285-L294 |
250,694 | closeio/tasktiger | tasktiger/redis_semaphore.py | Semaphore.set_system_lock | def set_system_lock(cls, redis, name, timeout):
"""
Set system lock for the semaphore.
Sets a system lock that will expire in timeout seconds. This
overrides all other locks. Existing locks cannot be renewed
and no new locks will be permitted until the system lock
expire... | python | def set_system_lock(cls, redis, name, timeout):
pipeline = redis.pipeline()
pipeline.zadd(name, SYSTEM_LOCK_ID, time.time() + timeout)
pipeline.expire(name, timeout + 10) # timeout plus buffer for troubleshooting
pipeline.execute() | [
"def",
"set_system_lock",
"(",
"cls",
",",
"redis",
",",
"name",
",",
"timeout",
")",
":",
"pipeline",
"=",
"redis",
".",
"pipeline",
"(",
")",
"pipeline",
".",
"zadd",
"(",
"name",
",",
"SYSTEM_LOCK_ID",
",",
"time",
".",
"time",
"(",
")",
"+",
"tim... | Set system lock for the semaphore.
Sets a system lock that will expire in timeout seconds. This
overrides all other locks. Existing locks cannot be renewed
and no new locks will be permitted until the system lock
expires.
Arguments:
redis: Redis client
n... | [
"Set",
"system",
"lock",
"for",
"the",
"semaphore",
"."
] | 59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a | https://github.com/closeio/tasktiger/blob/59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a/tasktiger/redis_semaphore.py#L51-L69 |
250,695 | closeio/tasktiger | tasktiger/redis_semaphore.py | Semaphore.acquire | def acquire(self):
"""
Obtain a semaphore lock.
Returns: Tuple that contains True/False if the lock was acquired and number of
locks in semaphore.
"""
acquired, locks = self._semaphore(keys=[self.name],
args=[self.lock_... | python | def acquire(self):
acquired, locks = self._semaphore(keys=[self.name],
args=[self.lock_id, self.max_locks,
self.timeout, time.time()])
# Convert Lua boolean returns to Python booleans
acquired = True if ac... | [
"def",
"acquire",
"(",
"self",
")",
":",
"acquired",
",",
"locks",
"=",
"self",
".",
"_semaphore",
"(",
"keys",
"=",
"[",
"self",
".",
"name",
"]",
",",
"args",
"=",
"[",
"self",
".",
"lock_id",
",",
"self",
".",
"max_locks",
",",
"self",
".",
"t... | Obtain a semaphore lock.
Returns: Tuple that contains True/False if the lock was acquired and number of
locks in semaphore. | [
"Obtain",
"a",
"semaphore",
"lock",
"."
] | 59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a | https://github.com/closeio/tasktiger/blob/59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a/tasktiger/redis_semaphore.py#L76-L91 |
250,696 | closeio/tasktiger | tasktiger/redis_lock.py | NewStyleLock.renew | def renew(self, new_timeout):
"""
Sets a new timeout for an already acquired lock.
``new_timeout`` can be specified as an integer or a float, both
representing the number of seconds.
"""
if self.local.token is None:
raise LockError("Cannot extend an unlocked ... | python | def renew(self, new_timeout):
if self.local.token is None:
raise LockError("Cannot extend an unlocked lock")
if self.timeout is None:
raise LockError("Cannot extend a lock with no timeout")
return self.do_renew(new_timeout) | [
"def",
"renew",
"(",
"self",
",",
"new_timeout",
")",
":",
"if",
"self",
".",
"local",
".",
"token",
"is",
"None",
":",
"raise",
"LockError",
"(",
"\"Cannot extend an unlocked lock\"",
")",
"if",
"self",
".",
"timeout",
"is",
"None",
":",
"raise",
"LockErr... | Sets a new timeout for an already acquired lock.
``new_timeout`` can be specified as an integer or a float, both
representing the number of seconds. | [
"Sets",
"a",
"new",
"timeout",
"for",
"an",
"already",
"acquired",
"lock",
"."
] | 59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a | https://github.com/closeio/tasktiger/blob/59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a/tasktiger/redis_lock.py#L122-L133 |
250,697 | closeio/tasktiger | tasktiger/__init__.py | TaskTiger.task | def task(self, _fn=None, queue=None, hard_timeout=None, unique=None,
lock=None, lock_key=None, retry=None, retry_on=None,
retry_method=None, schedule=None, batch=False,
max_queue_size=None):
"""
Function decorator that defines the behavior of the function when it i... | python | def task(self, _fn=None, queue=None, hard_timeout=None, unique=None,
lock=None, lock_key=None, retry=None, retry_on=None,
retry_method=None, schedule=None, batch=False,
max_queue_size=None):
def _delay(func):
def _delay_inner(*args, **kwargs):
r... | [
"def",
"task",
"(",
"self",
",",
"_fn",
"=",
"None",
",",
"queue",
"=",
"None",
",",
"hard_timeout",
"=",
"None",
",",
"unique",
"=",
"None",
",",
"lock",
"=",
"None",
",",
"lock_key",
"=",
"None",
",",
"retry",
"=",
"None",
",",
"retry_on",
"=",
... | Function decorator that defines the behavior of the function when it is
used as a task. To use the default behavior, tasks don't need to be
decorated.
See README.rst for an explanation of the options. | [
"Function",
"decorator",
"that",
"defines",
"the",
"behavior",
"of",
"the",
"function",
"when",
"it",
"is",
"used",
"as",
"a",
"task",
".",
"To",
"use",
"the",
"default",
"behavior",
"tasks",
"don",
"t",
"need",
"to",
"be",
"decorated",
"."
] | 59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a | https://github.com/closeio/tasktiger/blob/59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a/tasktiger/__init__.py#L242-L297 |
250,698 | closeio/tasktiger | tasktiger/__init__.py | TaskTiger.run_worker | def run_worker(self, queues=None, module=None, exclude_queues=None,
max_workers_per_queue=None, store_tracebacks=None):
"""
Main worker entry point method.
The arguments are explained in the module-level run_worker() method's
click options.
"""
try:
... | python | def run_worker(self, queues=None, module=None, exclude_queues=None,
max_workers_per_queue=None, store_tracebacks=None):
try:
module_names = module or ''
for module_name in module_names.split(','):
module_name = module_name.strip()
if mod... | [
"def",
"run_worker",
"(",
"self",
",",
"queues",
"=",
"None",
",",
"module",
"=",
"None",
",",
"exclude_queues",
"=",
"None",
",",
"max_workers_per_queue",
"=",
"None",
",",
"store_tracebacks",
"=",
"None",
")",
":",
"try",
":",
"module_names",
"=",
"modul... | Main worker entry point method.
The arguments are explained in the module-level run_worker() method's
click options. | [
"Main",
"worker",
"entry",
"point",
"method",
"."
] | 59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a | https://github.com/closeio/tasktiger/blob/59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a/tasktiger/__init__.py#L306-L331 |
250,699 | closeio/tasktiger | tasktiger/__init__.py | TaskTiger.delay | def delay(self, func, args=None, kwargs=None, queue=None,
hard_timeout=None, unique=None, lock=None, lock_key=None,
when=None, retry=None, retry_on=None, retry_method=None,
max_queue_size=None):
"""
Queues a task. See README.rst for an explanation of the options... | python | def delay(self, func, args=None, kwargs=None, queue=None,
hard_timeout=None, unique=None, lock=None, lock_key=None,
when=None, retry=None, retry_on=None, retry_method=None,
max_queue_size=None):
task = Task(self, func, args=args, kwargs=kwargs, queue=queue,
... | [
"def",
"delay",
"(",
"self",
",",
"func",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
",",
"queue",
"=",
"None",
",",
"hard_timeout",
"=",
"None",
",",
"unique",
"=",
"None",
",",
"lock",
"=",
"None",
",",
"lock_key",
"=",
"None",
",",
... | Queues a task. See README.rst for an explanation of the options. | [
"Queues",
"a",
"task",
".",
"See",
"README",
".",
"rst",
"for",
"an",
"explanation",
"of",
"the",
"options",
"."
] | 59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a | https://github.com/closeio/tasktiger/blob/59f893152d6eb4b7f1f62fc4b35aeeca7f26c07a/tasktiger/__init__.py#L333-L348 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.