This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pywikibot | |
from pywikibot import pagegenerators as pg | |
from pywikibot import textlib | |
def list_template_usage(site_obj, tmpl_name): | |
""" | |
Takes Site object and template name and returns a generator. | |
The function expects a Site object (pywikibot.Site()) and | |
a template name (String). It creates a list of all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_table_string(data, highlight=(True, False, False, False), | |
table_class='wikitable', style=''): | |
""" | |
Takes a list and returns a wikitable. | |
@param data: The list that is converted to a wikitable. | |
@type data: List (Nested) | |
@param highlight: Tuple of rows and columns that should be highlighted. | |
(first row, last row, left column, right column) | |
@type highlight: Tuple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gi.repository import Gtk, Gdk | |
import json | |
class MainWindow(Gtk.Window): | |
def __init__(self): | |
Gtk.Window.__init__(self, title="TreeView Drag and Drop") | |
self.connect("delete-event", Gtk.main_quit) | |
self.set_border_width(10) | |
self.set_default_size(400, 300) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
"""Creates a List of Player Matchups in a Tournament""" | |
def get_matches(players): | |
new_list = [] | |
for index, name in enumerate(players): | |
print("====================================================") | |
print("Entering the 1st for-loop for the {0} time.".format(index)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
"""Creates a List of Player Matchups in a Tournament""" | |
def get_matches(players): | |
new_list = [] | |
for index, name in enumerate(players): | |
for index2, name2 in enumerate(players): | |
if index2 < index: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lex(analyze): | |
lines = '' | |
listin = () | |
analyze.split('\n') | |
analyze.split() | |
for i in analyze: | |
lines += i | |
lisntin.append(lines) | |
return len(listin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Plotting a curved line in a polar plot in Matplotlib | |
import matplotlib.pylab as plt | |
import numpy as np | |
a = 0 | |
b = 2 | |
r1 = 2 | |
r2 = 2 | |
steps = 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- Generated with glade 3.18.3 --> | |
<interface> | |
<requires lib="gtk+" version="3.12"/> | |
<object class="GtkDialog" id="dialog1"> | |
<property name="can_focus">False</property> | |
<property name="type_hint">dialog</property> | |
<child internal-child="vbox"> | |
<object class="GtkBox" id="dialog-vbox1"> | |
<property name="can_focus">False</property> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- Generated with glade 3.18.3 --> | |
<interface> | |
<requires lib="gtk+" version="3.12"/> | |
<object class="GtkWindow" id="window1"> | |
<property name="can_focus">False</property> | |
<child> | |
<object class="GtkNotebook" id="notebook1"> | |
<property name="visible">True</property> | |
<property name="can_focus">True</property> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data_selection = data_treeview.get_selection() | |
data_model, data_row_list = data_selection.get_selected_rows() | |
treeiter_list = [] | |
for treepath in data_row_list: | |
row = data_model[treepath] | |
treeiter_list.append(data_model.get_iter(row)) | |
for treeiter in reversed(treeiter_list): | |
data_treestore.remove(treeiter) |