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 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Spinmob/spinmob | egg/_gui.py | BaseObject.save_gui_settings | def save_gui_settings(self, *a):
"""
Saves just the current configuration of the controls if the
autosettings_path is set.
"""
# only if we're supposed to!
if self._autosettings_path:
# Get the gui settings directory
gui_settings_dir = _o... | python | def save_gui_settings(self, *a):
"""
Saves just the current configuration of the controls if the
autosettings_path is set.
"""
# only if we're supposed to!
if self._autosettings_path:
# Get the gui settings directory
gui_settings_dir = _o... | [
"def",
"save_gui_settings",
"(",
"self",
",",
"*",
"a",
")",
":",
"if",
"self",
".",
"_autosettings_path",
":",
"gui_settings_dir",
"=",
"_os",
".",
"path",
".",
"join",
"(",
"_cwd",
",",
"'egg_settings'",
")",
"if",
"not",
"_os",
".",
"path",
".",
"ex... | Saves just the current configuration of the controls if the
autosettings_path is set. | [
"Saves",
"just",
"the",
"current",
"configuration",
"of",
"the",
"controls",
"if",
"the",
"autosettings_path",
"is",
"set",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L178-L203 | train |
Spinmob/spinmob | egg/_gui.py | BaseObject._store_gui_setting | def _store_gui_setting(self, databox, name):
"""
Stores the gui setting in the header of the supplied databox.
hkeys in the file are set to have the format
"self.controlname"
"""
try: databox.insert_header(name, eval(name + ".get_value()"))
except: print("ERROR... | python | def _store_gui_setting(self, databox, name):
"""
Stores the gui setting in the header of the supplied databox.
hkeys in the file are set to have the format
"self.controlname"
"""
try: databox.insert_header(name, eval(name + ".get_value()"))
except: print("ERROR... | [
"def",
"_store_gui_setting",
"(",
"self",
",",
"databox",
",",
"name",
")",
":",
"try",
":",
"databox",
".",
"insert_header",
"(",
"name",
",",
"eval",
"(",
"name",
"+",
"\".get_value()\"",
")",
")",
"except",
":",
"print",
"(",
"\"ERROR: Could not store gui... | Stores the gui setting in the header of the supplied databox.
hkeys in the file are set to have the format
"self.controlname" | [
"Stores",
"the",
"gui",
"setting",
"in",
"the",
"header",
"of",
"the",
"supplied",
"databox",
".",
"hkeys",
"in",
"the",
"file",
"are",
"set",
"to",
"have",
"the",
"format",
"self",
".",
"controlname"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L288-L295 | train |
Spinmob/spinmob | egg/_gui.py | GridLayout.place_object | def place_object(self, object, column=None, row=None, column_span=1, row_span=1, alignment=1):
"""
This adds either one of our simplified objects or a QWidget to the
grid at the specified position, appends the object to self.objects.
alignment=0 Fill the space.
alignment=1 ... | python | def place_object(self, object, column=None, row=None, column_span=1, row_span=1, alignment=1):
"""
This adds either one of our simplified objects or a QWidget to the
grid at the specified position, appends the object to self.objects.
alignment=0 Fill the space.
alignment=1 ... | [
"def",
"place_object",
"(",
"self",
",",
"object",
",",
"column",
"=",
"None",
",",
"row",
"=",
"None",
",",
"column_span",
"=",
"1",
",",
"row_span",
"=",
"1",
",",
"alignment",
"=",
"1",
")",
":",
"if",
"column",
"==",
"None",
":",
"column",
"=",... | This adds either one of our simplified objects or a QWidget to the
grid at the specified position, appends the object to self.objects.
alignment=0 Fill the space.
alignment=1 Left-justified.
alignment=2 Right-justified.
If column isn't specified, the new object will... | [
"This",
"adds",
"either",
"one",
"of",
"our",
"simplified",
"objects",
"or",
"a",
"QWidget",
"to",
"the",
"grid",
"at",
"the",
"specified",
"position",
"appends",
"the",
"object",
"to",
"self",
".",
"objects",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L369-L408 | train |
Spinmob/spinmob | egg/_gui.py | GridLayout.remove_object | def remove_object(self, object=0, delete=True):
"""
Removes the supplied object from the grid. If object is an integer,
it removes the n'th object.
"""
if type(object) in [int, int]: n = object
else: n = self.objects.index(object)
# pop ... | python | def remove_object(self, object=0, delete=True):
"""
Removes the supplied object from the grid. If object is an integer,
it removes the n'th object.
"""
if type(object) in [int, int]: n = object
else: n = self.objects.index(object)
# pop ... | [
"def",
"remove_object",
"(",
"self",
",",
"object",
"=",
"0",
",",
"delete",
"=",
"True",
")",
":",
"if",
"type",
"(",
"object",
")",
"in",
"[",
"int",
",",
"int",
"]",
":",
"n",
"=",
"object",
"else",
":",
"n",
"=",
"self",
".",
"objects",
"."... | Removes the supplied object from the grid. If object is an integer,
it removes the n'th object. | [
"Removes",
"the",
"supplied",
"object",
"from",
"the",
"grid",
".",
"If",
"object",
"is",
"an",
"integer",
"it",
"removes",
"the",
"n",
"th",
"object",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L410-L429 | train |
Spinmob/spinmob | egg/_gui.py | GridLayout.set_column_stretch | def set_column_stretch(self, column=0, stretch=10):
"""
Sets the column stretch. Larger numbers mean it will expand more to
fill space.
"""
self._layout.setColumnStretch(column, stretch)
return self | python | def set_column_stretch(self, column=0, stretch=10):
"""
Sets the column stretch. Larger numbers mean it will expand more to
fill space.
"""
self._layout.setColumnStretch(column, stretch)
return self | [
"def",
"set_column_stretch",
"(",
"self",
",",
"column",
"=",
"0",
",",
"stretch",
"=",
"10",
")",
":",
"self",
".",
"_layout",
".",
"setColumnStretch",
"(",
"column",
",",
"stretch",
")",
"return",
"self"
] | Sets the column stretch. Larger numbers mean it will expand more to
fill space. | [
"Sets",
"the",
"column",
"stretch",
".",
"Larger",
"numbers",
"mean",
"it",
"will",
"expand",
"more",
"to",
"fill",
"space",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L439-L445 | train |
Spinmob/spinmob | egg/_gui.py | GridLayout.set_row_stretch | def set_row_stretch(self, row=0, stretch=10):
"""
Sets the row stretch. Larger numbers mean it will expand more to fill
space.
"""
self._layout.setRowStretch(row, stretch)
return self | python | def set_row_stretch(self, row=0, stretch=10):
"""
Sets the row stretch. Larger numbers mean it will expand more to fill
space.
"""
self._layout.setRowStretch(row, stretch)
return self | [
"def",
"set_row_stretch",
"(",
"self",
",",
"row",
"=",
"0",
",",
"stretch",
"=",
"10",
")",
":",
"self",
".",
"_layout",
".",
"setRowStretch",
"(",
"row",
",",
"stretch",
")",
"return",
"self"
] | Sets the row stretch. Larger numbers mean it will expand more to fill
space. | [
"Sets",
"the",
"row",
"stretch",
".",
"Larger",
"numbers",
"mean",
"it",
"will",
"expand",
"more",
"to",
"fill",
"space",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L447-L453 | train |
Spinmob/spinmob | egg/_gui.py | GridLayout.new_autorow | def new_autorow(self, row=None):
"""
Sets the auto-add row. If row=None, increments by 1
"""
if row==None: self._auto_row += 1
else: self._auto_row = row
self._auto_column=0
return self | python | def new_autorow(self, row=None):
"""
Sets the auto-add row. If row=None, increments by 1
"""
if row==None: self._auto_row += 1
else: self._auto_row = row
self._auto_column=0
return self | [
"def",
"new_autorow",
"(",
"self",
",",
"row",
"=",
"None",
")",
":",
"if",
"row",
"==",
"None",
":",
"self",
".",
"_auto_row",
"+=",
"1",
"else",
":",
"self",
".",
"_auto_row",
"=",
"row",
"self",
".",
"_auto_column",
"=",
"0",
"return",
"self"
] | Sets the auto-add row. If row=None, increments by 1 | [
"Sets",
"the",
"auto",
"-",
"add",
"row",
".",
"If",
"row",
"=",
"None",
"increments",
"by",
"1"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L455-L463 | train |
Spinmob/spinmob | egg/_gui.py | Window._save_settings | def _save_settings(self):
"""
Saves all the parameters to a text file.
"""
if self._autosettings_path == None: return
# Get the gui settings directory
gui_settings_dir = _os.path.join(_cwd, 'egg_settings')
# make sure the directory exists
if not ... | python | def _save_settings(self):
"""
Saves all the parameters to a text file.
"""
if self._autosettings_path == None: return
# Get the gui settings directory
gui_settings_dir = _os.path.join(_cwd, 'egg_settings')
# make sure the directory exists
if not ... | [
"def",
"_save_settings",
"(",
"self",
")",
":",
"if",
"self",
".",
"_autosettings_path",
"==",
"None",
":",
"return",
"gui_settings_dir",
"=",
"_os",
".",
"path",
".",
"join",
"(",
"_cwd",
",",
"'egg_settings'",
")",
"if",
"not",
"_os",
".",
"path",
".",... | Saves all the parameters to a text file. | [
"Saves",
"all",
"the",
"parameters",
"to",
"a",
"text",
"file",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L602-L624 | train |
Spinmob/spinmob | egg/_gui.py | Window._load_settings | def _load_settings(self):
"""
Loads all the parameters from a databox text file. If path=None,
loads from self._autosettings_path.
"""
if self._autosettings_path == None: return
# Get the gui settings directory
gui_settings_dir = _os.path.join(_cwd, 'egg_... | python | def _load_settings(self):
"""
Loads all the parameters from a databox text file. If path=None,
loads from self._autosettings_path.
"""
if self._autosettings_path == None: return
# Get the gui settings directory
gui_settings_dir = _os.path.join(_cwd, 'egg_... | [
"def",
"_load_settings",
"(",
"self",
")",
":",
"if",
"self",
".",
"_autosettings_path",
"==",
"None",
":",
"return",
"gui_settings_dir",
"=",
"_os",
".",
"path",
".",
"join",
"(",
"_cwd",
",",
"'egg_settings'",
")",
"path",
"=",
"_os",
".",
"path",
".",... | Loads all the parameters from a databox text file. If path=None,
loads from self._autosettings_path. | [
"Loads",
"all",
"the",
"parameters",
"from",
"a",
"databox",
"text",
"file",
".",
"If",
"path",
"=",
"None",
"loads",
"from",
"self",
".",
"_autosettings_path",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L626-L654 | train |
Spinmob/spinmob | egg/_gui.py | Window.show | def show(self, block_command_line=False, block_timing=0.05):
"""
Shows the window and raises it.
If block_command_line is 0, this will start the window up and allow you
to monkey with the command line at the same time. Otherwise, the
window will block the command line and proces... | python | def show(self, block_command_line=False, block_timing=0.05):
"""
Shows the window and raises it.
If block_command_line is 0, this will start the window up and allow you
to monkey with the command line at the same time. Otherwise, the
window will block the command line and proces... | [
"def",
"show",
"(",
"self",
",",
"block_command_line",
"=",
"False",
",",
"block_timing",
"=",
"0.05",
")",
":",
"self",
".",
"_is_open",
"=",
"True",
"self",
".",
"_window",
".",
"show",
"(",
")",
"self",
".",
"_window",
".",
"raise_",
"(",
")",
"if... | Shows the window and raises it.
If block_command_line is 0, this will start the window up and allow you
to monkey with the command line at the same time. Otherwise, the
window will block the command line and process events every
block_timing seconds. | [
"Shows",
"the",
"window",
"and",
"raises",
"it",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L713-L738 | train |
Spinmob/spinmob | egg/_gui.py | Button.set_checked | def set_checked(self, value=True, block_events=False):
"""
This will set whether the button is checked.
Setting block_events=True will temporarily disable signals
from the button when setting the value.
"""
if block_events: self._widget.blockSignals(True)
self._w... | python | def set_checked(self, value=True, block_events=False):
"""
This will set whether the button is checked.
Setting block_events=True will temporarily disable signals
from the button when setting the value.
"""
if block_events: self._widget.blockSignals(True)
self._w... | [
"def",
"set_checked",
"(",
"self",
",",
"value",
"=",
"True",
",",
"block_events",
"=",
"False",
")",
":",
"if",
"block_events",
":",
"self",
".",
"_widget",
".",
"blockSignals",
"(",
"True",
")",
"self",
".",
"_widget",
".",
"setChecked",
"(",
"value",
... | This will set whether the button is checked.
Setting block_events=True will temporarily disable signals
from the button when setting the value. | [
"This",
"will",
"set",
"whether",
"the",
"button",
"is",
"checked",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L915-L926 | train |
Spinmob/spinmob | egg/_gui.py | Button.click | def click(self):
"""
Pretends to user clicked it, sending the signal and everything.
"""
if self.is_checkable():
if self.is_checked(): self.set_checked(False)
else: self.set_checked(True)
self.signal_clicked.emit(self.is_checked... | python | def click(self):
"""
Pretends to user clicked it, sending the signal and everything.
"""
if self.is_checkable():
if self.is_checked(): self.set_checked(False)
else: self.set_checked(True)
self.signal_clicked.emit(self.is_checked... | [
"def",
"click",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_checkable",
"(",
")",
":",
"if",
"self",
".",
"is_checked",
"(",
")",
":",
"self",
".",
"set_checked",
"(",
"False",
")",
"else",
":",
"self",
".",
"set_checked",
"(",
"True",
")",
"self... | Pretends to user clicked it, sending the signal and everything. | [
"Pretends",
"to",
"user",
"clicked",
"it",
"sending",
"the",
"signal",
"and",
"everything",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L949-L959 | train |
Spinmob/spinmob | egg/_gui.py | NumberBox.set_value | def set_value(self, value, block_events=False):
"""
Sets the current value of the number box.
Setting block_events=True will temporarily block the widget from
sending any signals when setting the value.
"""
if block_events: self.block_events()
self._widget.setVal... | python | def set_value(self, value, block_events=False):
"""
Sets the current value of the number box.
Setting block_events=True will temporarily block the widget from
sending any signals when setting the value.
"""
if block_events: self.block_events()
self._widget.setVal... | [
"def",
"set_value",
"(",
"self",
",",
"value",
",",
"block_events",
"=",
"False",
")",
":",
"if",
"block_events",
":",
"self",
".",
"block_events",
"(",
")",
"self",
".",
"_widget",
".",
"setValue",
"(",
"value",
")",
"if",
"block_events",
":",
"self",
... | Sets the current value of the number box.
Setting block_events=True will temporarily block the widget from
sending any signals when setting the value. | [
"Sets",
"the",
"current",
"value",
"of",
"the",
"number",
"box",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1070-L1079 | train |
Spinmob/spinmob | egg/_gui.py | NumberBox.set_step | def set_step(self, value, block_events=False):
"""
Sets the step of the number box.
Setting block_events=True will temporarily block the widget from
sending any signals when setting the value.
"""
if block_events: self.block_events()
self._widget.setSingleStep(va... | python | def set_step(self, value, block_events=False):
"""
Sets the step of the number box.
Setting block_events=True will temporarily block the widget from
sending any signals when setting the value.
"""
if block_events: self.block_events()
self._widget.setSingleStep(va... | [
"def",
"set_step",
"(",
"self",
",",
"value",
",",
"block_events",
"=",
"False",
")",
":",
"if",
"block_events",
":",
"self",
".",
"block_events",
"(",
")",
"self",
".",
"_widget",
".",
"setSingleStep",
"(",
"value",
")",
"if",
"block_events",
":",
"self... | Sets the step of the number box.
Setting block_events=True will temporarily block the widget from
sending any signals when setting the value. | [
"Sets",
"the",
"step",
"of",
"the",
"number",
"box",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1081-L1090 | train |
Spinmob/spinmob | egg/_gui.py | ComboBox.get_all_items | def get_all_items(self):
"""
Returns all items in the combobox dictionary.
"""
return [self._widget.itemText(k) for k in range(self._widget.count())] | python | def get_all_items(self):
"""
Returns all items in the combobox dictionary.
"""
return [self._widget.itemText(k) for k in range(self._widget.count())] | [
"def",
"get_all_items",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"_widget",
".",
"itemText",
"(",
"k",
")",
"for",
"k",
"in",
"range",
"(",
"self",
".",
"_widget",
".",
"count",
"(",
")",
")",
"]"
] | Returns all items in the combobox dictionary. | [
"Returns",
"all",
"items",
"in",
"the",
"combobox",
"dictionary",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1206-L1210 | train |
Spinmob/spinmob | egg/_gui.py | TabArea.add_tab | def add_tab(self, title="Yeah!", block_events=True):
"""
Adds a tab to the area, and creates the layout for this tab.
"""
self._widget.blockSignals(block_events)
# create a widget to go in the tab
tab = GridLayout()
self.tabs.append(tab)
tab.set_parent(se... | python | def add_tab(self, title="Yeah!", block_events=True):
"""
Adds a tab to the area, and creates the layout for this tab.
"""
self._widget.blockSignals(block_events)
# create a widget to go in the tab
tab = GridLayout()
self.tabs.append(tab)
tab.set_parent(se... | [
"def",
"add_tab",
"(",
"self",
",",
"title",
"=",
"\"Yeah!\"",
",",
"block_events",
"=",
"True",
")",
":",
"self",
".",
"_widget",
".",
"blockSignals",
"(",
"block_events",
")",
"tab",
"=",
"GridLayout",
"(",
")",
"self",
".",
"tabs",
".",
"append",
"(... | Adds a tab to the area, and creates the layout for this tab. | [
"Adds",
"a",
"tab",
"to",
"the",
"area",
"and",
"creates",
"the",
"layout",
"for",
"this",
"tab",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1271-L1292 | train |
Spinmob/spinmob | egg/_gui.py | TabArea.remove_tab | def remove_tab(self, tab=0):
"""
Removes the tab by index.
"""
# pop it from the list
t = self.tabs.pop(tab)
# remove it from the gui
self._widget.removeTab(tab)
# return it in case someone cares
return t | python | def remove_tab(self, tab=0):
"""
Removes the tab by index.
"""
# pop it from the list
t = self.tabs.pop(tab)
# remove it from the gui
self._widget.removeTab(tab)
# return it in case someone cares
return t | [
"def",
"remove_tab",
"(",
"self",
",",
"tab",
"=",
"0",
")",
":",
"t",
"=",
"self",
".",
"tabs",
".",
"pop",
"(",
"tab",
")",
"self",
".",
"_widget",
".",
"removeTab",
"(",
"tab",
")",
"return",
"t"
] | Removes the tab by index. | [
"Removes",
"the",
"tab",
"by",
"index",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1294-L1306 | train |
Spinmob/spinmob | egg/_gui.py | Table.get_value | def get_value(self, column=0, row=0):
"""
Returns a the value at column, row.
"""
x = self._widget.item(row, column)
if x==None: return x
else: return str(self._widget.item(row,column).text()) | python | def get_value(self, column=0, row=0):
"""
Returns a the value at column, row.
"""
x = self._widget.item(row, column)
if x==None: return x
else: return str(self._widget.item(row,column).text()) | [
"def",
"get_value",
"(",
"self",
",",
"column",
"=",
"0",
",",
"row",
"=",
"0",
")",
":",
"x",
"=",
"self",
".",
"_widget",
".",
"item",
"(",
"row",
",",
"column",
")",
"if",
"x",
"==",
"None",
":",
"return",
"x",
"else",
":",
"return",
"str",
... | Returns a the value at column, row. | [
"Returns",
"a",
"the",
"value",
"at",
"column",
"row",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1369-L1376 | train |
Spinmob/spinmob | egg/_gui.py | Table.set_value | def set_value(self, column=0, row=0, value='', block_events=False):
"""
Sets the value at column, row. This will create elements dynamically,
and in a totally stupid while-looping way.
Setting block_events=True will temporarily block the widget from
sending any signals when sett... | python | def set_value(self, column=0, row=0, value='', block_events=False):
"""
Sets the value at column, row. This will create elements dynamically,
and in a totally stupid while-looping way.
Setting block_events=True will temporarily block the widget from
sending any signals when sett... | [
"def",
"set_value",
"(",
"self",
",",
"column",
"=",
"0",
",",
"row",
"=",
"0",
",",
"value",
"=",
"''",
",",
"block_events",
"=",
"False",
")",
":",
"if",
"block_events",
":",
"self",
".",
"block_events",
"(",
")",
"while",
"column",
">",
"self",
... | Sets the value at column, row. This will create elements dynamically,
and in a totally stupid while-looping way.
Setting block_events=True will temporarily block the widget from
sending any signals when setting the value. | [
"Sets",
"the",
"value",
"at",
"column",
"row",
".",
"This",
"will",
"create",
"elements",
"dynamically",
"and",
"in",
"a",
"totally",
"stupid",
"while",
"-",
"looping",
"way",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1378-L1398 | train |
Spinmob/spinmob | egg/_gui.py | Table.set_column_width | def set_column_width(self, n=0, width=120):
"""
Sets the n'th column width in pixels.
"""
self._widget.setColumnWidth(n, width)
return self | python | def set_column_width(self, n=0, width=120):
"""
Sets the n'th column width in pixels.
"""
self._widget.setColumnWidth(n, width)
return self | [
"def",
"set_column_width",
"(",
"self",
",",
"n",
"=",
"0",
",",
"width",
"=",
"120",
")",
":",
"self",
".",
"_widget",
".",
"setColumnWidth",
"(",
"n",
",",
"width",
")",
"return",
"self"
] | Sets the n'th column width in pixels. | [
"Sets",
"the",
"n",
"th",
"column",
"width",
"in",
"pixels",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1400-L1405 | train |
Spinmob/spinmob | egg/_gui.py | Table.set_header_visibility | def set_header_visibility(self, column=False, row=False):
"""
Sets whether we can see the column and row headers.
"""
if row: self._widget.verticalHeader().show()
else: self._widget.verticalHeader().hide()
if column: self._widget.horizontalHeader().show()
... | python | def set_header_visibility(self, column=False, row=False):
"""
Sets whether we can see the column and row headers.
"""
if row: self._widget.verticalHeader().show()
else: self._widget.verticalHeader().hide()
if column: self._widget.horizontalHeader().show()
... | [
"def",
"set_header_visibility",
"(",
"self",
",",
"column",
"=",
"False",
",",
"row",
"=",
"False",
")",
":",
"if",
"row",
":",
"self",
".",
"_widget",
".",
"verticalHeader",
"(",
")",
".",
"show",
"(",
")",
"else",
":",
"self",
".",
"_widget",
".",
... | Sets whether we can see the column and row headers. | [
"Sets",
"whether",
"we",
"can",
"see",
"the",
"column",
"and",
"row",
"headers",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1407-L1417 | train |
Spinmob/spinmob | egg/_gui.py | Table.set_row_height | def set_row_height(self, n=0, height=18):
"""
Sets the n'th row height in pixels.
"""
self._widget.setRowHeight(n, height)
return self | python | def set_row_height(self, n=0, height=18):
"""
Sets the n'th row height in pixels.
"""
self._widget.setRowHeight(n, height)
return self | [
"def",
"set_row_height",
"(",
"self",
",",
"n",
"=",
"0",
",",
"height",
"=",
"18",
")",
":",
"self",
".",
"_widget",
".",
"setRowHeight",
"(",
"n",
",",
"height",
")",
"return",
"self"
] | Sets the n'th row height in pixels. | [
"Sets",
"the",
"n",
"th",
"row",
"height",
"in",
"pixels",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1419-L1424 | train |
Spinmob/spinmob | egg/_gui.py | TableDictionary._clean_up_key | def _clean_up_key(self, key):
"""
Returns the key string with no naughty characters.
"""
for n in self.naughty: key = key.replace(n, '_')
return key | python | def _clean_up_key(self, key):
"""
Returns the key string with no naughty characters.
"""
for n in self.naughty: key = key.replace(n, '_')
return key | [
"def",
"_clean_up_key",
"(",
"self",
",",
"key",
")",
":",
"for",
"n",
"in",
"self",
".",
"naughty",
":",
"key",
"=",
"key",
".",
"replace",
"(",
"n",
",",
"'_'",
")",
"return",
"key"
] | Returns the key string with no naughty characters. | [
"Returns",
"the",
"key",
"string",
"with",
"no",
"naughty",
"characters",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1467-L1472 | train |
Spinmob/spinmob | egg/_gui.py | TableDictionary._cell_changed | def _cell_changed(self, *a):
"""
Called whenever a cell is changed. Updates the dictionary.
"""
# block all signals during the update (to avoid re-calling this)
self.block_events()
# loop over the rows
for n in range(self.get_row_count()):
# get the... | python | def _cell_changed(self, *a):
"""
Called whenever a cell is changed. Updates the dictionary.
"""
# block all signals during the update (to avoid re-calling this)
self.block_events()
# loop over the rows
for n in range(self.get_row_count()):
# get the... | [
"def",
"_cell_changed",
"(",
"self",
",",
"*",
"a",
")",
":",
"self",
".",
"block_events",
"(",
")",
"for",
"n",
"in",
"range",
"(",
"self",
".",
"get_row_count",
"(",
")",
")",
":",
"key",
"=",
"self",
".",
"get_value",
"(",
"0",
",",
"n",
")",
... | Called whenever a cell is changed. Updates the dictionary. | [
"Called",
"whenever",
"a",
"cell",
"is",
"changed",
".",
"Updates",
"the",
"dictionary",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1474-L1511 | train |
Spinmob/spinmob | egg/_gui.py | TableDictionary.get_item | def get_item(self, key):
"""
Returns the value associated with the key.
"""
keys = list(self.keys())
# make sure it exists
if not key in keys:
self.print_message("ERROR: '"+str(key)+"' not found.")
return None
try:
x = eval(se... | python | def get_item(self, key):
"""
Returns the value associated with the key.
"""
keys = list(self.keys())
# make sure it exists
if not key in keys:
self.print_message("ERROR: '"+str(key)+"' not found.")
return None
try:
x = eval(se... | [
"def",
"get_item",
"(",
"self",
",",
"key",
")",
":",
"keys",
"=",
"list",
"(",
"self",
".",
"keys",
"(",
")",
")",
"if",
"not",
"key",
"in",
"keys",
":",
"self",
".",
"print_message",
"(",
"\"ERROR: '\"",
"+",
"str",
"(",
"key",
")",
"+",
"\"' n... | Returns the value associated with the key. | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"key",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1513-L1530 | train |
Spinmob/spinmob | egg/_gui.py | TableDictionary.keys | def keys(self):
"""
Returns a sorted list of keys
"""
keys = list()
for n in range(len(self)):
# only append the valid keys
key = self.get_value()
if not key in ['', None]: keys.append(key)
return keys | python | def keys(self):
"""
Returns a sorted list of keys
"""
keys = list()
for n in range(len(self)):
# only append the valid keys
key = self.get_value()
if not key in ['', None]: keys.append(key)
return keys | [
"def",
"keys",
"(",
"self",
")",
":",
"keys",
"=",
"list",
"(",
")",
"for",
"n",
"in",
"range",
"(",
"len",
"(",
"self",
")",
")",
":",
"key",
"=",
"self",
".",
"get_value",
"(",
")",
"if",
"not",
"key",
"in",
"[",
"''",
",",
"None",
"]",
"... | Returns a sorted list of keys | [
"Returns",
"a",
"sorted",
"list",
"of",
"keys"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1534-L1545 | train |
Spinmob/spinmob | egg/_gui.py | TableDictionary.set_item | def set_item(self, key, value):
"""
Sets the item by key, and refills the table sorted.
"""
keys = list(self.keys())
# if it exists, update
if key in keys:
self.set_value(1,keys.index(key),str(value))
# otherwise we have to add an element
els... | python | def set_item(self, key, value):
"""
Sets the item by key, and refills the table sorted.
"""
keys = list(self.keys())
# if it exists, update
if key in keys:
self.set_value(1,keys.index(key),str(value))
# otherwise we have to add an element
els... | [
"def",
"set_item",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"keys",
"=",
"list",
"(",
"self",
".",
"keys",
"(",
")",
")",
"if",
"key",
"in",
"keys",
":",
"self",
".",
"set_value",
"(",
"1",
",",
"keys",
".",
"index",
"(",
"key",
")",
... | Sets the item by key, and refills the table sorted. | [
"Sets",
"the",
"item",
"by",
"key",
"and",
"refills",
"the",
"table",
"sorted",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1547-L1560 | train |
Spinmob/spinmob | egg/_gui.py | TextBox.get_text | def get_text(self):
"""
Returns the current text.
"""
if self._multiline: return str(self._widget.toPlainText())
else: return str(self._widget.text()) | python | def get_text(self):
"""
Returns the current text.
"""
if self._multiline: return str(self._widget.toPlainText())
else: return str(self._widget.text()) | [
"def",
"get_text",
"(",
"self",
")",
":",
"if",
"self",
".",
"_multiline",
":",
"return",
"str",
"(",
"self",
".",
"_widget",
".",
"toPlainText",
"(",
")",
")",
"else",
":",
"return",
"str",
"(",
"self",
".",
"_widget",
".",
"text",
"(",
")",
")"
] | Returns the current text. | [
"Returns",
"the",
"current",
"text",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1640-L1645 | train |
Spinmob/spinmob | egg/_gui.py | TextBox.set_text | def set_text(self, text="YEAH."):
"""
Sets the current value of the text box.
"""
# Make sure the text is actually different, so as not to
# trigger a value changed signal
s = str(text)
if not s == self.get_text(): self._widget.setText(str(text))
return s... | python | def set_text(self, text="YEAH."):
"""
Sets the current value of the text box.
"""
# Make sure the text is actually different, so as not to
# trigger a value changed signal
s = str(text)
if not s == self.get_text(): self._widget.setText(str(text))
return s... | [
"def",
"set_text",
"(",
"self",
",",
"text",
"=",
"\"YEAH.\"",
")",
":",
"s",
"=",
"str",
"(",
"text",
")",
"if",
"not",
"s",
"==",
"self",
".",
"get_text",
"(",
")",
":",
"self",
".",
"_widget",
".",
"setText",
"(",
"str",
"(",
"text",
")",
")... | Sets the current value of the text box. | [
"Sets",
"the",
"current",
"value",
"of",
"the",
"text",
"box",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1647-L1655 | train |
Spinmob/spinmob | egg/_gui.py | TextBox.set_colors | def set_colors(self, text='black', background='white'):
"""
Sets the colors of the text area.
"""
if self._multiline: self._widget.setStyleSheet("QTextEdit {background-color: "+str(background)+"; color: "+str(text)+"}")
else: self._widget.setStyleSheet("QLineEdit {b... | python | def set_colors(self, text='black', background='white'):
"""
Sets the colors of the text area.
"""
if self._multiline: self._widget.setStyleSheet("QTextEdit {background-color: "+str(background)+"; color: "+str(text)+"}")
else: self._widget.setStyleSheet("QLineEdit {b... | [
"def",
"set_colors",
"(",
"self",
",",
"text",
"=",
"'black'",
",",
"background",
"=",
"'white'",
")",
":",
"if",
"self",
".",
"_multiline",
":",
"self",
".",
"_widget",
".",
"setStyleSheet",
"(",
"\"QTextEdit {background-color: \"",
"+",
"str",
"(",
"backgr... | Sets the colors of the text area. | [
"Sets",
"the",
"colors",
"of",
"the",
"text",
"area",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1657-L1662 | train |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.block_events | def block_events(self):
"""
Special version of block_events that loops over all tree elements.
"""
# block events in the usual way
BaseObject.block_events(self)
# loop over all top level parameters
for i in range(self._widget.topLevelItemCount()):
... | python | def block_events(self):
"""
Special version of block_events that loops over all tree elements.
"""
# block events in the usual way
BaseObject.block_events(self)
# loop over all top level parameters
for i in range(self._widget.topLevelItemCount()):
... | [
"def",
"block_events",
"(",
"self",
")",
":",
"BaseObject",
".",
"block_events",
"(",
"self",
")",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"_widget",
".",
"topLevelItemCount",
"(",
")",
")",
":",
"self",
".",
"_widget",
".",
"topLevelItem",
"(",
"... | Special version of block_events that loops over all tree elements. | [
"Special",
"version",
"of",
"block_events",
"that",
"loops",
"over",
"all",
"tree",
"elements",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1773-L1784 | train |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.unblock_events | def unblock_events(self):
"""
Special version of unblock_events that loops over all tree elements as well.
"""
# unblock events in the usual way
BaseObject.unblock_events(self)
# loop over all top level parameters
for i in range(self._widget.topLevelItemC... | python | def unblock_events(self):
"""
Special version of unblock_events that loops over all tree elements as well.
"""
# unblock events in the usual way
BaseObject.unblock_events(self)
# loop over all top level parameters
for i in range(self._widget.topLevelItemC... | [
"def",
"unblock_events",
"(",
"self",
")",
":",
"BaseObject",
".",
"unblock_events",
"(",
"self",
")",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"_widget",
".",
"topLevelItemCount",
"(",
")",
")",
":",
"self",
".",
"_widget",
".",
"topLevelItem",
"(",... | Special version of unblock_events that loops over all tree elements as well. | [
"Special",
"version",
"of",
"unblock_events",
"that",
"loops",
"over",
"all",
"tree",
"elements",
"as",
"well",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1786-L1797 | train |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.connect_signal_changed | def connect_signal_changed(self, name, function):
"""
Connects a changed signal from the parameters of the specified name
to the supplied function.
"""
x = self._find_parameter(name.split("/"))
# if it pooped.
if x==None: return None
# connect it
... | python | def connect_signal_changed(self, name, function):
"""
Connects a changed signal from the parameters of the specified name
to the supplied function.
"""
x = self._find_parameter(name.split("/"))
# if it pooped.
if x==None: return None
# connect it
... | [
"def",
"connect_signal_changed",
"(",
"self",
",",
"name",
",",
"function",
")",
":",
"x",
"=",
"self",
".",
"_find_parameter",
"(",
"name",
".",
"split",
"(",
"\"/\"",
")",
")",
"if",
"x",
"==",
"None",
":",
"return",
"None",
"x",
".",
"sigValueChange... | Connects a changed signal from the parameters of the specified name
to the supplied function. | [
"Connects",
"a",
"changed",
"signal",
"from",
"the",
"parameters",
"of",
"the",
"specified",
"name",
"to",
"the",
"supplied",
"function",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1823-L1840 | train |
Spinmob/spinmob | egg/_gui.py | TreeDictionary._find_parameter | def _find_parameter(self, name_list, create_missing=False, quiet=False):
"""
Tries to find and return the parameter of the specified name. The name
should be of the form
['branch1','branch2', 'parametername']
Setting create_missing=True means if it doesn't find a branch it
... | python | def _find_parameter(self, name_list, create_missing=False, quiet=False):
"""
Tries to find and return the parameter of the specified name. The name
should be of the form
['branch1','branch2', 'parametername']
Setting create_missing=True means if it doesn't find a branch it
... | [
"def",
"_find_parameter",
"(",
"self",
",",
"name_list",
",",
"create_missing",
"=",
"False",
",",
"quiet",
"=",
"False",
")",
":",
"s",
"=",
"list",
"(",
"name_list",
")",
"if",
"len",
"(",
"s",
")",
"==",
"0",
":",
"return",
"self",
".",
"_widget",... | Tries to find and return the parameter of the specified name. The name
should be of the form
['branch1','branch2', 'parametername']
Setting create_missing=True means if it doesn't find a branch it
will create one.
Setting quiet=True will suppress error messages (for checking) | [
"Tries",
"to",
"find",
"and",
"return",
"the",
"parameter",
"of",
"the",
"specified",
"name",
".",
"The",
"name",
"should",
"be",
"of",
"the",
"form"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1882-L1942 | train |
Spinmob/spinmob | egg/_gui.py | TreeDictionary._clean_up_name | def _clean_up_name(self, name):
"""
Cleans up the name according to the rules specified in this exact
function. Uses self.naughty, a list of naughty characters.
"""
for n in self.naughty: name = name.replace(n, '_')
return name | python | def _clean_up_name(self, name):
"""
Cleans up the name according to the rules specified in this exact
function. Uses self.naughty, a list of naughty characters.
"""
for n in self.naughty: name = name.replace(n, '_')
return name | [
"def",
"_clean_up_name",
"(",
"self",
",",
"name",
")",
":",
"for",
"n",
"in",
"self",
".",
"naughty",
":",
"name",
"=",
"name",
".",
"replace",
"(",
"n",
",",
"'_'",
")",
"return",
"name"
] | Cleans up the name according to the rules specified in this exact
function. Uses self.naughty, a list of naughty characters. | [
"Cleans",
"up",
"the",
"name",
"according",
"to",
"the",
"rules",
"specified",
"in",
"this",
"exact",
"function",
".",
"Uses",
"self",
".",
"naughty",
"a",
"list",
"of",
"naughty",
"characters",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L1946-L1952 | train |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.send_to_databox_header | def send_to_databox_header(self, destination_databox):
"""
Sends all the information currently in the tree to the supplied
databox's header, in alphabetical order. If the entries already
exists, just updates them.
"""
k, d = self.get_dictionary()
destination_datab... | python | def send_to_databox_header(self, destination_databox):
"""
Sends all the information currently in the tree to the supplied
databox's header, in alphabetical order. If the entries already
exists, just updates them.
"""
k, d = self.get_dictionary()
destination_datab... | [
"def",
"send_to_databox_header",
"(",
"self",
",",
"destination_databox",
")",
":",
"k",
",",
"d",
"=",
"self",
".",
"get_dictionary",
"(",
")",
"destination_databox",
".",
"update_headers",
"(",
"d",
",",
"k",
")"
] | Sends all the information currently in the tree to the supplied
databox's header, in alphabetical order. If the entries already
exists, just updates them. | [
"Sends",
"all",
"the",
"information",
"currently",
"in",
"the",
"tree",
"to",
"the",
"supplied",
"databox",
"s",
"header",
"in",
"alphabetical",
"order",
".",
"If",
"the",
"entries",
"already",
"exists",
"just",
"updates",
"them",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2105-L2112 | train |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.get_value | def get_value(self, name):
"""
Returns the value of the parameter with the specified name.
"""
# first clean up the name
name = self._clean_up_name(name)
# now get the parameter object
x = self._find_parameter(name.split('/'))
# quit if it pooped.
... | python | def get_value(self, name):
"""
Returns the value of the parameter with the specified name.
"""
# first clean up the name
name = self._clean_up_name(name)
# now get the parameter object
x = self._find_parameter(name.split('/'))
# quit if it pooped.
... | [
"def",
"get_value",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"self",
".",
"_clean_up_name",
"(",
"name",
")",
"x",
"=",
"self",
".",
"_find_parameter",
"(",
"name",
".",
"split",
"(",
"'/'",
")",
")",
"if",
"x",
"==",
"None",
":",
"return",... | Returns the value of the parameter with the specified name. | [
"Returns",
"the",
"value",
"of",
"the",
"parameter",
"with",
"the",
"specified",
"name",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2162-L2209 | train |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.get_list_values | def get_list_values(self, name):
"""
Returns the values for a list item of the specified name.
"""
# Make sure it's a list
if not self.get_type(name) in ['list']:
self.print_message('ERROR: "'+name+'" is not a list.')
return
# Return a co... | python | def get_list_values(self, name):
"""
Returns the values for a list item of the specified name.
"""
# Make sure it's a list
if not self.get_type(name) in ['list']:
self.print_message('ERROR: "'+name+'" is not a list.')
return
# Return a co... | [
"def",
"get_list_values",
"(",
"self",
",",
"name",
")",
":",
"if",
"not",
"self",
".",
"get_type",
"(",
"name",
")",
"in",
"[",
"'list'",
"]",
":",
"self",
".",
"print_message",
"(",
"'ERROR: \"'",
"+",
"name",
"+",
"'\" is not a list.'",
")",
"return",... | Returns the values for a list item of the specified name. | [
"Returns",
"the",
"values",
"for",
"a",
"list",
"item",
"of",
"the",
"specified",
"name",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2213-L2223 | train |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.set_value | def set_value(self, name, value, ignore_error=False, block_user_signals=False):
"""
Sets the variable of the supplied name to the supplied value.
Setting block_user_signals=True will temporarily block the widget from
sending any signals when setting the value.
"""
# firs... | python | def set_value(self, name, value, ignore_error=False, block_user_signals=False):
"""
Sets the variable of the supplied name to the supplied value.
Setting block_user_signals=True will temporarily block the widget from
sending any signals when setting the value.
"""
# firs... | [
"def",
"set_value",
"(",
"self",
",",
"name",
",",
"value",
",",
"ignore_error",
"=",
"False",
",",
"block_user_signals",
"=",
"False",
")",
":",
"name",
"=",
"self",
".",
"_clean_up_name",
"(",
"name",
")",
"if",
"block_user_signals",
":",
"self",
".",
... | Sets the variable of the supplied name to the supplied value.
Setting block_user_signals=True will temporarily block the widget from
sending any signals when setting the value. | [
"Sets",
"the",
"variable",
"of",
"the",
"supplied",
"name",
"to",
"the",
"supplied",
"value",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2225-L2259 | train |
Spinmob/spinmob | egg/_gui.py | TreeDictionary.save | def save(self, path=None):
"""
Saves all the parameters to a text file using the databox
functionality. If path=None, saves to self._autosettings_path. If
self._autosettings_path=None, does not save.
"""
if path==None:
if self._autosettings_path ... | python | def save(self, path=None):
"""
Saves all the parameters to a text file using the databox
functionality. If path=None, saves to self._autosettings_path. If
self._autosettings_path=None, does not save.
"""
if path==None:
if self._autosettings_path ... | [
"def",
"save",
"(",
"self",
",",
"path",
"=",
"None",
")",
":",
"if",
"path",
"==",
"None",
":",
"if",
"self",
".",
"_autosettings_path",
"==",
"None",
":",
"return",
"self",
"gui_settings_dir",
"=",
"_os",
".",
"path",
".",
"join",
"(",
"_cwd",
",",... | Saves all the parameters to a text file using the databox
functionality. If path=None, saves to self._autosettings_path. If
self._autosettings_path=None, does not save. | [
"Saves",
"all",
"the",
"parameters",
"to",
"a",
"text",
"file",
"using",
"the",
"databox",
"functionality",
".",
"If",
"path",
"=",
"None",
"saves",
"to",
"self",
".",
"_autosettings_path",
".",
"If",
"self",
".",
"_autosettings_path",
"=",
"None",
"does",
... | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2280-L2315 | train |
Spinmob/spinmob | egg/_gui.py | TreeDictionary._set_value_safe | def _set_value_safe(self, k, v, ignore_errors=False, block_user_signals=False):
"""
Actually sets the value, first by trying it directly, then by
"""
# for safety: by default assume it's a repr() with python code
try:
self.set_value(k, v, ignore_error = ignore_... | python | def _set_value_safe(self, k, v, ignore_errors=False, block_user_signals=False):
"""
Actually sets the value, first by trying it directly, then by
"""
# for safety: by default assume it's a repr() with python code
try:
self.set_value(k, v, ignore_error = ignore_... | [
"def",
"_set_value_safe",
"(",
"self",
",",
"k",
",",
"v",
",",
"ignore_errors",
"=",
"False",
",",
"block_user_signals",
"=",
"False",
")",
":",
"try",
":",
"self",
".",
"set_value",
"(",
"k",
",",
"v",
",",
"ignore_error",
"=",
"ignore_errors",
",",
... | Actually sets the value, first by trying it directly, then by | [
"Actually",
"sets",
"the",
"value",
"first",
"by",
"trying",
"it",
"directly",
"then",
"by"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2382-L2392 | train |
Spinmob/spinmob | egg/_gui.py | DataboxPlot._button_autosave_clicked | def _button_autosave_clicked(self, checked):
"""
Called whenever the button is clicked.
"""
if checked:
# get the path from the user
path = _spinmob.dialogs.save(filters=self.file_type)
# abort if necessary
if not path:
sel... | python | def _button_autosave_clicked(self, checked):
"""
Called whenever the button is clicked.
"""
if checked:
# get the path from the user
path = _spinmob.dialogs.save(filters=self.file_type)
# abort if necessary
if not path:
sel... | [
"def",
"_button_autosave_clicked",
"(",
"self",
",",
"checked",
")",
":",
"if",
"checked",
":",
"path",
"=",
"_spinmob",
".",
"dialogs",
".",
"save",
"(",
"filters",
"=",
"self",
".",
"file_type",
")",
"if",
"not",
"path",
":",
"self",
".",
"button_autos... | Called whenever the button is clicked. | [
"Called",
"whenever",
"the",
"button",
"is",
"clicked",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2556-L2573 | train |
Spinmob/spinmob | egg/_gui.py | DataboxPlot.save_file | def save_file(self, path=None, force_overwrite=False, just_settings=False, **kwargs):
"""
Saves the data in the databox to a file.
Parameters
----------
path=None
Path for output. If set to None, use a save dialog.
force_overwrite=False
Do not que... | python | def save_file(self, path=None, force_overwrite=False, just_settings=False, **kwargs):
"""
Saves the data in the databox to a file.
Parameters
----------
path=None
Path for output. If set to None, use a save dialog.
force_overwrite=False
Do not que... | [
"def",
"save_file",
"(",
"self",
",",
"path",
"=",
"None",
",",
"force_overwrite",
"=",
"False",
",",
"just_settings",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"'binary'",
"in",
"kwargs",
":",
"kwargs",
"[",
"'binary'",
"]",
"=",
"self... | Saves the data in the databox to a file.
Parameters
----------
path=None
Path for output. If set to None, use a save dialog.
force_overwrite=False
Do not question the overwrite if the file already exists.
just_settings=False
Set to True to sa... | [
"Saves",
"the",
"data",
"in",
"the",
"databox",
"to",
"a",
"file",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2594-L2623 | train |
Spinmob/spinmob | egg/_gui.py | DataboxPlot.autosave | def autosave(self):
"""
Autosaves the currently stored data, but only if autosave is checked!
"""
# make sure we're suppoed to
if self.button_autosave.is_checked():
# save the file
self.save_file(_os.path.join(self._autosave_directory, "%04d " % (self.num... | python | def autosave(self):
"""
Autosaves the currently stored data, but only if autosave is checked!
"""
# make sure we're suppoed to
if self.button_autosave.is_checked():
# save the file
self.save_file(_os.path.join(self._autosave_directory, "%04d " % (self.num... | [
"def",
"autosave",
"(",
"self",
")",
":",
"if",
"self",
".",
"button_autosave",
".",
"is_checked",
"(",
")",
":",
"self",
".",
"save_file",
"(",
"_os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_autosave_directory",
",",
"\"%04d \"",
"%",
"(",
"self... | Autosaves the currently stored data, but only if autosave is checked! | [
"Autosaves",
"the",
"currently",
"stored",
"data",
"but",
"only",
"if",
"autosave",
"is",
"checked!"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2842-L2853 | train |
Spinmob/spinmob | egg/_gui.py | DataboxPlot.autozoom | def autozoom(self, n=None):
"""
Auto-scales the axes to fit all the data in plot index n. If n == None,
auto-scale everyone.
"""
if n==None:
for p in self.plot_widgets: p.autoRange()
else: self.plot_widgets[n].autoRange()
return self | python | def autozoom(self, n=None):
"""
Auto-scales the axes to fit all the data in plot index n. If n == None,
auto-scale everyone.
"""
if n==None:
for p in self.plot_widgets: p.autoRange()
else: self.plot_widgets[n].autoRange()
return self | [
"def",
"autozoom",
"(",
"self",
",",
"n",
"=",
"None",
")",
":",
"if",
"n",
"==",
"None",
":",
"for",
"p",
"in",
"self",
".",
"plot_widgets",
":",
"p",
".",
"autoRange",
"(",
")",
"else",
":",
"self",
".",
"plot_widgets",
"[",
"n",
"]",
".",
"a... | Auto-scales the axes to fit all the data in plot index n. If n == None,
auto-scale everyone. | [
"Auto",
"-",
"scales",
"the",
"axes",
"to",
"fit",
"all",
"the",
"data",
"in",
"plot",
"index",
"n",
".",
"If",
"n",
"==",
"None",
"auto",
"-",
"scale",
"everyone",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2855-L2864 | train |
Spinmob/spinmob | egg/_gui.py | DataboxPlot._synchronize_controls | def _synchronize_controls(self):
"""
Updates the gui based on button configs.
"""
# whether the script is visible
self.grid_script._widget.setVisible(self.button_script.get_value())
# whether we should be able to edit it.
if not self.combo_autoscript.get_index()... | python | def _synchronize_controls(self):
"""
Updates the gui based on button configs.
"""
# whether the script is visible
self.grid_script._widget.setVisible(self.button_script.get_value())
# whether we should be able to edit it.
if not self.combo_autoscript.get_index()... | [
"def",
"_synchronize_controls",
"(",
"self",
")",
":",
"self",
".",
"grid_script",
".",
"_widget",
".",
"setVisible",
"(",
"self",
".",
"button_script",
".",
"get_value",
"(",
")",
")",
"if",
"not",
"self",
".",
"combo_autoscript",
".",
"get_index",
"(",
"... | Updates the gui based on button configs. | [
"Updates",
"the",
"gui",
"based",
"on",
"button",
"configs",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2866-L2876 | train |
Spinmob/spinmob | egg/_gui.py | DataboxPlot._set_number_of_plots | def _set_number_of_plots(self, n):
"""
Adjusts number of plots & curves to the desired value the gui.
"""
# multi plot, right number of plots and curves = great!
if self.button_multi.is_checked() \
and len(self._curves) == len(self.plot_widgets) \
a... | python | def _set_number_of_plots(self, n):
"""
Adjusts number of plots & curves to the desired value the gui.
"""
# multi plot, right number of plots and curves = great!
if self.button_multi.is_checked() \
and len(self._curves) == len(self.plot_widgets) \
a... | [
"def",
"_set_number_of_plots",
"(",
"self",
",",
"n",
")",
":",
"if",
"self",
".",
"button_multi",
".",
"is_checked",
"(",
")",
"and",
"len",
"(",
"self",
".",
"_curves",
")",
"==",
"len",
"(",
"self",
".",
"plot_widgets",
")",
"and",
"len",
"(",
"se... | Adjusts number of plots & curves to the desired value the gui. | [
"Adjusts",
"number",
"of",
"plots",
"&",
"curves",
"to",
"the",
"desired",
"value",
"the",
"gui",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/egg/_gui.py#L2879-L2945 | train |
thriftrw/thriftrw-python | thriftrw/compile/scope.py | Scope.resolve_const_spec | def resolve_const_spec(self, name, lineno):
"""Finds and links the ConstSpec with the given name."""
if name in self.const_specs:
return self.const_specs[name].link(self)
if '.' in name:
include_name, component = name.split('.', 1)
if include_name in self.in... | python | def resolve_const_spec(self, name, lineno):
"""Finds and links the ConstSpec with the given name."""
if name in self.const_specs:
return self.const_specs[name].link(self)
if '.' in name:
include_name, component = name.split('.', 1)
if include_name in self.in... | [
"def",
"resolve_const_spec",
"(",
"self",
",",
"name",
",",
"lineno",
")",
":",
"if",
"name",
"in",
"self",
".",
"const_specs",
":",
"return",
"self",
".",
"const_specs",
"[",
"name",
"]",
".",
"link",
"(",
"self",
")",
"if",
"'.'",
"in",
"name",
":"... | Finds and links the ConstSpec with the given name. | [
"Finds",
"and",
"links",
"the",
"ConstSpec",
"with",
"the",
"given",
"name",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/compile/scope.py#L76-L93 | train |
thriftrw/thriftrw-python | thriftrw/compile/scope.py | Scope.resolve_type_spec | def resolve_type_spec(self, name, lineno):
"""Finds and links the TypeSpec with the given name."""
if name in self.type_specs:
return self.type_specs[name].link(self)
if '.' in name:
include_name, component = name.split('.', 1)
if include_name in self.includ... | python | def resolve_type_spec(self, name, lineno):
"""Finds and links the TypeSpec with the given name."""
if name in self.type_specs:
return self.type_specs[name].link(self)
if '.' in name:
include_name, component = name.split('.', 1)
if include_name in self.includ... | [
"def",
"resolve_type_spec",
"(",
"self",
",",
"name",
",",
"lineno",
")",
":",
"if",
"name",
"in",
"self",
".",
"type_specs",
":",
"return",
"self",
".",
"type_specs",
"[",
"name",
"]",
".",
"link",
"(",
"self",
")",
"if",
"'.'",
"in",
"name",
":",
... | Finds and links the TypeSpec with the given name. | [
"Finds",
"and",
"links",
"the",
"TypeSpec",
"with",
"the",
"given",
"name",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/compile/scope.py#L95-L112 | train |
thriftrw/thriftrw-python | thriftrw/compile/scope.py | Scope.resolve_service_spec | def resolve_service_spec(self, name, lineno):
"""Finds and links the ServiceSpec with the given name."""
if name in self.service_specs:
return self.service_specs[name].link(self)
if '.' in name:
include_name, component = name.split('.', 2)
if include_name in... | python | def resolve_service_spec(self, name, lineno):
"""Finds and links the ServiceSpec with the given name."""
if name in self.service_specs:
return self.service_specs[name].link(self)
if '.' in name:
include_name, component = name.split('.', 2)
if include_name in... | [
"def",
"resolve_service_spec",
"(",
"self",
",",
"name",
",",
"lineno",
")",
":",
"if",
"name",
"in",
"self",
".",
"service_specs",
":",
"return",
"self",
".",
"service_specs",
"[",
"name",
"]",
".",
"link",
"(",
"self",
")",
"if",
"'.'",
"in",
"name",... | Finds and links the ServiceSpec with the given name. | [
"Finds",
"and",
"links",
"the",
"ServiceSpec",
"with",
"the",
"given",
"name",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/compile/scope.py#L114-L131 | train |
thriftrw/thriftrw-python | thriftrw/compile/scope.py | Scope.add_include | def add_include(self, name, included_scope, module):
"""Register an imported module into this scope.
Raises ``ThriftCompilerError`` if the name has already been used.
"""
# The compiler already ensures this. If we still get here with a
# conflict, that's a bug.
assert na... | python | def add_include(self, name, included_scope, module):
"""Register an imported module into this scope.
Raises ``ThriftCompilerError`` if the name has already been used.
"""
# The compiler already ensures this. If we still get here with a
# conflict, that's a bug.
assert na... | [
"def",
"add_include",
"(",
"self",
",",
"name",
",",
"included_scope",
",",
"module",
")",
":",
"assert",
"name",
"not",
"in",
"self",
".",
"included_scopes",
"self",
".",
"included_scopes",
"[",
"name",
"]",
"=",
"included_scope",
"self",
".",
"add_surface"... | Register an imported module into this scope.
Raises ``ThriftCompilerError`` if the name has already been used. | [
"Register",
"an",
"imported",
"module",
"into",
"this",
"scope",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/compile/scope.py#L133-L143 | train |
thriftrw/thriftrw-python | thriftrw/compile/scope.py | Scope.add_service_spec | def add_service_spec(self, service_spec):
"""Registers the given ``ServiceSpec`` into the scope.
Raises ``ThriftCompilerError`` if the name has already been used.
"""
assert service_spec is not None
if service_spec.name in self.service_specs:
raise ThriftCompilerErr... | python | def add_service_spec(self, service_spec):
"""Registers the given ``ServiceSpec`` into the scope.
Raises ``ThriftCompilerError`` if the name has already been used.
"""
assert service_spec is not None
if service_spec.name in self.service_specs:
raise ThriftCompilerErr... | [
"def",
"add_service_spec",
"(",
"self",
",",
"service_spec",
")",
":",
"assert",
"service_spec",
"is",
"not",
"None",
"if",
"service_spec",
".",
"name",
"in",
"self",
".",
"service_specs",
":",
"raise",
"ThriftCompilerError",
"(",
"'Cannot define service \"%s\". Tha... | Registers the given ``ServiceSpec`` into the scope.
Raises ``ThriftCompilerError`` if the name has already been used. | [
"Registers",
"the",
"given",
"ServiceSpec",
"into",
"the",
"scope",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/compile/scope.py#L145-L157 | train |
thriftrw/thriftrw-python | thriftrw/compile/scope.py | Scope.add_const_spec | def add_const_spec(self, const_spec):
"""Adds a ConstSpec to the compliation scope.
If the ConstSpec's ``save`` attribute is True, the constant will be
added to the module at the top-level.
"""
if const_spec.name in self.const_specs:
raise ThriftCompilerError(
... | python | def add_const_spec(self, const_spec):
"""Adds a ConstSpec to the compliation scope.
If the ConstSpec's ``save`` attribute is True, the constant will be
added to the module at the top-level.
"""
if const_spec.name in self.const_specs:
raise ThriftCompilerError(
... | [
"def",
"add_const_spec",
"(",
"self",
",",
"const_spec",
")",
":",
"if",
"const_spec",
".",
"name",
"in",
"self",
".",
"const_specs",
":",
"raise",
"ThriftCompilerError",
"(",
"'Cannot define constant \"%s\". That name is already taken.'",
"%",
"const_spec",
".",
"nam... | Adds a ConstSpec to the compliation scope.
If the ConstSpec's ``save`` attribute is True, the constant will be
added to the module at the top-level. | [
"Adds",
"a",
"ConstSpec",
"to",
"the",
"compliation",
"scope",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/compile/scope.py#L159-L170 | train |
thriftrw/thriftrw-python | thriftrw/compile/scope.py | Scope.add_surface | def add_surface(self, name, surface):
"""Adds a top-level attribute with the given name to the module."""
assert surface is not None
if hasattr(self.module, name):
raise ThriftCompilerError(
'Cannot define "%s". The name has already been used.' % name
)
... | python | def add_surface(self, name, surface):
"""Adds a top-level attribute with the given name to the module."""
assert surface is not None
if hasattr(self.module, name):
raise ThriftCompilerError(
'Cannot define "%s". The name has already been used.' % name
)
... | [
"def",
"add_surface",
"(",
"self",
",",
"name",
",",
"surface",
")",
":",
"assert",
"surface",
"is",
"not",
"None",
"if",
"hasattr",
"(",
"self",
".",
"module",
",",
"name",
")",
":",
"raise",
"ThriftCompilerError",
"(",
"'Cannot define \"%s\". The name has al... | Adds a top-level attribute with the given name to the module. | [
"Adds",
"a",
"top",
"-",
"level",
"attribute",
"with",
"the",
"given",
"name",
"to",
"the",
"module",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/compile/scope.py#L172-L181 | train |
thriftrw/thriftrw-python | thriftrw/compile/scope.py | Scope.add_type_spec | def add_type_spec(self, name, spec, lineno):
"""Adds the given type to the scope.
:param str name:
Name of the new type
:param spec:
``TypeSpec`` object containing information on the type, or a
``TypeReference`` if this is meant to be resolved during the
... | python | def add_type_spec(self, name, spec, lineno):
"""Adds the given type to the scope.
:param str name:
Name of the new type
:param spec:
``TypeSpec`` object containing information on the type, or a
``TypeReference`` if this is meant to be resolved during the
... | [
"def",
"add_type_spec",
"(",
"self",
",",
"name",
",",
"spec",
",",
"lineno",
")",
":",
"assert",
"type",
"is",
"not",
"None",
"if",
"name",
"in",
"self",
".",
"type_specs",
":",
"raise",
"ThriftCompilerError",
"(",
"'Cannot define type \"%s\" at line %d. '",
... | Adds the given type to the scope.
:param str name:
Name of the new type
:param spec:
``TypeSpec`` object containing information on the type, or a
``TypeReference`` if this is meant to be resolved during the
``link`` stage.
:param lineno:
... | [
"Adds",
"the",
"given",
"type",
"to",
"the",
"scope",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/compile/scope.py#L183-L204 | train |
Spinmob/spinmob | _functions.py | coarsen_matrix | def coarsen_matrix(Z, xlevel=0, ylevel=0, method='average'):
"""
This returns a coarsened numpy matrix.
method can be 'average', 'maximum', or 'minimum'
"""
# coarsen x
if not ylevel:
Z_coarsened = Z
else:
temp = []
for z in Z: temp.append(coarsen_array(z, ylevel, m... | python | def coarsen_matrix(Z, xlevel=0, ylevel=0, method='average'):
"""
This returns a coarsened numpy matrix.
method can be 'average', 'maximum', or 'minimum'
"""
# coarsen x
if not ylevel:
Z_coarsened = Z
else:
temp = []
for z in Z: temp.append(coarsen_array(z, ylevel, m... | [
"def",
"coarsen_matrix",
"(",
"Z",
",",
"xlevel",
"=",
"0",
",",
"ylevel",
"=",
"0",
",",
"method",
"=",
"'average'",
")",
":",
"if",
"not",
"ylevel",
":",
"Z_coarsened",
"=",
"Z",
"else",
":",
"temp",
"=",
"[",
"]",
"for",
"z",
"in",
"Z",
":",
... | This returns a coarsened numpy matrix.
method can be 'average', 'maximum', or 'minimum' | [
"This",
"returns",
"a",
"coarsened",
"numpy",
"matrix",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L128-L162 | train |
Spinmob/spinmob | _functions.py | erange | def erange(start, end, steps):
"""
Returns a numpy array over the specified range taking geometric steps.
See also numpy.logspace()
"""
if start == 0:
print("Nothing you multiply zero by gives you anything but zero. Try picking something small.")
return None
if end == 0:
... | python | def erange(start, end, steps):
"""
Returns a numpy array over the specified range taking geometric steps.
See also numpy.logspace()
"""
if start == 0:
print("Nothing you multiply zero by gives you anything but zero. Try picking something small.")
return None
if end == 0:
... | [
"def",
"erange",
"(",
"start",
",",
"end",
",",
"steps",
")",
":",
"if",
"start",
"==",
"0",
":",
"print",
"(",
"\"Nothing you multiply zero by gives you anything but zero. Try picking something small.\"",
")",
"return",
"None",
"if",
"end",
"==",
"0",
":",
"print... | Returns a numpy array over the specified range taking geometric steps.
See also numpy.logspace() | [
"Returns",
"a",
"numpy",
"array",
"over",
"the",
"specified",
"range",
"taking",
"geometric",
"steps",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L165-L188 | train |
Spinmob/spinmob | _functions.py | is_a_number | def is_a_number(s):
"""
This takes an object and determines whether it's a number or a string
representing a number.
"""
if _s.fun.is_iterable(s) and not type(s) == str: return False
try:
float(s)
return 1
except:
try:
complex(s)
return 2
... | python | def is_a_number(s):
"""
This takes an object and determines whether it's a number or a string
representing a number.
"""
if _s.fun.is_iterable(s) and not type(s) == str: return False
try:
float(s)
return 1
except:
try:
complex(s)
return 2
... | [
"def",
"is_a_number",
"(",
"s",
")",
":",
"if",
"_s",
".",
"fun",
".",
"is_iterable",
"(",
"s",
")",
"and",
"not",
"type",
"(",
"s",
")",
"==",
"str",
":",
"return",
"False",
"try",
":",
"float",
"(",
"s",
")",
"return",
"1",
"except",
":",
"tr... | This takes an object and determines whether it's a number or a string
representing a number. | [
"This",
"takes",
"an",
"object",
"and",
"determines",
"whether",
"it",
"s",
"a",
"number",
"or",
"a",
"string",
"representing",
"a",
"number",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L190-L209 | train |
Spinmob/spinmob | _functions.py | array_shift | def array_shift(a, n, fill="average"):
"""
This will return an array with all the elements shifted forward in index by n.
a is the array
n is the amount by which to shift (can be positive or negative)
fill="average" fill the new empty elements with the average of the array
fill="wrap" ... | python | def array_shift(a, n, fill="average"):
"""
This will return an array with all the elements shifted forward in index by n.
a is the array
n is the amount by which to shift (can be positive or negative)
fill="average" fill the new empty elements with the average of the array
fill="wrap" ... | [
"def",
"array_shift",
"(",
"a",
",",
"n",
",",
"fill",
"=",
"\"average\"",
")",
":",
"new_a",
"=",
"_n",
".",
"array",
"(",
"a",
")",
"if",
"n",
"==",
"0",
":",
"return",
"new_a",
"fill_array",
"=",
"_n",
".",
"array",
"(",
"[",
"]",
")",
"fill... | This will return an array with all the elements shifted forward in index by n.
a is the array
n is the amount by which to shift (can be positive or negative)
fill="average" fill the new empty elements with the average of the array
fill="wrap" fill the new empty elements with the lopped-of... | [
"This",
"will",
"return",
"an",
"array",
"with",
"all",
"the",
"elements",
"shifted",
"forward",
"in",
"index",
"by",
"n",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L224-L259 | train |
Spinmob/spinmob | _functions.py | assemble_covariance | def assemble_covariance(error, correlation):
"""
This takes an error vector and a correlation matrix and assembles the covariance
"""
covariance = []
for n in range(0, len(error)):
covariance.append([])
for m in range(0, len(error)):
covariance[n].append(correlation[n][m... | python | def assemble_covariance(error, correlation):
"""
This takes an error vector and a correlation matrix and assembles the covariance
"""
covariance = []
for n in range(0, len(error)):
covariance.append([])
for m in range(0, len(error)):
covariance[n].append(correlation[n][m... | [
"def",
"assemble_covariance",
"(",
"error",
",",
"correlation",
")",
":",
"covariance",
"=",
"[",
"]",
"for",
"n",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"error",
")",
")",
":",
"covariance",
".",
"append",
"(",
"[",
"]",
")",
"for",
"m",
"in",
... | This takes an error vector and a correlation matrix and assembles the covariance | [
"This",
"takes",
"an",
"error",
"vector",
"and",
"a",
"correlation",
"matrix",
"and",
"assembles",
"the",
"covariance"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L263-L273 | train |
Spinmob/spinmob | _functions.py | combine_dictionaries | def combine_dictionaries(a, b):
"""
returns the combined dictionary. a's values preferentially chosen
"""
c = {}
for key in list(b.keys()): c[key]=b[key]
for key in list(a.keys()): c[key]=a[key]
return c | python | def combine_dictionaries(a, b):
"""
returns the combined dictionary. a's values preferentially chosen
"""
c = {}
for key in list(b.keys()): c[key]=b[key]
for key in list(a.keys()): c[key]=a[key]
return c | [
"def",
"combine_dictionaries",
"(",
"a",
",",
"b",
")",
":",
"c",
"=",
"{",
"}",
"for",
"key",
"in",
"list",
"(",
"b",
".",
"keys",
"(",
")",
")",
":",
"c",
"[",
"key",
"]",
"=",
"b",
"[",
"key",
"]",
"for",
"key",
"in",
"list",
"(",
"a",
... | returns the combined dictionary. a's values preferentially chosen | [
"returns",
"the",
"combined",
"dictionary",
".",
"a",
"s",
"values",
"preferentially",
"chosen"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L290-L298 | train |
Spinmob/spinmob | _functions.py | decompose_covariance | def decompose_covariance(c):
"""
This decomposes a covariance matrix into an error vector and a correlation matrix
"""
# make it a kickass copy of the original
c = _n.array(c)
# first get the error vector
e = []
for n in range(0, len(c[0])): e.append(_n.sqrt(c[n][n]))
# now cycle ... | python | def decompose_covariance(c):
"""
This decomposes a covariance matrix into an error vector and a correlation matrix
"""
# make it a kickass copy of the original
c = _n.array(c)
# first get the error vector
e = []
for n in range(0, len(c[0])): e.append(_n.sqrt(c[n][n]))
# now cycle ... | [
"def",
"decompose_covariance",
"(",
"c",
")",
":",
"c",
"=",
"_n",
".",
"array",
"(",
"c",
")",
"e",
"=",
"[",
"]",
"for",
"n",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"c",
"[",
"0",
"]",
")",
")",
":",
"e",
".",
"append",
"(",
"_n",
".... | This decomposes a covariance matrix into an error vector and a correlation matrix | [
"This",
"decomposes",
"a",
"covariance",
"matrix",
"into",
"an",
"error",
"vector",
"and",
"a",
"correlation",
"matrix"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L326-L343 | train |
Spinmob/spinmob | _functions.py | derivative_fit | def derivative_fit(xdata, ydata, neighbors=1):
"""
loops over the data points, performing a least-squares linear fit of the
nearest neighbors at each point. Returns an array of x-values and slopes.
xdata should probably be well-ordered.
neighbors How many data point on the left and right to incl... | python | def derivative_fit(xdata, ydata, neighbors=1):
"""
loops over the data points, performing a least-squares linear fit of the
nearest neighbors at each point. Returns an array of x-values and slopes.
xdata should probably be well-ordered.
neighbors How many data point on the left and right to incl... | [
"def",
"derivative_fit",
"(",
"xdata",
",",
"ydata",
",",
"neighbors",
"=",
"1",
")",
":",
"x",
"=",
"[",
"]",
"dydx",
"=",
"[",
"]",
"nmax",
"=",
"len",
"(",
"xdata",
")",
"-",
"1",
"for",
"n",
"in",
"range",
"(",
"nmax",
"+",
"1",
")",
":",... | loops over the data points, performing a least-squares linear fit of the
nearest neighbors at each point. Returns an array of x-values and slopes.
xdata should probably be well-ordered.
neighbors How many data point on the left and right to include. | [
"loops",
"over",
"the",
"data",
"points",
"performing",
"a",
"least",
"-",
"squares",
"linear",
"fit",
"of",
"the",
"nearest",
"neighbors",
"at",
"each",
"point",
".",
"Returns",
"an",
"array",
"of",
"x",
"-",
"values",
"and",
"slopes",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L360-L389 | train |
Spinmob/spinmob | _functions.py | dumbguy_minimize | def dumbguy_minimize(f, xmin, xmax, xstep):
"""
This just steps x and looks for a peak
returns x, f(x)
"""
prev = f(xmin)
this = f(xmin+xstep)
for x in frange(xmin+xstep,xmax,xstep):
next = f(x+xstep)
# see if we're on top
if this < prev and this < next: return x, ... | python | def dumbguy_minimize(f, xmin, xmax, xstep):
"""
This just steps x and looks for a peak
returns x, f(x)
"""
prev = f(xmin)
this = f(xmin+xstep)
for x in frange(xmin+xstep,xmax,xstep):
next = f(x+xstep)
# see if we're on top
if this < prev and this < next: return x, ... | [
"def",
"dumbguy_minimize",
"(",
"f",
",",
"xmin",
",",
"xmax",
",",
"xstep",
")",
":",
"prev",
"=",
"f",
"(",
"xmin",
")",
"this",
"=",
"f",
"(",
"xmin",
"+",
"xstep",
")",
"for",
"x",
"in",
"frange",
"(",
"xmin",
"+",
"xstep",
",",
"xmax",
","... | This just steps x and looks for a peak
returns x, f(x) | [
"This",
"just",
"steps",
"x",
"and",
"looks",
"for",
"a",
"peak"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L477-L495 | train |
Spinmob/spinmob | _functions.py | elements_are_numbers | def elements_are_numbers(array):
"""
Tests whether the elements of the supplied array are numbers.
"""
# empty case
if len(array) == 0: return 0
output_value = 1
for x in array:
# test it and die if it's not a number
test = is_a_number(x)
if not test: return False
... | python | def elements_are_numbers(array):
"""
Tests whether the elements of the supplied array are numbers.
"""
# empty case
if len(array) == 0: return 0
output_value = 1
for x in array:
# test it and die if it's not a number
test = is_a_number(x)
if not test: return False
... | [
"def",
"elements_are_numbers",
"(",
"array",
")",
":",
"if",
"len",
"(",
"array",
")",
"==",
"0",
":",
"return",
"0",
"output_value",
"=",
"1",
"for",
"x",
"in",
"array",
":",
"test",
"=",
"is_a_number",
"(",
"x",
")",
"if",
"not",
"test",
":",
"re... | Tests whether the elements of the supplied array are numbers. | [
"Tests",
"whether",
"the",
"elements",
"of",
"the",
"supplied",
"array",
"are",
"numbers",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L497-L515 | train |
Spinmob/spinmob | _functions.py | find_N_peaks | def find_N_peaks(array, N=4, max_iterations=100, rec_max_iterations=3, recursion=1):
"""
This will run the find_peaks algorythm, adjusting the baseline until exactly N peaks are found.
"""
if recursion<0: return None
# get an initial guess as to the baseline
ymin = min(array)
ymax = max(ar... | python | def find_N_peaks(array, N=4, max_iterations=100, rec_max_iterations=3, recursion=1):
"""
This will run the find_peaks algorythm, adjusting the baseline until exactly N peaks are found.
"""
if recursion<0: return None
# get an initial guess as to the baseline
ymin = min(array)
ymax = max(ar... | [
"def",
"find_N_peaks",
"(",
"array",
",",
"N",
"=",
"4",
",",
"max_iterations",
"=",
"100",
",",
"rec_max_iterations",
"=",
"3",
",",
"recursion",
"=",
"1",
")",
":",
"if",
"recursion",
"<",
"0",
":",
"return",
"None",
"ymin",
"=",
"min",
"(",
"array... | This will run the find_peaks algorythm, adjusting the baseline until exactly N peaks are found. | [
"This",
"will",
"run",
"the",
"find_peaks",
"algorythm",
"adjusting",
"the",
"baseline",
"until",
"exactly",
"N",
"peaks",
"are",
"found",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L547-L588 | train |
Spinmob/spinmob | _functions.py | find_peaks | def find_peaks(array, baseline=0.1, return_subarrays=False):
"""
This will try to identify the indices of the peaks in array, returning a list of indices in ascending order.
Runs along the data set until it jumps above baseline. Then it considers all the subsequent data above the baseline
as part of th... | python | def find_peaks(array, baseline=0.1, return_subarrays=False):
"""
This will try to identify the indices of the peaks in array, returning a list of indices in ascending order.
Runs along the data set until it jumps above baseline. Then it considers all the subsequent data above the baseline
as part of th... | [
"def",
"find_peaks",
"(",
"array",
",",
"baseline",
"=",
"0.1",
",",
"return_subarrays",
"=",
"False",
")",
":",
"peaks",
"=",
"[",
"]",
"if",
"return_subarrays",
":",
"subarray_values",
"=",
"[",
"]",
"subarray_indices",
"=",
"[",
"]",
"n",
"=",
"0",
... | This will try to identify the indices of the peaks in array, returning a list of indices in ascending order.
Runs along the data set until it jumps above baseline. Then it considers all the subsequent data above the baseline
as part of the peak, and records the maximum of this data as one peak value. | [
"This",
"will",
"try",
"to",
"identify",
"the",
"indices",
"of",
"the",
"peaks",
"in",
"array",
"returning",
"a",
"list",
"of",
"indices",
"in",
"ascending",
"order",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L591-L636 | train |
Spinmob/spinmob | _functions.py | find_zero_bisect | def find_zero_bisect(f, xmin, xmax, xprecision):
"""
This will bisect the range and zero in on zero.
"""
if f(xmax)*f(xmin) > 0:
print("find_zero_bisect(): no zero on the range",xmin,"to",xmax)
return None
temp = min(xmin,xmax)
xmax = max(xmin,xmax)
xmin = temp
xmid = (... | python | def find_zero_bisect(f, xmin, xmax, xprecision):
"""
This will bisect the range and zero in on zero.
"""
if f(xmax)*f(xmin) > 0:
print("find_zero_bisect(): no zero on the range",xmin,"to",xmax)
return None
temp = min(xmin,xmax)
xmax = max(xmin,xmax)
xmin = temp
xmid = (... | [
"def",
"find_zero_bisect",
"(",
"f",
",",
"xmin",
",",
"xmax",
",",
"xprecision",
")",
":",
"if",
"f",
"(",
"xmax",
")",
"*",
"f",
"(",
"xmin",
")",
">",
"0",
":",
"print",
"(",
"\"find_zero_bisect(): no zero on the range\"",
",",
"xmin",
",",
"\"to\"",
... | This will bisect the range and zero in on zero. | [
"This",
"will",
"bisect",
"the",
"range",
"and",
"zero",
"in",
"on",
"zero",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L701-L735 | train |
Spinmob/spinmob | _functions.py | frange | def frange(start, end, inc=1.0):
"""
A range function, that accepts float increments and reversed direction.
See also numpy.linspace()
"""
start = 1.0*start
end = 1.0*end
inc = 1.0*inc
# if we got a dumb increment
if not inc: return _n.array([start,end])
# if the incremen... | python | def frange(start, end, inc=1.0):
"""
A range function, that accepts float increments and reversed direction.
See also numpy.linspace()
"""
start = 1.0*start
end = 1.0*end
inc = 1.0*inc
# if we got a dumb increment
if not inc: return _n.array([start,end])
# if the incremen... | [
"def",
"frange",
"(",
"start",
",",
"end",
",",
"inc",
"=",
"1.0",
")",
":",
"start",
"=",
"1.0",
"*",
"start",
"end",
"=",
"1.0",
"*",
"end",
"inc",
"=",
"1.0",
"*",
"inc",
"if",
"not",
"inc",
":",
"return",
"_n",
".",
"array",
"(",
"[",
"st... | A range function, that accepts float increments and reversed direction.
See also numpy.linspace() | [
"A",
"range",
"function",
"that",
"accepts",
"float",
"increments",
"and",
"reversed",
"direction",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L770-L791 | train |
Spinmob/spinmob | _functions.py | get_shell_history | def get_shell_history():
"""
This only works with some shells.
"""
# try for ipython
if 'get_ipython' in globals():
a = list(get_ipython().history_manager.input_hist_raw)
a.reverse()
return a
elif 'SPYDER_SHELL_ID' in _os.environ:
try:
p = _os.path.jo... | python | def get_shell_history():
"""
This only works with some shells.
"""
# try for ipython
if 'get_ipython' in globals():
a = list(get_ipython().history_manager.input_hist_raw)
a.reverse()
return a
elif 'SPYDER_SHELL_ID' in _os.environ:
try:
p = _os.path.jo... | [
"def",
"get_shell_history",
"(",
")",
":",
"if",
"'get_ipython'",
"in",
"globals",
"(",
")",
":",
"a",
"=",
"list",
"(",
"get_ipython",
"(",
")",
".",
"history_manager",
".",
"input_hist_raw",
")",
"a",
".",
"reverse",
"(",
")",
"return",
"a",
"elif",
... | This only works with some shells. | [
"This",
"only",
"works",
"with",
"some",
"shells",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L850-L881 | train |
Spinmob/spinmob | _functions.py | index | def index(value, array):
"""
Array search that behaves like I want it to. Totally dumb, I know.
"""
i = array.searchsorted(value)
if i == len(array): return -1
else: return i | python | def index(value, array):
"""
Array search that behaves like I want it to. Totally dumb, I know.
"""
i = array.searchsorted(value)
if i == len(array): return -1
else: return i | [
"def",
"index",
"(",
"value",
",",
"array",
")",
":",
"i",
"=",
"array",
".",
"searchsorted",
"(",
"value",
")",
"if",
"i",
"==",
"len",
"(",
"array",
")",
":",
"return",
"-",
"1",
"else",
":",
"return",
"i"
] | Array search that behaves like I want it to. Totally dumb, I know. | [
"Array",
"search",
"that",
"behaves",
"like",
"I",
"want",
"it",
"to",
".",
"Totally",
"dumb",
"I",
"know",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L896-L902 | train |
Spinmob/spinmob | _functions.py | index_next_crossing | def index_next_crossing(value, array, starting_index=0, direction=1):
"""
starts at starting_index, and walks through the array until
it finds a crossing point with value
set direction=-1 for down crossing
"""
for n in range(starting_index, len(array)-1):
if (value-array[n] )*directi... | python | def index_next_crossing(value, array, starting_index=0, direction=1):
"""
starts at starting_index, and walks through the array until
it finds a crossing point with value
set direction=-1 for down crossing
"""
for n in range(starting_index, len(array)-1):
if (value-array[n] )*directi... | [
"def",
"index_next_crossing",
"(",
"value",
",",
"array",
",",
"starting_index",
"=",
"0",
",",
"direction",
"=",
"1",
")",
":",
"for",
"n",
"in",
"range",
"(",
"starting_index",
",",
"len",
"(",
"array",
")",
"-",
"1",
")",
":",
"if",
"(",
"value",
... | starts at starting_index, and walks through the array until
it finds a crossing point with value
set direction=-1 for down crossing | [
"starts",
"at",
"starting_index",
"and",
"walks",
"through",
"the",
"array",
"until",
"it",
"finds",
"a",
"crossing",
"point",
"with",
"value"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L913-L926 | train |
Spinmob/spinmob | _functions.py | insert_ordered | def insert_ordered(value, array):
"""
This will insert the value into the array, keeping it sorted, and returning the
index where it was inserted
"""
index = 0
# search for the last array item that value is larger than
for n in range(0,len(array)):
if value >= array[n]: index = n+1... | python | def insert_ordered(value, array):
"""
This will insert the value into the array, keeping it sorted, and returning the
index where it was inserted
"""
index = 0
# search for the last array item that value is larger than
for n in range(0,len(array)):
if value >= array[n]: index = n+1... | [
"def",
"insert_ordered",
"(",
"value",
",",
"array",
")",
":",
"index",
"=",
"0",
"for",
"n",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"array",
")",
")",
":",
"if",
"value",
">=",
"array",
"[",
"n",
"]",
":",
"index",
"=",
"n",
"+",
"1",
"ar... | This will insert the value into the array, keeping it sorted, and returning the
index where it was inserted | [
"This",
"will",
"insert",
"the",
"value",
"into",
"the",
"array",
"keeping",
"it",
"sorted",
"and",
"returning",
"the",
"index",
"where",
"it",
"was",
"inserted"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L931-L944 | train |
Spinmob/spinmob | _functions.py | replace_in_files | def replace_in_files(search, replace, depth=0, paths=None, confirm=True):
"""
Does a line-by-line search and replace, but only up to the "depth" line.
"""
# have the user select some files
if paths==None:
paths = _s.dialogs.MultipleFiles('DIS AND DAT|*.*')
if paths == []: return
fo... | python | def replace_in_files(search, replace, depth=0, paths=None, confirm=True):
"""
Does a line-by-line search and replace, but only up to the "depth" line.
"""
# have the user select some files
if paths==None:
paths = _s.dialogs.MultipleFiles('DIS AND DAT|*.*')
if paths == []: return
fo... | [
"def",
"replace_in_files",
"(",
"search",
",",
"replace",
",",
"depth",
"=",
"0",
",",
"paths",
"=",
"None",
",",
"confirm",
"=",
"True",
")",
":",
"if",
"paths",
"==",
"None",
":",
"paths",
"=",
"_s",
".",
"dialogs",
".",
"MultipleFiles",
"(",
"'DIS... | Does a line-by-line search and replace, but only up to the "depth" line. | [
"Does",
"a",
"line",
"-",
"by",
"-",
"line",
"search",
"and",
"replace",
"but",
"only",
"up",
"to",
"the",
"depth",
"line",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L1232-L1262 | train |
Spinmob/spinmob | _functions.py | replace_lines_in_files | def replace_lines_in_files(search_string, replacement_line):
"""
Finds lines containing the search string and replaces the whole line with
the specified replacement string.
"""
# have the user select some files
paths = _s.dialogs.MultipleFiles('DIS AND DAT|*.*')
if paths == []: return
... | python | def replace_lines_in_files(search_string, replacement_line):
"""
Finds lines containing the search string and replaces the whole line with
the specified replacement string.
"""
# have the user select some files
paths = _s.dialogs.MultipleFiles('DIS AND DAT|*.*')
if paths == []: return
... | [
"def",
"replace_lines_in_files",
"(",
"search_string",
",",
"replacement_line",
")",
":",
"paths",
"=",
"_s",
".",
"dialogs",
".",
"MultipleFiles",
"(",
"'DIS AND DAT|*.*'",
")",
"if",
"paths",
"==",
"[",
"]",
":",
"return",
"for",
"path",
"in",
"paths",
":"... | Finds lines containing the search string and replaces the whole line with
the specified replacement string. | [
"Finds",
"lines",
"containing",
"the",
"search",
"string",
"and",
"replaces",
"the",
"whole",
"line",
"with",
"the",
"specified",
"replacement",
"string",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L1264-L1284 | train |
Spinmob/spinmob | _functions.py | reverse | def reverse(array):
"""
returns a reversed numpy array
"""
l = list(array)
l.reverse()
return _n.array(l) | python | def reverse(array):
"""
returns a reversed numpy array
"""
l = list(array)
l.reverse()
return _n.array(l) | [
"def",
"reverse",
"(",
"array",
")",
":",
"l",
"=",
"list",
"(",
"array",
")",
"l",
".",
"reverse",
"(",
")",
"return",
"_n",
".",
"array",
"(",
"l",
")"
] | returns a reversed numpy array | [
"returns",
"a",
"reversed",
"numpy",
"array"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L1286-L1292 | train |
Spinmob/spinmob | _functions.py | submatrix | def submatrix(matrix,i1,i2,j1,j2):
"""
returns the submatrix defined by the index bounds i1-i2 and j1-j2
Endpoints included!
"""
new = []
for i in range(i1,i2+1):
new.append(matrix[i][j1:j2+1])
return _n.array(new) | python | def submatrix(matrix,i1,i2,j1,j2):
"""
returns the submatrix defined by the index bounds i1-i2 and j1-j2
Endpoints included!
"""
new = []
for i in range(i1,i2+1):
new.append(matrix[i][j1:j2+1])
return _n.array(new) | [
"def",
"submatrix",
"(",
"matrix",
",",
"i1",
",",
"i2",
",",
"j1",
",",
"j2",
")",
":",
"new",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"i1",
",",
"i2",
"+",
"1",
")",
":",
"new",
".",
"append",
"(",
"matrix",
"[",
"i",
"]",
"[",
"... | returns the submatrix defined by the index bounds i1-i2 and j1-j2
Endpoints included! | [
"returns",
"the",
"submatrix",
"defined",
"by",
"the",
"index",
"bounds",
"i1",
"-",
"i2",
"and",
"j1",
"-",
"j2"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L1405-L1415 | train |
Spinmob/spinmob | _functions.py | trim_data_uber | def trim_data_uber(arrays, conditions):
"""
Non-destructively selects data from the supplied list of arrays based on
the supplied list of conditions. Importantly, if any of the conditions are
not met for the n'th data point, the n'th data point is rejected for
all supplied arrays.
Example
... | python | def trim_data_uber(arrays, conditions):
"""
Non-destructively selects data from the supplied list of arrays based on
the supplied list of conditions. Importantly, if any of the conditions are
not met for the n'th data point, the n'th data point is rejected for
all supplied arrays.
Example
... | [
"def",
"trim_data_uber",
"(",
"arrays",
",",
"conditions",
")",
":",
"if",
"len",
"(",
"conditions",
")",
"==",
"0",
":",
"return",
"arrays",
"if",
"len",
"(",
"arrays",
")",
"==",
"0",
":",
"return",
"[",
"]",
"all_conditions",
"=",
"conditions",
"[",... | Non-destructively selects data from the supplied list of arrays based on
the supplied list of conditions. Importantly, if any of the conditions are
not met for the n'th data point, the n'th data point is rejected for
all supplied arrays.
Example
-------
x = numpy.linspace(0,10,20)
y = num... | [
"Non",
"-",
"destructively",
"selects",
"data",
"from",
"the",
"supplied",
"list",
"of",
"arrays",
"based",
"on",
"the",
"supplied",
"list",
"of",
"conditions",
".",
"Importantly",
"if",
"any",
"of",
"the",
"conditions",
"are",
"not",
"met",
"for",
"the",
... | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_functions.py#L1448-L1478 | train |
fitnr/censusgeocode | censusgeocode/censusgeocode.py | CensusGeocode._fetch | def _fetch(self, searchtype, fields, **kwargs):
'''Fetch a response from the Geocoding API.'''
fields['vintage'] = self.vintage
fields['benchmark'] = self.benchmark
fields['format'] = 'json'
if 'layers' in kwargs:
fields['layers'] = kwargs['layers']
returnty... | python | def _fetch(self, searchtype, fields, **kwargs):
'''Fetch a response from the Geocoding API.'''
fields['vintage'] = self.vintage
fields['benchmark'] = self.benchmark
fields['format'] = 'json'
if 'layers' in kwargs:
fields['layers'] = kwargs['layers']
returnty... | [
"def",
"_fetch",
"(",
"self",
",",
"searchtype",
",",
"fields",
",",
"**",
"kwargs",
")",
":",
"fields",
"[",
"'vintage'",
"]",
"=",
"self",
".",
"vintage",
"fields",
"[",
"'benchmark'",
"]",
"=",
"self",
".",
"benchmark",
"fields",
"[",
"'format'",
"]... | Fetch a response from the Geocoding API. | [
"Fetch",
"a",
"response",
"from",
"the",
"Geocoding",
"API",
"."
] | 9414c331a63fbcfff6b7295cd8935c40ce54c88c | https://github.com/fitnr/censusgeocode/blob/9414c331a63fbcfff6b7295cd8935c40ce54c88c/censusgeocode/censusgeocode.py#L78-L105 | train |
fitnr/censusgeocode | censusgeocode/censusgeocode.py | CensusGeocode.address | def address(self, street, city=None, state=None, zipcode=None, **kwargs):
'''Geocode an address.'''
fields = {
'street': street,
'city': city,
'state': state,
'zip': zipcode,
}
return self._fetch('address', fields, **kwargs) | python | def address(self, street, city=None, state=None, zipcode=None, **kwargs):
'''Geocode an address.'''
fields = {
'street': street,
'city': city,
'state': state,
'zip': zipcode,
}
return self._fetch('address', fields, **kwargs) | [
"def",
"address",
"(",
"self",
",",
"street",
",",
"city",
"=",
"None",
",",
"state",
"=",
"None",
",",
"zipcode",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"fields",
"=",
"{",
"'street'",
":",
"street",
",",
"'city'",
":",
"city",
",",
"'state'"... | Geocode an address. | [
"Geocode",
"an",
"address",
"."
] | 9414c331a63fbcfff6b7295cd8935c40ce54c88c | https://github.com/fitnr/censusgeocode/blob/9414c331a63fbcfff6b7295cd8935c40ce54c88c/censusgeocode/censusgeocode.py#L117-L126 | train |
Spinmob/spinmob | _pylab_colormap.py | colormap.set_name | def set_name(self, name="My Colormap"):
"""
Sets the name.
Make sure the name is something your OS could name a file.
"""
if not type(name)==str:
print("set_name(): Name must be a string.")
return
self._name = name
return self | python | def set_name(self, name="My Colormap"):
"""
Sets the name.
Make sure the name is something your OS could name a file.
"""
if not type(name)==str:
print("set_name(): Name must be a string.")
return
self._name = name
return self | [
"def",
"set_name",
"(",
"self",
",",
"name",
"=",
"\"My Colormap\"",
")",
":",
"if",
"not",
"type",
"(",
"name",
")",
"==",
"str",
":",
"print",
"(",
"\"set_name(): Name must be a string.\"",
")",
"return",
"self",
".",
"_name",
"=",
"name",
"return",
"sel... | Sets the name.
Make sure the name is something your OS could name a file. | [
"Sets",
"the",
"name",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_colormap.py#L136-L146 | train |
Spinmob/spinmob | _pylab_colormap.py | colormap.set_image | def set_image(self, image='auto'):
"""
Set which pylab image to tweak.
"""
if image=="auto": image = _pylab.gca().images[0]
self._image=image
self.update_image() | python | def set_image(self, image='auto'):
"""
Set which pylab image to tweak.
"""
if image=="auto": image = _pylab.gca().images[0]
self._image=image
self.update_image() | [
"def",
"set_image",
"(",
"self",
",",
"image",
"=",
"'auto'",
")",
":",
"if",
"image",
"==",
"\"auto\"",
":",
"image",
"=",
"_pylab",
".",
"gca",
"(",
")",
".",
"images",
"[",
"0",
"]",
"self",
".",
"_image",
"=",
"image",
"self",
".",
"update_imag... | Set which pylab image to tweak. | [
"Set",
"which",
"pylab",
"image",
"to",
"tweak",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_colormap.py#L154-L160 | train |
Spinmob/spinmob | _pylab_colormap.py | colormap.update_image | def update_image(self):
"""
Set's the image's cmap.
"""
if self._image:
self._image.set_cmap(self.get_cmap())
_pylab.draw() | python | def update_image(self):
"""
Set's the image's cmap.
"""
if self._image:
self._image.set_cmap(self.get_cmap())
_pylab.draw() | [
"def",
"update_image",
"(",
"self",
")",
":",
"if",
"self",
".",
"_image",
":",
"self",
".",
"_image",
".",
"set_cmap",
"(",
"self",
".",
"get_cmap",
"(",
")",
")",
"_pylab",
".",
"draw",
"(",
")"
] | Set's the image's cmap. | [
"Set",
"s",
"the",
"image",
"s",
"cmap",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_colormap.py#L162-L168 | train |
Spinmob/spinmob | _pylab_colormap.py | colormap.pop_colorpoint | def pop_colorpoint(self, n=0):
"""
Removes and returns the specified colorpoint. Will always leave two behind.
"""
# make sure we have more than 2; otherwise don't pop it, just return it
if len(self._colorpoint_list) > 2:
# do the popping
x = self._color... | python | def pop_colorpoint(self, n=0):
"""
Removes and returns the specified colorpoint. Will always leave two behind.
"""
# make sure we have more than 2; otherwise don't pop it, just return it
if len(self._colorpoint_list) > 2:
# do the popping
x = self._color... | [
"def",
"pop_colorpoint",
"(",
"self",
",",
"n",
"=",
"0",
")",
":",
"if",
"len",
"(",
"self",
".",
"_colorpoint_list",
")",
">",
"2",
":",
"x",
"=",
"self",
".",
"_colorpoint_list",
".",
"pop",
"(",
"n",
")",
"self",
".",
"_colorpoint_list",
"[",
"... | Removes and returns the specified colorpoint. Will always leave two behind. | [
"Removes",
"and",
"returns",
"the",
"specified",
"colorpoint",
".",
"Will",
"always",
"leave",
"two",
"behind",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_colormap.py#L170-L191 | train |
Spinmob/spinmob | _pylab_colormap.py | colormap.insert_colorpoint | def insert_colorpoint(self, position=0.5, color1=[1.0,1.0,0.0], color2=[1.0,1.0,0.0]):
"""
Inserts the specified color into the list.
"""
L = self._colorpoint_list
# if position = 0 or 1, push the end points inward
if position <= 0.0:
L.insert(0,[0.0,color1... | python | def insert_colorpoint(self, position=0.5, color1=[1.0,1.0,0.0], color2=[1.0,1.0,0.0]):
"""
Inserts the specified color into the list.
"""
L = self._colorpoint_list
# if position = 0 or 1, push the end points inward
if position <= 0.0:
L.insert(0,[0.0,color1... | [
"def",
"insert_colorpoint",
"(",
"self",
",",
"position",
"=",
"0.5",
",",
"color1",
"=",
"[",
"1.0",
",",
"1.0",
",",
"0.0",
"]",
",",
"color2",
"=",
"[",
"1.0",
",",
"1.0",
",",
"0.0",
"]",
")",
":",
"L",
"=",
"self",
".",
"_colorpoint_list",
"... | Inserts the specified color into the list. | [
"Inserts",
"the",
"specified",
"color",
"into",
"the",
"list",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_colormap.py#L193-L220 | train |
Spinmob/spinmob | _pylab_colormap.py | colormap.modify_colorpoint | def modify_colorpoint(self, n, position=0.5, color1=[1.0,1.0,1.0], color2=[1.0,1.0,1.0]):
"""
Changes the values of an existing colorpoint, then updates the colormap.
"""
if n==0.0 : position = 0.0
elif n==len(self._colorpoint_list)-1: position = 1.0
... | python | def modify_colorpoint(self, n, position=0.5, color1=[1.0,1.0,1.0], color2=[1.0,1.0,1.0]):
"""
Changes the values of an existing colorpoint, then updates the colormap.
"""
if n==0.0 : position = 0.0
elif n==len(self._colorpoint_list)-1: position = 1.0
... | [
"def",
"modify_colorpoint",
"(",
"self",
",",
"n",
",",
"position",
"=",
"0.5",
",",
"color1",
"=",
"[",
"1.0",
",",
"1.0",
",",
"1.0",
"]",
",",
"color2",
"=",
"[",
"1.0",
",",
"1.0",
",",
"1.0",
"]",
")",
":",
"if",
"n",
"==",
"0.0",
":",
"... | Changes the values of an existing colorpoint, then updates the colormap. | [
"Changes",
"the",
"values",
"of",
"an",
"existing",
"colorpoint",
"then",
"updates",
"the",
"colormap",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_colormap.py#L222-L232 | train |
Spinmob/spinmob | _pylab_colormap.py | colormap.get_cmap | def get_cmap(self):
"""
Generates a pylab cmap object from the colorpoint data.
"""
# now generate the colormap from the ordered list
r = []
g = []
b = []
for p in self._colorpoint_list:
r.append((p[0], p[1][0]*1.0, p[2][0]*1.0))
g... | python | def get_cmap(self):
"""
Generates a pylab cmap object from the colorpoint data.
"""
# now generate the colormap from the ordered list
r = []
g = []
b = []
for p in self._colorpoint_list:
r.append((p[0], p[1][0]*1.0, p[2][0]*1.0))
g... | [
"def",
"get_cmap",
"(",
"self",
")",
":",
"r",
"=",
"[",
"]",
"g",
"=",
"[",
"]",
"b",
"=",
"[",
"]",
"for",
"p",
"in",
"self",
".",
"_colorpoint_list",
":",
"r",
".",
"append",
"(",
"(",
"p",
"[",
"0",
"]",
",",
"p",
"[",
"1",
"]",
"[",
... | Generates a pylab cmap object from the colorpoint data. | [
"Generates",
"a",
"pylab",
"cmap",
"object",
"from",
"the",
"colorpoint",
"data",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_colormap.py#L234-L252 | train |
Spinmob/spinmob | _pylab_colormap.py | colormap_interface._signal_load | def _signal_load(self):
"""
Load the selected cmap.
"""
# set our name
self.set_name(str(self._combobox_cmaps.currentText()))
# load the colormap
self.load_colormap()
# rebuild the interface
self._build_gui()
self._button_save.setEnable... | python | def _signal_load(self):
"""
Load the selected cmap.
"""
# set our name
self.set_name(str(self._combobox_cmaps.currentText()))
# load the colormap
self.load_colormap()
# rebuild the interface
self._build_gui()
self._button_save.setEnable... | [
"def",
"_signal_load",
"(",
"self",
")",
":",
"self",
".",
"set_name",
"(",
"str",
"(",
"self",
".",
"_combobox_cmaps",
".",
"currentText",
"(",
")",
")",
")",
"self",
".",
"load_colormap",
"(",
")",
"self",
".",
"_build_gui",
"(",
")",
"self",
".",
... | Load the selected cmap. | [
"Load",
"the",
"selected",
"cmap",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_colormap.py#L406-L420 | train |
Spinmob/spinmob | _pylab_colormap.py | colormap_interface._color_dialog_changed | def _color_dialog_changed(self, n, top, c):
"""
Updates the color of the slider.
"""
self._button_save.setEnabled(True)
cp = self._colorpoint_list[n]
# if they're linked, set both
if self._checkboxes[n].isChecked():
self.modify_colorpoint(n, cp[0], [... | python | def _color_dialog_changed(self, n, top, c):
"""
Updates the color of the slider.
"""
self._button_save.setEnabled(True)
cp = self._colorpoint_list[n]
# if they're linked, set both
if self._checkboxes[n].isChecked():
self.modify_colorpoint(n, cp[0], [... | [
"def",
"_color_dialog_changed",
"(",
"self",
",",
"n",
",",
"top",
",",
"c",
")",
":",
"self",
".",
"_button_save",
".",
"setEnabled",
"(",
"True",
")",
"cp",
"=",
"self",
".",
"_colorpoint_list",
"[",
"n",
"]",
"if",
"self",
".",
"_checkboxes",
"[",
... | Updates the color of the slider. | [
"Updates",
"the",
"color",
"of",
"the",
"slider",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_colormap.py#L442-L464 | train |
Spinmob/spinmob | _pylab_colormap.py | colormap_interface._button_plus_clicked | def _button_plus_clicked(self, n):
"""
Create a new colorpoint.
"""
self._button_save.setEnabled(True)
self.insert_colorpoint(self._colorpoint_list[n][0],
self._colorpoint_list[n][1],
self._colorpoint_list[n][2])
... | python | def _button_plus_clicked(self, n):
"""
Create a new colorpoint.
"""
self._button_save.setEnabled(True)
self.insert_colorpoint(self._colorpoint_list[n][0],
self._colorpoint_list[n][1],
self._colorpoint_list[n][2])
... | [
"def",
"_button_plus_clicked",
"(",
"self",
",",
"n",
")",
":",
"self",
".",
"_button_save",
".",
"setEnabled",
"(",
"True",
")",
"self",
".",
"insert_colorpoint",
"(",
"self",
".",
"_colorpoint_list",
"[",
"n",
"]",
"[",
"0",
"]",
",",
"self",
".",
"_... | Create a new colorpoint. | [
"Create",
"a",
"new",
"colorpoint",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_colormap.py#L468-L477 | train |
Spinmob/spinmob | _pylab_colormap.py | colormap_interface._button_minus_clicked | def _button_minus_clicked(self, n):
"""
Remove a new colorpoint.
"""
self._button_save.setEnabled(True)
self.pop_colorpoint(n)
self._build_gui() | python | def _button_minus_clicked(self, n):
"""
Remove a new colorpoint.
"""
self._button_save.setEnabled(True)
self.pop_colorpoint(n)
self._build_gui() | [
"def",
"_button_minus_clicked",
"(",
"self",
",",
"n",
")",
":",
"self",
".",
"_button_save",
".",
"setEnabled",
"(",
"True",
")",
"self",
".",
"pop_colorpoint",
"(",
"n",
")",
"self",
".",
"_build_gui",
"(",
")"
] | Remove a new colorpoint. | [
"Remove",
"a",
"new",
"colorpoint",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_colormap.py#L479-L486 | train |
Spinmob/spinmob | _pylab_colormap.py | colormap_interface._color_button_clicked | def _color_button_clicked(self, n,top):
"""
Opens the dialog.
"""
self._button_save.setEnabled(True)
if top: self._color_dialogs_top[n].open()
else: self._color_dialogs_bottom[n].open() | python | def _color_button_clicked(self, n,top):
"""
Opens the dialog.
"""
self._button_save.setEnabled(True)
if top: self._color_dialogs_top[n].open()
else: self._color_dialogs_bottom[n].open() | [
"def",
"_color_button_clicked",
"(",
"self",
",",
"n",
",",
"top",
")",
":",
"self",
".",
"_button_save",
".",
"setEnabled",
"(",
"True",
")",
"if",
"top",
":",
"self",
".",
"_color_dialogs_top",
"[",
"n",
"]",
".",
"open",
"(",
")",
"else",
":",
"se... | Opens the dialog. | [
"Opens",
"the",
"dialog",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_colormap.py#L497-L504 | train |
Spinmob/spinmob | _pylab_colormap.py | colormap_interface._load_cmap_list | def _load_cmap_list(self):
"""
Searches the colormaps directory for all files, populates the list.
"""
# store the current name
name = self.get_name()
# clear the list
self._combobox_cmaps.blockSignals(True)
self._combobox_cmaps.clear()
# list th... | python | def _load_cmap_list(self):
"""
Searches the colormaps directory for all files, populates the list.
"""
# store the current name
name = self.get_name()
# clear the list
self._combobox_cmaps.blockSignals(True)
self._combobox_cmaps.clear()
# list th... | [
"def",
"_load_cmap_list",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"get_name",
"(",
")",
"self",
".",
"_combobox_cmaps",
".",
"blockSignals",
"(",
"True",
")",
"self",
".",
"_combobox_cmaps",
".",
"clear",
"(",
")",
"paths",
"=",
"_settings",
"."... | Searches the colormaps directory for all files, populates the list. | [
"Searches",
"the",
"colormaps",
"directory",
"for",
"all",
"files",
"populates",
"the",
"list",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_pylab_colormap.py#L507-L527 | train |
Spinmob/spinmob | _dialogs.py | load | def load(filters="*.*", text='Select a file, FACEFACE!', default_directory='default_directory'):
"""
Pops up a dialog for opening a single file. Returns a string path or None.
"""
# make sure the filters contains "*.*" as an option!
if not '*' in filters.split(';'): filters = filters + ";;All files ... | python | def load(filters="*.*", text='Select a file, FACEFACE!', default_directory='default_directory'):
"""
Pops up a dialog for opening a single file. Returns a string path or None.
"""
# make sure the filters contains "*.*" as an option!
if not '*' in filters.split(';'): filters = filters + ";;All files ... | [
"def",
"load",
"(",
"filters",
"=",
"\"*.*\"",
",",
"text",
"=",
"'Select a file, FACEFACE!'",
",",
"default_directory",
"=",
"'default_directory'",
")",
":",
"if",
"not",
"'*'",
"in",
"filters",
".",
"split",
"(",
"';'",
")",
":",
"filters",
"=",
"filters",... | Pops up a dialog for opening a single file. Returns a string path or None. | [
"Pops",
"up",
"a",
"dialog",
"for",
"opening",
"a",
"single",
"file",
".",
"Returns",
"a",
"string",
"path",
"or",
"None",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_dialogs.py#L59-L82 | train |
Spinmob/spinmob | _dialogs.py | load_multiple | def load_multiple(filters="*.*", text='Select some files, FACEFACE!', default_directory='default_directory'):
"""
Pops up a dialog for opening more than one file. Returns a list of string paths or None.
"""
# make sure the filters contains "*.*" as an option!
if not '*' in filters.split(';'): filter... | python | def load_multiple(filters="*.*", text='Select some files, FACEFACE!', default_directory='default_directory'):
"""
Pops up a dialog for opening more than one file. Returns a list of string paths or None.
"""
# make sure the filters contains "*.*" as an option!
if not '*' in filters.split(';'): filter... | [
"def",
"load_multiple",
"(",
"filters",
"=",
"\"*.*\"",
",",
"text",
"=",
"'Select some files, FACEFACE!'",
",",
"default_directory",
"=",
"'default_directory'",
")",
":",
"if",
"not",
"'*'",
"in",
"filters",
".",
"split",
"(",
"';'",
")",
":",
"filters",
"=",... | Pops up a dialog for opening more than one file. Returns a list of string paths or None. | [
"Pops",
"up",
"a",
"dialog",
"for",
"opening",
"more",
"than",
"one",
"file",
".",
"Returns",
"a",
"list",
"of",
"string",
"paths",
"or",
"None",
"."
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_dialogs.py#L85-L109 | train |
Spinmob/spinmob | _prefs.py | Prefs.Dump | def Dump(self):
"""
Dumps the current prefs to the preferences.txt file
"""
prefs_file = open(self.prefs_path, 'w')
for n in range(0,len(self.prefs)):
if len(list(self.prefs.items())[n]) > 1:
prefs_file.write(str(list(self.prefs.items())[n][0]) + ' = '... | python | def Dump(self):
"""
Dumps the current prefs to the preferences.txt file
"""
prefs_file = open(self.prefs_path, 'w')
for n in range(0,len(self.prefs)):
if len(list(self.prefs.items())[n]) > 1:
prefs_file.write(str(list(self.prefs.items())[n][0]) + ' = '... | [
"def",
"Dump",
"(",
"self",
")",
":",
"prefs_file",
"=",
"open",
"(",
"self",
".",
"prefs_path",
",",
"'w'",
")",
"for",
"n",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"self",
".",
"prefs",
")",
")",
":",
"if",
"len",
"(",
"list",
"(",
"self",
... | Dumps the current prefs to the preferences.txt file | [
"Dumps",
"the",
"current",
"prefs",
"to",
"the",
"preferences",
".",
"txt",
"file"
] | f037f5df07f194bcd4a01f4d9916e57b9e8fb45a | https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_prefs.py#L110-L119 | train |
thriftrw/thriftrw-python | thriftrw/compile/link.py | TypeSpecLinker.link | def link(self):
"""Resolve and link all types in the scope."""
type_specs = {}
types = []
for name, type_spec in self.scope.type_specs.items():
type_spec = type_spec.link(self.scope)
type_specs[name] = type_spec
if type_spec.surface is not None:
... | python | def link(self):
"""Resolve and link all types in the scope."""
type_specs = {}
types = []
for name, type_spec in self.scope.type_specs.items():
type_spec = type_spec.link(self.scope)
type_specs[name] = type_spec
if type_spec.surface is not None:
... | [
"def",
"link",
"(",
"self",
")",
":",
"type_specs",
"=",
"{",
"}",
"types",
"=",
"[",
"]",
"for",
"name",
",",
"type_spec",
"in",
"self",
".",
"scope",
".",
"type_specs",
".",
"items",
"(",
")",
":",
"type_spec",
"=",
"type_spec",
".",
"link",
"(",... | Resolve and link all types in the scope. | [
"Resolve",
"and",
"link",
"all",
"types",
"in",
"the",
"scope",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/compile/link.py#L35-L50 | train |
thriftrw/thriftrw-python | thriftrw/loader.py | install | def install(path, name=None):
"""Compiles a Thrift file and installs it as a submodule of the caller.
Given a tree organized like so::
foo/
__init__.py
bar.py
my_service.thrift
You would do,
.. code-block:: python
my_service = thriftrw.install('my... | python | def install(path, name=None):
"""Compiles a Thrift file and installs it as a submodule of the caller.
Given a tree organized like so::
foo/
__init__.py
bar.py
my_service.thrift
You would do,
.. code-block:: python
my_service = thriftrw.install('my... | [
"def",
"install",
"(",
"path",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
")",
"[",
"0",
"]",
"callermod",
"="... | Compiles a Thrift file and installs it as a submodule of the caller.
Given a tree organized like so::
foo/
__init__.py
bar.py
my_service.thrift
You would do,
.. code-block:: python
my_service = thriftrw.install('my_service.thrift')
To install ``m... | [
"Compiles",
"a",
"Thrift",
"file",
"and",
"installs",
"it",
"as",
"a",
"submodule",
"of",
"the",
"caller",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/loader.py#L111-L164 | train |
thriftrw/thriftrw-python | thriftrw/loader.py | Loader.loads | def loads(self, name, document):
"""Parse and compile the given Thrift document.
:param str name:
Name of the Thrift document.
:param str document:
The Thrift IDL as a string.
"""
return self.compiler.compile(name, document).link().surface | python | def loads(self, name, document):
"""Parse and compile the given Thrift document.
:param str name:
Name of the Thrift document.
:param str document:
The Thrift IDL as a string.
"""
return self.compiler.compile(name, document).link().surface | [
"def",
"loads",
"(",
"self",
",",
"name",
",",
"document",
")",
":",
"return",
"self",
".",
"compiler",
".",
"compile",
"(",
"name",
",",
"document",
")",
".",
"link",
"(",
")",
".",
"surface"
] | Parse and compile the given Thrift document.
:param str name:
Name of the Thrift document.
:param str document:
The Thrift IDL as a string. | [
"Parse",
"and",
"compile",
"the",
"given",
"Thrift",
"document",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/loader.py#L61-L69 | train |
thriftrw/thriftrw-python | thriftrw/loader.py | Loader.load | def load(self, path, name=None):
"""Load and compile the given Thrift file.
:param str path:
Path to the ``.thrift`` file.
:param str name:
Name of the generated module. Defaults to the base name of the
file.
:returns:
The compiled module.... | python | def load(self, path, name=None):
"""Load and compile the given Thrift file.
:param str path:
Path to the ``.thrift`` file.
:param str name:
Name of the generated module. Defaults to the base name of the
file.
:returns:
The compiled module.... | [
"def",
"load",
"(",
"self",
",",
"path",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",
"(",
"path",
")",
")",
"[",
"0",
"]",
"wit... | Load and compile the given Thrift file.
:param str path:
Path to the ``.thrift`` file.
:param str name:
Name of the generated module. Defaults to the base name of the
file.
:returns:
The compiled module. | [
"Load",
"and",
"compile",
"the",
"given",
"Thrift",
"file",
"."
] | 4f2f71acd7a0ac716c9ea5cdcea2162aa561304a | https://github.com/thriftrw/thriftrw-python/blob/4f2f71acd7a0ac716c9ea5cdcea2162aa561304a/thriftrw/loader.py#L71-L89 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.