partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | get_dependency_metadata | Returns list of strings with dependency metadata from Dapi | devassistant/dapi/dapicli.py | def get_dependency_metadata():
'''Returns list of strings with dependency metadata from Dapi'''
link = os.path.join(_api_url(), 'meta.txt')
return _process_req_txt(requests.get(link)).split('\n') | def get_dependency_metadata():
'''Returns list of strings with dependency metadata from Dapi'''
link = os.path.join(_api_url(), 'meta.txt')
return _process_req_txt(requests.get(link)).split('\n') | [
"Returns",
"list",
"of",
"strings",
"with",
"dependency",
"metadata",
"from",
"Dapi"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/dapicli.py#L685-L688 | [
"def",
"get_dependency_metadata",
"(",
")",
":",
"link",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_api_url",
"(",
")",
",",
"'meta.txt'",
")",
"return",
"_process_req_txt",
"(",
"requests",
".",
"get",
"(",
"link",
")",
")",
".",
"split",
"(",
"'\\n'... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_frame | This function creates a frame | devassistant/gui/gui_helper.py | def create_frame(self):
"""
This function creates a frame
"""
frame = Gtk.Frame()
frame.set_shadow_type(Gtk.ShadowType.IN)
return frame | def create_frame(self):
"""
This function creates a frame
"""
frame = Gtk.Frame()
frame.set_shadow_type(Gtk.ShadowType.IN)
return frame | [
"This",
"function",
"creates",
"a",
"frame"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L22-L28 | [
"def",
"create_frame",
"(",
"self",
")",
":",
"frame",
"=",
"Gtk",
".",
"Frame",
"(",
")",
"frame",
".",
"set_shadow_type",
"(",
"Gtk",
".",
"ShadowType",
".",
"IN",
")",
"return",
"frame"
] | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_box | Function creates box. Based on orientation
it can be either HORIZONTAL or VERTICAL | devassistant/gui/gui_helper.py | def create_box(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=0):
"""
Function creates box. Based on orientation
it can be either HORIZONTAL or VERTICAL
"""
h_box = Gtk.Box(orientation=orientation, spacing=spacing)
h_box.set_homogeneous(False)
retur... | def create_box(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=0):
"""
Function creates box. Based on orientation
it can be either HORIZONTAL or VERTICAL
"""
h_box = Gtk.Box(orientation=orientation, spacing=spacing)
h_box.set_homogeneous(False)
retur... | [
"Function",
"creates",
"box",
".",
"Based",
"on",
"orientation",
"it",
"can",
"be",
"either",
"HORIZONTAL",
"or",
"VERTICAL"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L30-L37 | [
"def",
"create_box",
"(",
"self",
",",
"orientation",
"=",
"Gtk",
".",
"Orientation",
".",
"HORIZONTAL",
",",
"spacing",
"=",
"0",
")",
":",
"h_box",
"=",
"Gtk",
".",
"Box",
"(",
"orientation",
"=",
"orientation",
",",
"spacing",
"=",
"spacing",
")",
"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.button_with_label | Function creates a button with lave.
If assistant is specified then text is aligned | devassistant/gui/gui_helper.py | def button_with_label(self, description, assistants=None):
"""
Function creates a button with lave.
If assistant is specified then text is aligned
"""
btn = self.create_button()
label = self.create_label(description)
if assistants is not None:
... | def button_with_label(self, description, assistants=None):
"""
Function creates a button with lave.
If assistant is specified then text is aligned
"""
btn = self.create_button()
label = self.create_label(description)
if assistants is not None:
... | [
"Function",
"creates",
"a",
"button",
"with",
"lave",
".",
"If",
"assistant",
"is",
"specified",
"then",
"text",
"is",
"aligned"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L39-L57 | [
"def",
"button_with_label",
"(",
"self",
",",
"description",
",",
"assistants",
"=",
"None",
")",
":",
"btn",
"=",
"self",
".",
"create_button",
"(",
")",
"label",
"=",
"self",
".",
"create_label",
"(",
"description",
")",
"if",
"assistants",
"is",
"not",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_image | The function creates a image from name defined in image_name | devassistant/gui/gui_helper.py | def create_image(self, image_name=None, scale_ratio=1, window=None):
"""
The function creates a image from name defined in image_name
"""
size = 48 * scale_ratio
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(image_name, -1, size, True)
image = Gtk.Image()
... | def create_image(self, image_name=None, scale_ratio=1, window=None):
"""
The function creates a image from name defined in image_name
"""
size = 48 * scale_ratio
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(image_name, -1, size, True)
image = Gtk.Image()
... | [
"The",
"function",
"creates",
"a",
"image",
"from",
"name",
"defined",
"in",
"image_name"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L59-L76 | [
"def",
"create_image",
"(",
"self",
",",
"image_name",
"=",
"None",
",",
"scale_ratio",
"=",
"1",
",",
"window",
"=",
"None",
")",
":",
"size",
"=",
"48",
"*",
"scale_ratio",
"pixbuf",
"=",
"GdkPixbuf",
".",
"Pixbuf",
".",
"new_from_file_at_scale",
"(",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.button_with_image | The function creates a button with image | devassistant/gui/gui_helper.py | def button_with_image(self, description, image=None, sensitive=True):
"""
The function creates a button with image
"""
btn = self.create_button()
btn.set_sensitive(sensitive)
h_box = self.create_box()
try:
img = self.create_image(image_name=image,
... | def button_with_image(self, description, image=None, sensitive=True):
"""
The function creates a button with image
"""
btn = self.create_button()
btn.set_sensitive(sensitive)
h_box = self.create_box()
try:
img = self.create_image(image_name=image,
... | [
"The",
"function",
"creates",
"a",
"button",
"with",
"image"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L78-L95 | [
"def",
"button_with_image",
"(",
"self",
",",
"description",
",",
"image",
"=",
"None",
",",
"sensitive",
"=",
"True",
")",
":",
"btn",
"=",
"self",
".",
"create_button",
"(",
")",
"btn",
".",
"set_sensitive",
"(",
"sensitive",
")",
"h_box",
"=",
"self",... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.checkbutton_with_label | The function creates a checkbutton with label | devassistant/gui/gui_helper.py | def checkbutton_with_label(self, description):
"""
The function creates a checkbutton with label
"""
act_btn = Gtk.CheckButton(description)
align = self.create_alignment()
act_btn.add(align)
return align | def checkbutton_with_label(self, description):
"""
The function creates a checkbutton with label
"""
act_btn = Gtk.CheckButton(description)
align = self.create_alignment()
act_btn.add(align)
return align | [
"The",
"function",
"creates",
"a",
"checkbutton",
"with",
"label"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L97-L104 | [
"def",
"checkbutton_with_label",
"(",
"self",
",",
"description",
")",
":",
"act_btn",
"=",
"Gtk",
".",
"CheckButton",
"(",
"description",
")",
"align",
"=",
"self",
".",
"create_alignment",
"(",
")",
"act_btn",
".",
"add",
"(",
"align",
")",
"return",
"al... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_checkbox | Function creates a checkbox with his name | devassistant/gui/gui_helper.py | def create_checkbox(self, name, margin=10):
"""
Function creates a checkbox with his name
"""
chk_btn = Gtk.CheckButton(name)
chk_btn.set_margin_right(margin)
return chk_btn | def create_checkbox(self, name, margin=10):
"""
Function creates a checkbox with his name
"""
chk_btn = Gtk.CheckButton(name)
chk_btn.set_margin_right(margin)
return chk_btn | [
"Function",
"creates",
"a",
"checkbox",
"with",
"his",
"name"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L113-L119 | [
"def",
"create_checkbox",
"(",
"self",
",",
"name",
",",
"margin",
"=",
"10",
")",
":",
"chk_btn",
"=",
"Gtk",
".",
"CheckButton",
"(",
"name",
")",
"chk_btn",
".",
"set_margin_right",
"(",
"margin",
")",
"return",
"chk_btn"
] | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_entry | Function creates an Entry with corresponding text | devassistant/gui/gui_helper.py | def create_entry(self, text="", sensitive="False"):
"""
Function creates an Entry with corresponding text
"""
text_entry = Gtk.Entry()
text_entry.set_sensitive(sensitive)
text_entry.set_text(text)
return text_entry | def create_entry(self, text="", sensitive="False"):
"""
Function creates an Entry with corresponding text
"""
text_entry = Gtk.Entry()
text_entry.set_sensitive(sensitive)
text_entry.set_text(text)
return text_entry | [
"Function",
"creates",
"an",
"Entry",
"with",
"corresponding",
"text"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L121-L128 | [
"def",
"create_entry",
"(",
"self",
",",
"text",
"=",
"\"\"",
",",
"sensitive",
"=",
"\"False\"",
")",
":",
"text_entry",
"=",
"Gtk",
".",
"Entry",
"(",
")",
"text_entry",
".",
"set_sensitive",
"(",
"sensitive",
")",
"text_entry",
".",
"set_text",
"(",
"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_link_button | Function creates a link button with corresponding text and
URI reference | devassistant/gui/gui_helper.py | def create_link_button(self, text="None", uri="None"):
"""
Function creates a link button with corresponding text and
URI reference
"""
link_btn = Gtk.LinkButton(uri, text)
return link_btn | def create_link_button(self, text="None", uri="None"):
"""
Function creates a link button with corresponding text and
URI reference
"""
link_btn = Gtk.LinkButton(uri, text)
return link_btn | [
"Function",
"creates",
"a",
"link",
"button",
"with",
"corresponding",
"text",
"and",
"URI",
"reference"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L130-L136 | [
"def",
"create_link_button",
"(",
"self",
",",
"text",
"=",
"\"None\"",
",",
"uri",
"=",
"\"None\"",
")",
":",
"link_btn",
"=",
"Gtk",
".",
"LinkButton",
"(",
"uri",
",",
"text",
")",
"return",
"link_btn"
] | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_button | This is generalized method for creating Gtk.Button | devassistant/gui/gui_helper.py | def create_button(self, style=Gtk.ReliefStyle.NORMAL):
"""
This is generalized method for creating Gtk.Button
"""
btn = Gtk.Button()
btn.set_relief(style)
return btn | def create_button(self, style=Gtk.ReliefStyle.NORMAL):
"""
This is generalized method for creating Gtk.Button
"""
btn = Gtk.Button()
btn.set_relief(style)
return btn | [
"This",
"is",
"generalized",
"method",
"for",
"creating",
"Gtk",
".",
"Button"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L138-L144 | [
"def",
"create_button",
"(",
"self",
",",
"style",
"=",
"Gtk",
".",
"ReliefStyle",
".",
"NORMAL",
")",
":",
"btn",
"=",
"Gtk",
".",
"Button",
"(",
")",
"btn",
".",
"set_relief",
"(",
"style",
")",
"return",
"btn"
] | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_image_menu_item | Function creates a menu item with an image | devassistant/gui/gui_helper.py | def create_image_menu_item(self, text, image_name):
"""
Function creates a menu item with an image
"""
menu_item = Gtk.ImageMenuItem(text)
img = self.create_image(image_name)
menu_item.set_image(img)
return menu_item | def create_image_menu_item(self, text, image_name):
"""
Function creates a menu item with an image
"""
menu_item = Gtk.ImageMenuItem(text)
img = self.create_image(image_name)
menu_item.set_image(img)
return menu_item | [
"Function",
"creates",
"a",
"menu",
"item",
"with",
"an",
"image"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L153-L160 | [
"def",
"create_image_menu_item",
"(",
"self",
",",
"text",
",",
"image_name",
")",
":",
"menu_item",
"=",
"Gtk",
".",
"ImageMenuItem",
"(",
"text",
")",
"img",
"=",
"self",
".",
"create_image",
"(",
"image_name",
")",
"menu_item",
".",
"set_image",
"(",
"i... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_label | The function is used for creating lable with HTML text | devassistant/gui/gui_helper.py | def create_label(self, name, justify=Gtk.Justification.CENTER, wrap_mode=True, tooltip=None):
"""
The function is used for creating lable with HTML text
"""
label = Gtk.Label()
name = name.replace('|', '\n')
label.set_markup(name)
label.set_justify(justify)
... | def create_label(self, name, justify=Gtk.Justification.CENTER, wrap_mode=True, tooltip=None):
"""
The function is used for creating lable with HTML text
"""
label = Gtk.Label()
name = name.replace('|', '\n')
label.set_markup(name)
label.set_justify(justify)
... | [
"The",
"function",
"is",
"used",
"for",
"creating",
"lable",
"with",
"HTML",
"text"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L162-L174 | [
"def",
"create_label",
"(",
"self",
",",
"name",
",",
"justify",
"=",
"Gtk",
".",
"Justification",
".",
"CENTER",
",",
"wrap_mode",
"=",
"True",
",",
"tooltip",
"=",
"None",
")",
":",
"label",
"=",
"Gtk",
".",
"Label",
"(",
")",
"name",
"=",
"name",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.add_button | The function is used for creating button with all features
like signal on tooltip and signal on clicked
The function does not have any menu.
Button is add to the Gtk.Grid on specific row and column | devassistant/gui/gui_helper.py | def add_button(self, grid_lang, ass, row, column):
"""
The function is used for creating button with all features
like signal on tooltip and signal on clicked
The function does not have any menu.
Button is add to the Gtk.Grid on specific row and column
"""
#print ... | def add_button(self, grid_lang, ass, row, column):
"""
The function is used for creating button with all features
like signal on tooltip and signal on clicked
The function does not have any menu.
Button is add to the Gtk.Grid on specific row and column
"""
#print ... | [
"The",
"function",
"is",
"used",
"for",
"creating",
"button",
"with",
"all",
"features",
"like",
"signal",
"on",
"tooltip",
"and",
"signal",
"on",
"clicked",
"The",
"function",
"does",
"not",
"have",
"any",
"menu",
".",
"Button",
"is",
"add",
"to",
"the",
... | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L176-L202 | [
"def",
"add_button",
"(",
"self",
",",
"grid_lang",
",",
"ass",
",",
"row",
",",
"column",
")",
":",
"#print \"gui_helper add_button\"",
"image_name",
"=",
"ass",
"[",
"0",
"]",
".",
"icon_path",
"label",
"=",
"\"<b>\"",
"+",
"ass",
"[",
"0",
"]",
".",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.add_install_button | Add button that opens the window for installing more assistants | devassistant/gui/gui_helper.py | def add_install_button(self, grid_lang, row, column):
"""
Add button that opens the window for installing more assistants
"""
btn = self.button_with_label('<b>Install more...</b>')
if row == 0 and column == 0:
grid_lang.add(btn)
else:
grid_lang.att... | def add_install_button(self, grid_lang, row, column):
"""
Add button that opens the window for installing more assistants
"""
btn = self.button_with_label('<b>Install more...</b>')
if row == 0 and column == 0:
grid_lang.add(btn)
else:
grid_lang.att... | [
"Add",
"button",
"that",
"opens",
"the",
"window",
"for",
"installing",
"more",
"assistants"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L204-L214 | [
"def",
"add_install_button",
"(",
"self",
",",
"grid_lang",
",",
"row",
",",
"column",
")",
":",
"btn",
"=",
"self",
".",
"button_with_label",
"(",
"'<b>Install more...</b>'",
")",
"if",
"row",
"==",
"0",
"and",
"column",
"==",
"0",
":",
"grid_lang",
".",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.menu_item | The function creates a menu item
and assigns signal like select and button-press-event for
manipulation with menu_item. sub_assistant and path | devassistant/gui/gui_helper.py | def menu_item(self, sub_assistant, path):
"""
The function creates a menu item
and assigns signal like select and button-press-event for
manipulation with menu_item. sub_assistant and path
"""
if not sub_assistant[0].icon_path:
menu_item = self.create_menu_ite... | def menu_item(self, sub_assistant, path):
"""
The function creates a menu item
and assigns signal like select and button-press-event for
manipulation with menu_item. sub_assistant and path
"""
if not sub_assistant[0].icon_path:
menu_item = self.create_menu_ite... | [
"The",
"function",
"creates",
"a",
"menu",
"item",
"and",
"assigns",
"signal",
"like",
"select",
"and",
"button",
"-",
"press",
"-",
"event",
"for",
"manipulation",
"with",
"menu_item",
".",
"sub_assistant",
"and",
"path"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L224-L245 | [
"def",
"menu_item",
"(",
"self",
",",
"sub_assistant",
",",
"path",
")",
":",
"if",
"not",
"sub_assistant",
"[",
"0",
"]",
".",
"icon_path",
":",
"menu_item",
"=",
"self",
".",
"create_menu_item",
"(",
"sub_assistant",
"[",
"0",
"]",
".",
"fullname",
")"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.generate_menu | Function generates menu from based on ass parameter | devassistant/gui/gui_helper.py | def generate_menu(self, ass, text, path=None, level=0):
"""
Function generates menu from based on ass parameter
"""
menu = self.create_menu()
for index, sub in enumerate(sorted(ass[1], key=lambda y: y[0].fullname.lower())):
if index != 0:
text += "|"
... | def generate_menu(self, ass, text, path=None, level=0):
"""
Function generates menu from based on ass parameter
"""
menu = self.create_menu()
for index, sub in enumerate(sorted(ass[1], key=lambda y: y[0].fullname.lower())):
if index != 0:
text += "|"
... | [
"Function",
"generates",
"menu",
"from",
"based",
"on",
"ass",
"parameter"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L247-L266 | [
"def",
"generate_menu",
"(",
"self",
",",
"ass",
",",
"text",
",",
"path",
"=",
"None",
",",
"level",
"=",
"0",
")",
":",
"menu",
"=",
"self",
".",
"create_menu",
"(",
")",
"for",
"index",
",",
"sub",
"in",
"enumerate",
"(",
"sorted",
"(",
"ass",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.add_submenu | The function is used for creating button with menu and submenu.
Also signal on tooltip and signal on clicked are specified
Button is add to the Gtk.Grid | devassistant/gui/gui_helper.py | def add_submenu(self, grid_lang, ass, row, column):
"""
The function is used for creating button with menu and submenu.
Also signal on tooltip and signal on clicked are specified
Button is add to the Gtk.Grid
"""
text = "Available subassistants:\n"
# Generate menu... | def add_submenu(self, grid_lang, ass, row, column):
"""
The function is used for creating button with menu and submenu.
Also signal on tooltip and signal on clicked are specified
Button is add to the Gtk.Grid
"""
text = "Available subassistants:\n"
# Generate menu... | [
"The",
"function",
"is",
"used",
"for",
"creating",
"button",
"with",
"menu",
"and",
"submenu",
".",
"Also",
"signal",
"on",
"tooltip",
"and",
"signal",
"on",
"clicked",
"are",
"specified",
"Button",
"is",
"add",
"to",
"the",
"Gtk",
".",
"Grid"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L268-L299 | [
"def",
"add_submenu",
"(",
"self",
",",
"grid_lang",
",",
"ass",
",",
"row",
",",
"column",
")",
":",
"text",
"=",
"\"Available subassistants:\\n\"",
"# Generate menus",
"path",
"=",
"[",
"]",
"(",
"menu",
",",
"text",
")",
"=",
"self",
".",
"generate_menu... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_scrolled_window | Function creates a scrolled window with layout manager | devassistant/gui/gui_helper.py | def create_scrolled_window(self, layout_manager, horizontal=Gtk.PolicyType.NEVER, vertical=Gtk.PolicyType.ALWAYS):
"""
Function creates a scrolled window with layout manager
"""
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.add(layout_manager)
scrolled_window.set... | def create_scrolled_window(self, layout_manager, horizontal=Gtk.PolicyType.NEVER, vertical=Gtk.PolicyType.ALWAYS):
"""
Function creates a scrolled window with layout manager
"""
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.add(layout_manager)
scrolled_window.set... | [
"Function",
"creates",
"a",
"scrolled",
"window",
"with",
"layout",
"manager"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L328-L335 | [
"def",
"create_scrolled_window",
"(",
"self",
",",
"layout_manager",
",",
"horizontal",
"=",
"Gtk",
".",
"PolicyType",
".",
"NEVER",
",",
"vertical",
"=",
"Gtk",
".",
"PolicyType",
".",
"ALWAYS",
")",
":",
"scrolled_window",
"=",
"Gtk",
".",
"ScrolledWindow",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_gtk_grid | Function creates a Gtk Grid with spacing
and homogeous tags | devassistant/gui/gui_helper.py | def create_gtk_grid(self, row_spacing=6, col_spacing=6, row_homogenous=False, col_homogenous=True):
"""
Function creates a Gtk Grid with spacing
and homogeous tags
"""
grid_lang = Gtk.Grid()
grid_lang.set_column_spacing(row_spacing)
grid_lang.set_row_spacing(col_s... | def create_gtk_grid(self, row_spacing=6, col_spacing=6, row_homogenous=False, col_homogenous=True):
"""
Function creates a Gtk Grid with spacing
and homogeous tags
"""
grid_lang = Gtk.Grid()
grid_lang.set_column_spacing(row_spacing)
grid_lang.set_row_spacing(col_s... | [
"Function",
"creates",
"a",
"Gtk",
"Grid",
"with",
"spacing",
"and",
"homogeous",
"tags"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L337-L348 | [
"def",
"create_gtk_grid",
"(",
"self",
",",
"row_spacing",
"=",
"6",
",",
"col_spacing",
"=",
"6",
",",
"row_homogenous",
"=",
"False",
",",
"col_homogenous",
"=",
"True",
")",
":",
"grid_lang",
"=",
"Gtk",
".",
"Grid",
"(",
")",
"grid_lang",
".",
"set_c... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_notebook | Function creates a notebook | devassistant/gui/gui_helper.py | def create_notebook(self, position=Gtk.PositionType.TOP):
"""
Function creates a notebook
"""
notebook = Gtk.Notebook()
notebook.set_tab_pos(position)
notebook.set_show_border(True)
return notebook | def create_notebook(self, position=Gtk.PositionType.TOP):
"""
Function creates a notebook
"""
notebook = Gtk.Notebook()
notebook.set_tab_pos(position)
notebook.set_show_border(True)
return notebook | [
"Function",
"creates",
"a",
"notebook"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L350-L357 | [
"def",
"create_notebook",
"(",
"self",
",",
"position",
"=",
"Gtk",
".",
"PositionType",
".",
"TOP",
")",
":",
"notebook",
"=",
"Gtk",
".",
"Notebook",
"(",
")",
"notebook",
".",
"set_tab_pos",
"(",
"position",
")",
"notebook",
".",
"set_show_border",
"(",... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_message_dialog | Function creates a message dialog with text
and relevant buttons | devassistant/gui/gui_helper.py | def create_message_dialog(self, text, buttons=Gtk.ButtonsType.CLOSE, icon=Gtk.MessageType.WARNING):
"""
Function creates a message dialog with text
and relevant buttons
"""
dialog = Gtk.MessageDialog(None,
Gtk.DialogFlags.DESTROY_WITH_PARENT,
... | def create_message_dialog(self, text, buttons=Gtk.ButtonsType.CLOSE, icon=Gtk.MessageType.WARNING):
"""
Function creates a message dialog with text
and relevant buttons
"""
dialog = Gtk.MessageDialog(None,
Gtk.DialogFlags.DESTROY_WITH_PARENT,
... | [
"Function",
"creates",
"a",
"message",
"dialog",
"with",
"text",
"and",
"relevant",
"buttons"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L359-L370 | [
"def",
"create_message_dialog",
"(",
"self",
",",
"text",
",",
"buttons",
"=",
"Gtk",
".",
"ButtonsType",
".",
"CLOSE",
",",
"icon",
"=",
"Gtk",
".",
"MessageType",
".",
"WARNING",
")",
":",
"dialog",
"=",
"Gtk",
".",
"MessageDialog",
"(",
"None",
",",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_question_dialog | Function creates a question dialog with title text
and second_text | devassistant/gui/gui_helper.py | def create_question_dialog(self, text, second_text):
"""
Function creates a question dialog with title text
and second_text
"""
dialog = self.create_message_dialog(
text, buttons=Gtk.ButtonsType.YES_NO, icon=Gtk.MessageType.QUESTION
)
dialog.format_sec... | def create_question_dialog(self, text, second_text):
"""
Function creates a question dialog with title text
and second_text
"""
dialog = self.create_message_dialog(
text, buttons=Gtk.ButtonsType.YES_NO, icon=Gtk.MessageType.QUESTION
)
dialog.format_sec... | [
"Function",
"creates",
"a",
"question",
"dialog",
"with",
"title",
"text",
"and",
"second_text"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L372-L383 | [
"def",
"create_question_dialog",
"(",
"self",
",",
"text",
",",
"second_text",
")",
":",
"dialog",
"=",
"self",
".",
"create_message_dialog",
"(",
"text",
",",
"buttons",
"=",
"Gtk",
".",
"ButtonsType",
".",
"YES_NO",
",",
"icon",
"=",
"Gtk",
".",
"Message... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.execute_dialog | Function executes a dialog | devassistant/gui/gui_helper.py | def execute_dialog(self, title):
"""
Function executes a dialog
"""
msg_dlg = self.create_message_dialog(title)
msg_dlg.run()
msg_dlg.destroy()
return | def execute_dialog(self, title):
"""
Function executes a dialog
"""
msg_dlg = self.create_message_dialog(title)
msg_dlg.run()
msg_dlg.destroy()
return | [
"Function",
"executes",
"a",
"dialog"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L385-L392 | [
"def",
"execute_dialog",
"(",
"self",
",",
"title",
")",
":",
"msg_dlg",
"=",
"self",
".",
"create_message_dialog",
"(",
"title",
")",
"msg_dlg",
".",
"run",
"(",
")",
"msg_dlg",
".",
"destroy",
"(",
")",
"return"
] | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_file_chooser_dialog | Function creates a file chooser dialog with title text | devassistant/gui/gui_helper.py | def create_file_chooser_dialog(self, text, parent, name=Gtk.STOCK_OPEN):
"""
Function creates a file chooser dialog with title text
"""
text = None
dialog = Gtk.FileChooserDialog(
text, parent,
Gtk.FileChooserAction.SELECT_FOLDER,
(Gtk.STOCK_CA... | def create_file_chooser_dialog(self, text, parent, name=Gtk.STOCK_OPEN):
"""
Function creates a file chooser dialog with title text
"""
text = None
dialog = Gtk.FileChooserDialog(
text, parent,
Gtk.FileChooserAction.SELECT_FOLDER,
(Gtk.STOCK_CA... | [
"Function",
"creates",
"a",
"file",
"chooser",
"dialog",
"with",
"title",
"text"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L394-L408 | [
"def",
"create_file_chooser_dialog",
"(",
"self",
",",
"text",
",",
"parent",
",",
"name",
"=",
"Gtk",
".",
"STOCK_OPEN",
")",
":",
"text",
"=",
"None",
"dialog",
"=",
"Gtk",
".",
"FileChooserDialog",
"(",
"text",
",",
"parent",
",",
"Gtk",
".",
"FileCho... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_alignment | Function creates an alignment | devassistant/gui/gui_helper.py | def create_alignment(self, x_align=0, y_align=0, x_scale=0, y_scale=0):
"""
Function creates an alignment
"""
align = Gtk.Alignment()
align.set(x_align, y_align, x_scale, y_scale)
return align | def create_alignment(self, x_align=0, y_align=0, x_scale=0, y_scale=0):
"""
Function creates an alignment
"""
align = Gtk.Alignment()
align.set(x_align, y_align, x_scale, y_scale)
return align | [
"Function",
"creates",
"an",
"alignment"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L410-L416 | [
"def",
"create_alignment",
"(",
"self",
",",
"x_align",
"=",
"0",
",",
"y_align",
"=",
"0",
",",
"x_scale",
"=",
"0",
",",
"y_scale",
"=",
"0",
")",
":",
"align",
"=",
"Gtk",
".",
"Alignment",
"(",
")",
"align",
".",
"set",
"(",
"x_align",
",",
"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_textview | Function creates a text view with wrap_mode
and justification | devassistant/gui/gui_helper.py | def create_textview(self, wrap_mode=Gtk.WrapMode.WORD_CHAR, justify=Gtk.Justification.LEFT, visible=True, editable=True):
"""
Function creates a text view with wrap_mode
and justification
"""
text_view = Gtk.TextView()
text_view.set_wrap_mode(wrap_mode)
text_view.... | def create_textview(self, wrap_mode=Gtk.WrapMode.WORD_CHAR, justify=Gtk.Justification.LEFT, visible=True, editable=True):
"""
Function creates a text view with wrap_mode
and justification
"""
text_view = Gtk.TextView()
text_view.set_wrap_mode(wrap_mode)
text_view.... | [
"Function",
"creates",
"a",
"text",
"view",
"with",
"wrap_mode",
"and",
"justification"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L418-L431 | [
"def",
"create_textview",
"(",
"self",
",",
"wrap_mode",
"=",
"Gtk",
".",
"WrapMode",
".",
"WORD_CHAR",
",",
"justify",
"=",
"Gtk",
".",
"Justification",
".",
"LEFT",
",",
"visible",
"=",
"True",
",",
"editable",
"=",
"True",
")",
":",
"text_view",
"=",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_tree_view | Function creates a tree_view with model | devassistant/gui/gui_helper.py | def create_tree_view(self, model=None):
"""
Function creates a tree_view with model
"""
tree_view = Gtk.TreeView()
if model is not None:
tree_view.set_model(model)
return tree_view | def create_tree_view(self, model=None):
"""
Function creates a tree_view with model
"""
tree_view = Gtk.TreeView()
if model is not None:
tree_view.set_model(model)
return tree_view | [
"Function",
"creates",
"a",
"tree_view",
"with",
"model"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L433-L440 | [
"def",
"create_tree_view",
"(",
"self",
",",
"model",
"=",
"None",
")",
":",
"tree_view",
"=",
"Gtk",
".",
"TreeView",
"(",
")",
"if",
"model",
"is",
"not",
"None",
":",
"tree_view",
".",
"set_model",
"(",
"model",
")",
"return",
"tree_view"
] | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_cell_renderer_text | Function creates a CellRendererText with title | devassistant/gui/gui_helper.py | def create_cell_renderer_text(self, tree_view, title="title", assign=0, editable=False):
"""
Function creates a CellRendererText with title
"""
renderer = Gtk.CellRendererText()
renderer.set_property('editable', editable)
column = Gtk.TreeViewColumn(title, renderer, text=... | def create_cell_renderer_text(self, tree_view, title="title", assign=0, editable=False):
"""
Function creates a CellRendererText with title
"""
renderer = Gtk.CellRendererText()
renderer.set_property('editable', editable)
column = Gtk.TreeViewColumn(title, renderer, text=... | [
"Function",
"creates",
"a",
"CellRendererText",
"with",
"title"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L442-L449 | [
"def",
"create_cell_renderer_text",
"(",
"self",
",",
"tree_view",
",",
"title",
"=",
"\"title\"",
",",
"assign",
"=",
"0",
",",
"editable",
"=",
"False",
")",
":",
"renderer",
"=",
"Gtk",
".",
"CellRendererText",
"(",
")",
"renderer",
".",
"set_property",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_cell_renderer_combo | Function creates a CellRendererCombo with title, model | devassistant/gui/gui_helper.py | def create_cell_renderer_combo(self, tree_view, title="title", assign=0, editable=False, model=None, function=None):
"""'
Function creates a CellRendererCombo with title, model
"""
renderer_combo = Gtk.CellRendererCombo()
renderer_combo.set_property('editable', editable)
... | def create_cell_renderer_combo(self, tree_view, title="title", assign=0, editable=False, model=None, function=None):
"""'
Function creates a CellRendererCombo with title, model
"""
renderer_combo = Gtk.CellRendererCombo()
renderer_combo.set_property('editable', editable)
... | [
"Function",
"creates",
"a",
"CellRendererCombo",
"with",
"title",
"model"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L451-L464 | [
"def",
"create_cell_renderer_combo",
"(",
"self",
",",
"tree_view",
",",
"title",
"=",
"\"title\"",
",",
"assign",
"=",
"0",
",",
"editable",
"=",
"False",
",",
"model",
"=",
"None",
",",
"function",
"=",
"None",
")",
":",
"renderer_combo",
"=",
"Gtk",
"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GuiHelper.create_clipboard | Function creates a clipboard | devassistant/gui/gui_helper.py | def create_clipboard(self, text, selection=Gdk.SELECTION_CLIPBOARD):
"""
Function creates a clipboard
"""
clipboard = Gtk.Clipboard.get(selection)
clipboard.set_text('\n'.join(text), -1)
clipboard.store()
return clipboard | def create_clipboard(self, text, selection=Gdk.SELECTION_CLIPBOARD):
"""
Function creates a clipboard
"""
clipboard = Gtk.Clipboard.get(selection)
clipboard.set_text('\n'.join(text), -1)
clipboard.store()
return clipboard | [
"Function",
"creates",
"a",
"clipboard"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/gui_helper.py#L466-L473 | [
"def",
"create_clipboard",
"(",
"self",
",",
"text",
",",
"selection",
"=",
"Gdk",
".",
"SELECTION_CLIPBOARD",
")",
":",
"clipboard",
"=",
"Gtk",
".",
"Clipboard",
".",
"get",
"(",
"selection",
")",
"clipboard",
".",
"set_text",
"(",
"'\\n'",
".",
"join",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | ClHelper.run_command | Runs a command from string, e.g. "cp foo bar"
Args:
cmd_str: the command to run as string
log_level: level at which to log command output (DEBUG by default)
ignore_sigint: should we ignore sigint during this command (False by default)
output_callback: function tha... | devassistant/command_helpers.py | def run_command(cls,
cmd_str,
log_level=logging.DEBUG,
ignore_sigint=False,
output_callback=None,
as_user=None,
log_secret=False,
env=None):
"""Runs a command from string, ... | def run_command(cls,
cmd_str,
log_level=logging.DEBUG,
ignore_sigint=False,
output_callback=None,
as_user=None,
log_secret=False,
env=None):
"""Runs a command from string, ... | [
"Runs",
"a",
"command",
"from",
"string",
"e",
".",
"g",
".",
"cp",
"foo",
"bar",
"Args",
":",
"cmd_str",
":",
"the",
"command",
"to",
"run",
"as",
"string",
"log_level",
":",
"level",
"at",
"which",
"to",
"log",
"command",
"output",
"(",
"DEBUG",
"b... | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/command_helpers.py#L32-L133 | [
"def",
"run_command",
"(",
"cls",
",",
"cmd_str",
",",
"log_level",
"=",
"logging",
".",
"DEBUG",
",",
"ignore_sigint",
"=",
"False",
",",
"output_callback",
"=",
"None",
",",
"as_user",
"=",
"None",
",",
"log_secret",
"=",
"False",
",",
"env",
"=",
"Non... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DialogHelper.ask_for_password | Returns the password typed by user as a string or None if user cancels the request
(e.g. presses Ctrl + D on commandline or presses Cancel in GUI. | devassistant/command_helpers.py | def ask_for_password(cls, ui, prompt='Provide your password:', **options):
"""Returns the password typed by user as a string or None if user cancels the request
(e.g. presses Ctrl + D on commandline or presses Cancel in GUI.
"""
# optionally set title, that may be used by some helpers li... | def ask_for_password(cls, ui, prompt='Provide your password:', **options):
"""Returns the password typed by user as a string or None if user cancels the request
(e.g. presses Ctrl + D on commandline or presses Cancel in GUI.
"""
# optionally set title, that may be used by some helpers li... | [
"Returns",
"the",
"password",
"typed",
"by",
"user",
"as",
"a",
"string",
"or",
"None",
"if",
"user",
"cancels",
"the",
"request",
"(",
"e",
".",
"g",
".",
"presses",
"Ctrl",
"+",
"D",
"on",
"commandline",
"or",
"presses",
"Cancel",
"in",
"GUI",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/command_helpers.py#L226-L232 | [
"def",
"ask_for_password",
"(",
"cls",
",",
"ui",
",",
"prompt",
"=",
"'Provide your password:'",
",",
"*",
"*",
"options",
")",
":",
"# optionally set title, that may be used by some helpers like zenity",
"return",
"cls",
".",
"get_appropriate_helper",
"(",
"ui",
")",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DialogHelper.ask_for_confirm_with_message | Returns True if user agrees, False otherwise | devassistant/command_helpers.py | def ask_for_confirm_with_message(cls, ui, prompt='Do you agree?', message='', **options):
"""Returns True if user agrees, False otherwise"""
return cls.get_appropriate_helper(ui).ask_for_confirm_with_message(prompt, message) | def ask_for_confirm_with_message(cls, ui, prompt='Do you agree?', message='', **options):
"""Returns True if user agrees, False otherwise"""
return cls.get_appropriate_helper(ui).ask_for_confirm_with_message(prompt, message) | [
"Returns",
"True",
"if",
"user",
"agrees",
"False",
"otherwise"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/command_helpers.py#L235-L237 | [
"def",
"ask_for_confirm_with_message",
"(",
"cls",
",",
"ui",
",",
"prompt",
"=",
"'Do you agree?'",
",",
"message",
"=",
"''",
",",
"*",
"*",
"options",
")",
":",
"return",
"cls",
".",
"get_appropriate_helper",
"(",
"ui",
")",
".",
"ask_for_confirm_with_messa... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DialogHelper.ask_for_input_with_prompt | Ask user for written input with prompt | devassistant/command_helpers.py | def ask_for_input_with_prompt(cls, ui, prompt='', **options):
"""Ask user for written input with prompt"""
return cls.get_appropriate_helper(ui).ask_for_input_with_prompt(prompt=prompt, **options) | def ask_for_input_with_prompt(cls, ui, prompt='', **options):
"""Ask user for written input with prompt"""
return cls.get_appropriate_helper(ui).ask_for_input_with_prompt(prompt=prompt, **options) | [
"Ask",
"user",
"for",
"written",
"input",
"with",
"prompt"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/command_helpers.py#L250-L252 | [
"def",
"ask_for_input_with_prompt",
"(",
"cls",
",",
"ui",
",",
"prompt",
"=",
"''",
",",
"*",
"*",
"options",
")",
":",
"return",
"cls",
".",
"get_appropriate_helper",
"(",
"ui",
")",
".",
"ask_for_input_with_prompt",
"(",
"prompt",
"=",
"prompt",
",",
"*... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Argument.add_argument_to | Used by cli to add this as an argument to argparse parser.
Args:
parser: parser to add this argument to | devassistant/argument.py | def add_argument_to(self, parser):
"""Used by cli to add this as an argument to argparse parser.
Args:
parser: parser to add this argument to
"""
from devassistant.cli.devassistant_argparse import DefaultIffUsedActionFactory
if isinstance(self.kwargs.get('action', ''... | def add_argument_to(self, parser):
"""Used by cli to add this as an argument to argparse parser.
Args:
parser: parser to add this argument to
"""
from devassistant.cli.devassistant_argparse import DefaultIffUsedActionFactory
if isinstance(self.kwargs.get('action', ''... | [
"Used",
"by",
"cli",
"to",
"add",
"this",
"as",
"an",
"argument",
"to",
"argparse",
"parser",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/argument.py#L34-L54 | [
"def",
"add_argument_to",
"(",
"self",
",",
"parser",
")",
":",
"from",
"devassistant",
".",
"cli",
".",
"devassistant_argparse",
"import",
"DefaultIffUsedActionFactory",
"if",
"isinstance",
"(",
"self",
".",
"kwargs",
".",
"get",
"(",
"'action'",
",",
"''",
"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Argument.get_gui_hint | Returns the value for specified gui hint (or a sensible default value,
if this argument doesn't specify the hint).
Args:
hint: name of the hint to get value for
Returns:
value of the hint specified in yaml or a sensible default | devassistant/argument.py | def get_gui_hint(self, hint):
"""Returns the value for specified gui hint (or a sensible default value,
if this argument doesn't specify the hint).
Args:
hint: name of the hint to get value for
Returns:
value of the hint specified in yaml or a sensible default
... | def get_gui_hint(self, hint):
"""Returns the value for specified gui hint (or a sensible default value,
if this argument doesn't specify the hint).
Args:
hint: name of the hint to get value for
Returns:
value of the hint specified in yaml or a sensible default
... | [
"Returns",
"the",
"value",
"for",
"specified",
"gui",
"hint",
"(",
"or",
"a",
"sensible",
"default",
"value",
"if",
"this",
"argument",
"doesn",
"t",
"specify",
"the",
"hint",
")",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/argument.py#L67-L108 | [
"def",
"get_gui_hint",
"(",
"self",
",",
"hint",
")",
":",
"if",
"hint",
"==",
"'type'",
":",
"# 'self.kwargs.get('nargs') == 0' is there for default_iff_used, which may",
"# have nargs: 0, so that it works similarly to 'store_const'",
"if",
"self",
".",
"kwargs",
".",
"get",... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Argument.construct_arg | Construct an argument from name, and params (dict loaded from assistant/snippet). | devassistant/argument.py | def construct_arg(cls, name, params):
"""Construct an argument from name, and params (dict loaded from assistant/snippet).
"""
use_snippet = params.pop('use', None)
if use_snippet:
# if snippet is used, take this parameter from snippet and update
# it with current... | def construct_arg(cls, name, params):
"""Construct an argument from name, and params (dict loaded from assistant/snippet).
"""
use_snippet = params.pop('use', None)
if use_snippet:
# if snippet is used, take this parameter from snippet and update
# it with current... | [
"Construct",
"an",
"argument",
"from",
"name",
"and",
"params",
"(",
"dict",
"loaded",
"from",
"assistant",
"/",
"snippet",
")",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/argument.py#L111-L133 | [
"def",
"construct_arg",
"(",
"cls",
",",
"name",
",",
"params",
")",
":",
"use_snippet",
"=",
"params",
".",
"pop",
"(",
"'use'",
",",
"None",
")",
"if",
"use_snippet",
":",
"# if snippet is used, take this parameter from snippet and update",
"# it with current params... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | AssistantBase.get_subassistants | Return list of instantiated subassistants.
Usually, this needs not be overriden in subclasses, you should just override
get_subassistant_classes
Returns:
list of instantiated subassistants | devassistant/assistant_base.py | def get_subassistants(self):
"""Return list of instantiated subassistants.
Usually, this needs not be overriden in subclasses, you should just override
get_subassistant_classes
Returns:
list of instantiated subassistants
"""
if not hasattr(self, '_subassista... | def get_subassistants(self):
"""Return list of instantiated subassistants.
Usually, this needs not be overriden in subclasses, you should just override
get_subassistant_classes
Returns:
list of instantiated subassistants
"""
if not hasattr(self, '_subassista... | [
"Return",
"list",
"of",
"instantiated",
"subassistants",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/assistant_base.py#L33-L49 | [
"def",
"get_subassistants",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_subassistants'",
")",
":",
"self",
".",
"_subassistants",
"=",
"[",
"]",
"# we want to know, if type(self) defines 'get_subassistant_classes',",
"# we don't want to inherit it ... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | AssistantBase.get_subassistant_tree | Returns a tree-like structure representing the assistant hierarchy going down
from this assistant to leaf assistants.
For example: [(<This Assistant>,
[(<Subassistant 1>, [...]),
(<Subassistant 2>, [...])]
)]
Returns:
... | devassistant/assistant_base.py | def get_subassistant_tree(self):
"""Returns a tree-like structure representing the assistant hierarchy going down
from this assistant to leaf assistants.
For example: [(<This Assistant>,
[(<Subassistant 1>, [...]),
(<Subassistant 2>, [...])]
... | def get_subassistant_tree(self):
"""Returns a tree-like structure representing the assistant hierarchy going down
from this assistant to leaf assistants.
For example: [(<This Assistant>,
[(<Subassistant 1>, [...]),
(<Subassistant 2>, [...])]
... | [
"Returns",
"a",
"tree",
"-",
"like",
"structure",
"representing",
"the",
"assistant",
"hierarchy",
"going",
"down",
"from",
"this",
"assistant",
"to",
"leaf",
"assistants",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/assistant_base.py#L51-L69 | [
"def",
"get_subassistant_tree",
"(",
"self",
")",
":",
"if",
"'_tree'",
"not",
"in",
"dir",
"(",
"self",
")",
":",
"subassistant_tree",
"=",
"[",
"]",
"subassistants",
"=",
"self",
".",
"get_subassistants",
"(",
")",
"for",
"subassistant",
"in",
"subassistan... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | AssistantBase.get_selected_subassistant_path | Recursively searches self._tree - has format of (Assistant: [list_of_subassistants]) -
for specific path from first to last selected subassistants.
Args:
kwargs: arguments containing names of the given assistants in form of
subassistant_0 = 'name', subassistant_1 = 'another_name... | devassistant/assistant_base.py | def get_selected_subassistant_path(self, **kwargs):
"""Recursively searches self._tree - has format of (Assistant: [list_of_subassistants]) -
for specific path from first to last selected subassistants.
Args:
kwargs: arguments containing names of the given assistants in form of
... | def get_selected_subassistant_path(self, **kwargs):
"""Recursively searches self._tree - has format of (Assistant: [list_of_subassistants]) -
for specific path from first to last selected subassistants.
Args:
kwargs: arguments containing names of the given assistants in form of
... | [
"Recursively",
"searches",
"self",
".",
"_tree",
"-",
"has",
"format",
"of",
"(",
"Assistant",
":",
"[",
"list_of_subassistants",
"]",
")",
"-",
"for",
"specific",
"path",
"from",
"first",
"to",
"last",
"selected",
"subassistants",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/assistant_base.py#L71-L101 | [
"def",
"get_selected_subassistant_path",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"path",
"=",
"[",
"self",
"]",
"previous_subas_list",
"=",
"None",
"currently_searching",
"=",
"self",
".",
"get_subassistant_tree",
"(",
")",
"[",
"1",
"]",
"# len(path) ... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | AssistantBase.is_run_as_leaf | Returns True if this assistant was run as last in path, False otherwise. | devassistant/assistant_base.py | def is_run_as_leaf(self, **kwargs):
"""Returns True if this assistant was run as last in path, False otherwise."""
# find the last subassistant_N
i = 0
while i < len(kwargs): # len(kwargs) is maximum of subassistant_N keys
if settings.SUBASSISTANT_N_STRING.format(i) in kwarg... | def is_run_as_leaf(self, **kwargs):
"""Returns True if this assistant was run as last in path, False otherwise."""
# find the last subassistant_N
i = 0
while i < len(kwargs): # len(kwargs) is maximum of subassistant_N keys
if settings.SUBASSISTANT_N_STRING.format(i) in kwarg... | [
"Returns",
"True",
"if",
"this",
"assistant",
"was",
"run",
"as",
"last",
"in",
"path",
"False",
"otherwise",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/assistant_base.py#L103-L112 | [
"def",
"is_run_as_leaf",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# find the last subassistant_N",
"i",
"=",
"0",
"while",
"i",
"<",
"len",
"(",
"kwargs",
")",
":",
"# len(kwargs) is maximum of subassistant_N keys",
"if",
"settings",
".",
"SUBASSISTANT_N_S... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | YamlLoader.load_all_yamls | Loads yaml files from all given directories.
Args:
directories: list of directories to search
Returns:
dict of {fullpath: loaded_yaml_structure} | devassistant/yaml_loader.py | def load_all_yamls(cls, directories):
"""Loads yaml files from all given directories.
Args:
directories: list of directories to search
Returns:
dict of {fullpath: loaded_yaml_structure}
"""
yaml_files = []
loaded_yamls = {}
for d in direc... | def load_all_yamls(cls, directories):
"""Loads yaml files from all given directories.
Args:
directories: list of directories to search
Returns:
dict of {fullpath: loaded_yaml_structure}
"""
yaml_files = []
loaded_yamls = {}
for d in direc... | [
"Loads",
"yaml",
"files",
"from",
"all",
"given",
"directories",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_loader.py#L17-L38 | [
"def",
"load_all_yamls",
"(",
"cls",
",",
"directories",
")",
":",
"yaml_files",
"=",
"[",
"]",
"loaded_yamls",
"=",
"{",
"}",
"for",
"d",
"in",
"directories",
":",
"if",
"d",
".",
"startswith",
"(",
"'/home'",
")",
"and",
"not",
"os",
".",
"path",
"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | YamlLoader.load_yaml_by_relpath | Load a yaml file with path that is relative to one of given directories.
Args:
directories: list of directories to search
name: relative path of the yaml file to load
log_debug: log all messages as debug
Returns:
tuple (fullpath, loaded yaml structure) or... | devassistant/yaml_loader.py | def load_yaml_by_relpath(cls, directories, rel_path, log_debug=False):
"""Load a yaml file with path that is relative to one of given directories.
Args:
directories: list of directories to search
name: relative path of the yaml file to load
log_debug: log all message... | def load_yaml_by_relpath(cls, directories, rel_path, log_debug=False):
"""Load a yaml file with path that is relative to one of given directories.
Args:
directories: list of directories to search
name: relative path of the yaml file to load
log_debug: log all message... | [
"Load",
"a",
"yaml",
"file",
"with",
"path",
"that",
"is",
"relative",
"to",
"one",
"of",
"given",
"directories",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_loader.py#L41-L60 | [
"def",
"load_yaml_by_relpath",
"(",
"cls",
",",
"directories",
",",
"rel_path",
",",
"log_debug",
"=",
"False",
")",
":",
"for",
"d",
"in",
"directories",
":",
"if",
"d",
".",
"startswith",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~'",
")",
")... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | YamlLoader.load_yaml_by_path | Load a yaml file that is at given path,
if the path is not a string, it is assumed it's a file-like object | devassistant/yaml_loader.py | def load_yaml_by_path(cls, path, log_debug=False):
"""Load a yaml file that is at given path,
if the path is not a string, it is assumed it's a file-like object"""
try:
if isinstance(path, six.string_types):
return yaml.load(open(path, 'r'), Loader=Loader) or {}
... | def load_yaml_by_path(cls, path, log_debug=False):
"""Load a yaml file that is at given path,
if the path is not a string, it is assumed it's a file-like object"""
try:
if isinstance(path, six.string_types):
return yaml.load(open(path, 'r'), Loader=Loader) or {}
... | [
"Load",
"a",
"yaml",
"file",
"that",
"is",
"at",
"given",
"path",
"if",
"the",
"path",
"is",
"not",
"a",
"string",
"it",
"is",
"assumed",
"it",
"s",
"a",
"file",
"-",
"like",
"object"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_loader.py#L63-L78 | [
"def",
"load_yaml_by_path",
"(",
"cls",
",",
"path",
",",
"log_debug",
"=",
"False",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"path",
",",
"six",
".",
"string_types",
")",
":",
"return",
"yaml",
".",
"load",
"(",
"open",
"(",
"path",
",",
"'r'"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | PathRunner._run_path_dependencies | Installs dependencies from the leaf assistant.
Raises:
devassistant.exceptions.DependencyException with a cause if something goes wrong | devassistant/path_runner.py | def _run_path_dependencies(self, parsed_args):
"""Installs dependencies from the leaf assistant.
Raises:
devassistant.exceptions.DependencyException with a cause if something goes wrong
"""
deps = self.path[-1].dependencies(parsed_args)
lang.Command('dependencies', d... | def _run_path_dependencies(self, parsed_args):
"""Installs dependencies from the leaf assistant.
Raises:
devassistant.exceptions.DependencyException with a cause if something goes wrong
"""
deps = self.path[-1].dependencies(parsed_args)
lang.Command('dependencies', d... | [
"Installs",
"dependencies",
"from",
"the",
"leaf",
"assistant",
".",
"Raises",
":",
"devassistant",
".",
"exceptions",
".",
"DependencyException",
"with",
"a",
"cause",
"if",
"something",
"goes",
"wrong"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/path_runner.py#L19-L26 | [
"def",
"_run_path_dependencies",
"(",
"self",
",",
"parsed_args",
")",
":",
"deps",
"=",
"self",
".",
"path",
"[",
"-",
"1",
"]",
".",
"dependencies",
"(",
"parsed_args",
")",
"lang",
".",
"Command",
"(",
"'dependencies'",
",",
"deps",
",",
"parsed_args",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | PathRunner.run | Runs all errors, dependencies and run methods of all *Assistant objects in self.path.
Raises:
devassistant.exceptions.ExecutionException with a cause if something goes wrong | devassistant/path_runner.py | def run(self):
"""Runs all errors, dependencies and run methods of all *Assistant objects in self.path.
Raises:
devassistant.exceptions.ExecutionException with a cause if something goes wrong
"""
error = None
# run 'pre_run', 'logging', 'dependencies' and 'run'
... | def run(self):
"""Runs all errors, dependencies and run methods of all *Assistant objects in self.path.
Raises:
devassistant.exceptions.ExecutionException with a cause if something goes wrong
"""
error = None
# run 'pre_run', 'logging', 'dependencies' and 'run'
... | [
"Runs",
"all",
"errors",
"dependencies",
"and",
"run",
"methods",
"of",
"all",
"*",
"Assistant",
"objects",
"in",
"self",
".",
"path",
".",
"Raises",
":",
"devassistant",
".",
"exceptions",
".",
"ExecutionException",
"with",
"a",
"cause",
"if",
"something",
... | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/path_runner.py#L42-L75 | [
"def",
"run",
"(",
"self",
")",
":",
"error",
"=",
"None",
"# run 'pre_run', 'logging', 'dependencies' and 'run'",
"try",
":",
"# serve as a central place for error logging",
"self",
".",
"_logging",
"(",
"self",
".",
"parsed_args",
")",
"if",
"'deps_only'",
"not",
"i... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DapFormatter.calculate_offset | Return the maximum length of the provided strings that have a nice
variant in DapFormatter._nice_strings | devassistant/dapi/__init__.py | def calculate_offset(cls, labels):
'''Return the maximum length of the provided strings that have a nice
variant in DapFormatter._nice_strings'''
used_strings = set(cls._nice_strings.keys()) & set(labels)
return max([len(cls._nice_strings[s]) for s in used_strings]) | def calculate_offset(cls, labels):
'''Return the maximum length of the provided strings that have a nice
variant in DapFormatter._nice_strings'''
used_strings = set(cls._nice_strings.keys()) & set(labels)
return max([len(cls._nice_strings[s]) for s in used_strings]) | [
"Return",
"the",
"maximum",
"length",
"of",
"the",
"provided",
"strings",
"that",
"have",
"a",
"nice",
"variant",
"in",
"DapFormatter",
".",
"_nice_strings"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L57-L61 | [
"def",
"calculate_offset",
"(",
"cls",
",",
"labels",
")",
":",
"used_strings",
"=",
"set",
"(",
"cls",
".",
"_nice_strings",
".",
"keys",
"(",
")",
")",
"&",
"set",
"(",
"labels",
")",
"return",
"max",
"(",
"[",
"len",
"(",
"cls",
".",
"_nice_string... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DapFormatter.format_dapi_score | Format the line with DAPI user rating and number of votes | devassistant/dapi/__init__.py | def format_dapi_score(cls, meta, offset):
'''Format the line with DAPI user rating and number of votes'''
if 'average_rank' and 'rank_count' in meta:
label = (cls._nice_strings['average_rank'] + ':').ljust(offset + 2)
score = cls._format_field(meta['average_rank'])
vo... | def format_dapi_score(cls, meta, offset):
'''Format the line with DAPI user rating and number of votes'''
if 'average_rank' and 'rank_count' in meta:
label = (cls._nice_strings['average_rank'] + ':').ljust(offset + 2)
score = cls._format_field(meta['average_rank'])
vo... | [
"Format",
"the",
"line",
"with",
"DAPI",
"user",
"rating",
"and",
"number",
"of",
"votes"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L64-L72 | [
"def",
"format_dapi_score",
"(",
"cls",
",",
"meta",
",",
"offset",
")",
":",
"if",
"'average_rank'",
"and",
"'rank_count'",
"in",
"meta",
":",
"label",
"=",
"(",
"cls",
".",
"_nice_strings",
"[",
"'average_rank'",
"]",
"+",
"':'",
")",
".",
"ljust",
"("... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DapFormatter.format_meta_lines | Return all information from a given meta dictionary in a list of lines | devassistant/dapi/__init__.py | def format_meta_lines(cls, meta, labels, offset, **kwargs):
'''Return all information from a given meta dictionary in a list of lines'''
lines = []
# Name and underline
name = meta['package_name']
if 'version' in meta:
name += '-' + meta['version']
if 'custom... | def format_meta_lines(cls, meta, labels, offset, **kwargs):
'''Return all information from a given meta dictionary in a list of lines'''
lines = []
# Name and underline
name = meta['package_name']
if 'version' in meta:
name += '-' + meta['version']
if 'custom... | [
"Return",
"all",
"information",
"from",
"a",
"given",
"meta",
"dictionary",
"in",
"a",
"list",
"of",
"lines"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L75-L109 | [
"def",
"format_meta_lines",
"(",
"cls",
",",
"meta",
",",
"labels",
",",
"offset",
",",
"*",
"*",
"kwargs",
")",
":",
"lines",
"=",
"[",
"]",
"# Name and underline",
"name",
"=",
"meta",
"[",
"'package_name'",
"]",
"if",
"'version'",
"in",
"meta",
":",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DapFormatter._format_files | Format the list of files (e. g. assistants or snippets | devassistant/dapi/__init__.py | def _format_files(cls, files, kind):
'''Format the list of files (e. g. assistants or snippets'''
lines = []
if files:
lines.append('The following {kind} are contained in this DAP:'.format(kind=kind.title()))
for f in files:
lines.append('* ' + strip_prefi... | def _format_files(cls, files, kind):
'''Format the list of files (e. g. assistants or snippets'''
lines = []
if files:
lines.append('The following {kind} are contained in this DAP:'.format(kind=kind.title()))
for f in files:
lines.append('* ' + strip_prefi... | [
"Format",
"the",
"list",
"of",
"files",
"(",
"e",
".",
"g",
".",
"assistants",
"or",
"snippets"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L112-L121 | [
"def",
"_format_files",
"(",
"cls",
",",
"files",
",",
"kind",
")",
":",
"lines",
"=",
"[",
"]",
"if",
"files",
":",
"lines",
".",
"append",
"(",
"'The following {kind} are contained in this DAP:'",
".",
"format",
"(",
"kind",
"=",
"kind",
".",
"title",
"(... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DapFormatter.format_assistants_lines | Return formatted assistants from the given list in human readable form. | devassistant/dapi/__init__.py | def format_assistants_lines(cls, assistants):
'''Return formatted assistants from the given list in human readable form.'''
lines = cls._format_files(assistants, 'assistants')
# Assistant help
if assistants:
lines.append('')
assistant = strip_prefix(random.choice... | def format_assistants_lines(cls, assistants):
'''Return formatted assistants from the given list in human readable form.'''
lines = cls._format_files(assistants, 'assistants')
# Assistant help
if assistants:
lines.append('')
assistant = strip_prefix(random.choice... | [
"Return",
"formatted",
"assistants",
"from",
"the",
"given",
"list",
"in",
"human",
"readable",
"form",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L124-L140 | [
"def",
"format_assistants_lines",
"(",
"cls",
",",
"assistants",
")",
":",
"lines",
"=",
"cls",
".",
"_format_files",
"(",
"assistants",
",",
"'assistants'",
")",
"# Assistant help",
"if",
"assistants",
":",
"lines",
".",
"append",
"(",
"''",
")",
"assistant",... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DapFormatter.format_platforms | Formats supported platforms in human readable form | devassistant/dapi/__init__.py | def format_platforms(cls, platforms):
'''Formats supported platforms in human readable form'''
lines = []
if platforms:
lines.append('This DAP is only supported on the following platforms:')
lines.extend([' * ' + platform for platform in platforms])
return lines | def format_platforms(cls, platforms):
'''Formats supported platforms in human readable form'''
lines = []
if platforms:
lines.append('This DAP is only supported on the following platforms:')
lines.extend([' * ' + platform for platform in platforms])
return lines | [
"Formats",
"supported",
"platforms",
"in",
"human",
"readable",
"form"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L148-L154 | [
"def",
"format_platforms",
"(",
"cls",
",",
"platforms",
")",
":",
"lines",
"=",
"[",
"]",
"if",
"platforms",
":",
"lines",
".",
"append",
"(",
"'This DAP is only supported on the following platforms:'",
")",
"lines",
".",
"extend",
"(",
"[",
"' * '",
"+",
"pl... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DapChecker.check | Checks if the dap is valid, reports problems
Parameters:
network -- whether to run checks that requires network connection
output -- where to write() problems, might be None
raises -- whether to raise an exception immediately after problem is detected | devassistant/dapi/__init__.py | def check(cls, dap, network=False, yamls=True, raises=False, logger=logger):
'''Checks if the dap is valid, reports problems
Parameters:
network -- whether to run checks that requires network connection
output -- where to write() problems, might be None
raises -- whe... | def check(cls, dap, network=False, yamls=True, raises=False, logger=logger):
'''Checks if the dap is valid, reports problems
Parameters:
network -- whether to run checks that requires network connection
output -- where to write() problems, might be None
raises -- whe... | [
"Checks",
"if",
"the",
"dap",
"is",
"valid",
"reports",
"problems"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L160-L187 | [
"def",
"check",
"(",
"cls",
",",
"dap",
",",
"network",
"=",
"False",
",",
"yamls",
"=",
"True",
",",
"raises",
"=",
"False",
",",
"logger",
"=",
"logger",
")",
":",
"dap",
".",
"_check_raises",
"=",
"raises",
"dap",
".",
"_problematic",
"=",
"False"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DapChecker.check_meta | Check the meta.yaml in the dap.
Return a list of DapProblems. | devassistant/dapi/__init__.py | def check_meta(cls, dap):
'''Check the meta.yaml in the dap.
Return a list of DapProblems.'''
problems = list()
# Check for non array-like metadata
for datatype in (Dap._required_meta | Dap._optional_meta) - Dap._array_meta:
if not dap._isvalid(datatype):
... | def check_meta(cls, dap):
'''Check the meta.yaml in the dap.
Return a list of DapProblems.'''
problems = list()
# Check for non array-like metadata
for datatype in (Dap._required_meta | Dap._optional_meta) - Dap._array_meta:
if not dap._isvalid(datatype):
... | [
"Check",
"the",
"meta",
".",
"yaml",
"in",
"the",
"dap",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L190-L225 | [
"def",
"check_meta",
"(",
"cls",
",",
"dap",
")",
":",
"problems",
"=",
"list",
"(",
")",
"# Check for non array-like metadata",
"for",
"datatype",
"in",
"(",
"Dap",
".",
"_required_meta",
"|",
"Dap",
".",
"_optional_meta",
")",
"-",
"Dap",
".",
"_array_meta... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DapChecker.check_topdir | Check that everything is in the correct top-level directory.
Return a list of DapProblems | devassistant/dapi/__init__.py | def check_topdir(cls, dap):
'''Check that everything is in the correct top-level directory.
Return a list of DapProblems'''
problems = list()
dirname = os.path.dirname(dap._meta_location)
if not dirname:
msg = 'meta.yaml is not in top-level directory'
pr... | def check_topdir(cls, dap):
'''Check that everything is in the correct top-level directory.
Return a list of DapProblems'''
problems = list()
dirname = os.path.dirname(dap._meta_location)
if not dirname:
msg = 'meta.yaml is not in top-level directory'
pr... | [
"Check",
"that",
"everything",
"is",
"in",
"the",
"correct",
"top",
"-",
"level",
"directory",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L228-L257 | [
"def",
"check_topdir",
"(",
"cls",
",",
"dap",
")",
":",
"problems",
"=",
"list",
"(",
")",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"dap",
".",
"_meta_location",
")",
"if",
"not",
"dirname",
":",
"msg",
"=",
"'meta.yaml is not in top-leve... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DapChecker.check_no_self_dependency | Check that the package does not depend on itself.
Return a list of problems. | devassistant/dapi/__init__.py | def check_no_self_dependency(cls, dap):
'''Check that the package does not depend on itself.
Return a list of problems.'''
problems = list()
if 'package_name' in dap.meta and 'dependencies' in dap.meta:
dependencies = set()
for dependency in dap.meta['dependenc... | def check_no_self_dependency(cls, dap):
'''Check that the package does not depend on itself.
Return a list of problems.'''
problems = list()
if 'package_name' in dap.meta and 'dependencies' in dap.meta:
dependencies = set()
for dependency in dap.meta['dependenc... | [
"Check",
"that",
"the",
"package",
"does",
"not",
"depend",
"on",
"itself",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L260-L288 | [
"def",
"check_no_self_dependency",
"(",
"cls",
",",
"dap",
")",
":",
"problems",
"=",
"list",
"(",
")",
"if",
"'package_name'",
"in",
"dap",
".",
"meta",
"and",
"'dependencies'",
"in",
"dap",
".",
"meta",
":",
"dependencies",
"=",
"set",
"(",
")",
"for",... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DapChecker.check_name_not_on_dapi | Check that the package_name is not registered on Dapi.
Return list of problems. | devassistant/dapi/__init__.py | def check_name_not_on_dapi(cls, dap):
'''Check that the package_name is not registered on Dapi.
Return list of problems.'''
problems = list()
if dap.meta['package_name']:
from . import dapicli
d = dapicli.metadap(dap.meta['package_name'])
if d:
... | def check_name_not_on_dapi(cls, dap):
'''Check that the package_name is not registered on Dapi.
Return list of problems.'''
problems = list()
if dap.meta['package_name']:
from . import dapicli
d = dapicli.metadap(dap.meta['package_name'])
if d:
... | [
"Check",
"that",
"the",
"package_name",
"is",
"not",
"registered",
"on",
"Dapi",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L291-L303 | [
"def",
"check_name_not_on_dapi",
"(",
"cls",
",",
"dap",
")",
":",
"problems",
"=",
"list",
"(",
")",
"if",
"dap",
".",
"meta",
"[",
"'package_name'",
"]",
":",
"from",
".",
"import",
"dapicli",
"d",
"=",
"dapicli",
".",
"metadap",
"(",
"dap",
".",
"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DapChecker.check_files | Check that there are only those files the standard accepts.
Return list of DapProblems. | devassistant/dapi/__init__.py | def check_files(cls, dap):
'''Check that there are only those files the standard accepts.
Return list of DapProblems.'''
problems = list()
dirname = os.path.dirname(dap._meta_location)
if dirname:
dirname += '/'
files = [f for f in dap.files if f.startswith(... | def check_files(cls, dap):
'''Check that there are only those files the standard accepts.
Return list of DapProblems.'''
problems = list()
dirname = os.path.dirname(dap._meta_location)
if dirname:
dirname += '/'
files = [f for f in dap.files if f.startswith(... | [
"Check",
"that",
"there",
"are",
"only",
"those",
"files",
"the",
"standard",
"accepts",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L306-L394 | [
"def",
"check_files",
"(",
"cls",
",",
"dap",
")",
":",
"problems",
"=",
"list",
"(",
")",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"dap",
".",
"_meta_location",
")",
"if",
"dirname",
":",
"dirname",
"+=",
"'/'",
"files",
"=",
"[",
"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DapChecker.check_yamls | Check that all assistants and snippets are valid.
Return list of DapProblems. | devassistant/dapi/__init__.py | def check_yamls(cls, dap):
'''Check that all assistants and snippets are valid.
Return list of DapProblems.'''
problems = list()
for yaml in dap.assistants_and_snippets:
path = yaml + '.yaml'
parsed_yaml = YamlLoader.load_yaml_by_path(dap._get_file(path, prepend... | def check_yamls(cls, dap):
'''Check that all assistants and snippets are valid.
Return list of DapProblems.'''
problems = list()
for yaml in dap.assistants_and_snippets:
path = yaml + '.yaml'
parsed_yaml = YamlLoader.load_yaml_by_path(dap._get_file(path, prepend... | [
"Check",
"that",
"all",
"assistants",
"and",
"snippets",
"are",
"valid",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L397-L414 | [
"def",
"check_yamls",
"(",
"cls",
",",
"dap",
")",
":",
"problems",
"=",
"list",
"(",
")",
"for",
"yaml",
"in",
"dap",
".",
"assistants_and_snippets",
":",
"path",
"=",
"yaml",
"+",
"'.yaml'",
"parsed_yaml",
"=",
"YamlLoader",
".",
"load_yaml_by_path",
"("... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Dap._strip_leading_dirname | Strip leading directory name from the given path | devassistant/dapi/__init__.py | def _strip_leading_dirname(self, path):
'''Strip leading directory name from the given path'''
return os.path.sep.join(path.split(os.path.sep)[1:]) | def _strip_leading_dirname(self, path):
'''Strip leading directory name from the given path'''
return os.path.sep.join(path.split(os.path.sep)[1:]) | [
"Strip",
"leading",
"directory",
"name",
"from",
"the",
"given",
"path"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L511-L513 | [
"def",
"_strip_leading_dirname",
"(",
"self",
",",
"path",
")",
":",
"return",
"os",
".",
"path",
".",
"sep",
".",
"join",
"(",
"path",
".",
"split",
"(",
"os",
".",
"path",
".",
"sep",
")",
"[",
"1",
":",
"]",
")"
] | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Dap.assistants | Get all assistants in this DAP | devassistant/dapi/__init__.py | def assistants(self):
'''Get all assistants in this DAP'''
return [strip_suffix(f, '.yaml') for f in self._stripped_files if self._assistants_pattern.match(f)] | def assistants(self):
'''Get all assistants in this DAP'''
return [strip_suffix(f, '.yaml') for f in self._stripped_files if self._assistants_pattern.match(f)] | [
"Get",
"all",
"assistants",
"in",
"this",
"DAP"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L521-L523 | [
"def",
"assistants",
"(",
"self",
")",
":",
"return",
"[",
"strip_suffix",
"(",
"f",
",",
"'.yaml'",
")",
"for",
"f",
"in",
"self",
".",
"_stripped_files",
"if",
"self",
".",
"_assistants_pattern",
".",
"match",
"(",
"f",
")",
"]"
] | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Dap.snippets | Get all snippets in this DAP | devassistant/dapi/__init__.py | def snippets(self):
'''Get all snippets in this DAP'''
return [strip_suffix(f, '.yaml') for f in self._stripped_files if self._snippets_pattern.match(f)] | def snippets(self):
'''Get all snippets in this DAP'''
return [strip_suffix(f, '.yaml') for f in self._stripped_files if self._snippets_pattern.match(f)] | [
"Get",
"all",
"snippets",
"in",
"this",
"DAP"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L526-L528 | [
"def",
"snippets",
"(",
"self",
")",
":",
"return",
"[",
"strip_suffix",
"(",
"f",
",",
"'.yaml'",
")",
"for",
"f",
"in",
"self",
".",
"_stripped_files",
"if",
"self",
".",
"_snippets_pattern",
".",
"match",
"(",
"f",
")",
"]"
] | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Dap.icons | Get all icons in this DAP, optionally strip extensions | devassistant/dapi/__init__.py | def icons(self, strip_ext=False):
'''Get all icons in this DAP, optionally strip extensions'''
result = [f for f in self._stripped_files if self._icons_pattern.match(f)]
if strip_ext:
result = [strip_suffix(f, '\.({ext})'.format(ext=self._icons_ext), regex=True) for f in result]
... | def icons(self, strip_ext=False):
'''Get all icons in this DAP, optionally strip extensions'''
result = [f for f in self._stripped_files if self._icons_pattern.match(f)]
if strip_ext:
result = [strip_suffix(f, '\.({ext})'.format(ext=self._icons_ext), regex=True) for f in result]
... | [
"Get",
"all",
"icons",
"in",
"this",
"DAP",
"optionally",
"strip",
"extensions"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L535-L541 | [
"def",
"icons",
"(",
"self",
",",
"strip_ext",
"=",
"False",
")",
":",
"result",
"=",
"[",
"f",
"for",
"f",
"in",
"self",
".",
"_stripped_files",
"if",
"self",
".",
"_icons_pattern",
".",
"match",
"(",
"f",
")",
"]",
"if",
"strip_ext",
":",
"result",... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Dap._find_bad_meta | Fill self._badmeta with meta datatypes that are invalid | devassistant/dapi/__init__.py | def _find_bad_meta(self):
'''Fill self._badmeta with meta datatypes that are invalid'''
self._badmeta = dict()
for datatype in self.meta:
for item in self.meta[datatype]:
if not Dap._meta_valid[datatype].match(item):
if datatype not in self._badme... | def _find_bad_meta(self):
'''Fill self._badmeta with meta datatypes that are invalid'''
self._badmeta = dict()
for datatype in self.meta:
for item in self.meta[datatype]:
if not Dap._meta_valid[datatype].match(item):
if datatype not in self._badme... | [
"Fill",
"self",
".",
"_badmeta",
"with",
"meta",
"datatypes",
"that",
"are",
"invalid"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L543-L552 | [
"def",
"_find_bad_meta",
"(",
"self",
")",
":",
"self",
".",
"_badmeta",
"=",
"dict",
"(",
")",
"for",
"datatype",
"in",
"self",
".",
"meta",
":",
"for",
"item",
"in",
"self",
".",
"meta",
"[",
"datatype",
"]",
":",
"if",
"not",
"Dap",
".",
"_meta_... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Dap._get_file | Extracts a file from dap to a file-like object | devassistant/dapi/__init__.py | def _get_file(self, path, prepend=False):
'''Extracts a file from dap to a file-like object'''
if prepend:
path = os.path.join(self._dirname(), path)
extracted = self._tar.extractfile(path)
if extracted:
return extracted
raise DapFileError(('Could not read... | def _get_file(self, path, prepend=False):
'''Extracts a file from dap to a file-like object'''
if prepend:
path = os.path.join(self._dirname(), path)
extracted = self._tar.extractfile(path)
if extracted:
return extracted
raise DapFileError(('Could not read... | [
"Extracts",
"a",
"file",
"from",
"dap",
"to",
"a",
"file",
"-",
"like",
"object"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L582-L590 | [
"def",
"_get_file",
"(",
"self",
",",
"path",
",",
"prepend",
"=",
"False",
")",
":",
"if",
"prepend",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_dirname",
"(",
")",
",",
"path",
")",
"extracted",
"=",
"self",
".",
"_ta... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Dap._load_meta | Load data from meta.yaml to a dictionary | devassistant/dapi/__init__.py | def _load_meta(self, meta):
'''Load data from meta.yaml to a dictionary'''
meta = yaml.load(meta, Loader=Loader)
# Versions are often specified in a format that is convertible to an
# int or a float, so we want to make sure it is interpreted as a str.
# Fix for the bug #300.
... | def _load_meta(self, meta):
'''Load data from meta.yaml to a dictionary'''
meta = yaml.load(meta, Loader=Loader)
# Versions are often specified in a format that is convertible to an
# int or a float, so we want to make sure it is interpreted as a str.
# Fix for the bug #300.
... | [
"Load",
"data",
"from",
"meta",
".",
"yaml",
"to",
"a",
"dictionary"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L592-L602 | [
"def",
"_load_meta",
"(",
"self",
",",
"meta",
")",
":",
"meta",
"=",
"yaml",
".",
"load",
"(",
"meta",
",",
"Loader",
"=",
"Loader",
")",
"# Versions are often specified in a format that is convertible to an",
"# int or a float, so we want to make sure it is interpreted as... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Dap._report_problem | Report a given problem | devassistant/dapi/__init__.py | def _report_problem(self, problem, level=logging.ERROR):
'''Report a given problem'''
problem = self.basename + ': ' + problem
if self._logger.isEnabledFor(level):
self._problematic = True
if self._check_raises:
raise DapInvalid(problem)
self._logger.log(l... | def _report_problem(self, problem, level=logging.ERROR):
'''Report a given problem'''
problem = self.basename + ': ' + problem
if self._logger.isEnabledFor(level):
self._problematic = True
if self._check_raises:
raise DapInvalid(problem)
self._logger.log(l... | [
"Report",
"a",
"given",
"problem"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L604-L611 | [
"def",
"_report_problem",
"(",
"self",
",",
"problem",
",",
"level",
"=",
"logging",
".",
"ERROR",
")",
":",
"problem",
"=",
"self",
".",
"basename",
"+",
"': '",
"+",
"problem",
"if",
"self",
".",
"_logger",
".",
"isEnabledFor",
"(",
"level",
")",
":"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Dap._isvalid | Checks if the given datatype is valid in meta | devassistant/dapi/__init__.py | def _isvalid(self, datatype):
'''Checks if the given datatype is valid in meta'''
if datatype in self.meta:
return bool(Dap._meta_valid[datatype].match(self.meta[datatype]))
else:
return datatype in Dap._optional_meta | def _isvalid(self, datatype):
'''Checks if the given datatype is valid in meta'''
if datatype in self.meta:
return bool(Dap._meta_valid[datatype].match(self.meta[datatype]))
else:
return datatype in Dap._optional_meta | [
"Checks",
"if",
"the",
"given",
"datatype",
"is",
"valid",
"in",
"meta"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L613-L618 | [
"def",
"_isvalid",
"(",
"self",
",",
"datatype",
")",
":",
"if",
"datatype",
"in",
"self",
".",
"meta",
":",
"return",
"bool",
"(",
"Dap",
".",
"_meta_valid",
"[",
"datatype",
"]",
".",
"match",
"(",
"self",
".",
"meta",
"[",
"datatype",
"]",
")",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Dap._arevalid | Checks if the given datatype is valid in meta (for array-like types) | devassistant/dapi/__init__.py | def _arevalid(self, datatype):
'''Checks if the given datatype is valid in meta (for array-like types)'''
# Datatype not specified
if datatype not in self.meta:
return datatype in Dap._optional_meta, []
# Required datatype empty
if datatype in self._required_meta and... | def _arevalid(self, datatype):
'''Checks if the given datatype is valid in meta (for array-like types)'''
# Datatype not specified
if datatype not in self.meta:
return datatype in Dap._optional_meta, []
# Required datatype empty
if datatype in self._required_meta and... | [
"Checks",
"if",
"the",
"given",
"datatype",
"is",
"valid",
"in",
"meta",
"(",
"for",
"array",
"-",
"like",
"types",
")"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L620-L649 | [
"def",
"_arevalid",
"(",
"self",
",",
"datatype",
")",
":",
"# Datatype not specified",
"if",
"datatype",
"not",
"in",
"self",
".",
"meta",
":",
"return",
"datatype",
"in",
"Dap",
".",
"_optional_meta",
",",
"[",
"]",
"# Required datatype empty",
"if",
"dataty... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Dap._is_dir | Check if the given in-dap file is a directory | devassistant/dapi/__init__.py | def _is_dir(self, f):
'''Check if the given in-dap file is a directory'''
return self._tar.getmember(f).type == tarfile.DIRTYPE | def _is_dir(self, f):
'''Check if the given in-dap file is a directory'''
return self._tar.getmember(f).type == tarfile.DIRTYPE | [
"Check",
"if",
"the",
"given",
"in",
"-",
"dap",
"file",
"is",
"a",
"directory"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L651-L653 | [
"def",
"_is_dir",
"(",
"self",
",",
"f",
")",
":",
"return",
"self",
".",
"_tar",
".",
"getmember",
"(",
"f",
")",
".",
"type",
"==",
"tarfile",
".",
"DIRTYPE"
] | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Dap._get_emptydirs | Find empty directories and return them
Only works for actual files in dap | devassistant/dapi/__init__.py | def _get_emptydirs(self, files):
'''Find empty directories and return them
Only works for actual files in dap'''
emptydirs = []
for f in files:
if self._is_dir(f):
empty = True
for ff in files:
if ff.startswith(f + '/'):
... | def _get_emptydirs(self, files):
'''Find empty directories and return them
Only works for actual files in dap'''
emptydirs = []
for f in files:
if self._is_dir(f):
empty = True
for ff in files:
if ff.startswith(f + '/'):
... | [
"Find",
"empty",
"directories",
"and",
"return",
"them",
"Only",
"works",
"for",
"actual",
"files",
"in",
"dap"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/dapi/__init__.py#L655-L668 | [
"def",
"_get_emptydirs",
"(",
"self",
",",
"files",
")",
":",
"emptydirs",
"=",
"[",
"]",
"for",
"f",
"in",
"files",
":",
"if",
"self",
".",
"_is_dir",
"(",
"f",
")",
":",
"empty",
"=",
"True",
"for",
"ff",
"in",
"files",
":",
"if",
"ff",
".",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | ConfigManager.load_configuration_file | Load all configuration from file | devassistant/config_manager.py | def load_configuration_file(self):
"""
Load all configuration from file
"""
if not os.path.exists(self.config_file):
return
try:
with open(self.config_file, 'r') as file:
csvreader = csv.reader(file, delimiter='=',
... | def load_configuration_file(self):
"""
Load all configuration from file
"""
if not os.path.exists(self.config_file):
return
try:
with open(self.config_file, 'r') as file:
csvreader = csv.reader(file, delimiter='=',
... | [
"Load",
"all",
"configuration",
"from",
"file"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/config_manager.py#L22-L43 | [
"def",
"load_configuration_file",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"config_file",
")",
":",
"return",
"try",
":",
"with",
"open",
"(",
"self",
".",
"config_file",
",",
"'r'",
")",
"as",
"file",
"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | ConfigManager.save_configuration_file | Save all configuration into file
Only if config file does not yet exist or configuration was changed | devassistant/config_manager.py | def save_configuration_file(self):
"""
Save all configuration into file
Only if config file does not yet exist or configuration was changed
"""
if os.path.exists(self.config_file) and not self.config_changed:
return
dirname = os.path.dirname(self.config_file)
... | def save_configuration_file(self):
"""
Save all configuration into file
Only if config file does not yet exist or configuration was changed
"""
if os.path.exists(self.config_file) and not self.config_changed:
return
dirname = os.path.dirname(self.config_file)
... | [
"Save",
"all",
"configuration",
"into",
"file",
"Only",
"if",
"config",
"file",
"does",
"not",
"yet",
"exist",
"or",
"configuration",
"was",
"changed"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/config_manager.py#L45-L69 | [
"def",
"save_configuration_file",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"config_file",
")",
"and",
"not",
"self",
".",
"config_changed",
":",
"return",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | ConfigManager.set_config_value | Set configuration value with given name.
Value can be string or boolean type. | devassistant/config_manager.py | def set_config_value(self, name, value):
"""
Set configuration value with given name.
Value can be string or boolean type.
"""
if value is True:
value = "True"
elif value is False:
if name in self.config_dict:
del self.config_dict[n... | def set_config_value(self, name, value):
"""
Set configuration value with given name.
Value can be string or boolean type.
"""
if value is True:
value = "True"
elif value is False:
if name in self.config_dict:
del self.config_dict[n... | [
"Set",
"configuration",
"value",
"with",
"given",
"name",
".",
"Value",
"can",
"be",
"string",
"or",
"boolean",
"type",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/config_manager.py#L77-L91 | [
"def",
"set_config_value",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"if",
"value",
"is",
"True",
":",
"value",
"=",
"\"True\"",
"elif",
"value",
"is",
"False",
":",
"if",
"name",
"in",
"self",
".",
"config_dict",
":",
"del",
"self",
".",
"co... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | MainWindow.tooltip_queries | The function is used for setting tooltip on menus and submenus | devassistant/gui/main_window.py | def tooltip_queries(self, item, x_coord, y_coord, key_mode, tooltip, text):
"""
The function is used for setting tooltip on menus and submenus
"""
tooltip.set_text(text)
return True | def tooltip_queries(self, item, x_coord, y_coord, key_mode, tooltip, text):
"""
The function is used for setting tooltip on menus and submenus
"""
tooltip.set_text(text)
return True | [
"The",
"function",
"is",
"used",
"for",
"setting",
"tooltip",
"on",
"menus",
"and",
"submenus"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L110-L115 | [
"def",
"tooltip_queries",
"(",
"self",
",",
"item",
",",
"x_coord",
",",
"y_coord",
",",
"key_mode",
",",
"tooltip",
",",
"text",
")",
":",
"tooltip",
".",
"set_text",
"(",
"text",
")",
"return",
"True"
] | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | MainWindow._create_notebook_page | This function is used for create tab page for notebook.
Input arguments are:
assistant - used for collecting all info about assistants and subassistants | devassistant/gui/main_window.py | def _create_notebook_page(self, assistant):
"""
This function is used for create tab page for notebook.
Input arguments are:
assistant - used for collecting all info about assistants and subassistants
"""
#frame = self._create_frame()
grid_lang = self.gui_helper.c... | def _create_notebook_page(self, assistant):
"""
This function is used for create tab page for notebook.
Input arguments are:
assistant - used for collecting all info about assistants and subassistants
"""
#frame = self._create_frame()
grid_lang = self.gui_helper.c... | [
"This",
"function",
"is",
"used",
"for",
"create",
"tab",
"page",
"for",
"notebook",
".",
"Input",
"arguments",
"are",
":",
"assistant",
"-",
"used",
"for",
"collecting",
"all",
"info",
"about",
"assistants",
"and",
"subassistants"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L117-L155 | [
"def",
"_create_notebook_page",
"(",
"self",
",",
"assistant",
")",
":",
"#frame = self._create_frame()",
"grid_lang",
"=",
"self",
".",
"gui_helper",
".",
"create_gtk_grid",
"(",
")",
"scrolled_window",
"=",
"self",
".",
"gui_helper",
".",
"create_scrolled_window",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | MainWindow._open_path_window | Hides this window and opens path window.
Passes all needed data and kwargs. | devassistant/gui/main_window.py | def _open_path_window(self):
"""
Hides this window and opens path window.
Passes all needed data and kwargs.
"""
self.data['top_assistant'] = self.top_assistant
self.data['current_main_assistant'] = self.get_current_main_assistant()
self.data['kwargs'] = self.kwar... | def _open_path_window(self):
"""
Hides this window and opens path window.
Passes all needed data and kwargs.
"""
self.data['top_assistant'] = self.top_assistant
self.data['current_main_assistant'] = self.get_current_main_assistant()
self.data['kwargs'] = self.kwar... | [
"Hides",
"this",
"window",
"and",
"opens",
"path",
"window",
".",
"Passes",
"all",
"needed",
"data",
"and",
"kwargs",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L163-L172 | [
"def",
"_open_path_window",
"(",
"self",
")",
":",
"self",
".",
"data",
"[",
"'top_assistant'",
"]",
"=",
"self",
".",
"top_assistant",
"self",
".",
"data",
"[",
"'current_main_assistant'",
"]",
"=",
"self",
".",
"get_current_main_assistant",
"(",
")",
"self",... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | MainWindow.sub_menu_pressed | Function serves for getting full assistant path and
collects the information from GUI | devassistant/gui/main_window.py | def sub_menu_pressed(self, widget, event):
"""
Function serves for getting full assistant path and
collects the information from GUI
"""
for index, data in enumerate(self.dev_assistant_path):
index += 1
if settings.SUBASSISTANT_N_STRING.format(index) in se... | def sub_menu_pressed(self, widget, event):
"""
Function serves for getting full assistant path and
collects the information from GUI
"""
for index, data in enumerate(self.dev_assistant_path):
index += 1
if settings.SUBASSISTANT_N_STRING.format(index) in se... | [
"Function",
"serves",
"for",
"getting",
"full",
"assistant",
"path",
"and",
"collects",
"the",
"information",
"from",
"GUI"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L174-L185 | [
"def",
"sub_menu_pressed",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"for",
"index",
",",
"data",
"in",
"enumerate",
"(",
"self",
".",
"dev_assistant_path",
")",
":",
"index",
"+=",
"1",
"if",
"settings",
".",
"SUBASSISTANT_N_STRING",
".",
"forma... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | MainWindow.get_current_main_assistant | Function return current assistant | devassistant/gui/main_window.py | def get_current_main_assistant(self):
"""
Function return current assistant
"""
current_page = self.notebook.get_nth_page(self.notebook.get_current_page())
return current_page.main_assistant | def get_current_main_assistant(self):
"""
Function return current assistant
"""
current_page = self.notebook.get_nth_page(self.notebook.get_current_page())
return current_page.main_assistant | [
"Function",
"return",
"current",
"assistant"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L187-L192 | [
"def",
"get_current_main_assistant",
"(",
"self",
")",
":",
"current_page",
"=",
"self",
".",
"notebook",
".",
"get_nth_page",
"(",
"self",
".",
"notebook",
".",
"get_current_page",
"(",
")",
")",
"return",
"current_page",
".",
"main_assistant"
] | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | MainWindow.btn_clicked | Function is used for case that assistant does not have any
subassistants | devassistant/gui/main_window.py | def btn_clicked(self, widget, data=None):
"""
Function is used for case that assistant does not have any
subassistants
"""
self.kwargs['subassistant_0'] = self.get_current_main_assistant().name
self.kwargs['subassistant_1'] = data
if 'subassistant_2' in self.kwarg... | def btn_clicked(self, widget, data=None):
"""
Function is used for case that assistant does not have any
subassistants
"""
self.kwargs['subassistant_0'] = self.get_current_main_assistant().name
self.kwargs['subassistant_1'] = data
if 'subassistant_2' in self.kwarg... | [
"Function",
"is",
"used",
"for",
"case",
"that",
"assistant",
"does",
"not",
"have",
"any",
"subassistants"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L194-L203 | [
"def",
"btn_clicked",
"(",
"self",
",",
"widget",
",",
"data",
"=",
"None",
")",
":",
"self",
".",
"kwargs",
"[",
"'subassistant_0'",
"]",
"=",
"self",
".",
"get_current_main_assistant",
"(",
")",
".",
"name",
"self",
".",
"kwargs",
"[",
"'subassistant_1'"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | MainWindow.open_window | Function opens Main Window and in case of previously created
project is switches to /home directory
This is fix in case that da creats a project
and project was deleted and GUI was not closed yet | devassistant/gui/main_window.py | def open_window(self, widget, data=None):
"""
Function opens Main Window and in case of previously created
project is switches to /home directory
This is fix in case that da creats a project
and project was deleted and GUI was not closed yet
"""
if data is not Non... | def open_window(self, widget, data=None):
"""
Function opens Main Window and in case of previously created
project is switches to /home directory
This is fix in case that da creats a project
and project was deleted and GUI was not closed yet
"""
if data is not Non... | [
"Function",
"opens",
"Main",
"Window",
"and",
"in",
"case",
"of",
"previously",
"created",
"project",
"is",
"switches",
"to",
"/",
"home",
"directory",
"This",
"is",
"fix",
"in",
"case",
"that",
"da",
"creats",
"a",
"project",
"and",
"project",
"was",
"del... | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L224-L235 | [
"def",
"open_window",
"(",
"self",
",",
"widget",
",",
"data",
"=",
"None",
")",
":",
"if",
"data",
"is",
"not",
"None",
":",
"self",
".",
"data",
"=",
"data",
"os",
".",
"chdir",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~'",
")",
")",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | MainWindow.btn_press_event | Function is used for showing Popup menu | devassistant/gui/main_window.py | def btn_press_event(self, widget, event):
"""
Function is used for showing Popup menu
"""
if event.type == Gdk.EventType.BUTTON_PRESS:
if event.button.button == 1:
widget.popup(None, None, None, None,
event.button.button, event.tim... | def btn_press_event(self, widget, event):
"""
Function is used for showing Popup menu
"""
if event.type == Gdk.EventType.BUTTON_PRESS:
if event.button.button == 1:
widget.popup(None, None, None, None,
event.button.button, event.tim... | [
"Function",
"is",
"used",
"for",
"showing",
"Popup",
"menu"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/main_window.py#L237-L246 | [
"def",
"btn_press_event",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"if",
"event",
".",
"type",
"==",
"Gdk",
".",
"EventType",
".",
"BUTTON_PRESS",
":",
"if",
"event",
".",
"button",
".",
"button",
"==",
"1",
":",
"widget",
".",
"popup",
"(... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | run_gui | Function for running DevAssistant GUI | devassistant/gui/__init__.py | def run_gui():
"""
Function for running DevAssistant GUI
"""
try:
from gi.repository import Gtk
except ImportError as ie:
pass
except RuntimeError as e:
sys.stderr.write(GUI_MESSAGE)
sys.stderr.write("%s: %r" % (e.__class__.__name__, utils.exc_as_decoded_string(e)... | def run_gui():
"""
Function for running DevAssistant GUI
"""
try:
from gi.repository import Gtk
except ImportError as ie:
pass
except RuntimeError as e:
sys.stderr.write(GUI_MESSAGE)
sys.stderr.write("%s: %r" % (e.__class__.__name__, utils.exc_as_decoded_string(e)... | [
"Function",
"for",
"running",
"DevAssistant",
"GUI"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/gui/__init__.py#L14-L50 | [
"def",
"run_gui",
"(",
")",
":",
"try",
":",
"from",
"gi",
".",
"repository",
"import",
"Gtk",
"except",
"ImportError",
"as",
"ie",
":",
"pass",
"except",
"RuntimeError",
"as",
"e",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"GUI_MESSAGE",
")",
"sys... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | needs_fully_loaded | Wraps all publicly callable methods of YamlAssistant. If the assistant was loaded
from cache, this decorator will fully load it first time a publicly callable method
is used. | devassistant/yaml_assistant.py | def needs_fully_loaded(method):
"""Wraps all publicly callable methods of YamlAssistant. If the assistant was loaded
from cache, this decorator will fully load it first time a publicly callable method
is used.
"""
@functools.wraps(method)
def inner(self, *args, **kwargs):
if not self.ful... | def needs_fully_loaded(method):
"""Wraps all publicly callable methods of YamlAssistant. If the assistant was loaded
from cache, this decorator will fully load it first time a publicly callable method
is used.
"""
@functools.wraps(method)
def inner(self, *args, **kwargs):
if not self.ful... | [
"Wraps",
"all",
"publicly",
"callable",
"methods",
"of",
"YamlAssistant",
".",
"If",
"the",
"assistant",
"was",
"loaded",
"from",
"cache",
"this",
"decorator",
"will",
"fully",
"load",
"it",
"first",
"time",
"a",
"publicly",
"callable",
"method",
"is",
"used",... | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_assistant.py#L19-L32 | [
"def",
"needs_fully_loaded",
"(",
"method",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"method",
")",
"def",
"inner",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"fully_loaded",
":",
"loaded_yaml",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | YamlAssistant.default_icon_path | Returns default path to icon of this assistant.
Assuming self.path == "/foo/assistants/crt/python/django.yaml"
For image format in [png, svg]:
1) Take the path of this assistant and strip it of load path
(=> "crt/python/django.yaml")
2) Substitute its extension fo... | devassistant/yaml_assistant.py | def default_icon_path(self):
"""Returns default path to icon of this assistant.
Assuming self.path == "/foo/assistants/crt/python/django.yaml"
For image format in [png, svg]:
1) Take the path of this assistant and strip it of load path
(=> "crt/python/django.yaml")
... | def default_icon_path(self):
"""Returns default path to icon of this assistant.
Assuming self.path == "/foo/assistants/crt/python/django.yaml"
For image format in [png, svg]:
1) Take the path of this assistant and strip it of load path
(=> "crt/python/django.yaml")
... | [
"Returns",
"default",
"path",
"to",
"icon",
"of",
"this",
"assistant",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_assistant.py#L95-L116 | [
"def",
"default_icon_path",
"(",
"self",
")",
":",
"supported_exts",
"=",
"[",
"'.png'",
",",
"'.svg'",
"]",
"stripped",
"=",
"self",
".",
"path",
".",
"replace",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"load_path",
",",
"'assistants'",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | YamlAssistant.proper_kwargs | Returns kwargs updated with proper meta variables (like __assistant__).
If this method is run repeatedly with the same section and the same kwargs,
it always modifies kwargs in the same way. | devassistant/yaml_assistant.py | def proper_kwargs(self, section, kwargs):
"""Returns kwargs updated with proper meta variables (like __assistant__).
If this method is run repeatedly with the same section and the same kwargs,
it always modifies kwargs in the same way.
"""
kwargs['__section__'] = section
... | def proper_kwargs(self, section, kwargs):
"""Returns kwargs updated with proper meta variables (like __assistant__).
If this method is run repeatedly with the same section and the same kwargs,
it always modifies kwargs in the same way.
"""
kwargs['__section__'] = section
... | [
"Returns",
"kwargs",
"updated",
"with",
"proper",
"meta",
"variables",
"(",
"like",
"__assistant__",
")",
".",
"If",
"this",
"method",
"is",
"run",
"repeatedly",
"with",
"the",
"same",
"section",
"and",
"the",
"same",
"kwargs",
"it",
"always",
"modifies",
"k... | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_assistant.py#L141-L158 | [
"def",
"proper_kwargs",
"(",
"self",
",",
"section",
",",
"kwargs",
")",
":",
"kwargs",
"[",
"'__section__'",
"]",
"=",
"section",
"kwargs",
"[",
"'__assistant__'",
"]",
"=",
"self",
"kwargs",
"[",
"'__env__'",
"]",
"=",
"copy",
".",
"deepcopy",
"(",
"os... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | YamlAssistant.dependencies | Returns all dependencies of this assistant with regards to specified kwargs.
If expand_only == False, this method returns list of mappings of dependency types
to actual dependencies (keeps order, types can repeat), e.g.
Example:
[{'rpm', ['rubygems']}, {'gem', ['mygem']}, {'rpm', ['spam... | devassistant/yaml_assistant.py | def dependencies(self, kwargs=None, expand_only=False):
"""Returns all dependencies of this assistant with regards to specified kwargs.
If expand_only == False, this method returns list of mappings of dependency types
to actual dependencies (keeps order, types can repeat), e.g.
Example:... | def dependencies(self, kwargs=None, expand_only=False):
"""Returns all dependencies of this assistant with regards to specified kwargs.
If expand_only == False, this method returns list of mappings of dependency types
to actual dependencies (keeps order, types can repeat), e.g.
Example:... | [
"Returns",
"all",
"dependencies",
"of",
"this",
"assistant",
"with",
"regards",
"to",
"specified",
"kwargs",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/yaml_assistant.py#L202-L228 | [
"def",
"dependencies",
"(",
"self",
",",
"kwargs",
"=",
"None",
",",
"expand_only",
"=",
"False",
")",
":",
"# we can't use {} as a default for kwargs, as that initializes the dict only once in Python",
"# and uses the same dict in all subsequent calls of this method",
"if",
"not",... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | PackageManager.get_perm_prompt | Return text for prompt (do you want to install...), to install given packages. | devassistant/package_managers.py | def get_perm_prompt(cls, package_list):
"""
Return text for prompt (do you want to install...), to install given packages.
"""
if cls == PackageManager:
raise NotImplementedError()
ln = len(package_list)
plural = 's' if ln > 1 else ''
return cls.permis... | def get_perm_prompt(cls, package_list):
"""
Return text for prompt (do you want to install...), to install given packages.
"""
if cls == PackageManager:
raise NotImplementedError()
ln = len(package_list)
plural = 's' if ln > 1 else ''
return cls.permis... | [
"Return",
"text",
"for",
"prompt",
"(",
"do",
"you",
"want",
"to",
"install",
"...",
")",
"to",
"install",
"given",
"packages",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L56-L64 | [
"def",
"get_perm_prompt",
"(",
"cls",
",",
"package_list",
")",
":",
"if",
"cls",
"==",
"PackageManager",
":",
"raise",
"NotImplementedError",
"(",
")",
"ln",
"=",
"len",
"(",
"package_list",
")",
"plural",
"=",
"'s'",
"if",
"ln",
">",
"1",
"else",
"''",... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GentooPackageManager._try_get_current_manager | Try to detect a package manager used in a current Gentoo system. | devassistant/package_managers.py | def _try_get_current_manager(cls):
""" Try to detect a package manager used in a current Gentoo system. """
if utils.get_distro_name().find('gentoo') == -1:
return None
if 'PACKAGE_MANAGER' in os.environ:
pm = os.environ['PACKAGE_MANAGER']
if pm == 'paludis':
... | def _try_get_current_manager(cls):
""" Try to detect a package manager used in a current Gentoo system. """
if utils.get_distro_name().find('gentoo') == -1:
return None
if 'PACKAGE_MANAGER' in os.environ:
pm = os.environ['PACKAGE_MANAGER']
if pm == 'paludis':
... | [
"Try",
"to",
"detect",
"a",
"package",
"manager",
"used",
"in",
"a",
"current",
"Gentoo",
"system",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L607-L637 | [
"def",
"_try_get_current_manager",
"(",
"cls",
")",
":",
"if",
"utils",
".",
"get_distro_name",
"(",
")",
".",
"find",
"(",
"'gentoo'",
")",
"==",
"-",
"1",
":",
"return",
"None",
"if",
"'PACKAGE_MANAGER'",
"in",
"os",
".",
"environ",
":",
"pm",
"=",
"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | GentooPackageManager.is_current_manager_equals_to | Returns True if this package manager is usable, False otherwise. | devassistant/package_managers.py | def is_current_manager_equals_to(cls, pm):
"""Returns True if this package manager is usable, False otherwise."""
if hasattr(cls, 'works_result'):
return cls.works_result
is_ok = bool(cls._try_get_current_manager() == pm)
setattr(cls, 'works_result', is_ok)
return is_... | def is_current_manager_equals_to(cls, pm):
"""Returns True if this package manager is usable, False otherwise."""
if hasattr(cls, 'works_result'):
return cls.works_result
is_ok = bool(cls._try_get_current_manager() == pm)
setattr(cls, 'works_result', is_ok)
return is_... | [
"Returns",
"True",
"if",
"this",
"package",
"manager",
"is",
"usable",
"False",
"otherwise",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L640-L646 | [
"def",
"is_current_manager_equals_to",
"(",
"cls",
",",
"pm",
")",
":",
"if",
"hasattr",
"(",
"cls",
",",
"'works_result'",
")",
":",
"return",
"cls",
".",
"works_result",
"is_ok",
"=",
"bool",
"(",
"cls",
".",
"_try_get_current_manager",
"(",
")",
"==",
"... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DependencyInstaller.get_package_manager | Choose proper package manager and return it. | devassistant/package_managers.py | def get_package_manager(self, dep_t):
"""Choose proper package manager and return it."""
mgrs = managers.get(dep_t, [])
for manager in mgrs:
if manager.works():
return manager
if not mgrs:
err = 'No package manager for dependency type "{dep_t}"'.fo... | def get_package_manager(self, dep_t):
"""Choose proper package manager and return it."""
mgrs = managers.get(dep_t, [])
for manager in mgrs:
if manager.works():
return manager
if not mgrs:
err = 'No package manager for dependency type "{dep_t}"'.fo... | [
"Choose",
"proper",
"package",
"manager",
"and",
"return",
"it",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L836-L849 | [
"def",
"get_package_manager",
"(",
"self",
",",
"dep_t",
")",
":",
"mgrs",
"=",
"managers",
".",
"get",
"(",
"dep_t",
",",
"[",
"]",
")",
"for",
"manager",
"in",
"mgrs",
":",
"if",
"manager",
".",
"works",
"(",
")",
":",
"return",
"manager",
"if",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DependencyInstaller._process_dependency | Add dependencies into self.dependencies, possibly also adding system packages
that contain non-distro package managers (e.g. if someone wants to install
dependencies with pip and pip is not present, it will get installed through
RPM on RPM based systems, etc.
Skips dependencies that are... | devassistant/package_managers.py | def _process_dependency(self, dep_t, dep_l):
"""Add dependencies into self.dependencies, possibly also adding system packages
that contain non-distro package managers (e.g. if someone wants to install
dependencies with pip and pip is not present, it will get installed through
RPM on RPM ... | def _process_dependency(self, dep_t, dep_l):
"""Add dependencies into self.dependencies, possibly also adding system packages
that contain non-distro package managers (e.g. if someone wants to install
dependencies with pip and pip is not present, it will get installed through
RPM on RPM ... | [
"Add",
"dependencies",
"into",
"self",
".",
"dependencies",
"possibly",
"also",
"adding",
"system",
"packages",
"that",
"contain",
"non",
"-",
"distro",
"package",
"managers",
"(",
"e",
".",
"g",
".",
"if",
"someone",
"wants",
"to",
"install",
"dependencies",
... | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L851-L879 | [
"def",
"_process_dependency",
"(",
"self",
",",
"dep_t",
",",
"dep_l",
")",
":",
"if",
"dep_t",
"not",
"in",
"managers",
":",
"err",
"=",
"'No package manager for dependency type \"{dep_t}\"'",
".",
"format",
"(",
"dep_t",
"=",
"dep_t",
")",
"raise",
"exceptions... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DependencyInstaller._ask_to_confirm | Return True if user wants to install packages, False otherwise | devassistant/package_managers.py | def _ask_to_confirm(self, ui, pac_man, *to_install):
""" Return True if user wants to install packages, False otherwise """
ret = DialogHelper.ask_for_package_list_confirm(
ui, prompt=pac_man.get_perm_prompt(to_install),
package_list=to_install,
)
return bool(ret) | def _ask_to_confirm(self, ui, pac_man, *to_install):
""" Return True if user wants to install packages, False otherwise """
ret = DialogHelper.ask_for_package_list_confirm(
ui, prompt=pac_man.get_perm_prompt(to_install),
package_list=to_install,
)
return bool(ret) | [
"Return",
"True",
"if",
"user",
"wants",
"to",
"install",
"packages",
"False",
"otherwise"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L881-L887 | [
"def",
"_ask_to_confirm",
"(",
"self",
",",
"ui",
",",
"pac_man",
",",
"*",
"to_install",
")",
":",
"ret",
"=",
"DialogHelper",
".",
"ask_for_package_list_confirm",
"(",
"ui",
",",
"prompt",
"=",
"pac_man",
".",
"get_perm_prompt",
"(",
"to_install",
")",
","... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DependencyInstaller._install_dependencies | Install missing dependencies | devassistant/package_managers.py | def _install_dependencies(self, ui, debug):
"""Install missing dependencies"""
for dep_t, dep_l in self.dependencies:
if not dep_l:
continue
pkg_mgr = self.get_package_manager(dep_t)
pkg_mgr.works()
to_resolve = []
for dep in de... | def _install_dependencies(self, ui, debug):
"""Install missing dependencies"""
for dep_t, dep_l in self.dependencies:
if not dep_l:
continue
pkg_mgr = self.get_package_manager(dep_t)
pkg_mgr.works()
to_resolve = []
for dep in de... | [
"Install",
"missing",
"dependencies"
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L889-L933 | [
"def",
"_install_dependencies",
"(",
"self",
",",
"ui",
",",
"debug",
")",
":",
"for",
"dep_t",
",",
"dep_l",
"in",
"self",
".",
"dependencies",
":",
"if",
"not",
"dep_l",
":",
"continue",
"pkg_mgr",
"=",
"self",
".",
"get_package_manager",
"(",
"dep_t",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | DependencyInstaller.install | This is the only method that should be called from outside. Call it
like:
`DependencyInstaller(struct)` and it will install packages which are
not present on system (it uses package managers specified by `struct`
structure) | devassistant/package_managers.py | def install(self, struct, ui, debug=False):
"""
This is the only method that should be called from outside. Call it
like:
`DependencyInstaller(struct)` and it will install packages which are
not present on system (it uses package managers specified by `struct`
structure)
... | def install(self, struct, ui, debug=False):
"""
This is the only method that should be called from outside. Call it
like:
`DependencyInstaller(struct)` and it will install packages which are
not present on system (it uses package managers specified by `struct`
structure)
... | [
"This",
"is",
"the",
"only",
"method",
"that",
"should",
"be",
"called",
"from",
"outside",
".",
"Call",
"it",
"like",
":",
"DependencyInstaller",
"(",
"struct",
")",
"and",
"it",
"will",
"install",
"packages",
"which",
"are",
"not",
"present",
"on",
"syst... | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/package_managers.py#L935-L949 | [
"def",
"install",
"(",
"self",
",",
"struct",
",",
"ui",
",",
"debug",
"=",
"False",
")",
":",
"# the system dependencies should always go first",
"self",
".",
"__add_dependencies",
"(",
"self",
".",
"get_system_deptype_shortcut",
"(",
")",
",",
"[",
"]",
")",
... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Cache.refresh_role | Checks and refreshes (if needed) all assistants with given role.
Args:
role: role of assistants to refresh
file_hierarchy: hierarchy as returned by devassistant.yaml_assistant_loader.\
YamlAssistantLoader.get_assistants_file_hierarchy | devassistant/cache.py | def refresh_role(self, role, file_hierarchy):
"""Checks and refreshes (if needed) all assistants with given role.
Args:
role: role of assistants to refresh
file_hierarchy: hierarchy as returned by devassistant.yaml_assistant_loader.\
YamlAssistantLoad... | def refresh_role(self, role, file_hierarchy):
"""Checks and refreshes (if needed) all assistants with given role.
Args:
role: role of assistants to refresh
file_hierarchy: hierarchy as returned by devassistant.yaml_assistant_loader.\
YamlAssistantLoad... | [
"Checks",
"and",
"refreshes",
"(",
"if",
"needed",
")",
"all",
"assistants",
"with",
"given",
"role",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cache.py#L78-L92 | [
"def",
"refresh_role",
"(",
"self",
",",
"role",
",",
"file_hierarchy",
")",
":",
"if",
"role",
"not",
"in",
"self",
".",
"cache",
":",
"self",
".",
"cache",
"[",
"role",
"]",
"=",
"{",
"}",
"was_change",
"=",
"self",
".",
"_refresh_hierarchy_recursive",... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Cache._refresh_hierarchy_recursive | Recursively goes through given corresponding hierarchies from cache and filesystem
and adds/refreshes/removes added/changed/removed assistants.
Args:
cached_hierarchy: the respective hierarchy part from current cache
(for format see Cache class docstring)
... | devassistant/cache.py | def _refresh_hierarchy_recursive(self, cached_hierarchy, file_hierarchy):
"""Recursively goes through given corresponding hierarchies from cache and filesystem
and adds/refreshes/removes added/changed/removed assistants.
Args:
cached_hierarchy: the respective hierarchy part from cur... | def _refresh_hierarchy_recursive(self, cached_hierarchy, file_hierarchy):
"""Recursively goes through given corresponding hierarchies from cache and filesystem
and adds/refreshes/removes added/changed/removed assistants.
Args:
cached_hierarchy: the respective hierarchy part from cur... | [
"Recursively",
"goes",
"through",
"given",
"corresponding",
"hierarchies",
"from",
"cache",
"and",
"filesystem",
"and",
"adds",
"/",
"refreshes",
"/",
"removes",
"added",
"/",
"changed",
"/",
"removed",
"assistants",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cache.py#L94-L139 | [
"def",
"_refresh_hierarchy_recursive",
"(",
"self",
",",
"cached_hierarchy",
",",
"file_hierarchy",
")",
":",
"was_change",
"=",
"False",
"cached_ass",
"=",
"set",
"(",
"cached_hierarchy",
".",
"keys",
"(",
")",
")",
"new_ass",
"=",
"set",
"(",
"file_hierarchy",... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Cache._ass_needs_refresh | Checks if assistant needs refresh.
Assistant needs refresh iff any of following conditions is True:
- stored source file is different than given source file
- stored assistant ctime is lower than current source file ctime
- stored list of subassistants is different than given list of su... | devassistant/cache.py | def _ass_needs_refresh(self, cached_ass, file_ass):
"""Checks if assistant needs refresh.
Assistant needs refresh iff any of following conditions is True:
- stored source file is different than given source file
- stored assistant ctime is lower than current source file ctime
- ... | def _ass_needs_refresh(self, cached_ass, file_ass):
"""Checks if assistant needs refresh.
Assistant needs refresh iff any of following conditions is True:
- stored source file is different than given source file
- stored assistant ctime is lower than current source file ctime
- ... | [
"Checks",
"if",
"assistant",
"needs",
"refresh",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cache.py#L141-L167 | [
"def",
"_ass_needs_refresh",
"(",
"self",
",",
"cached_ass",
",",
"file_ass",
")",
":",
"if",
"cached_ass",
"[",
"'source'",
"]",
"!=",
"file_ass",
"[",
"'source'",
"]",
":",
"return",
"True",
"if",
"os",
".",
"path",
".",
"getctime",
"(",
"file_ass",
"[... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
train | Cache._ass_refresh_attrs | Completely refreshes cached assistant from file.
Args:
cached_ass: an assistant from cache hierarchy
(for format see Cache class docstring)
file_ass: the respective assistant from filesystem hierarchy
(for format see what refresh_role accept... | devassistant/cache.py | def _ass_refresh_attrs(self, cached_ass, file_ass):
"""Completely refreshes cached assistant from file.
Args:
cached_ass: an assistant from cache hierarchy
(for format see Cache class docstring)
file_ass: the respective assistant from filesystem hierarchy... | def _ass_refresh_attrs(self, cached_ass, file_ass):
"""Completely refreshes cached assistant from file.
Args:
cached_ass: an assistant from cache hierarchy
(for format see Cache class docstring)
file_ass: the respective assistant from filesystem hierarchy... | [
"Completely",
"refreshes",
"cached",
"assistant",
"from",
"file",
"."
] | devassistant/devassistant | python | https://github.com/devassistant/devassistant/blob/2dbfeaa666a64127263664d18969c55d19ecc83e/devassistant/cache.py#L169-L203 | [
"def",
"_ass_refresh_attrs",
"(",
"self",
",",
"cached_ass",
",",
"file_ass",
")",
":",
"# we need to process assistant in custom way to see unexpanded args, etc.",
"loaded_ass",
"=",
"yaml_loader",
".",
"YamlLoader",
".",
"load_yaml_by_path",
"(",
"file_ass",
"[",
"'source... | 2dbfeaa666a64127263664d18969c55d19ecc83e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.