_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q231600
kappa_analysis_cicchetti
train
def kappa_analysis_cicchetti(kappa): """ Analysis kappa number with Cicchetti benchmark. :param kappa: kappa number :type kappa : float :return: strength of agreement as str """ try: if kappa < 0.4: return "Poor" if kappa >= 0.4 and kappa < 0.59: retu...
python
{ "resource": "" }
q231601
kappa_analysis_koch
train
def kappa_analysis_koch(kappa): """ Analysis kappa number with Landis-Koch benchmark. :param kappa: kappa number :type kappa : float :return: strength of agreement as str """ try: if kappa < 0: return "Poor" if kappa >= 0 and kappa < 0.2: return "Slig...
python
{ "resource": "" }
q231602
kappa_analysis_altman
train
def kappa_analysis_altman(kappa): """ Analysis kappa number with Altman benchmark. :param kappa: kappa number :type kappa : float :return: strength of agreement as str """ try: if kappa < 0.2: return "Poor" if kappa >= 0.20 and kappa < 0.4: return "Fa...
python
{ "resource": "" }
q231603
get_requires
train
def get_requires(): """Read requirements.txt.""" requirements = open("requirements.txt", "r").read() return list(filter(lambda x: x != "", requirements.split()))
python
{ "resource": "" }
q231604
read_description
train
def read_description(): """Read README.md and CHANGELOG.md.""" try: with open("README.md") as r: description = "\n" description += r.read() with open("CHANGELOG.md") as c: description += "\n" description += c.read() return description e...
python
{ "resource": "" }
q231605
ConfusionMatrix.print_matrix
train
def print_matrix(self, one_vs_all=False, class_name=None): """ Print confusion matrix. :param one_vs_all : One-Vs-All mode flag :type one_vs_all : bool :param class_name : target class name for One-Vs-All mode :type class_name : any valid type :return: None ...
python
{ "resource": "" }
q231606
ConfusionMatrix.stat
train
def stat(self, overall_param=None, class_param=None, class_name=None): """ Print statistical measures table. :param overall_param : overall parameters list for print, Example : ["Kappa","Scott PI] :type overall_param : list :param class_param : class parameters list for print, E...
python
{ "resource": "" }
q231607
ConfusionMatrix.save_html
train
def save_html( self, name, address=True, overall_param=None, class_param=None, class_name=None, color=(0, 0, 0), normalize=False): """ Save ConfusionMatrix in HTML file. :param name: filename :type name : str ...
python
{ "resource": "" }
q231608
ConfusionMatrix.save_csv
train
def save_csv( self, name, address=True, class_param=None, class_name=None, matrix_save=True, normalize=False): """ Save ConfusionMatrix in CSV file. :param name: filename :type name : str :param ...
python
{ "resource": "" }
q231609
ConfusionMatrix.save_obj
train
def save_obj(self, name, address=True): """ Save ConfusionMatrix in .obj file. :param name: filename :type name : str :param address: flag for address return :type address : bool :return: saving Status as dict {"Status":bool , "Message":str} """ t...
python
{ "resource": "" }
q231610
ConfusionMatrix.F_beta
train
def F_beta(self, beta): """ Calculate FBeta score. :param beta: beta parameter :type beta : float :return: FBeta score for classes as dict """ try: F_dict = {} for i in self.TP.keys(): F_dict[i] = F_calc( ...
python
{ "resource": "" }
q231611
ConfusionMatrix.IBA_alpha
train
def IBA_alpha(self, alpha): """ Calculate IBA_alpha score. :param alpha: alpha parameter :type alpha: float :return: IBA_alpha score for classes as dict """ try: IBA_dict = {} for i in self.classes: IBA_dict[i] = IBA_calc(s...
python
{ "resource": "" }
q231612
ConfusionMatrix.relabel
train
def relabel(self, mapping): """ Rename ConfusionMatrix classes. :param mapping: mapping dictionary :type mapping : dict :return: None """ if not isinstance(mapping, dict): raise pycmMatrixError(MAPPING_FORMAT_ERROR) if self.classes != list(map...
python
{ "resource": "" }
q231613
ToolbarBase.add_tools
train
def add_tools(self): """Adds tools from self.toolbardata to self""" for data in self.toolbardata: # tool type is in data[0] if data[0] == "T": # Simple tool _, msg_type, label, tool_tip = data icon = icons[label] ...
python
{ "resource": "" }
q231614
ToolbarBase.OnTool
train
def OnTool(self, event): """Toolbar event handler""" msgtype = self.ids_msgs[event.GetId()] post_command_event(self, msgtype)
python
{ "resource": "" }
q231615
MainToolbar.OnToggleTool
train
def OnToggleTool(self, event): """Tool event handler""" config["check_spelling"] = str(event.IsChecked()) toggle_id = self.parent.menubar.FindMenuItem(_("View"), _("Check spelling")) if toggle_id != -1: # Check may fail if...
python
{ "resource": "" }
q231616
WidgetToolbar._get_button_label
train
def _get_button_label(self): """Gets Button label from user and returns string""" dlg = wx.TextEntryDialog(self, _('Button label:')) if dlg.ShowModal() == wx.ID_OK: label = dlg.GetValue() else: label = "" dlg.Destroy() return label
python
{ "resource": "" }
q231617
WidgetToolbar.OnButtonCell
train
def OnButtonCell(self, event): """Event handler for cell button toggle button""" if self.button_cell_button_id == event.GetId(): if event.IsChecked(): label = self._get_button_label() post_command_event(self, self.ButtonCellMsg, text=label) else: ...
python
{ "resource": "" }
q231618
WidgetToolbar.OnVideoCell
train
def OnVideoCell(self, event): """Event handler for video cell toggle button""" if self.video_cell_button_id == event.GetId(): if event.IsChecked(): wildcard = _("Media files") + " (*.*)|*.*" videofile, __ = self.get_filepath_findex_from_user( ...
python
{ "resource": "" }
q231619
FindToolbar.make_menu
train
def make_menu(self): """Creates the search menu""" menu = wx.Menu() item = menu.Append(-1, "Recent Searches") item.Enable(False) for __id, txt in enumerate(self.search_history): menu.Append(__id, txt) return menu
python
{ "resource": "" }
q231620
FindToolbar.OnMenu
train
def OnMenu(self, event): """Search history has been selected""" __id = event.GetId() try: menuitem = event.GetEventObject().FindItemById(__id) selected_text = menuitem.GetItemLabel() self.search.SetValue(selected_text) except AttributeError: ...
python
{ "resource": "" }
q231621
FindToolbar.OnSearch
train
def OnSearch(self, event): """Event handler for starting the search""" search_string = self.search.GetValue() if search_string not in self.search_history: self.search_history.append(search_string) if len(self.search_history) > 10: self.search_history.pop(0) ...
python
{ "resource": "" }
q231622
FindToolbar.OnSearchDirectionButton
train
def OnSearchDirectionButton(self, event): """Event handler for search direction toggle button""" if "DOWN" in self.search_options: flag_index = self.search_options.index("DOWN") self.search_options[flag_index] = "UP" elif "UP" in self.search_options: flag_ind...
python
{ "resource": "" }
q231623
FindToolbar.OnSearchFlag
train
def OnSearchFlag(self, event): """Event handler for search flag toggle buttons""" for label in self.search_options_buttons: button_id = self.label2id[label] if button_id == event.GetId(): if event.IsChecked(): self.search_options.append(label)...
python
{ "resource": "" }
q231624
AttributesToolbar._create_font_choice_combo
train
def _create_font_choice_combo(self): """Creates font choice combo box""" self.fonts = get_font_list() self.font_choice_combo = \ _widgets.FontChoiceCombobox(self, choices=self.fonts, style=wx.CB_READONLY, size=(125, -1)) self.font_cho...
python
{ "resource": "" }
q231625
AttributesToolbar._create_font_size_combo
train
def _create_font_size_combo(self): """Creates font size combo box""" self.std_font_sizes = config["font_default_sizes"] font_size = str(get_default_font().GetPointSize()) self.font_size_combo = \ wx.ComboBox(self, -1, value=font_size, size=(60, -1), c...
python
{ "resource": "" }
q231626
AttributesToolbar._create_font_face_buttons
train
def _create_font_face_buttons(self): """Creates font face buttons""" font_face_buttons = [ (wx.FONTFLAG_BOLD, "OnBold", "FormatTextBold", _("Bold")), (wx.FONTFLAG_ITALIC, "OnItalics", "FormatTextItalic", _("Italics")), (wx.FONTFLAG_UNDERLINED, "OnUnderli...
python
{ "resource": "" }
q231627
AttributesToolbar._create_textrotation_button
train
def _create_textrotation_button(self): """Create text rotation toggle button""" iconnames = ["TextRotate270", "TextRotate0", "TextRotate90", "TextRotate180"] bmplist = [icons[iconname] for iconname in iconnames] self.rotation_tb = _widgets.BitmapToggleButton(self, ...
python
{ "resource": "" }
q231628
AttributesToolbar._create_justification_button
train
def _create_justification_button(self): """Creates horizontal justification button""" iconnames = ["JustifyLeft", "JustifyCenter", "JustifyRight"] bmplist = [icons[iconname] for iconname in iconnames] self.justify_tb = _widgets.BitmapToggleButton(self, bmplist) self.justify_tb.S...
python
{ "resource": "" }
q231629
AttributesToolbar._create_alignment_button
train
def _create_alignment_button(self): """Creates vertical alignment button""" iconnames = ["AlignTop", "AlignCenter", "AlignBottom"] bmplist = [icons[iconname] for iconname in iconnames] self.alignment_tb = _widgets.BitmapToggleButton(self, bmplist) self.alignment_tb.SetToolTipSt...
python
{ "resource": "" }
q231630
AttributesToolbar._create_borderchoice_combo
train
def _create_borderchoice_combo(self): """Create border choice combo box""" choices = [c[0] for c in self.border_toggles] self.borderchoice_combo = \ _widgets.BorderEditChoice(self, choices=choices, style=wx.CB_READONLY, size=(50, -1)) s...
python
{ "resource": "" }
q231631
AttributesToolbar._create_penwidth_combo
train
def _create_penwidth_combo(self): """Create pen width combo box""" choices = map(unicode, xrange(12)) self.pen_width_combo = \ _widgets.PenWidthComboBox(self, choices=choices, style=wx.CB_READONLY, size=(50, -1)) self.pen_width_combo.Se...
python
{ "resource": "" }
q231632
AttributesToolbar._create_color_buttons
train
def _create_color_buttons(self): """Create color choice buttons""" button_size = (30, 30) button_style = wx.NO_BORDER try: self.linecolor_choice = \ csel.ColourSelect(self, -1, unichr(0x2500), (0, 0, 0), size=button_size, st...
python
{ "resource": "" }
q231633
AttributesToolbar._create_merge_button
train
def _create_merge_button(self): """Create merge button""" bmp = icons["Merge"] self.mergetool_id = wx.NewId() self.AddCheckTool(self.mergetool_id, "Merge", bmp, bmp, short_help_string=_("Merge cells")) self.Bind(wx.EVT_TOOL, self.OnMerge, id=self.merget...
python
{ "resource": "" }
q231634
AttributesToolbar._update_font
train
def _update_font(self, textfont): """Updates text font widget Parameters ---------- textfont: String \tFont name """ try: fontface_id = self.fonts.index(textfont) except ValueError: fontface_id = 0 self.font_choice_comb...
python
{ "resource": "" }
q231635
AttributesToolbar._update_font_weight
train
def _update_font_weight(self, font_weight): """Updates font weight widget Parameters ---------- font_weight: Integer \tButton down iif font_weight == wx.FONTWEIGHT_BOLD """ toggle_state = font_weight & wx.FONTWEIGHT_BOLD == wx.FONTWEIGHT_BOLD self.Tog...
python
{ "resource": "" }
q231636
AttributesToolbar._update_font_style
train
def _update_font_style(self, font_style): """Updates font style widget Parameters ---------- font_style: Integer \tButton down iif font_style == wx.FONTSTYLE_ITALIC """ toggle_state = font_style & wx.FONTSTYLE_ITALIC == wx.FONTSTYLE_ITALIC self.Toggle...
python
{ "resource": "" }
q231637
AttributesToolbar._update_frozencell
train
def _update_frozencell(self, frozen): """Updates frozen cell widget Parameters ---------- frozen: Bool or string \tUntoggled iif False """ toggle_state = frozen is not False self.ToggleTool(wx.FONTFLAG_MASK, toggle_state)
python
{ "resource": "" }
q231638
AttributesToolbar._update_textrotation
train
def _update_textrotation(self, angle): """Updates text rotation toggle button""" states = {0: 0, -90: 1, 180: 2, 90: 3} try: self.rotation_tb.state = states[round(angle)] except KeyError: self.rotation_tb.state = 0 self.rotation_tb.toggle(None) ...
python
{ "resource": "" }
q231639
AttributesToolbar._update_justification
train
def _update_justification(self, justification): """Updates horizontal text justification button Parameters ---------- justification: String in ["left", "center", "right"] \tSwitches button to untoggled if False and toggled if True """ states = {"left": 2, "cen...
python
{ "resource": "" }
q231640
AttributesToolbar._update_alignment
train
def _update_alignment(self, alignment): """Updates vertical text alignment button Parameters ---------- alignment: String in ["top", "middle", "right"] \tSwitches button to untoggled if False and toggled if True """ states = {"top": 2, "middle": 0, "bottom": 1...
python
{ "resource": "" }
q231641
AttributesToolbar._update_fontcolor
train
def _update_fontcolor(self, fontcolor): """Updates text font color button Parameters ---------- fontcolor: Integer \tText color in integer RGB format """ textcolor = wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOWTEXT) textcolor.SetRGB(fontcolor) ...
python
{ "resource": "" }
q231642
AttributesToolbar.OnBorderChoice
train
def OnBorderChoice(self, event): """Change the borders that are affected by color and width changes""" choicelist = event.GetEventObject().GetItems() self.borderstate = choicelist[event.GetInt()]
python
{ "resource": "" }
q231643
AttributesToolbar.OnLineColor
train
def OnLineColor(self, event): """Line color choice event handler""" color = event.GetValue().GetRGB() borders = self.bordermap[self.borderstate] post_command_event(self, self.BorderColorMsg, color=color, borders=borders)
python
{ "resource": "" }
q231644
AttributesToolbar.OnLineWidth
train
def OnLineWidth(self, event): """Line width choice event handler""" linewidth_combobox = event.GetEventObject() idx = event.GetInt() width = int(linewidth_combobox.GetString(idx)) borders = self.bordermap[self.borderstate] post_command_event(self, self.BorderWidthMsg, w...
python
{ "resource": "" }
q231645
AttributesToolbar.OnBGColor
train
def OnBGColor(self, event): """Background color choice event handler""" color = event.GetValue().GetRGB() post_command_event(self, self.BackgroundColorMsg, color=color)
python
{ "resource": "" }
q231646
AttributesToolbar.OnTextColor
train
def OnTextColor(self, event): """Text color choice event handler""" color = event.GetValue().GetRGB() post_command_event(self, self.TextColorMsg, color=color)
python
{ "resource": "" }
q231647
AttributesToolbar.OnTextFont
train
def OnTextFont(self, event): """Text font choice event handler""" fontchoice_combobox = event.GetEventObject() idx = event.GetInt() try: font_string = fontchoice_combobox.GetString(idx) except AttributeError: font_string = event.GetString() post...
python
{ "resource": "" }
q231648
AttributesToolbar.OnTextSize
train
def OnTextSize(self, event): """Text size combo text event handler""" try: size = int(event.GetString()) except Exception: size = get_default_font().GetPointSize() post_command_event(self, self.FontSizeMsg, size=size)
python
{ "resource": "" }
q231649
CellActions.set_code
train
def set_code(self, key, code): """Sets code of cell key, marks grid as changed""" old_code = self.grid.code_array(key) try: old_code = unicode(old_code, encoding="utf-8") except TypeError: pass if code == old_code: return if not (o...
python
{ "resource": "" }
q231650
CellActions.quote_code
train
def quote_code(self, key): """Returns string quoted code """ code = self.grid.code_array(key) quoted_code = quote(code) if quoted_code is not None: self.set_code(key, quoted_code)
python
{ "resource": "" }
q231651
CellActions.delete_cell
train
def delete_cell(self, key): """Deletes key cell""" try: self.code_array.pop(key) except KeyError: pass self.grid.code_array.result_cache.clear()
python
{ "resource": "" }
q231652
CellActions.append_reference_code
train
def append_reference_code(self, key, ref_key, ref_type="absolute"): """Appends reference code to cell code. Replaces existing reference. Parameters ---------- key: 3-tuple of Integer \tKey of cell that gets the reference ref_key: 3-tuple of Integer \tKey...
python
{ "resource": "" }
q231653
CellActions._set_cell_attr
train
def _set_cell_attr(self, selection, table, attr): """Sets cell attr for key cell and mark grid content as changed Parameters ---------- attr: dict \tContains cell attribute keys \tkeys in ["borderwidth_bottom", "borderwidth_right", \t"bordercolor_bottom", "borde...
python
{ "resource": "" }
q231654
CellActions.set_attr
train
def set_attr(self, attr, value, selection=None): """Sets attr of current selection to value""" if selection is None: selection = self.grid.selection if not selection: # Add current cell to selection so that it gets changed selection.cells.append(self.grid.ac...
python
{ "resource": "" }
q231655
CellActions.set_border_attr
train
def set_border_attr(self, attr, value, borders): """Sets border attribute by adjusting selection to borders Parameters ---------- attr: String in ["borderwidth", "bordercolor"] \tBorder attribute that shall be changed value: wx.Colour or Integer \tAttribute value...
python
{ "resource": "" }
q231656
CellActions.toggle_attr
train
def toggle_attr(self, attr): """Toggles an attribute attr for current selection""" selection = self.grid.selection # Selection or single cell access? if selection: value = self.get_new_selection_attr_state(selection, attr) else: value = self.get_new_ce...
python
{ "resource": "" }
q231657
CellActions.change_frozen_attr
train
def change_frozen_attr(self): """Changes frozen state of cell if there is no selection""" # Selections are not supported if self.grid.selection: statustext = _("Freezing selections is not supported.") post_command_event(self.main_window, self.StatusBarMsg, ...
python
{ "resource": "" }
q231658
CellActions.unmerge
train
def unmerge(self, unmerge_area, tab): """Unmerges all cells in unmerge_area""" top, left, bottom, right = unmerge_area selection = Selection([(top, left)], [(bottom, right)], [], [], []) attr = {"merge_area": None, "locked": False} self._set_cell_attr(selection, tab, attr)
python
{ "resource": "" }
q231659
CellActions.merge
train
def merge(self, merge_area, tab): """Merges top left cell with all cells until bottom_right""" top, left, bottom, right = merge_area cursor = self.grid.actions.cursor top_left_code = self.code_array((top, left, cursor[2])) selection = Selection([(top, left)], [(bottom, right)]...
python
{ "resource": "" }
q231660
CellActions.merge_selected_cells
train
def merge_selected_cells(self, selection): """Merges or unmerges cells that are in the selection bounding box Parameters ---------- selection: Selection object \tSelection for which attr toggle shall be returned """ tab = self.grid.current_table # Get ...
python
{ "resource": "" }
q231661
CellActions.get_new_cell_attr_state
train
def get_new_cell_attr_state(self, key, attr_key): """Returns new attr cell state for toggles Parameters ---------- key: 3-Tuple \tCell for which attr toggle shall be returned attr_key: Hashable \tAttribute key """ cell_attributes = self.grid.cod...
python
{ "resource": "" }
q231662
CellActions.get_new_selection_attr_state
train
def get_new_selection_attr_state(self, selection, attr_key): """Toggles new attr selection state and returns it Parameters ---------- selection: Selection object \tSelection for which attr toggle shall be returned attr_key: Hashable \tAttribute key """ ...
python
{ "resource": "" }
q231663
CellActions.refresh_frozen_cell
train
def refresh_frozen_cell(self, key): """Refreshes a frozen cell""" code = self.grid.code_array(key) result = self.grid.code_array._eval_cell(key, code) self.grid.code_array.frozen_cache[repr(key)] = result
python
{ "resource": "" }
q231664
CellActions.refresh_selected_frozen_cells
train
def refresh_selected_frozen_cells(self, selection=None): """Refreshes content of frozen cells that are currently selected If there is no selection, the cell at the cursor is updated. Parameters ---------- selection: Selection, defaults to None \tIf not None then use thi...
python
{ "resource": "" }
q231665
ExchangeActions._import_csv
train
def _import_csv(self, path): """CSV import workflow""" # If path is not set, do nothing if not path: return # Get csv info try: dialect, has_header, digest_types, encoding = \ self.main_window.interfaces.get_csv_import_info(path) ...
python
{ "resource": "" }
q231666
ExchangeActions.import_file
train
def import_file(self, filepath, filterindex): """Imports external file Parameters ---------- filepath: String \tPath of import file filterindex: Integer \tIndex for type of file, 0: csv, 1: tab-delimited text file """ # Mark content as changed ...
python
{ "resource": "" }
q231667
ExchangeActions._export_csv
train
def _export_csv(self, filepath, data, preview_data): """CSV export of code_array results Parameters ---------- filepath: String \tPath of export file data: Object \tCode array result object slice, i. e. one object or iterable of \tsuch objects ""...
python
{ "resource": "" }
q231668
ExchangeActions._export_figure
train
def _export_figure(self, filepath, data, format): """Export of single cell that contains a matplotlib figure Parameters ---------- filepath: String \tPath of export file data: Matplotlib Figure \tMatplotlib figure that is eported format: String in ["png",...
python
{ "resource": "" }
q231669
ExchangeActions.export_file
train
def export_file(self, filepath, __filter, data, preview_data=None): """Export data for other applications Parameters ---------- filepath: String \tPath of export file __filter: String \tImport filter data: Object \tCode array result object slice, ...
python
{ "resource": "" }
q231670
ExchangeActions.get_print_rect
train
def get_print_rect(self, grid_rect): """Returns wx.Rect that is correctly positioned on the print canvas""" grid = self.grid rect_x = grid_rect.x - \ grid.GetScrollPos(wx.HORIZONTAL) * grid.GetScrollLineX() rect_y = grid_rect.y - \ grid.GetScrollPos(wx.VERTICAL)...
python
{ "resource": "" }
q231671
ExchangeActions.export_cairo
train
def export_cairo(self, filepath, filetype): """Exports grid to the PDF file filepath Parameters ---------- filepath: String \tPath of file to export filetype in ["pdf", "svg"] \tType of file to export """ if cairo is None: return ...
python
{ "resource": "" }
q231672
PrintActions.print_preview
train
def print_preview(self, print_area, print_data): """Launch print preview""" if cairo is None: return print_info = \ self.main_window.interfaces.get_cairo_export_info("Print") if print_info is None: # Dialog has been canceled return ...
python
{ "resource": "" }
q231673
PrintActions.printout
train
def printout(self, print_area, print_data): """Print out print area See: http://aspn.activestate.com/ASPN/Mail/Message/wxpython-users/3471083 """ print_info = \ self.main_window.interfaces.get_cairo_export_info("Print") if print_info is None: #...
python
{ "resource": "" }
q231674
ClipboardActions.copy
train
def copy(self, selection, getter=None, delete=False): """Returns code from selection in a tab separated string Cells that are not in selection are included as empty. Parameters ---------- selection: Selection object \tSelection of cells in current table that shall be c...
python
{ "resource": "" }
q231675
ClipboardActions.img2code
train
def img2code(self, key, img): """Pastes wx.Image into single cell""" code_template = \ "wx.ImageFromData({width}, {height}, " + \ "bz2.decompress(base64.b64decode('{data}'))).ConvertToBitmap()" code_alpha_template = \ "wx.ImageFromDataWithAlpha({width}, {hei...
python
{ "resource": "" }
q231676
ClipboardActions._get_paste_data_gen
train
def _get_paste_data_gen(self, key, data): """Generator for paste data Can be used in grid.actions.paste """ if type(data) is wx._gdi.Bitmap: code_str = self.bmp2code(key, data) return [[code_str]] else: return (line.split("\t") for line in d...
python
{ "resource": "" }
q231677
ClipboardActions.paste
train
def paste(self, key, data): """Pastes data into grid Parameters ---------- key: 2-Tuple of Integer \tTop left cell data: String or wx.Bitmap \tTab separated string of paste data \tor paste data image """ data_gen = self._get_paste_data_g...
python
{ "resource": "" }
q231678
ClipboardActions._get_pasteas_data
train
def _get_pasteas_data(self, dim, obj): """Returns list of lists of obj than has dimensionality dim Parameters ---------- dim: Integer \tDimensionality of obj obj: Object \tIterable object of dimensionality dim """ if dim == 0: return...
python
{ "resource": "" }
q231679
ClipboardActions.paste_as
train
def paste_as(self, key, data): """Paste and transform data Data may be given as a Python code as well as a tab separated multi-line strings similar to paste. """ def error_msg(err): msg = _("Error evaluating data: ") + str(err) post_command_event(self.m...
python
{ "resource": "" }
q231680
MacroActions.execute_macros
train
def execute_macros(self): """Executes macros and marks grid as changed""" # Mark content as changed post_command_event(self.main_window, self.ContentChangedMsg) (result, err) = self.grid.code_array.execute_macros() # Post event to macro dialog post_command_event(self.m...
python
{ "resource": "" }
q231681
MacroActions.open_macros
train
def open_macros(self, filepath): """Loads macros from file and marks grid as changed Parameters ---------- filepath: String \tPath to macro file """ try: wx.BeginBusyCursor() self.main_window.grid.Disable() with open(filepat...
python
{ "resource": "" }
q231682
MacroActions.save_macros
train
def save_macros(self, filepath, macros): """Saves macros to file Parameters ---------- filepath: String \tPath to macro file macros: String \tMacro code """ io_error_text = _("Error writing to file {filepath}.") io_error_text = io_error_...
python
{ "resource": "" }
q231683
HelpActions.launch_help
train
def launch_help(self, helpname, filename): """Generic help launcher Launches HTMLWindow that shows content of filename or the Internet page with the filename url Parameters ---------- filename: String \thtml file or url """ # Set up window ...
python
{ "resource": "" }
q231684
HelpActions.OnHelpMove
train
def OnHelpMove(self, event): """Help window move event handler stores position in config""" position = event.GetPosition() config["help_window_position"] = repr((position.x, position.y)) event.Skip()
python
{ "resource": "" }
q231685
HelpActions.OnHelpSize
train
def OnHelpSize(self, event): """Help window size event handler stores size in config""" size = event.GetSize() config["help_window_size"] = repr((size.width, size.height)) event.Skip()
python
{ "resource": "" }
q231686
vlcpanel_factory
train
def vlcpanel_factory(filepath, volume=None): """Returns a VLCPanel class Parameters ---------- filepath: String \tFile path of video volume: Float, optional \tSound volume """ vlc_panel_cls = VLCPanel VLCPanel.filepath = filepath if volume is not None: VLCPanel.vol...
python
{ "resource": "" }
q231687
VLCPanel.SetClientRect
train
def SetClientRect(self, rect): """Positions and resizes video panel Parameters ---------- rect: 4-tuple of Integer \tRect area of video panel """ panel_posx = rect[0] + self.grid.GetRowLabelSize() panel_posy = rect[1] + self.grid.GetColLabelSize() ...
python
{ "resource": "" }
q231688
VLCPanel.OnTogglePlay
train
def OnTogglePlay(self, event): """Toggles the video status between play and hold""" if self.player.get_state() == vlc.State.Playing: self.player.pause() else: self.player.play() event.Skip()
python
{ "resource": "" }
q231689
VLCPanel.OnShiftVideo
train
def OnShiftVideo(self, event): """Shifts through the video""" length = self.player.get_length() time = self.player.get_time() if event.GetWheelRotation() < 0: target_time = max(0, time-length/100.0) elif event.GetWheelRotation() > 0: target_time = min(le...
python
{ "resource": "" }
q231690
VLCPanel.OnAdjustVolume
train
def OnAdjustVolume(self, event): """Changes video volume""" self.volume = self.player.audio_get_volume() if event.GetWheelRotation() < 0: self.volume = max(0, self.volume-10) elif event.GetWheelRotation() > 0: self.volume = min(200, self.volume+10) self...
python
{ "resource": "" }
q231691
Config.load
train
def load(self): """Loads configuration file""" # Config files prior to 0.2.4 dor not have config version keys old_config = not self.cfg_file.Exists("config_version") # Reset data self.data.__dict__.update(self.defaults.__dict__) for key in self.defaults.__dict__: ...
python
{ "resource": "" }
q231692
Config.save
train
def save(self): """Saves configuration file""" for key in self.defaults.__dict__: data = getattr(self.data, key) self.cfg_file.Write(key, data)
python
{ "resource": "" }
q231693
string_result
train
def string_result(result, func, arguments): """Errcheck function. Returns a string and frees the original pointer. It assumes the result is a char *. """ if result: # make a python string copy s = bytes_to_str(ctypes.string_at(result)) # free original string ptr libvlc_f...
python
{ "resource": "" }
q231694
class_result
train
def class_result(classname): """Errcheck function. Returns a function that creates the specified class. """ def wrap_errcheck(result, func, arguments): if result is None: return None return classname(result) return wrap_errcheck
python
{ "resource": "" }
q231695
libvlc_vprinterr
train
def libvlc_vprinterr(fmt, ap): '''Sets the LibVLC error status and message for the current thread. Any previous error is overridden. @param fmt: the format string. @param ap: the arguments. @return: a nul terminated string in any case. ''' f = _Cfunctions.get('libvlc_vprinterr', None) or \ ...
python
{ "resource": "" }
q231696
libvlc_add_intf
train
def libvlc_add_intf(p_instance, name): '''Try to start a user interface for the libvlc instance. @param p_instance: the instance. @param name: interface name, or NULL for default. @return: 0 on success, -1 on error. ''' f = _Cfunctions.get('libvlc_add_intf', None) or \ _Cfunction('libvlc...
python
{ "resource": "" }
q231697
libvlc_event_attach
train
def libvlc_event_attach(p_event_manager, i_event_type, f_callback, user_data): '''Register for an event notification. @param p_event_manager: the event manager to which you want to attach to. Generally it is obtained by vlc_my_object_event_manager() where my_object is the object you want to listen to. @para...
python
{ "resource": "" }
q231698
libvlc_event_type_name
train
def libvlc_event_type_name(event_type): '''Get an event's type name. @param event_type: the desired event. ''' f = _Cfunctions.get('libvlc_event_type_name', None) or \ _Cfunction('libvlc_event_type_name', ((1,),), None, ctypes.c_char_p, ctypes.c_uint) return f(event_type)
python
{ "resource": "" }
q231699
libvlc_log_set_file
train
def libvlc_log_set_file(p_instance, stream): '''Sets up logging to a file. @param p_instance: libvlc instance. @param stream: FILE pointer opened for writing (the FILE pointer must remain valid until L{libvlc_log_unset}()). @version: LibVLC 2.1.0 or later. ''' f = _Cfunctions.get('libvlc_log_set...
python
{ "resource": "" }