repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
acutesoftware/AIKIF | aikif/environments/happiness.py | Happiness.calculate | def calculate(self):
"""
calculates the estimated happiness of a person
living in a world
self._update_pref(self.person.prefs['tax_min'], self.person.prefs['tax_max'], self.world.tax_rate)
self._update_pref(self.person.prefs['tradition'], self.person.prefs['tradition'], self.worl... | python | def calculate(self):
"""
calculates the estimated happiness of a person
living in a world
self._update_pref(self.person.prefs['tax_min'], self.person.prefs['tax_max'], self.world.tax_rate)
self._update_pref(self.person.prefs['tradition'], self.person.prefs['tradition'], self.worl... | [
"def",
"calculate",
"(",
"self",
")",
":",
"self",
".",
"rating",
"=",
"0",
"for",
"f",
"in",
"self",
".",
"factors",
":",
"self",
".",
"_update_pref",
"(",
"f",
".",
"min",
",",
"f",
".",
"max",
",",
"self",
".",
"world",
".",
"tax_rate",
")"
] | calculates the estimated happiness of a person
living in a world
self._update_pref(self.person.prefs['tax_min'], self.person.prefs['tax_max'], self.world.tax_rate)
self._update_pref(self.person.prefs['tradition'], self.person.prefs['tradition'], self.world.tradition)
self._update_pref(se... | [
"calculates",
"the",
"estimated",
"happiness",
"of",
"a",
"person",
"living",
"in",
"a",
"world",
"self",
".",
"_update_pref",
"(",
"self",
".",
"person",
".",
"prefs",
"[",
"tax_min",
"]",
"self",
".",
"person",
".",
"prefs",
"[",
"tax_max",
"]",
"self"... | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/environments/happiness.py#L237-L247 | train | Calculates the estimated happiness of a person in a world. |
acutesoftware/AIKIF | aikif/environments/happiness.py | Happiness._update_pref | def _update_pref(self, lmin, lmax, cur):
"""
update the self rating based on the parameters.
If min max is a range (ie not equal) then add fixed value
to rating depending if current value is in range, otherwise
compare distance away from min/max (same value)
"""
r... | python | def _update_pref(self, lmin, lmax, cur):
"""
update the self rating based on the parameters.
If min max is a range (ie not equal) then add fixed value
to rating depending if current value is in range, otherwise
compare distance away from min/max (same value)
"""
r... | [
"def",
"_update_pref",
"(",
"self",
",",
"lmin",
",",
"lmax",
",",
"cur",
")",
":",
"rate_of_change_positive",
"=",
"10",
"rate_of_change_negative",
"=",
"2",
"add_positive",
"=",
"10",
"add_negative",
"=",
"2",
"if",
"lmin",
"==",
"lmax",
":",
"self",
"."... | update the self rating based on the parameters.
If min max is a range (ie not equal) then add fixed value
to rating depending if current value is in range, otherwise
compare distance away from min/max (same value) | [
"update",
"the",
"self",
"rating",
"based",
"on",
"the",
"parameters",
".",
"If",
"min",
"max",
"is",
"a",
"range",
"(",
"ie",
"not",
"equal",
")",
"then",
"add",
"fixed",
"value",
"to",
"rating",
"depending",
"if",
"current",
"value",
"is",
"in",
"ran... | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/environments/happiness.py#L249-L270 | train | Update the self. rating based on the parameters. |
acutesoftware/AIKIF | aikif/environments/happiness.py | Value.match_value_to_text | def match_value_to_text(self, text):
"""
this is going to be the tricky bit - probably not possible
to get the 'exact' rating for a value. Will need to do sentiment
analysis of the text to see how it matches the rating. Even that
sounds like it wont work - maybe a ML algorithm wo... | python | def match_value_to_text(self, text):
"""
this is going to be the tricky bit - probably not possible
to get the 'exact' rating for a value. Will need to do sentiment
analysis of the text to see how it matches the rating. Even that
sounds like it wont work - maybe a ML algorithm wo... | [
"def",
"match_value_to_text",
"(",
"self",
",",
"text",
")",
":",
"if",
"self",
".",
"nme",
"in",
"text",
":",
"res",
"=",
"0.8",
"else",
":",
"res",
"=",
"0.2",
"return",
"self",
".",
"nme",
"+",
"' = '",
"+",
"str",
"(",
"res",
")",
"+",
"' mat... | this is going to be the tricky bit - probably not possible
to get the 'exact' rating for a value. Will need to do sentiment
analysis of the text to see how it matches the rating. Even that
sounds like it wont work - maybe a ML algorithm would do it, but
that requires a large body of text... | [
"this",
"is",
"going",
"to",
"be",
"the",
"tricky",
"bit",
"-",
"probably",
"not",
"possible",
"to",
"get",
"the",
"exact",
"rating",
"for",
"a",
"value",
".",
"Will",
"need",
"to",
"do",
"sentiment",
"analysis",
"of",
"the",
"text",
"to",
"see",
"how"... | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/environments/happiness.py#L310-L329 | train | This function is used to match the value of a attribute to a text. |
acutesoftware/AIKIF | aikif/web_app/web_utils.py | list2html | def list2html(lst):
"""
convert a list to html using table formatting
"""
txt = '<TABLE width=100% border=0>'
for l in lst:
txt += '<TR>\n'
if type(l) is str:
txt+= '<TD>' + l + '</TD>\n'
elif type(l) is list:
txt+= '<TD>'
for i in l:
... | python | def list2html(lst):
"""
convert a list to html using table formatting
"""
txt = '<TABLE width=100% border=0>'
for l in lst:
txt += '<TR>\n'
if type(l) is str:
txt+= '<TD>' + l + '</TD>\n'
elif type(l) is list:
txt+= '<TD>'
for i in l:
... | [
"def",
"list2html",
"(",
"lst",
")",
":",
"txt",
"=",
"'<TABLE width=100% border=0>'",
"for",
"l",
"in",
"lst",
":",
"txt",
"+=",
"'<TR>\\n'",
"if",
"type",
"(",
"l",
")",
"is",
"str",
":",
"txt",
"+=",
"'<TD>'",
"+",
"l",
"+",
"'</TD>\\n'",
"elif",
... | convert a list to html using table formatting | [
"convert",
"a",
"list",
"to",
"html",
"using",
"table",
"formatting"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/web_app/web_utils.py#L10-L28 | train | convert a list to html using table formatting
|
acutesoftware/AIKIF | aikif/web_app/web_utils.py | GetFileList | def GetFileList(rootPaths, lstXtn, shortNameOnly='Y'):
"""
builds a list of files and returns as a list
"""
numFiles = 0
opFileList = []
if type(rootPaths) == str:
rootPaths = [rootPaths]
for rootPath in rootPaths:
for root, dirs, files in os.walk(rootPath):
... | python | def GetFileList(rootPaths, lstXtn, shortNameOnly='Y'):
"""
builds a list of files and returns as a list
"""
numFiles = 0
opFileList = []
if type(rootPaths) == str:
rootPaths = [rootPaths]
for rootPath in rootPaths:
for root, dirs, files in os.walk(rootPath):
... | [
"def",
"GetFileList",
"(",
"rootPaths",
",",
"lstXtn",
",",
"shortNameOnly",
"=",
"'Y'",
")",
":",
"numFiles",
"=",
"0",
"opFileList",
"=",
"[",
"]",
"if",
"type",
"(",
"rootPaths",
")",
"==",
"str",
":",
"rootPaths",
"=",
"[",
"rootPaths",
"]",
"for",... | builds a list of files and returns as a list | [
"builds",
"a",
"list",
"of",
"files",
"and",
"returns",
"as",
"a",
"list"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/web_app/web_utils.py#L31-L52 | train | Builds a list of files and returns as a list
|
acutesoftware/AIKIF | aikif/web_app/web_utils.py | build_edit_form | def build_edit_form(title, id, cols, return_page):
"""
returns the html for a simple edit form
"""
txt = '<H3>' + title + '<H3>'
txt += '<form action="' + return_page + '" method="POST">\n' # return_page = /agents
txt += ' updating id:' + str(id) + '\n<BR>'
txt += ' <input type="hidden" ... | python | def build_edit_form(title, id, cols, return_page):
"""
returns the html for a simple edit form
"""
txt = '<H3>' + title + '<H3>'
txt += '<form action="' + return_page + '" method="POST">\n' # return_page = /agents
txt += ' updating id:' + str(id) + '\n<BR>'
txt += ' <input type="hidden" ... | [
"def",
"build_edit_form",
"(",
"title",
",",
"id",
",",
"cols",
",",
"return_page",
")",
":",
"txt",
"=",
"'<H3>'",
"+",
"title",
"+",
"'<H3>'",
"txt",
"+=",
"'<form action=\"'",
"+",
"return_page",
"+",
"'\" method=\"POST\">\\n'",
"# return_page = /agents",
"tx... | returns the html for a simple edit form | [
"returns",
"the",
"html",
"for",
"a",
"simple",
"edit",
"form"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/web_app/web_utils.py#L67-L89 | train | Builds the html for an edit form
|
acutesoftware/AIKIF | aikif/web_app/web_utils.py | build_html_listbox | def build_html_listbox(lst, nme):
"""
returns the html to display a listbox
"""
res = '<select name="' + nme + '" multiple="multiple">\n'
for l in lst:
res += ' <option>' + str(l) + '</option>\n'
res += '</select>\n'
return res | python | def build_html_listbox(lst, nme):
"""
returns the html to display a listbox
"""
res = '<select name="' + nme + '" multiple="multiple">\n'
for l in lst:
res += ' <option>' + str(l) + '</option>\n'
res += '</select>\n'
return res | [
"def",
"build_html_listbox",
"(",
"lst",
",",
"nme",
")",
":",
"res",
"=",
"'<select name=\"'",
"+",
"nme",
"+",
"'\" multiple=\"multiple\">\\n'",
"for",
"l",
"in",
"lst",
":",
"res",
"+=",
"' <option>'",
"+",
"str",
"(",
"l",
")",
"+",
"'</option>\\n'",
... | returns the html to display a listbox | [
"returns",
"the",
"html",
"to",
"display",
"a",
"listbox"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/web_app/web_utils.py#L91-L100 | train | returns the html to display a listbox |
acutesoftware/AIKIF | aikif/web_app/web_utils.py | build_data_list | def build_data_list(lst):
"""
returns the html with supplied list as a HTML listbox
"""
txt = '<H3>' + List + '<H3><UL>'
for i in lst:
txt += '<LI>' + i + '</LI>'
txt += '<UL>'
return txt | python | def build_data_list(lst):
"""
returns the html with supplied list as a HTML listbox
"""
txt = '<H3>' + List + '<H3><UL>'
for i in lst:
txt += '<LI>' + i + '</LI>'
txt += '<UL>'
return txt | [
"def",
"build_data_list",
"(",
"lst",
")",
":",
"txt",
"=",
"'<H3>'",
"+",
"List",
"+",
"'<H3><UL>'",
"for",
"i",
"in",
"lst",
":",
"txt",
"+=",
"'<LI>'",
"+",
"i",
"+",
"'</LI>'",
"txt",
"+=",
"'<UL>'",
"return",
"txt"
] | returns the html with supplied list as a HTML listbox | [
"returns",
"the",
"html",
"with",
"supplied",
"list",
"as",
"a",
"HTML",
"listbox"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/web_app/web_utils.py#L102-L111 | train | returns the html with supplied list as a HTML listbox
|
acutesoftware/AIKIF | aikif/web_app/web_utils.py | filelist2html | def filelist2html(lst, fldr, hasHeader='N'):
"""
formats a standard filelist to htmk using table formats
"""
txt = '<TABLE width=100% border=0>'
numRows = 1
if lst:
for l in lst:
if hasHeader == 'Y':
if numRows == 1:
td_begin = '<TH>'
... | python | def filelist2html(lst, fldr, hasHeader='N'):
"""
formats a standard filelist to htmk using table formats
"""
txt = '<TABLE width=100% border=0>'
numRows = 1
if lst:
for l in lst:
if hasHeader == 'Y':
if numRows == 1:
td_begin = '<TH>'
... | [
"def",
"filelist2html",
"(",
"lst",
",",
"fldr",
",",
"hasHeader",
"=",
"'N'",
")",
":",
"txt",
"=",
"'<TABLE width=100% border=0>'",
"numRows",
"=",
"1",
"if",
"lst",
":",
"for",
"l",
"in",
"lst",
":",
"if",
"hasHeader",
"==",
"'Y'",
":",
"if",
"numRo... | formats a standard filelist to htmk using table formats | [
"formats",
"a",
"standard",
"filelist",
"to",
"htmk",
"using",
"table",
"formats"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/web_app/web_utils.py#L114-L145 | train | formats a standard filelist to htmk using table formats
|
acutesoftware/AIKIF | aikif/web_app/web_utils.py | link_file | def link_file(f, fldr):
"""
creates a html link for a file using folder fldr
"""
fname = os.path.join(fldr,f)
if os.path.isfile(fname):
return '<a href="/aikif/data/core/' + f + '">' + f + '</a>'
else:
return f | python | def link_file(f, fldr):
"""
creates a html link for a file using folder fldr
"""
fname = os.path.join(fldr,f)
if os.path.isfile(fname):
return '<a href="/aikif/data/core/' + f + '">' + f + '</a>'
else:
return f | [
"def",
"link_file",
"(",
"f",
",",
"fldr",
")",
":",
"fname",
"=",
"os",
".",
"path",
".",
"join",
"(",
"fldr",
",",
"f",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"fname",
")",
":",
"return",
"'<a href=\"/aikif/data/core/'",
"+",
"f",
"+",... | creates a html link for a file using folder fldr | [
"creates",
"a",
"html",
"link",
"for",
"a",
"file",
"using",
"folder",
"fldr"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/web_app/web_utils.py#L147-L155 | train | creates a html link for a file using folder fldr |
acutesoftware/AIKIF | aikif/web_app/web_utils.py | dict_to_htmlrow | def dict_to_htmlrow(d):
"""
converts a dictionary to a HTML table row
"""
res = "<TR>\n"
for k, v in d.items():
if type(v) == str:
res = res + '<TD><p>' + k + ':</p></TD><TD><p>' + v + '</p></TD>'
else:
res = res + '<TD><p>' + k + ':</p></TD><TD><p>' + str(v) ... | python | def dict_to_htmlrow(d):
"""
converts a dictionary to a HTML table row
"""
res = "<TR>\n"
for k, v in d.items():
if type(v) == str:
res = res + '<TD><p>' + k + ':</p></TD><TD><p>' + v + '</p></TD>'
else:
res = res + '<TD><p>' + k + ':</p></TD><TD><p>' + str(v) ... | [
"def",
"dict_to_htmlrow",
"(",
"d",
")",
":",
"res",
"=",
"\"<TR>\\n\"",
"for",
"k",
",",
"v",
"in",
"d",
".",
"items",
"(",
")",
":",
"if",
"type",
"(",
"v",
")",
"==",
"str",
":",
"res",
"=",
"res",
"+",
"'<TD><p>'",
"+",
"k",
"+",
"':</p></T... | converts a dictionary to a HTML table row | [
"converts",
"a",
"dictionary",
"to",
"a",
"HTML",
"table",
"row"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/web_app/web_utils.py#L157-L168 | train | converts a dictionary to a HTML table row |
acutesoftware/AIKIF | aikif/web_app/web_utils.py | read_csv_to_html_table | def read_csv_to_html_table(csvFile, hasHeader='N'):
"""
reads a CSV file and converts it to HTML
"""
txt = '<table class="as-table as-table-zebra as-table-horizontal">'
with open(csvFile, "r") as f: #
numRows = 1
for row in f:
if hasHeader == 'Y':
if num... | python | def read_csv_to_html_table(csvFile, hasHeader='N'):
"""
reads a CSV file and converts it to HTML
"""
txt = '<table class="as-table as-table-zebra as-table-horizontal">'
with open(csvFile, "r") as f: #
numRows = 1
for row in f:
if hasHeader == 'Y':
if num... | [
"def",
"read_csv_to_html_table",
"(",
"csvFile",
",",
"hasHeader",
"=",
"'N'",
")",
":",
"txt",
"=",
"'<table class=\"as-table as-table-zebra as-table-horizontal\">'",
"with",
"open",
"(",
"csvFile",
",",
"\"r\"",
")",
"as",
"f",
":",
"# ",
"numRows",
"=",
"1",
... | reads a CSV file and converts it to HTML | [
"reads",
"a",
"CSV",
"file",
"and",
"converts",
"it",
"to",
"HTML"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/web_app/web_utils.py#L170-L202 | train | reads a CSV file and converts it to HTML |
acutesoftware/AIKIF | aikif/web_app/web_utils.py | read_csv_to_html_list | def read_csv_to_html_list(csvFile):
"""
reads a CSV file and converts it to a HTML List
"""
txt = ''
with open(csvFile) as csv_file:
for row in csv.reader(csv_file, delimiter=','):
txt += '<div id="table_row">'
for col in row:
txt += " "
... | python | def read_csv_to_html_list(csvFile):
"""
reads a CSV file and converts it to a HTML List
"""
txt = ''
with open(csvFile) as csv_file:
for row in csv.reader(csv_file, delimiter=','):
txt += '<div id="table_row">'
for col in row:
txt += " "
... | [
"def",
"read_csv_to_html_list",
"(",
"csvFile",
")",
":",
"txt",
"=",
"''",
"with",
"open",
"(",
"csvFile",
")",
"as",
"csv_file",
":",
"for",
"row",
"in",
"csv",
".",
"reader",
"(",
"csv_file",
",",
"delimiter",
"=",
"','",
")",
":",
"txt",
"+=",
"'... | reads a CSV file and converts it to a HTML List | [
"reads",
"a",
"CSV",
"file",
"and",
"converts",
"it",
"to",
"a",
"HTML",
"List"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/web_app/web_utils.py#L206-L222 | train | reads a CSV file and converts it to a HTML List
|
acutesoftware/AIKIF | aikif/agents/explore/agent_explore_grid.py | ExploreAgent.set_world | def set_world(self, grd, start_y_x, y_x):
"""
tell the agent to move to location y,x
Why is there another grd object in the agent? Because
this is NOT the main grid, rather a copy for the agent
to overwrite with planning routes, etc.
The real grid is initialised in Worl... | python | def set_world(self, grd, start_y_x, y_x):
"""
tell the agent to move to location y,x
Why is there another grd object in the agent? Because
this is NOT the main grid, rather a copy for the agent
to overwrite with planning routes, etc.
The real grid is initialised in Worl... | [
"def",
"set_world",
"(",
"self",
",",
"grd",
",",
"start_y_x",
",",
"y_x",
")",
":",
"self",
".",
"grd",
"=",
"grd",
"self",
".",
"start_y",
"=",
"start_y_x",
"[",
"0",
"]",
"self",
".",
"start_x",
"=",
"start_y_x",
"[",
"1",
"]",
"self",
".",
"c... | tell the agent to move to location y,x
Why is there another grd object in the agent? Because
this is NOT the main grid, rather a copy for the agent
to overwrite with planning routes, etc.
The real grid is initialised in World.__init__() class | [
"tell",
"the",
"agent",
"to",
"move",
"to",
"location",
"y",
"x",
"Why",
"is",
"there",
"another",
"grd",
"object",
"in",
"the",
"agent?",
"Because",
"this",
"is",
"NOT",
"the",
"main",
"grid",
"rather",
"a",
"copy",
"for",
"the",
"agent",
"to",
"overw... | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/agents/explore/agent_explore_grid.py#L24-L41 | train | Set the world to the given grd. |
acutesoftware/AIKIF | aikif/agents/explore/agent_explore_grid.py | ExploreAgent.do_your_job | def do_your_job(self):
"""
the goal of the explore agent is to move to the
target while avoiding blockages on the grid.
This function is messy and needs to be looked at.
It currently has a bug in that the backtrack oscillates
so need a new method of doing this - probably... | python | def do_your_job(self):
"""
the goal of the explore agent is to move to the
target while avoiding blockages on the grid.
This function is messy and needs to be looked at.
It currently has a bug in that the backtrack oscillates
so need a new method of doing this - probably... | [
"def",
"do_your_job",
"(",
"self",
")",
":",
"y",
",",
"x",
"=",
"self",
".",
"get_intended_direction",
"(",
")",
"# first find out where we should go",
"if",
"self",
".",
"target_x",
"==",
"self",
".",
"current_x",
"and",
"self",
".",
"target_y",
"==",
"sel... | the goal of the explore agent is to move to the
target while avoiding blockages on the grid.
This function is messy and needs to be looked at.
It currently has a bug in that the backtrack oscillates
so need a new method of doing this - probably checking if
previously backtracked... | [
"the",
"goal",
"of",
"the",
"explore",
"agent",
"is",
"to",
"move",
"to",
"the",
"target",
"while",
"avoiding",
"blockages",
"on",
"the",
"grid",
".",
"This",
"function",
"is",
"messy",
"and",
"needs",
"to",
"be",
"looked",
"at",
".",
"It",
"currently",
... | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/agents/explore/agent_explore_grid.py#L43-L95 | train | This function is called by the explore agent to move to the target while avoiding blockages on the grid. It is also called by the explore agent to avoid blockages on the grid. |
acutesoftware/AIKIF | aikif/agents/explore/agent_explore_grid.py | ExploreAgent.lg_mv | def lg_mv(self, log_lvl, txt):
"""
wrapper for debugging print and log methods
"""
if log_lvl <= self.LOG_LEVEL:
print(txt + str(self.current_y) + "," + str(self.current_x)) | python | def lg_mv(self, log_lvl, txt):
"""
wrapper for debugging print and log methods
"""
if log_lvl <= self.LOG_LEVEL:
print(txt + str(self.current_y) + "," + str(self.current_x)) | [
"def",
"lg_mv",
"(",
"self",
",",
"log_lvl",
",",
"txt",
")",
":",
"if",
"log_lvl",
"<=",
"self",
".",
"LOG_LEVEL",
":",
"print",
"(",
"txt",
"+",
"str",
"(",
"self",
".",
"current_y",
")",
"+",
"\",\"",
"+",
"str",
"(",
"self",
".",
"current_x",
... | wrapper for debugging print and log methods | [
"wrapper",
"for",
"debugging",
"print",
"and",
"log",
"methods"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/agents/explore/agent_explore_grid.py#L98-L103 | train | wrapper for debugging print and log methods |
acutesoftware/AIKIF | aikif/agents/explore/agent_explore_grid.py | ExploreAgent.get_intended_direction | def get_intended_direction(self):
"""
returns a Y,X value showing which direction the
agent should move in order to get to the target
"""
x = 0
y = 0
if self.target_x == self.current_x and self.target_y == self.current_y:
return y,x # target already a... | python | def get_intended_direction(self):
"""
returns a Y,X value showing which direction the
agent should move in order to get to the target
"""
x = 0
y = 0
if self.target_x == self.current_x and self.target_y == self.current_y:
return y,x # target already a... | [
"def",
"get_intended_direction",
"(",
"self",
")",
":",
"x",
"=",
"0",
"y",
"=",
"0",
"if",
"self",
".",
"target_x",
"==",
"self",
".",
"current_x",
"and",
"self",
".",
"target_y",
"==",
"self",
".",
"current_y",
":",
"return",
"y",
",",
"x",
"# targ... | returns a Y,X value showing which direction the
agent should move in order to get to the target | [
"returns",
"a",
"Y",
"X",
"value",
"showing",
"which",
"direction",
"the",
"agent",
"should",
"move",
"in",
"order",
"to",
"get",
"to",
"the",
"target"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/agents/explore/agent_explore_grid.py#L105-L122 | train | returns a Y X value showing which direction the agent should move in order to get to the target ArcGIS agent should move in order to get to the target ArcGIS agent should move in order to get to the target ArcGIS agent |
acutesoftware/AIKIF | aikif/agents/explore/agent_explore_grid.py | ExploreAgent.clear_surroundings | def clear_surroundings(self):
"""
clears the cells immediately around the grid of the agent
(just to make it find to see on the screen)
"""
cells_to_clear = self.grd.eight_neighbors(self.current_y, self.current_x)
for cell in cells_to_clear:
self.grd.set_tile(... | python | def clear_surroundings(self):
"""
clears the cells immediately around the grid of the agent
(just to make it find to see on the screen)
"""
cells_to_clear = self.grd.eight_neighbors(self.current_y, self.current_x)
for cell in cells_to_clear:
self.grd.set_tile(... | [
"def",
"clear_surroundings",
"(",
"self",
")",
":",
"cells_to_clear",
"=",
"self",
".",
"grd",
".",
"eight_neighbors",
"(",
"self",
".",
"current_y",
",",
"self",
".",
"current_x",
")",
"for",
"cell",
"in",
"cells_to_clear",
":",
"self",
".",
"grd",
".",
... | clears the cells immediately around the grid of the agent
(just to make it find to see on the screen) | [
"clears",
"the",
"cells",
"immediately",
"around",
"the",
"grid",
"of",
"the",
"agent",
"(",
"just",
"to",
"make",
"it",
"find",
"to",
"see",
"on",
"the",
"screen",
")"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/agents/explore/agent_explore_grid.py#L125-L132 | train | Clears the cells immediately around the grid of the agent. |
acutesoftware/AIKIF | aikif/agents/explore/agent_explore_grid.py | ExploreAgent.show_status | def show_status(self):
"""
dumps the status of the agent
"""
txt = 'Agent Status:\n'
print(txt)
txt += "start_x = " + str(self.start_x) + "\n"
txt += "start_y = " + str(self.start_y) + "\n"
txt += "target_x = " + str(self.target_x) + "\n"
txt += ... | python | def show_status(self):
"""
dumps the status of the agent
"""
txt = 'Agent Status:\n'
print(txt)
txt += "start_x = " + str(self.start_x) + "\n"
txt += "start_y = " + str(self.start_y) + "\n"
txt += "target_x = " + str(self.target_x) + "\n"
txt += ... | [
"def",
"show_status",
"(",
"self",
")",
":",
"txt",
"=",
"'Agent Status:\\n'",
"print",
"(",
"txt",
")",
"txt",
"+=",
"\"start_x = \"",
"+",
"str",
"(",
"self",
".",
"start_x",
")",
"+",
"\"\\n\"",
"txt",
"+=",
"\"start_y = \"",
"+",
"str",
"(",
"self"... | dumps the status of the agent | [
"dumps",
"the",
"status",
"of",
"the",
"agent"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/agents/explore/agent_explore_grid.py#L135-L150 | train | shows the status of the agent |
acutesoftware/AIKIF | aikif/toolbox/audio_tools.py | get_audio_metadata | def get_audio_metadata(fname):
""" collects basic MP3 metadata
Works, once you use mutagenx (buried deep in issues page)
['Angels']
['Red Back Fever']
['Red Back Fever']
{'album': ['Red Back Fever'], 'title': ['Red Back Fever'], 'artist': ['Angels']}
"""
from mutagenx.easyid3 import ... | python | def get_audio_metadata(fname):
""" collects basic MP3 metadata
Works, once you use mutagenx (buried deep in issues page)
['Angels']
['Red Back Fever']
['Red Back Fever']
{'album': ['Red Back Fever'], 'title': ['Red Back Fever'], 'artist': ['Angels']}
"""
from mutagenx.easyid3 import ... | [
"def",
"get_audio_metadata",
"(",
"fname",
")",
":",
"from",
"mutagenx",
".",
"easyid3",
"import",
"EasyID3",
"audio",
"=",
"EasyID3",
"(",
"fname",
")",
"audio_dict",
"=",
"{",
"}",
"try",
":",
"artist",
"=",
"audio",
"[",
"\"artist\"",
"]",
"except",
"... | collects basic MP3 metadata
Works, once you use mutagenx (buried deep in issues page)
['Angels']
['Red Back Fever']
['Red Back Fever']
{'album': ['Red Back Fever'], 'title': ['Red Back Fever'], 'artist': ['Angels']} | [
"collects",
"basic",
"MP3",
"metadata",
"Works",
"once",
"you",
"use",
"mutagenx",
"(",
"buried",
"deep",
"in",
"issues",
"page",
")",
"[",
"Angels",
"]",
"[",
"Red",
"Back",
"Fever",
"]",
"[",
"Red",
"Back",
"Fever",
"]",
"{",
"album",
":",
"[",
"Re... | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/toolbox/audio_tools.py#L31-L63 | train | returns a dictionary of audio metadata |
acutesoftware/AIKIF | aikif/toolbox/audio_tools.py | get_audio_metadata_old | def get_audio_metadata_old(fname):
""" retrieve the metadata from an MP3 file """
audio_dict = {}
print("IDv2 tag info for %s:" % fname)
try:
audio = mutagenx.id3.ID3(fname, translate=False)
except StandardError as err:
print("ERROR = " + str(err))
#else:
#print(audio.ppr... | python | def get_audio_metadata_old(fname):
""" retrieve the metadata from an MP3 file """
audio_dict = {}
print("IDv2 tag info for %s:" % fname)
try:
audio = mutagenx.id3.ID3(fname, translate=False)
except StandardError as err:
print("ERROR = " + str(err))
#else:
#print(audio.ppr... | [
"def",
"get_audio_metadata_old",
"(",
"fname",
")",
":",
"audio_dict",
"=",
"{",
"}",
"print",
"(",
"\"IDv2 tag info for %s:\"",
"%",
"fname",
")",
"try",
":",
"audio",
"=",
"mutagenx",
".",
"id3",
".",
"ID3",
"(",
"fname",
",",
"translate",
"=",
"False",
... | retrieve the metadata from an MP3 file | [
"retrieve",
"the",
"metadata",
"from",
"an",
"MP3",
"file"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/toolbox/audio_tools.py#L65-L100 | train | retrieve the metadata from an MP3 file |
mpg-age-bioinformatics/AGEpy | AGEpy/cytoscape.py | checkCytoscapeVersion | def checkCytoscapeVersion(host=cytoscape_host,port=cytoscape_port):
"""
Checks cytoscape version
:param host: cytoscape host address, default=cytoscape_host
:param port: cytoscape port, default=1234
:returns: cytoscape and api version
"""
URL="http://"+str(host)+":"+str(port)+... | python | def checkCytoscapeVersion(host=cytoscape_host,port=cytoscape_port):
"""
Checks cytoscape version
:param host: cytoscape host address, default=cytoscape_host
:param port: cytoscape port, default=1234
:returns: cytoscape and api version
"""
URL="http://"+str(host)+":"+str(port)+... | [
"def",
"checkCytoscapeVersion",
"(",
"host",
"=",
"cytoscape_host",
",",
"port",
"=",
"cytoscape_port",
")",
":",
"URL",
"=",
"\"http://\"",
"+",
"str",
"(",
"host",
")",
"+",
"\":\"",
"+",
"str",
"(",
"port",
")",
"+",
"\"/v1/version/\"",
"r",
"=",
"req... | Checks cytoscape version
:param host: cytoscape host address, default=cytoscape_host
:param port: cytoscape port, default=1234
:returns: cytoscape and api version | [
"Checks",
"cytoscape",
"version",
":",
"param",
"host",
":",
"cytoscape",
"host",
"address",
"default",
"=",
"cytoscape_host",
":",
"param",
"port",
":",
"cytoscape",
"port",
"default",
"=",
"1234",
":",
"returns",
":",
"cytoscape",
"and",
"api",
"version"
] | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/cytoscape.py#L35-L49 | train | Checks the cytoscape version of the current node |
mpg-age-bioinformatics/AGEpy | AGEpy/cytoscape.py | cytoscape | def cytoscape(namespace,command="",PARAMS={},host=cytoscape_host,port=cytoscape_port,method="POST",verbose=False):
"""
General function for interacting with Cytoscape API.
:param namespace: namespace where the request should be executed. eg. "string"
:param commnand: command to execute. eg. "protei... | python | def cytoscape(namespace,command="",PARAMS={},host=cytoscape_host,port=cytoscape_port,method="POST",verbose=False):
"""
General function for interacting with Cytoscape API.
:param namespace: namespace where the request should be executed. eg. "string"
:param commnand: command to execute. eg. "protei... | [
"def",
"cytoscape",
"(",
"namespace",
",",
"command",
"=",
"\"\"",
",",
"PARAMS",
"=",
"{",
"}",
",",
"host",
"=",
"cytoscape_host",
",",
"port",
"=",
"cytoscape_port",
",",
"method",
"=",
"\"POST\"",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"(",
... | General function for interacting with Cytoscape API.
:param namespace: namespace where the request should be executed. eg. "string"
:param commnand: command to execute. eg. "protein query"
:param PARAMs: a dictionary with the parameters. Check your swagger normaly running on
http://localhost:1234/v... | [
"General",
"function",
"for",
"interacting",
"with",
"Cytoscape",
"API",
".",
":",
"param",
"namespace",
":",
"namespace",
"where",
"the",
"request",
"should",
"be",
"executed",
".",
"eg",
".",
"string",
":",
"param",
"commnand",
":",
"command",
"to",
"execu... | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/cytoscape.py#L51-L115 | train | General function for interacting with Cytoscape API. |
mpg-age-bioinformatics/AGEpy | AGEpy/cytoscape.py | getTableColumns | def getTableColumns(table, columns, namespace = "default", network = "current", host=cytoscape_host,port=cytoscape_port,verbose=False):
"""
Gets tables from cytoscape
:param table: table to retrieve eg. node
:param columns: columns to retrieve in list format
:param namespace: namepsace, default... | python | def getTableColumns(table, columns, namespace = "default", network = "current", host=cytoscape_host,port=cytoscape_port,verbose=False):
"""
Gets tables from cytoscape
:param table: table to retrieve eg. node
:param columns: columns to retrieve in list format
:param namespace: namepsace, default... | [
"def",
"getTableColumns",
"(",
"table",
",",
"columns",
",",
"namespace",
"=",
"\"default\"",
",",
"network",
"=",
"\"current\"",
",",
"host",
"=",
"cytoscape_host",
",",
"port",
"=",
"cytoscape_port",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"type",
... | Gets tables from cytoscape
:param table: table to retrieve eg. node
:param columns: columns to retrieve in list format
:param namespace: namepsace, default="default"
:param network: a network name or id, default="current"
:param host: cytoscape host address, default=cytoscape_host
:param po... | [
"Gets",
"tables",
"from",
"cytoscape",
":",
"param",
"table",
":",
"table",
"to",
"retrieve",
"eg",
".",
"node",
":",
"param",
"columns",
":",
"columns",
"to",
"retrieve",
"in",
"list",
"format",
":",
"param",
"namespace",
":",
"namepsace",
"default",
"=",... | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/cytoscape.py#L117-L171 | train | Gets tables from cytoscape and returns a pandas dataframe |
mpg-age-bioinformatics/AGEpy | AGEpy/cytoscape.py | loadTableData | def loadTableData(df, df_key='index',table="node", \
table_key_column = "name",
network="current",\
namespace="default",\
host=cytoscape_host,port=cytoscape_port,verbose=False):
"""
Loads tables into cytoscape
:param df: a pan... | python | def loadTableData(df, df_key='index',table="node", \
table_key_column = "name",
network="current",\
namespace="default",\
host=cytoscape_host,port=cytoscape_port,verbose=False):
"""
Loads tables into cytoscape
:param df: a pan... | [
"def",
"loadTableData",
"(",
"df",
",",
"df_key",
"=",
"'index'",
",",
"table",
"=",
"\"node\"",
",",
"table_key_column",
"=",
"\"name\"",
",",
"network",
"=",
"\"current\"",
",",
"namespace",
"=",
"\"default\"",
",",
"host",
"=",
"cytoscape_host",
",",
"por... | Loads tables into cytoscape
:param df: a pandas dataframe to load
:param df_key: key column in df, default="index"
:param table: target table, default="node"
:param table_key_column: table key column, default="name"
:param network: a network name or id, default="current"
:param host: cytosc... | [
"Loads",
"tables",
"into",
"cytoscape",
":",
"param",
"df",
":",
"a",
"pandas",
"dataframe",
"to",
"load",
":",
"param",
"df_key",
":",
"key",
"column",
"in",
"df",
"default",
"=",
"index",
":",
"param",
"table",
":",
"target",
"table",
"default",
"=",
... | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/cytoscape.py#L173-L251 | train | Loads the data from a pandas dataframe into a single node or network. |
mpg-age-bioinformatics/AGEpy | AGEpy/cytoscape.py | update_style | def update_style(title,defaults=None,mappings=None,host=cytoscape_host,port=cytoscape_port,verbose=False):
"""
Updates a visual style
:param title: title of the visual style
:param defaults: a list of dictionaries for each visualProperty
:param mappings: a list of dictionaries for each visualPr... | python | def update_style(title,defaults=None,mappings=None,host=cytoscape_host,port=cytoscape_port,verbose=False):
"""
Updates a visual style
:param title: title of the visual style
:param defaults: a list of dictionaries for each visualProperty
:param mappings: a list of dictionaries for each visualPr... | [
"def",
"update_style",
"(",
"title",
",",
"defaults",
"=",
"None",
",",
"mappings",
"=",
"None",
",",
"host",
"=",
"cytoscape_host",
",",
"port",
"=",
"cytoscape_port",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"defaults",
":",
"defaults_",
"=",
"[",... | Updates a visual style
:param title: title of the visual style
:param defaults: a list of dictionaries for each visualProperty
:param mappings: a list of dictionaries for each visualProperty
:param host: cytoscape host address, default=cytoscape_host
:param port: cytoscape port, default=1234
... | [
"Updates",
"a",
"visual",
"style",
":",
"param",
"title",
":",
"title",
"of",
"the",
"visual",
"style",
":",
"param",
"defaults",
":",
"a",
"list",
"of",
"dictionaries",
"for",
"each",
"visualProperty",
":",
"param",
"mappings",
":",
"a",
"list",
"of",
"... | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/cytoscape.py#L270-L334 | train | Updates a single visual style. |
mpg-age-bioinformatics/AGEpy | AGEpy/cytoscape.py | create_styles | def create_styles(title,defaults=None,mappings=None,host=cytoscape_host,port=cytoscape_port):
"""
Creates a new visual style
:param title: title of the visual style
:param defaults: a list of dictionaries for each visualProperty
:param mappings: a list of dictionaries for each visualProperty
... | python | def create_styles(title,defaults=None,mappings=None,host=cytoscape_host,port=cytoscape_port):
"""
Creates a new visual style
:param title: title of the visual style
:param defaults: a list of dictionaries for each visualProperty
:param mappings: a list of dictionaries for each visualProperty
... | [
"def",
"create_styles",
"(",
"title",
",",
"defaults",
"=",
"None",
",",
"mappings",
"=",
"None",
",",
"host",
"=",
"cytoscape_host",
",",
"port",
"=",
"cytoscape_port",
")",
":",
"if",
"defaults",
":",
"defaults_",
"=",
"[",
"]",
"for",
"d",
"in",
"de... | Creates a new visual style
:param title: title of the visual style
:param defaults: a list of dictionaries for each visualProperty
:param mappings: a list of dictionaries for each visualProperty
:param host: cytoscape host address, default=cytoscape_host
:param port: cytoscape port, default=123... | [
"Creates",
"a",
"new",
"visual",
"style",
":",
"param",
"title",
":",
"title",
"of",
"the",
"visual",
"style",
":",
"param",
"defaults",
":",
"a",
"list",
"of",
"dictionaries",
"for",
"each",
"visualProperty",
":",
"param",
"mappings",
":",
"a",
"list",
... | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/cytoscape.py#L336-L375 | train | Creates a new visual style and returns the new style. |
mpg-age-bioinformatics/AGEpy | AGEpy/cytoscape.py | mapVisualProperty | def mapVisualProperty(visualProperty,mappingType,mappingColumn,\
lower=None,center=None,upper=None,\
discrete=None,\
network="current",table="node",\
namespace="default",host=cytoscape_host,\
port=cytoscape_por... | python | def mapVisualProperty(visualProperty,mappingType,mappingColumn,\
lower=None,center=None,upper=None,\
discrete=None,\
network="current",table="node",\
namespace="default",host=cytoscape_host,\
port=cytoscape_por... | [
"def",
"mapVisualProperty",
"(",
"visualProperty",
",",
"mappingType",
",",
"mappingColumn",
",",
"lower",
"=",
"None",
",",
"center",
"=",
"None",
",",
"upper",
"=",
"None",
",",
"discrete",
"=",
"None",
",",
"network",
"=",
"\"current\"",
",",
"table",
"... | Generates a dictionary for a given visual property
:param visualProperty: visualProperty
:param mappingType: mappingType
:param mappingColumn: mappingColumn
:param lower: for "continuous" mappings a list of the form [value,rgb_string]
:param center: for "continuous" mappings a list of the form ... | [
"Generates",
"a",
"dictionary",
"for",
"a",
"given",
"visual",
"property",
":",
"param",
"visualProperty",
":",
"visualProperty",
":",
"param",
"mappingType",
":",
"mappingType",
":",
"param",
"mappingColumn",
":",
"mappingColumn",
":",
"param",
"lower",
":",
"f... | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/cytoscape.py#L378-L460 | train | This function maps a given visual property to a set of properties. |
mpg-age-bioinformatics/AGEpy | AGEpy/cytoscape.py | result | def result(filetype="PNG",saveas=None, host=cytoscape_host,port=cytoscape_port):
"""
Checks the current network.
Note: works only on localhost
:param filetype: file type, default="PNG"
:param saveas: /path/to/non/tmp/file.prefix
:param host: cytoscape host address, default=cytoscape_h... | python | def result(filetype="PNG",saveas=None, host=cytoscape_host,port=cytoscape_port):
"""
Checks the current network.
Note: works only on localhost
:param filetype: file type, default="PNG"
:param saveas: /path/to/non/tmp/file.prefix
:param host: cytoscape host address, default=cytoscape_h... | [
"def",
"result",
"(",
"filetype",
"=",
"\"PNG\"",
",",
"saveas",
"=",
"None",
",",
"host",
"=",
"cytoscape_host",
",",
"port",
"=",
"cytoscape_port",
")",
":",
"sleep",
"(",
"1",
")",
"def",
"MAKETMP",
"(",
")",
":",
"(",
"fd",
",",
"tmp_file",
")",
... | Checks the current network.
Note: works only on localhost
:param filetype: file type, default="PNG"
:param saveas: /path/to/non/tmp/file.prefix
:param host: cytoscape host address, default=cytoscape_host
:param port: cytoscape port, default=1234
:returns: an image | [
"Checks",
"the",
"current",
"network",
".",
"Note",
":",
"works",
"only",
"on",
"localhost",
":",
"param",
"filetype",
":",
"file",
"type",
"default",
"=",
"PNG",
":",
"param",
"saveas",
":",
"/",
"path",
"/",
"to",
"/",
"non",
"/",
"tmp",
"/",
"file... | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/cytoscape.py#L462-L504 | train | Checks the current network. |
mpg-age-bioinformatics/AGEpy | AGEpy/cytoscape.py | aDiffCytoscape | def aDiffCytoscape(df,aging_genes,target,species="caenorhabditis elegans",limit=None, cutoff=0.4,\
taxon=None,host=cytoscape_host,port=cytoscape_port):
"""
Plots tables from aDiff/cuffdiff into cytoscape using String protein queries.
Uses top changed genes as well as first neighbours and ... | python | def aDiffCytoscape(df,aging_genes,target,species="caenorhabditis elegans",limit=None, cutoff=0.4,\
taxon=None,host=cytoscape_host,port=cytoscape_port):
"""
Plots tables from aDiff/cuffdiff into cytoscape using String protein queries.
Uses top changed genes as well as first neighbours and ... | [
"def",
"aDiffCytoscape",
"(",
"df",
",",
"aging_genes",
",",
"target",
",",
"species",
"=",
"\"caenorhabditis elegans\"",
",",
"limit",
"=",
"None",
",",
"cutoff",
"=",
"0.4",
",",
"taxon",
"=",
"None",
",",
"host",
"=",
"cytoscape_host",
",",
"port",
"=",... | Plots tables from aDiff/cuffdiff into cytoscape using String protein queries.
Uses top changed genes as well as first neighbours and difusion fo generate subnetworks.
:param df: df as outputed by aDiff for differential gene expression
:param aging_genes: ENS gene ids to be labeled with a diagonal
... | [
"Plots",
"tables",
"from",
"aDiff",
"/",
"cuffdiff",
"into",
"cytoscape",
"using",
"String",
"protein",
"queries",
".",
"Uses",
"top",
"changed",
"genes",
"as",
"well",
"as",
"first",
"neighbours",
"and",
"difusion",
"fo",
"generate",
"subnetworks",
".",
":",
... | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/cytoscape.py#L506-L864 | train | A diff function that creates a new cytoscape with the same set of genes. |
Nachtfeuer/pipeline | spline/tools/table.py | calculate_columns | def calculate_columns(sequence):
"""
Find all row names and the maximum column widths.
Args:
columns (dict): the keys are the column name and the value the max length.
Returns:
dict: column names (key) and widths (value).
"""
columns = {}
for row in sequence:
for k... | python | def calculate_columns(sequence):
"""
Find all row names and the maximum column widths.
Args:
columns (dict): the keys are the column name and the value the max length.
Returns:
dict: column names (key) and widths (value).
"""
columns = {}
for row in sequence:
for k... | [
"def",
"calculate_columns",
"(",
"sequence",
")",
":",
"columns",
"=",
"{",
"}",
"for",
"row",
"in",
"sequence",
":",
"for",
"key",
"in",
"row",
".",
"keys",
"(",
")",
":",
"if",
"key",
"not",
"in",
"columns",
":",
"columns",
"[",
"key",
"]",
"=",
... | Find all row names and the maximum column widths.
Args:
columns (dict): the keys are the column name and the value the max length.
Returns:
dict: column names (key) and widths (value). | [
"Find",
"all",
"row",
"names",
"and",
"the",
"maximum",
"column",
"widths",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/tools/table.py#L5-L26 | train | Calculates the maximum column widths for all tables in the resource tree. |
Nachtfeuer/pipeline | spline/tools/table.py | calculate_row_format | def calculate_row_format(columns, keys=None):
"""
Calculate row format.
Args:
columns (dict): the keys are the column name and the value the max length.
keys (list): optional list of keys to order columns as well as to filter for them.
Returns:
str: format for table row
"""... | python | def calculate_row_format(columns, keys=None):
"""
Calculate row format.
Args:
columns (dict): the keys are the column name and the value the max length.
keys (list): optional list of keys to order columns as well as to filter for them.
Returns:
str: format for table row
"""... | [
"def",
"calculate_row_format",
"(",
"columns",
",",
"keys",
"=",
"None",
")",
":",
"row_format",
"=",
"''",
"if",
"keys",
"is",
"None",
":",
"keys",
"=",
"columns",
".",
"keys",
"(",
")",
"else",
":",
"keys",
"=",
"[",
"key",
"for",
"key",
"in",
"k... | Calculate row format.
Args:
columns (dict): the keys are the column name and the value the max length.
keys (list): optional list of keys to order columns as well as to filter for them.
Returns:
str: format for table row | [
"Calculate",
"row",
"format",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/tools/table.py#L29-L51 | train | Calculate row format for the current language. |
Nachtfeuer/pipeline | spline/tools/table.py | pprint | def pprint(sequence, keys=None):
"""
Print sequence as ascii table to stdout.
Args:
sequence (list or tuple): a sequence with a dictionary each entry.
keys (list): optional list of keys to order columns as well as to filter for them.
"""
if len(sequence) > 0:
columns = calcu... | python | def pprint(sequence, keys=None):
"""
Print sequence as ascii table to stdout.
Args:
sequence (list or tuple): a sequence with a dictionary each entry.
keys (list): optional list of keys to order columns as well as to filter for them.
"""
if len(sequence) > 0:
columns = calcu... | [
"def",
"pprint",
"(",
"sequence",
",",
"keys",
"=",
"None",
")",
":",
"if",
"len",
"(",
"sequence",
")",
">",
"0",
":",
"columns",
"=",
"calculate_columns",
"(",
"sequence",
")",
"row_format",
"=",
"calculate_row_format",
"(",
"columns",
",",
"keys",
")"... | Print sequence as ascii table to stdout.
Args:
sequence (list or tuple): a sequence with a dictionary each entry.
keys (list): optional list of keys to order columns as well as to filter for them. | [
"Print",
"sequence",
"as",
"ascii",
"table",
"to",
"stdout",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/tools/table.py#L54-L75 | train | Prints a sequence as ascii table to stdout. |
Nachtfeuer/pipeline | spline/matrix.py | matrix_worker | def matrix_worker(data):
"""
Run pipelines in parallel.
Args:
data(dict): parameters for the pipeline (model, options, ...).
Returns:
dict: with two fields: success True/False and captured output (list of str).
"""
matrix = data['matrix']
Logger.get_logger(__name__ + '.worke... | python | def matrix_worker(data):
"""
Run pipelines in parallel.
Args:
data(dict): parameters for the pipeline (model, options, ...).
Returns:
dict: with two fields: success True/False and captured output (list of str).
"""
matrix = data['matrix']
Logger.get_logger(__name__ + '.worke... | [
"def",
"matrix_worker",
"(",
"data",
")",
":",
"matrix",
"=",
"data",
"[",
"'matrix'",
"]",
"Logger",
".",
"get_logger",
"(",
"__name__",
"+",
"'.worker'",
")",
".",
"info",
"(",
"\"Processing pipeline for matrix entry '%s'\"",
",",
"matrix",
"[",
"'name'",
"]... | Run pipelines in parallel.
Args:
data(dict): parameters for the pipeline (model, options, ...).
Returns:
dict: with two fields: success True/False and captured output (list of str). | [
"Run",
"pipelines",
"in",
"parallel",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/matrix.py#L32-L50 | train | This function runs the pipeline in parallel. |
Nachtfeuer/pipeline | spline/matrix.py | Matrix.can_process_matrix | def can_process_matrix(entry, matrix_tags):
"""
Check given matrix tags to be in the given list of matric tags.
Args:
entry (dict): matrix item (in yaml).
matrix_tags (list): represents --matrix-tags defined by user in command line.
Returns:
bool: Tru... | python | def can_process_matrix(entry, matrix_tags):
"""
Check given matrix tags to be in the given list of matric tags.
Args:
entry (dict): matrix item (in yaml).
matrix_tags (list): represents --matrix-tags defined by user in command line.
Returns:
bool: Tru... | [
"def",
"can_process_matrix",
"(",
"entry",
",",
"matrix_tags",
")",
":",
"if",
"len",
"(",
"matrix_tags",
")",
"==",
"0",
":",
"return",
"True",
"count",
"=",
"0",
"if",
"'tags'",
"in",
"entry",
":",
"for",
"tag",
"in",
"matrix_tags",
":",
"if",
"tag",... | Check given matrix tags to be in the given list of matric tags.
Args:
entry (dict): matrix item (in yaml).
matrix_tags (list): represents --matrix-tags defined by user in command line.
Returns:
bool: True when matrix entry can be processed. | [
"Check",
"given",
"matrix",
"tags",
"to",
"be",
"in",
"the",
"given",
"list",
"of",
"matric",
"tags",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/matrix.py#L115-L134 | train | Check if matrix entry can be processed. |
Nachtfeuer/pipeline | spline/matrix.py | Matrix.run_matrix_ordered | def run_matrix_ordered(self, process_data):
"""
Running pipelines one after the other.
Returns
dict: with two fields: success True/False and captured output (list of str).
"""
output = []
for entry in self.matrix:
env = entry['env'].copy()
... | python | def run_matrix_ordered(self, process_data):
"""
Running pipelines one after the other.
Returns
dict: with two fields: success True/False and captured output (list of str).
"""
output = []
for entry in self.matrix:
env = entry['env'].copy()
... | [
"def",
"run_matrix_ordered",
"(",
"self",
",",
"process_data",
")",
":",
"output",
"=",
"[",
"]",
"for",
"entry",
"in",
"self",
".",
"matrix",
":",
"env",
"=",
"entry",
"[",
"'env'",
"]",
".",
"copy",
"(",
")",
"env",
".",
"update",
"(",
"{",
"'PIP... | Running pipelines one after the other.
Returns
dict: with two fields: success True/False and captured output (list of str). | [
"Running",
"pipelines",
"one",
"after",
"the",
"other",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/matrix.py#L136-L157 | train | Runs the pipeline in order of the matrix. |
Nachtfeuer/pipeline | spline/matrix.py | Matrix.run_matrix_in_parallel | def run_matrix_in_parallel(self, process_data):
"""Running pipelines in parallel."""
worker_data = [{'matrix': entry, 'pipeline': process_data.pipeline,
'model': process_data.model, 'options': process_data.options,
'hooks': process_data.hooks} for entry in... | python | def run_matrix_in_parallel(self, process_data):
"""Running pipelines in parallel."""
worker_data = [{'matrix': entry, 'pipeline': process_data.pipeline,
'model': process_data.model, 'options': process_data.options,
'hooks': process_data.hooks} for entry in... | [
"def",
"run_matrix_in_parallel",
"(",
"self",
",",
"process_data",
")",
":",
"worker_data",
"=",
"[",
"{",
"'matrix'",
":",
"entry",
",",
"'pipeline'",
":",
"process_data",
".",
"pipeline",
",",
"'model'",
":",
"process_data",
".",
"model",
",",
"'options'",
... | Running pipelines in parallel. | [
"Running",
"pipelines",
"in",
"parallel",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/matrix.py#L159-L172 | train | Runs pipelines in parallel. |
Nachtfeuer/pipeline | spline/matrix.py | Matrix.process | def process(self, process_data):
"""Process the pipeline per matrix item."""
if self.parallel and not process_data.options.dry_run:
return self.run_matrix_in_parallel(process_data)
return self.run_matrix_ordered(process_data) | python | def process(self, process_data):
"""Process the pipeline per matrix item."""
if self.parallel and not process_data.options.dry_run:
return self.run_matrix_in_parallel(process_data)
return self.run_matrix_ordered(process_data) | [
"def",
"process",
"(",
"self",
",",
"process_data",
")",
":",
"if",
"self",
".",
"parallel",
"and",
"not",
"process_data",
".",
"options",
".",
"dry_run",
":",
"return",
"self",
".",
"run_matrix_in_parallel",
"(",
"process_data",
")",
"return",
"self",
".",
... | Process the pipeline per matrix item. | [
"Process",
"the",
"pipeline",
"per",
"matrix",
"item",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/matrix.py#L174-L178 | train | Process the pipeline per matrix item. |
aartur/mschematool | mschematool/core.py | _sqlfile_to_statements | def _sqlfile_to_statements(sql):
"""
Takes a SQL string containing 0 or more statements and returns a
list of individual statements as strings. Comments and
empty statements are ignored.
"""
statements = (sqlparse.format(stmt, strip_comments=True).strip() for stmt in sqlparse.split(sql))
re... | python | def _sqlfile_to_statements(sql):
"""
Takes a SQL string containing 0 or more statements and returns a
list of individual statements as strings. Comments and
empty statements are ignored.
"""
statements = (sqlparse.format(stmt, strip_comments=True).strip() for stmt in sqlparse.split(sql))
re... | [
"def",
"_sqlfile_to_statements",
"(",
"sql",
")",
":",
"statements",
"=",
"(",
"sqlparse",
".",
"format",
"(",
"stmt",
",",
"strip_comments",
"=",
"True",
")",
".",
"strip",
"(",
")",
"for",
"stmt",
"in",
"sqlparse",
".",
"split",
"(",
"sql",
")",
")",... | Takes a SQL string containing 0 or more statements and returns a
list of individual statements as strings. Comments and
empty statements are ignored. | [
"Takes",
"a",
"SQL",
"string",
"containing",
"0",
"or",
"more",
"statements",
"and",
"returns",
"a",
"list",
"of",
"individual",
"statements",
"as",
"strings",
".",
"Comments",
"and",
"empty",
"statements",
"are",
"ignored",
"."
] | 57ec9541f80b44890294126eab92ce243c8833c4 | https://github.com/aartur/mschematool/blob/57ec9541f80b44890294126eab92ce243c8833c4/mschematool/core.py#L94-L101 | train | Takes a SQL string containing 0 or more statements and returns a
list of individual statements as strings. Comments and empty statements are ignored. |
aartur/mschematool | mschematool/core.py | MigrationsRepository.generate_migration_name | def generate_migration_name(self, name, suffix):
"""Returns a name of a new migration. It will usually be a filename with
a valid and unique name.
:param name: human-readable name of a migration
:param suffix: file suffix (extension) - eg. 'sql'
"""
return os.path.join(s... | python | def generate_migration_name(self, name, suffix):
"""Returns a name of a new migration. It will usually be a filename with
a valid and unique name.
:param name: human-readable name of a migration
:param suffix: file suffix (extension) - eg. 'sql'
"""
return os.path.join(s... | [
"def",
"generate_migration_name",
"(",
"self",
",",
"name",
",",
"suffix",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"dir",
",",
"'m{datestr}_{name}.{suffix}'",
".",
"format",
"(",
"datestr",
"=",
"datetime",
".",
"datetime",
".... | Returns a name of a new migration. It will usually be a filename with
a valid and unique name.
:param name: human-readable name of a migration
:param suffix: file suffix (extension) - eg. 'sql' | [
"Returns",
"a",
"name",
"of",
"a",
"new",
"migration",
".",
"It",
"will",
"usually",
"be",
"a",
"filename",
"with",
"a",
"valid",
"and",
"unique",
"name",
"."
] | 57ec9541f80b44890294126eab92ce243c8833c4 | https://github.com/aartur/mschematool/blob/57ec9541f80b44890294126eab92ce243c8833c4/mschematool/core.py#L118-L129 | train | Generate a migration name. |
aartur/mschematool | mschematool/core.py | MigrationsExecutor._call_migrate | def _call_migrate(self, module, connection_param):
"""Subclasses should call this method instead of `module.migrate` directly,
to support `db_config` optional argument.
"""
args = [connection_param]
spec = inspect.getargspec(module.migrate)
if len(spec.args) == 2:
... | python | def _call_migrate(self, module, connection_param):
"""Subclasses should call this method instead of `module.migrate` directly,
to support `db_config` optional argument.
"""
args = [connection_param]
spec = inspect.getargspec(module.migrate)
if len(spec.args) == 2:
... | [
"def",
"_call_migrate",
"(",
"self",
",",
"module",
",",
"connection_param",
")",
":",
"args",
"=",
"[",
"connection_param",
"]",
"spec",
"=",
"inspect",
".",
"getargspec",
"(",
"module",
".",
"migrate",
")",
"if",
"len",
"(",
"spec",
".",
"args",
")",
... | Subclasses should call this method instead of `module.migrate` directly,
to support `db_config` optional argument. | [
"Subclasses",
"should",
"call",
"this",
"method",
"instead",
"of",
"module",
".",
"migrate",
"directly",
"to",
"support",
"db_config",
"optional",
"argument",
"."
] | 57ec9541f80b44890294126eab92ce243c8833c4 | https://github.com/aartur/mschematool/blob/57ec9541f80b44890294126eab92ce243c8833c4/mschematool/core.py#L232-L240 | train | Subclasses should call this method instead of module. migrate directly to support db_config optional argument. |
aartur/mschematool | mschematool/core.py | MigrationsExecutor.execute_migration | def execute_migration(self, migration_file_relative):
"""This recognizes migration type and executes either
:method:`execute_python_migration` or :method:`execute_native_migration`
"""
migration_file = os.path.join(self.db_config['migrations_dir'], migration_file_relative)
m_type... | python | def execute_migration(self, migration_file_relative):
"""This recognizes migration type and executes either
:method:`execute_python_migration` or :method:`execute_native_migration`
"""
migration_file = os.path.join(self.db_config['migrations_dir'], migration_file_relative)
m_type... | [
"def",
"execute_migration",
"(",
"self",
",",
"migration_file_relative",
")",
":",
"migration_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"db_config",
"[",
"'migrations_dir'",
"]",
",",
"migration_file_relative",
")",
"m_type",
"=",
"self",
"... | This recognizes migration type and executes either
:method:`execute_python_migration` or :method:`execute_native_migration` | [
"This",
"recognizes",
"migration",
"type",
"and",
"executes",
"either",
":",
"method",
":",
"execute_python_migration",
"or",
":",
"method",
":",
"execute_native_migration"
] | 57ec9541f80b44890294126eab92ce243c8833c4 | https://github.com/aartur/mschematool/blob/57ec9541f80b44890294126eab92ce243c8833c4/mschematool/core.py#L242-L253 | train | This handles migration type and executes eitheretherether or python migration. |
acutesoftware/AIKIF | aikif/dataTools/cls_data.py | Data._identify_datatype | def _identify_datatype(self, input_data):
"""
uses the input data, which may be a string, list, number
or file to work out how to load the data (this can be
overridden by passing the data_type on the command line
"""
if isinstance(input_data, (int, float)) :
... | python | def _identify_datatype(self, input_data):
"""
uses the input data, which may be a string, list, number
or file to work out how to load the data (this can be
overridden by passing the data_type on the command line
"""
if isinstance(input_data, (int, float)) :
... | [
"def",
"_identify_datatype",
"(",
"self",
",",
"input_data",
")",
":",
"if",
"isinstance",
"(",
"input_data",
",",
"(",
"int",
",",
"float",
")",
")",
":",
"self",
".",
"data_type",
"=",
"'number'",
"elif",
"isinstance",
"(",
"input_data",
",",
"(",
"lis... | uses the input data, which may be a string, list, number
or file to work out how to load the data (this can be
overridden by passing the data_type on the command line | [
"uses",
"the",
"input",
"data",
"which",
"may",
"be",
"a",
"string",
"list",
"number",
"or",
"file",
"to",
"work",
"out",
"how",
"to",
"load",
"the",
"data",
"(",
"this",
"can",
"be",
"overridden",
"by",
"passing",
"the",
"data_type",
"on",
"the",
"com... | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/dataTools/cls_data.py#L51-L71 | train | Identify the data type of the object based on the input data. |
acutesoftware/AIKIF | aikif/dataTools/cls_data.py | Data._create_from_csv | def _create_from_csv(self):
"""
create a standard data object based on CSV file
"""
import aikif.dataTools.cls_datatable as cl
fle = cl.DataTable(self.input_data, ',')
fle.load_to_array()
self.content['data'] = fle.arr
lg.record_p... | python | def _create_from_csv(self):
"""
create a standard data object based on CSV file
"""
import aikif.dataTools.cls_datatable as cl
fle = cl.DataTable(self.input_data, ',')
fle.load_to_array()
self.content['data'] = fle.arr
lg.record_p... | [
"def",
"_create_from_csv",
"(",
"self",
")",
":",
"import",
"aikif",
".",
"dataTools",
".",
"cls_datatable",
"as",
"cl",
"fle",
"=",
"cl",
".",
"DataTable",
"(",
"self",
".",
"input_data",
",",
"','",
")",
"fle",
".",
"load_to_array",
"(",
")",
"self",
... | create a standard data object based on CSV file | [
"create",
"a",
"standard",
"data",
"object",
"based",
"on",
"CSV",
"file"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/dataTools/cls_data.py#L87-L98 | train | create a standard data object based on CSV file |
acutesoftware/AIKIF | aikif/dataTools/cls_data.py | Data._create_from_owl | def _create_from_owl(self):
"""
create a standard data object based on CSV file
"""
self.content['data'] = 'TODO - read OWL from ' + self.input_data
lg.record_process('_create_from_owl', 'read ' + self._calc_size_stats() + ' from ' + self.input_data) | python | def _create_from_owl(self):
"""
create a standard data object based on CSV file
"""
self.content['data'] = 'TODO - read OWL from ' + self.input_data
lg.record_process('_create_from_owl', 'read ' + self._calc_size_stats() + ' from ' + self.input_data) | [
"def",
"_create_from_owl",
"(",
"self",
")",
":",
"self",
".",
"content",
"[",
"'data'",
"]",
"=",
"'TODO - read OWL from '",
"+",
"self",
".",
"input_data",
"lg",
".",
"record_process",
"(",
"'_create_from_owl'",
",",
"'read '",
"+",
"self",
".",
"_calc_size_... | create a standard data object based on CSV file | [
"create",
"a",
"standard",
"data",
"object",
"based",
"on",
"CSV",
"file"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/dataTools/cls_data.py#L100-L106 | train | create a standard data object based on CSV file |
acutesoftware/AIKIF | aikif/dataTools/cls_data.py | Data._create_from_url | def _create_from_url(self):
"""
create a standard data object based on CSV file
"""
import aikif.toolbox.network_tools as mod_net
mod_net.download_file_no_logon(self.input_data, 'temp_file.htm')
with open('temp_file.htm', 'r') as f:
self.content['data'] = f.re... | python | def _create_from_url(self):
"""
create a standard data object based on CSV file
"""
import aikif.toolbox.network_tools as mod_net
mod_net.download_file_no_logon(self.input_data, 'temp_file.htm')
with open('temp_file.htm', 'r') as f:
self.content['data'] = f.re... | [
"def",
"_create_from_url",
"(",
"self",
")",
":",
"import",
"aikif",
".",
"toolbox",
".",
"network_tools",
"as",
"mod_net",
"mod_net",
".",
"download_file_no_logon",
"(",
"self",
".",
"input_data",
",",
"'temp_file.htm'",
")",
"with",
"open",
"(",
"'temp_file.ht... | create a standard data object based on CSV file | [
"create",
"a",
"standard",
"data",
"object",
"based",
"on",
"CSV",
"file"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/dataTools/cls_data.py#L109-L117 | train | create a standard data object based on CSV file |
acutesoftware/AIKIF | aikif/dataTools/cls_data.py | Data._calc_size_stats | def _calc_size_stats(self):
"""
get the size in bytes and num records of the content
"""
self.total_records = 0
self.total_length = 0
self.total_nodes = 0
if type(self.content['data']) is dict:
self.total_length += len(str(self.content['data']))
... | python | def _calc_size_stats(self):
"""
get the size in bytes and num records of the content
"""
self.total_records = 0
self.total_length = 0
self.total_nodes = 0
if type(self.content['data']) is dict:
self.total_length += len(str(self.content['data']))
... | [
"def",
"_calc_size_stats",
"(",
"self",
")",
":",
"self",
".",
"total_records",
"=",
"0",
"self",
".",
"total_length",
"=",
"0",
"self",
".",
"total_nodes",
"=",
"0",
"if",
"type",
"(",
"self",
".",
"content",
"[",
"'data'",
"]",
")",
"is",
"dict",
"... | get the size in bytes and num records of the content | [
"get",
"the",
"size",
"in",
"bytes",
"and",
"num",
"records",
"of",
"the",
"content"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/dataTools/cls_data.py#L120-L138 | train | Calculate the size in bytes and num records of the content ArcGIS object. |
acutesoftware/AIKIF | aikif/dataTools/cls_data.py | Data._get_size_recursive | def _get_size_recursive(self, dat):
"""
recursively walk through a data set or json file
to get the total number of nodes
"""
self.total_records += 1
#self.total_nodes += 1
for rec in dat:
if hasattr(rec, '__iter__') and type(rec) is not str:
... | python | def _get_size_recursive(self, dat):
"""
recursively walk through a data set or json file
to get the total number of nodes
"""
self.total_records += 1
#self.total_nodes += 1
for rec in dat:
if hasattr(rec, '__iter__') and type(rec) is not str:
... | [
"def",
"_get_size_recursive",
"(",
"self",
",",
"dat",
")",
":",
"self",
".",
"total_records",
"+=",
"1",
"#self.total_nodes += 1",
"for",
"rec",
"in",
"dat",
":",
"if",
"hasattr",
"(",
"rec",
",",
"'__iter__'",
")",
"and",
"type",
"(",
"rec",
")",
"is",... | recursively walk through a data set or json file
to get the total number of nodes | [
"recursively",
"walk",
"through",
"a",
"data",
"set",
"or",
"json",
"file",
"to",
"get",
"the",
"total",
"number",
"of",
"nodes"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/dataTools/cls_data.py#L140-L152 | train | Recursively walk through a data set or json file
to get the total number of records and nodes and total length |
staticdev/django-pagination-bootstrap | pagination_bootstrap/version.py | _make_version | def _make_version(major, minor, micro, releaselevel, serial):
"""Create a readable version string from version_info tuple components."""
assert releaselevel in ['alpha', 'beta', 'candidate', 'final']
version = "%d.%d" % (major, minor)
if micro:
version += ".%d" % (micro,)
if releaselevel != ... | python | def _make_version(major, minor, micro, releaselevel, serial):
"""Create a readable version string from version_info tuple components."""
assert releaselevel in ['alpha', 'beta', 'candidate', 'final']
version = "%d.%d" % (major, minor)
if micro:
version += ".%d" % (micro,)
if releaselevel != ... | [
"def",
"_make_version",
"(",
"major",
",",
"minor",
",",
"micro",
",",
"releaselevel",
",",
"serial",
")",
":",
"assert",
"releaselevel",
"in",
"[",
"'alpha'",
",",
"'beta'",
",",
"'candidate'",
",",
"'final'",
"]",
"version",
"=",
"\"%d.%d\"",
"%",
"(",
... | Create a readable version string from version_info tuple components. | [
"Create",
"a",
"readable",
"version",
"string",
"from",
"version_info",
"tuple",
"components",
"."
] | b4bf8352a364b223babbc5f33e14ecabd82c0886 | https://github.com/staticdev/django-pagination-bootstrap/blob/b4bf8352a364b223babbc5f33e14ecabd82c0886/pagination_bootstrap/version.py#L3-L12 | train | Create a readable version string from version_info tuple components. |
staticdev/django-pagination-bootstrap | pagination_bootstrap/version.py | _make_url | def _make_url(major, minor, micro, releaselevel, serial):
"""Make the URL people should start at for this version of coverage.py."""
url = "https://django-pagination-bootstrap.readthedocs.io"
if releaselevel != 'final':
# For pre-releases, use a version-specific URL.
url += "/en/" + _make_ve... | python | def _make_url(major, minor, micro, releaselevel, serial):
"""Make the URL people should start at for this version of coverage.py."""
url = "https://django-pagination-bootstrap.readthedocs.io"
if releaselevel != 'final':
# For pre-releases, use a version-specific URL.
url += "/en/" + _make_ve... | [
"def",
"_make_url",
"(",
"major",
",",
"minor",
",",
"micro",
",",
"releaselevel",
",",
"serial",
")",
":",
"url",
"=",
"\"https://django-pagination-bootstrap.readthedocs.io\"",
"if",
"releaselevel",
"!=",
"'final'",
":",
"# For pre-releases, use a version-specific URL.",... | Make the URL people should start at for this version of coverage.py. | [
"Make",
"the",
"URL",
"people",
"should",
"start",
"at",
"for",
"this",
"version",
"of",
"coverage",
".",
"py",
"."
] | b4bf8352a364b223babbc5f33e14ecabd82c0886 | https://github.com/staticdev/django-pagination-bootstrap/blob/b4bf8352a364b223babbc5f33e14ecabd82c0886/pagination_bootstrap/version.py#L15-L21 | train | Make the URL people should start at for this version of coverage. py. |
acutesoftware/AIKIF | aikif/lib/cls_filelist.py | FileList.get_list_of_paths | def get_list_of_paths(self):
"""
return a list of unique paths in the file list
"""
all_paths = []
for p in self.fl_metadata:
try:
all_paths.append(p['path'])
except:
try:
print('cls_filelist - ... | python | def get_list_of_paths(self):
"""
return a list of unique paths in the file list
"""
all_paths = []
for p in self.fl_metadata:
try:
all_paths.append(p['path'])
except:
try:
print('cls_filelist - ... | [
"def",
"get_list_of_paths",
"(",
"self",
")",
":",
"all_paths",
"=",
"[",
"]",
"for",
"p",
"in",
"self",
".",
"fl_metadata",
":",
"try",
":",
"all_paths",
".",
"append",
"(",
"p",
"[",
"'path'",
"]",
")",
"except",
":",
"try",
":",
"print",
"(",
"'... | return a list of unique paths in the file list | [
"return",
"a",
"list",
"of",
"unique",
"paths",
"in",
"the",
"file",
"list"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/lib/cls_filelist.py#L47-L61 | train | returns a list of unique paths in the file list |
acutesoftware/AIKIF | aikif/lib/cls_filelist.py | FileList.get_file_list | def get_file_list(self, lstPaths, lstXtn, lstExcluded, VERBOSE = False):
"""
builds a list of files and returns as a list
"""
if VERBOSE:
print("Generating list of Files...")
print("Paths = ", lstPaths)
print("Xtns = ", lstXtn)
pri... | python | def get_file_list(self, lstPaths, lstXtn, lstExcluded, VERBOSE = False):
"""
builds a list of files and returns as a list
"""
if VERBOSE:
print("Generating list of Files...")
print("Paths = ", lstPaths)
print("Xtns = ", lstXtn)
pri... | [
"def",
"get_file_list",
"(",
"self",
",",
"lstPaths",
",",
"lstXtn",
",",
"lstExcluded",
",",
"VERBOSE",
"=",
"False",
")",
":",
"if",
"VERBOSE",
":",
"print",
"(",
"\"Generating list of Files...\"",
")",
"print",
"(",
"\"Paths = \"",
",",
"lstPaths",
")",
"... | builds a list of files and returns as a list | [
"builds",
"a",
"list",
"of",
"files",
"and",
"returns",
"as",
"a",
"list"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/lib/cls_filelist.py#L64-L98 | train | Builds a list of files and returns as a list of lists. |
acutesoftware/AIKIF | aikif/lib/cls_filelist.py | FileList.add_file_metadata | def add_file_metadata(self, fname):
"""
collects the files metadata - note that this will fail
with strange errors if network connection drops out to
shared folder, but it is better to stop the program
rather than do a try except otherwise you will get an
incomplete... | python | def add_file_metadata(self, fname):
"""
collects the files metadata - note that this will fail
with strange errors if network connection drops out to
shared folder, but it is better to stop the program
rather than do a try except otherwise you will get an
incomplete... | [
"def",
"add_file_metadata",
"(",
"self",
",",
"fname",
")",
":",
"file_dict",
"=",
"{",
"}",
"file_dict",
"[",
"\"fullfilename\"",
"]",
"=",
"fname",
"try",
":",
"file_dict",
"[",
"\"name\"",
"]",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"fname",
... | collects the files metadata - note that this will fail
with strange errors if network connection drops out to
shared folder, but it is better to stop the program
rather than do a try except otherwise you will get an
incomplete set of files. | [
"collects",
"the",
"files",
"metadata",
"-",
"note",
"that",
"this",
"will",
"fail",
"with",
"strange",
"errors",
"if",
"network",
"connection",
"drops",
"out",
"to",
"shared",
"folder",
"but",
"it",
"is",
"better",
"to",
"stop",
"the",
"program",
"rather",
... | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/lib/cls_filelist.py#L100-L119 | train | Add the file metadata to the list of files that have been added to the list of files that have been added to the list of files that have been added to the list of files that have been added to the list of files that have been added to the list of files that have been added to the list. |
acutesoftware/AIKIF | aikif/lib/cls_filelist.py | FileList.print_file_details_in_line | def print_file_details_in_line(self, fname, col_headers):
"""
makes a nice display of filename for printing based on columns passed
print('{:<30}'.format(f["name"]), '{:,}'.format(f["size"]))
"""
line = ''
try:
sze = os.path.getsize(fname)
exce... | python | def print_file_details_in_line(self, fname, col_headers):
"""
makes a nice display of filename for printing based on columns passed
print('{:<30}'.format(f["name"]), '{:,}'.format(f["size"]))
"""
line = ''
try:
sze = os.path.getsize(fname)
exce... | [
"def",
"print_file_details_in_line",
"(",
"self",
",",
"fname",
",",
"col_headers",
")",
":",
"line",
"=",
"''",
"try",
":",
"sze",
"=",
"os",
".",
"path",
".",
"getsize",
"(",
"fname",
")",
"except",
"Exception",
"as",
"ex",
":",
"return",
"'no file'",
... | makes a nice display of filename for printing based on columns passed
print('{:<30}'.format(f["name"]), '{:,}'.format(f["size"])) | [
"makes",
"a",
"nice",
"display",
"of",
"filename",
"for",
"printing",
"based",
"on",
"columns",
"passed",
"print",
"(",
"{",
":",
"<30",
"}",
".",
"format",
"(",
"f",
"[",
"name",
"]",
")",
"{",
":",
"}",
".",
"format",
"(",
"f",
"[",
"size",
"]"... | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/lib/cls_filelist.py#L121-L143 | train | Print the details of a file in a nice format |
acutesoftware/AIKIF | aikif/lib/cls_filelist.py | FileList.print_file_details_as_csv | def print_file_details_as_csv(self, fname, col_headers):
""" saves as csv format """
line = ''
qu = '"'
d = ','
for fld in col_headers:
if fld == "fullfilename":
line = line + qu + fname + qu + d
if fld == "name":
l... | python | def print_file_details_as_csv(self, fname, col_headers):
""" saves as csv format """
line = ''
qu = '"'
d = ','
for fld in col_headers:
if fld == "fullfilename":
line = line + qu + fname + qu + d
if fld == "name":
l... | [
"def",
"print_file_details_as_csv",
"(",
"self",
",",
"fname",
",",
"col_headers",
")",
":",
"line",
"=",
"''",
"qu",
"=",
"'\"'",
"d",
"=",
"','",
"for",
"fld",
"in",
"col_headers",
":",
"if",
"fld",
"==",
"\"fullfilename\"",
":",
"line",
"=",
"line",
... | saves as csv format | [
"saves",
"as",
"csv",
"format"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/lib/cls_filelist.py#L145-L165 | train | prints details of a file as a csv file |
acutesoftware/AIKIF | aikif/lib/cls_filelist.py | FileList.save_filelist | def save_filelist(self, opFile, opFormat, delim=',', qu='"'):
"""
uses a List of files and collects meta data on them and saves
to an text file as a list or with metadata depending on opFormat.
"""
op_folder = os.path.dirname(opFile)
if op_folder is not None: # ... | python | def save_filelist(self, opFile, opFormat, delim=',', qu='"'):
"""
uses a List of files and collects meta data on them and saves
to an text file as a list or with metadata depending on opFormat.
"""
op_folder = os.path.dirname(opFile)
if op_folder is not None: # ... | [
"def",
"save_filelist",
"(",
"self",
",",
"opFile",
",",
"opFormat",
",",
"delim",
"=",
"','",
",",
"qu",
"=",
"'\"'",
")",
":",
"op_folder",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"opFile",
")",
"if",
"op_folder",
"is",
"not",
"None",
":",
"... | uses a List of files and collects meta data on them and saves
to an text file as a list or with metadata depending on opFormat. | [
"uses",
"a",
"List",
"of",
"files",
"and",
"collects",
"meta",
"data",
"on",
"them",
"and",
"saves",
"to",
"an",
"text",
"file",
"as",
"a",
"list",
"or",
"with",
"metadata",
"depending",
"on",
"opFormat",
"."
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/lib/cls_filelist.py#L192-L228 | train | Saves a list of files and meta data on them to a text file. |
acutesoftware/AIKIF | aikif/dataTools/cls_dataset.py | DataSet.login | def login(self, schema, username, password):
"""
connect here - use the other classes cls_oracle, cls_mysql, etc
otherwise this has the credentials used to access a share folder
"""
self.schema = schema
self.username = username
self.password = password
sel... | python | def login(self, schema, username, password):
"""
connect here - use the other classes cls_oracle, cls_mysql, etc
otherwise this has the credentials used to access a share folder
"""
self.schema = schema
self.username = username
self.password = password
sel... | [
"def",
"login",
"(",
"self",
",",
"schema",
",",
"username",
",",
"password",
")",
":",
"self",
".",
"schema",
"=",
"schema",
"self",
".",
"username",
"=",
"username",
"self",
".",
"password",
"=",
"password",
"self",
".",
"connection",
"=",
"schema"
] | connect here - use the other classes cls_oracle, cls_mysql, etc
otherwise this has the credentials used to access a share folder | [
"connect",
"here",
"-",
"use",
"the",
"other",
"classes",
"cls_oracle",
"cls_mysql",
"etc",
"otherwise",
"this",
"has",
"the",
"credentials",
"used",
"to",
"access",
"a",
"share",
"folder"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/dataTools/cls_dataset.py#L34-L42 | train | login to the database |
Phelimb/atlas | mykatlas/typing/typer/presence.py | GeneCollectionTyper.type | def type(self, sequence_coverage_collection,
min_gene_percent_covg_threshold=99):
"""Types a collection of genes returning the most likely gene version
in the collection with it's genotype"""
best_versions = self.get_best_version(
sequence_coverage_collection.values(... | python | def type(self, sequence_coverage_collection,
min_gene_percent_covg_threshold=99):
"""Types a collection of genes returning the most likely gene version
in the collection with it's genotype"""
best_versions = self.get_best_version(
sequence_coverage_collection.values(... | [
"def",
"type",
"(",
"self",
",",
"sequence_coverage_collection",
",",
"min_gene_percent_covg_threshold",
"=",
"99",
")",
":",
"best_versions",
"=",
"self",
".",
"get_best_version",
"(",
"sequence_coverage_collection",
".",
"values",
"(",
")",
",",
"min_gene_percent_co... | Types a collection of genes returning the most likely gene version
in the collection with it's genotype | [
"Types",
"a",
"collection",
"of",
"genes",
"returning",
"the",
"most",
"likely",
"gene",
"version",
"in",
"the",
"collection",
"with",
"it",
"s",
"genotype"
] | 02e85497bb5ac423d6452a10dca11964582ac4d7 | https://github.com/Phelimb/atlas/blob/02e85497bb5ac423d6452a10dca11964582ac4d7/mykatlas/typing/typer/presence.py#L146-L154 | train | Types a collection of genes returning the most likely gene version
in the collection with it s genotype |
acutesoftware/AIKIF | aikif/programs.py | Programs.list_all_python_programs | def list_all_python_programs(self):
"""
collects a filelist of all .py programs
"""
self.tot_lines = 0
self.tot_bytes = 0
self.tot_files = 0
self.tot_loc = 0
self.lstPrograms = []
fl = mod_fl.FileList([self.fldr], ['*.py'], ["__pycache__", "/venv/"... | python | def list_all_python_programs(self):
"""
collects a filelist of all .py programs
"""
self.tot_lines = 0
self.tot_bytes = 0
self.tot_files = 0
self.tot_loc = 0
self.lstPrograms = []
fl = mod_fl.FileList([self.fldr], ['*.py'], ["__pycache__", "/venv/"... | [
"def",
"list_all_python_programs",
"(",
"self",
")",
":",
"self",
".",
"tot_lines",
"=",
"0",
"self",
".",
"tot_bytes",
"=",
"0",
"self",
".",
"tot_files",
"=",
"0",
"self",
".",
"tot_loc",
"=",
"0",
"self",
".",
"lstPrograms",
"=",
"[",
"]",
"fl",
"... | collects a filelist of all .py programs | [
"collects",
"a",
"filelist",
"of",
"all",
".",
"py",
"programs"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/programs.py#L38-L58 | train | collects a filelist of all. py programs |
acutesoftware/AIKIF | aikif/programs.py | Programs.comment | def comment(self, nme, desc):
"""
Adds a comment to the existing program in the list,
logs the reference and TODO - adds core link to processes
"""
if nme != '':
program_exists = False
for i in self.lstPrograms:
print(i)
... | python | def comment(self, nme, desc):
"""
Adds a comment to the existing program in the list,
logs the reference and TODO - adds core link to processes
"""
if nme != '':
program_exists = False
for i in self.lstPrograms:
print(i)
... | [
"def",
"comment",
"(",
"self",
",",
"nme",
",",
"desc",
")",
":",
"if",
"nme",
"!=",
"''",
":",
"program_exists",
"=",
"False",
"for",
"i",
"in",
"self",
".",
"lstPrograms",
":",
"print",
"(",
"i",
")",
"if",
"nme",
"in",
"i",
"[",
"0",
"]",
":... | Adds a comment to the existing program in the list,
logs the reference and TODO - adds core link to processes | [
"Adds",
"a",
"comment",
"to",
"the",
"existing",
"program",
"in",
"the",
"list",
"logs",
"the",
"reference",
"and",
"TODO",
"-",
"adds",
"core",
"link",
"to",
"processes"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/programs.py#L68-L85 | train | Adds a comment to the existing program in the list |
acutesoftware/AIKIF | aikif/programs.py | Programs.save | def save(self, fname=''):
"""
Save the list of items to AIKIF core and optionally to local file fname
"""
if fname != '':
with open(fname, 'w') as f:
for i in self.lstPrograms:
f.write(self.get_file_info_line(i, ','))
# sa... | python | def save(self, fname=''):
"""
Save the list of items to AIKIF core and optionally to local file fname
"""
if fname != '':
with open(fname, 'w') as f:
for i in self.lstPrograms:
f.write(self.get_file_info_line(i, ','))
# sa... | [
"def",
"save",
"(",
"self",
",",
"fname",
"=",
"''",
")",
":",
"if",
"fname",
"!=",
"''",
":",
"with",
"open",
"(",
"fname",
",",
"'w'",
")",
"as",
"f",
":",
"for",
"i",
"in",
"self",
".",
"lstPrograms",
":",
"f",
".",
"write",
"(",
"self",
"... | Save the list of items to AIKIF core and optionally to local file fname | [
"Save",
"the",
"list",
"of",
"items",
"to",
"AIKIF",
"core",
"and",
"optionally",
"to",
"local",
"file",
"fname"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/programs.py#L88-L112 | train | Save the list of items to AIKIF core and optionally to local file fname |
acutesoftware/AIKIF | aikif/programs.py | Programs.get_file_info_line | def get_file_info_line(self, fname, delim):
"""
gathers info on a python program in list and formats as string
"""
txt = ''
f = mod_file.File(fname[0])
txt += '"' + f.fullname + '"' + delim
txt += '"' + f.name + '"' + delim
txt += '"' + f.path + '"' + de... | python | def get_file_info_line(self, fname, delim):
"""
gathers info on a python program in list and formats as string
"""
txt = ''
f = mod_file.File(fname[0])
txt += '"' + f.fullname + '"' + delim
txt += '"' + f.name + '"' + delim
txt += '"' + f.path + '"' + de... | [
"def",
"get_file_info_line",
"(",
"self",
",",
"fname",
",",
"delim",
")",
":",
"txt",
"=",
"''",
"f",
"=",
"mod_file",
".",
"File",
"(",
"fname",
"[",
"0",
"]",
")",
"txt",
"+=",
"'\"'",
"+",
"f",
".",
"fullname",
"+",
"'\"'",
"+",
"delim",
"txt... | gathers info on a python program in list and formats as string | [
"gathers",
"info",
"on",
"a",
"python",
"program",
"in",
"list",
"and",
"formats",
"as",
"string"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/programs.py#L114-L125 | train | returns a string that contains the file info |
acutesoftware/AIKIF | aikif/programs.py | Programs.get_file_info_web | def get_file_info_web(self, fname, delim='<BR>\n'):
"""
gathers info on a python program in list and formats as string
"""
txt = ''
f = mod_file.File(fname[0])
txt += '<sup>' + f.name + '</sup>' + delim
txt += '<sup>' + fname[1] + '</sup>' + delim
txt +=... | python | def get_file_info_web(self, fname, delim='<BR>\n'):
"""
gathers info on a python program in list and formats as string
"""
txt = ''
f = mod_file.File(fname[0])
txt += '<sup>' + f.name + '</sup>' + delim
txt += '<sup>' + fname[1] + '</sup>' + delim
txt +=... | [
"def",
"get_file_info_web",
"(",
"self",
",",
"fname",
",",
"delim",
"=",
"'<BR>\\n'",
")",
":",
"txt",
"=",
"''",
"f",
"=",
"mod_file",
".",
"File",
"(",
"fname",
"[",
"0",
"]",
")",
"txt",
"+=",
"'<sup>'",
"+",
"f",
".",
"name",
"+",
"'</sup>'",
... | gathers info on a python program in list and formats as string | [
"gathers",
"info",
"on",
"a",
"python",
"program",
"in",
"list",
"and",
"formats",
"as",
"string"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/programs.py#L127-L137 | train | returns a string of the file info in web format |
acutesoftware/AIKIF | aikif/programs.py | Programs.collect_program_info | def collect_program_info(self, fname):
"""
gets details on the program, size, date, list of functions
and produces a Markdown file for documentation
"""
md = '#AIKIF Technical details\n'
md += 'Autogenerated list of programs with comments and progress\n'
md += '\n... | python | def collect_program_info(self, fname):
"""
gets details on the program, size, date, list of functions
and produces a Markdown file for documentation
"""
md = '#AIKIF Technical details\n'
md += 'Autogenerated list of programs with comments and progress\n'
md += '\n... | [
"def",
"collect_program_info",
"(",
"self",
",",
"fname",
")",
":",
"md",
"=",
"'#AIKIF Technical details\\n'",
"md",
"+=",
"'Autogenerated list of programs with comments and progress\\n'",
"md",
"+=",
"'\\nFilename | Comment | Date | Size\\n'",
"md",
"+=",
"'--- | --- | --- | ... | gets details on the program, size, date, list of functions
and produces a Markdown file for documentation | [
"gets",
"details",
"on",
"the",
"program",
"size",
"date",
"list",
"of",
"functions",
"and",
"produces",
"a",
"Markdown",
"file",
"for",
"documentation"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/programs.py#L140-L154 | train | collects the details on the program size date list of functions
generates a Markdown file for documentation
|
mpg-age-bioinformatics/AGEpy | AGEpy/david.py | DAVIDenrich | def DAVIDenrich(database, categories, user, ids, ids_bg = None, name = '', name_bg = '', verbose = False, p = 0.1, n = 2):
# Modified from https://david.ncifcrf.gov/content.jsp?file=WS.html
# by courtesy of HuangYi @ 20110424
"""
Queries the DAVID database for an enrichment analysis
Check https://d... | python | def DAVIDenrich(database, categories, user, ids, ids_bg = None, name = '', name_bg = '', verbose = False, p = 0.1, n = 2):
# Modified from https://david.ncifcrf.gov/content.jsp?file=WS.html
# by courtesy of HuangYi @ 20110424
"""
Queries the DAVID database for an enrichment analysis
Check https://d... | [
"def",
"DAVIDenrich",
"(",
"database",
",",
"categories",
",",
"user",
",",
"ids",
",",
"ids_bg",
"=",
"None",
",",
"name",
"=",
"''",
",",
"name_bg",
"=",
"''",
",",
"verbose",
"=",
"False",
",",
"p",
"=",
"0.1",
",",
"n",
"=",
"2",
")",
":",
... | Queries the DAVID database for an enrichment analysis
Check https://david.ncifcrf.gov/content.jsp?file=DAVID_API.html for database == "type" tag and categories == "annot" tag.
:param database: A string for the database to query, e.g. 'WORMBASE_GENE_ID'
:param categories: A comma separated string with data... | [
"Queries",
"the",
"DAVID",
"database",
"for",
"an",
"enrichment",
"analysis",
"Check",
"https",
":",
"//",
"david",
".",
"ncifcrf",
".",
"gov",
"/",
"content",
".",
"jsp?file",
"=",
"DAVID_API",
".",
"html",
"for",
"database",
"==",
"type",
"tag",
"and",
... | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/david.py#L19-L89 | train | Query the DAVID database for an enrichment analysis. |
mpg-age-bioinformatics/AGEpy | AGEpy/david.py | id_nameDAVID | def id_nameDAVID(df,GTF=None,name_id=None):
"""
Given a DAVIDenrich output it converts ensembl gene ids to genes names and adds this column to the output
:param df: a dataframe output from DAVIDenrich
:param GTF: a GTF dataframe from readGTF()
:param name_id: instead of a gtf dataframe a dataframe ... | python | def id_nameDAVID(df,GTF=None,name_id=None):
"""
Given a DAVIDenrich output it converts ensembl gene ids to genes names and adds this column to the output
:param df: a dataframe output from DAVIDenrich
:param GTF: a GTF dataframe from readGTF()
:param name_id: instead of a gtf dataframe a dataframe ... | [
"def",
"id_nameDAVID",
"(",
"df",
",",
"GTF",
"=",
"None",
",",
"name_id",
"=",
"None",
")",
":",
"if",
"name_id",
"is",
"None",
":",
"gene_name",
"=",
"retrieve_GTF_field",
"(",
"'gene_name'",
",",
"GTF",
")",
"gene_id",
"=",
"retrieve_GTF_field",
"(",
... | Given a DAVIDenrich output it converts ensembl gene ids to genes names and adds this column to the output
:param df: a dataframe output from DAVIDenrich
:param GTF: a GTF dataframe from readGTF()
:param name_id: instead of a gtf dataframe a dataframe with the columns 'gene_name' and 'gene_id' can be given ... | [
"Given",
"a",
"DAVIDenrich",
"output",
"it",
"converts",
"ensembl",
"gene",
"ids",
"to",
"genes",
"names",
"and",
"adds",
"this",
"column",
"to",
"the",
"output"
] | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/david.py#L92-L134 | train | Given a DAVIDenrich output it converts ensembl gene ids to genes names and adds this column to the output
|
mpg-age-bioinformatics/AGEpy | AGEpy/david.py | DAVIDgetGeneAttribute | def DAVIDgetGeneAttribute(x,df,refCol="ensembl_gene_id",fieldTOretrieve="gene_name"):
"""
Returns a list of gene names for given gene ids.
:param x: a string with the list of IDs separated by ', '
:param df: a dataframe with the reference column and a the column to retrieve
:param refCol: the heade... | python | def DAVIDgetGeneAttribute(x,df,refCol="ensembl_gene_id",fieldTOretrieve="gene_name"):
"""
Returns a list of gene names for given gene ids.
:param x: a string with the list of IDs separated by ', '
:param df: a dataframe with the reference column and a the column to retrieve
:param refCol: the heade... | [
"def",
"DAVIDgetGeneAttribute",
"(",
"x",
",",
"df",
",",
"refCol",
"=",
"\"ensembl_gene_id\"",
",",
"fieldTOretrieve",
"=",
"\"gene_name\"",
")",
":",
"l",
"=",
"x",
".",
"split",
"(",
"\", \"",
")",
"l",
"=",
"[",
"s",
".",
"upper",
"(",
")",
"for",
... | Returns a list of gene names for given gene ids.
:param x: a string with the list of IDs separated by ', '
:param df: a dataframe with the reference column and a the column to retrieve
:param refCol: the header of the column containing the identifiers
:param fieldTOretrieve: the field to retrieve from ... | [
"Returns",
"a",
"list",
"of",
"gene",
"names",
"for",
"given",
"gene",
"ids",
"."
] | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/david.py#L136-L157 | train | Returns a list of gene names for given gene ids. |
mpg-age-bioinformatics/AGEpy | AGEpy/david.py | DAVIDplot | def DAVIDplot(database, categories, user, df_ids, output, df_ids_bg = None, name = '', \
name_bg = '', verbose = False, p = 0.1, n = 2):
"""
Queries the DAVID database for an enrichment analysis and plots CellPlots as
well as SymPlots (see plots).
Check https://david.ncifcrf.gov/content.jsp?file=DAV... | python | def DAVIDplot(database, categories, user, df_ids, output, df_ids_bg = None, name = '', \
name_bg = '', verbose = False, p = 0.1, n = 2):
"""
Queries the DAVID database for an enrichment analysis and plots CellPlots as
well as SymPlots (see plots).
Check https://david.ncifcrf.gov/content.jsp?file=DAV... | [
"def",
"DAVIDplot",
"(",
"database",
",",
"categories",
",",
"user",
",",
"df_ids",
",",
"output",
",",
"df_ids_bg",
"=",
"None",
",",
"name",
"=",
"''",
",",
"name_bg",
"=",
"''",
",",
"verbose",
"=",
"False",
",",
"p",
"=",
"0.1",
",",
"n",
"=",
... | Queries the DAVID database for an enrichment analysis and plots CellPlots as
well as SymPlots (see plots).
Check https://david.ncifcrf.gov/content.jsp?file=DAVID_API.html for database == "type" tag and categories == "annot" tag.
:param database: a string for the database to query, e.g. 'WORMBASE_GENE_ID'
... | [
"Queries",
"the",
"DAVID",
"database",
"for",
"an",
"enrichment",
"analysis",
"and",
"plots",
"CellPlots",
"as",
"well",
"as",
"SymPlots",
"(",
"see",
"plots",
")",
".",
"Check",
"https",
":",
"//",
"david",
".",
"ncifcrf",
".",
"gov",
"/",
"content",
".... | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/david.py#L160-L225 | train | Queries the DAVID database for an enrichment analysis and plots CellPlots as CellPlots |
Nachtfeuer/pipeline | spline/tools/loc/application.py | main | def main(**options):
"""Spline loc tool."""
application = Application(**options)
# fails application when your defined threshold is higher than your ratio of com/loc.
if not application.run():
sys.exit(1)
return application | python | def main(**options):
"""Spline loc tool."""
application = Application(**options)
# fails application when your defined threshold is higher than your ratio of com/loc.
if not application.run():
sys.exit(1)
return application | [
"def",
"main",
"(",
"*",
"*",
"options",
")",
":",
"application",
"=",
"Application",
"(",
"*",
"*",
"options",
")",
"# fails application when your defined threshold is higher than your ratio of com/loc.",
"if",
"not",
"application",
".",
"run",
"(",
")",
":",
"sys"... | Spline loc tool. | [
"Spline",
"loc",
"tool",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/tools/loc/application.py#L170-L176 | train | Spline loc tool. |
Nachtfeuer/pipeline | spline/tools/loc/application.py | Application.load_configuration | def load_configuration(self):
"""Loading configuration."""
filename = os.path.join(os.path.dirname(__file__), 'templates/spline-loc.yml.j2')
with open(filename) as handle:
return Adapter(safe_load(handle)).configuration | python | def load_configuration(self):
"""Loading configuration."""
filename = os.path.join(os.path.dirname(__file__), 'templates/spline-loc.yml.j2')
with open(filename) as handle:
return Adapter(safe_load(handle)).configuration | [
"def",
"load_configuration",
"(",
"self",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"'templates/spline-loc.yml.j2'",
")",
"with",
"open",
"(",
"filename",
")",
"as",
"han... | Loading configuration. | [
"Loading",
"configuration",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/tools/loc/application.py#L56-L60 | train | Loads the configuration from the file. |
Nachtfeuer/pipeline | spline/tools/loc/application.py | Application.ignore_path | def ignore_path(path):
"""
Verify whether to ignore a path.
Args:
path (str): path to check.
Returns:
bool: True when to ignore given path.
"""
ignore = False
for name in ['.tox', 'dist', 'build', 'node_modules', 'htmlcov']:
i... | python | def ignore_path(path):
"""
Verify whether to ignore a path.
Args:
path (str): path to check.
Returns:
bool: True when to ignore given path.
"""
ignore = False
for name in ['.tox', 'dist', 'build', 'node_modules', 'htmlcov']:
i... | [
"def",
"ignore_path",
"(",
"path",
")",
":",
"ignore",
"=",
"False",
"for",
"name",
"in",
"[",
"'.tox'",
",",
"'dist'",
",",
"'build'",
",",
"'node_modules'",
",",
"'htmlcov'",
"]",
":",
"if",
"path",
".",
"find",
"(",
"name",
")",
">=",
"0",
":",
... | Verify whether to ignore a path.
Args:
path (str): path to check.
Returns:
bool: True when to ignore given path. | [
"Verify",
"whether",
"to",
"ignore",
"a",
"path",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/tools/loc/application.py#L63-L78 | train | Verify whether to ignore a path. |
Nachtfeuer/pipeline | spline/tools/loc/application.py | Application.walk_files_for | def walk_files_for(paths, supported_extensions):
"""
Iterating files for given extensions.
Args:
supported_extensions (list): supported file extentsion for which to check loc and com.
Returns:
str: yield each full path and filename found.
"""
for... | python | def walk_files_for(paths, supported_extensions):
"""
Iterating files for given extensions.
Args:
supported_extensions (list): supported file extentsion for which to check loc and com.
Returns:
str: yield each full path and filename found.
"""
for... | [
"def",
"walk_files_for",
"(",
"paths",
",",
"supported_extensions",
")",
":",
"for",
"path",
"in",
"paths",
":",
"for",
"root",
",",
"_",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"path",
")",
":",
"if",
"Application",
".",
"ignore_path",
"(",
"root"... | Iterating files for given extensions.
Args:
supported_extensions (list): supported file extentsion for which to check loc and com.
Returns:
str: yield each full path and filename found. | [
"Iterating",
"files",
"for",
"given",
"extensions",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/tools/loc/application.py#L81-L99 | train | Yields each full path and filename found for given extensions. |
Nachtfeuer/pipeline | spline/tools/loc/application.py | Application.analyse | def analyse(self, path_and_filename, pattern):
"""
Find out lines of code and lines of comments.
Args:
path_and_filename (str): path and filename to parse for loc and com.
pattern (str): regex to search for line commens and block comments
Returns:
i... | python | def analyse(self, path_and_filename, pattern):
"""
Find out lines of code and lines of comments.
Args:
path_and_filename (str): path and filename to parse for loc and com.
pattern (str): regex to search for line commens and block comments
Returns:
i... | [
"def",
"analyse",
"(",
"self",
",",
"path_and_filename",
",",
"pattern",
")",
":",
"with",
"open",
"(",
"path_and_filename",
")",
"as",
"handle",
":",
"content",
"=",
"handle",
".",
"read",
"(",
")",
"loc",
"=",
"content",
".",
"count",
"(",
"'\\n'",
"... | Find out lines of code and lines of comments.
Args:
path_and_filename (str): path and filename to parse for loc and com.
pattern (str): regex to search for line commens and block comments
Returns:
int, int: loc and com for given file. | [
"Find",
"out",
"lines",
"of",
"code",
"and",
"lines",
"of",
"comments",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/tools/loc/application.py#L101-L119 | train | Analyse the file and return loc and com for given file. |
Nachtfeuer/pipeline | spline/tools/loc/application.py | Application.run | def run(self):
"""Processing the pipeline."""
self.logger.info("Running with Python %s", sys.version.replace("\n", ""))
self.logger.info("Running on platform %s", platform.platform())
self.logger.info("Current cpu count is %d", multiprocessing.cpu_count())
configuration = self.l... | python | def run(self):
"""Processing the pipeline."""
self.logger.info("Running with Python %s", sys.version.replace("\n", ""))
self.logger.info("Running on platform %s", platform.platform())
self.logger.info("Current cpu count is %d", multiprocessing.cpu_count())
configuration = self.l... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"\"Running with Python %s\"",
",",
"sys",
".",
"version",
".",
"replace",
"(",
"\"\\n\"",
",",
"\"\"",
")",
")",
"self",
".",
"logger",
".",
"info",
"(",
"\"Running on platform... | Processing the pipeline. | [
"Processing",
"the",
"pipeline",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/tools/loc/application.py#L121-L167 | train | This method is called by the application to run the pipeline. |
mpg-age-bioinformatics/AGEpy | AGEpy/biom.py | datasetsBM | def datasetsBM(host=biomart_host):
"""
Lists BioMart datasets.
:param host: address of the host server, default='http://www.ensembl.org/biomart'
:returns: nothing
"""
stdout_ = sys.stdout #Keep track of the previous value.
stream = StringIO()
sys.stdout = stream
server = Biomar... | python | def datasetsBM(host=biomart_host):
"""
Lists BioMart datasets.
:param host: address of the host server, default='http://www.ensembl.org/biomart'
:returns: nothing
"""
stdout_ = sys.stdout #Keep track of the previous value.
stream = StringIO()
sys.stdout = stream
server = Biomar... | [
"def",
"datasetsBM",
"(",
"host",
"=",
"biomart_host",
")",
":",
"stdout_",
"=",
"sys",
".",
"stdout",
"#Keep track of the previous value.",
"stream",
"=",
"StringIO",
"(",
")",
"sys",
".",
"stdout",
"=",
"stream",
"server",
"=",
"BiomartServer",
"(",
"biomart... | Lists BioMart datasets.
:param host: address of the host server, default='http://www.ensembl.org/biomart'
:returns: nothing | [
"Lists",
"BioMart",
"datasets",
"."
] | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/biom.py#L12-L31 | train | Lists BioMart datasets. |
mpg-age-bioinformatics/AGEpy | AGEpy/biom.py | filtersBM | def filtersBM(dataset,host=biomart_host):
"""
Lists BioMart filters for a specific dataset.
:param dataset: dataset to list filters of.
:param host: address of the host server, default='http://www.ensembl.org/biomart'
:returns: nothing
"""
stdout_ = sys.stdout #Keep track of the previous ... | python | def filtersBM(dataset,host=biomart_host):
"""
Lists BioMart filters for a specific dataset.
:param dataset: dataset to list filters of.
:param host: address of the host server, default='http://www.ensembl.org/biomart'
:returns: nothing
"""
stdout_ = sys.stdout #Keep track of the previous ... | [
"def",
"filtersBM",
"(",
"dataset",
",",
"host",
"=",
"biomart_host",
")",
":",
"stdout_",
"=",
"sys",
".",
"stdout",
"#Keep track of the previous value.",
"stream",
"=",
"StringIO",
"(",
")",
"sys",
".",
"stdout",
"=",
"stream",
"server",
"=",
"BiomartServer"... | Lists BioMart filters for a specific dataset.
:param dataset: dataset to list filters of.
:param host: address of the host server, default='http://www.ensembl.org/biomart'
:returns: nothing | [
"Lists",
"BioMart",
"filters",
"for",
"a",
"specific",
"dataset",
"."
] | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/biom.py#L33-L54 | train | Lists BioMart filters for a specific dataset. |
mpg-age-bioinformatics/AGEpy | AGEpy/biom.py | queryBM | def queryBM(query_attributes,query_dataset,query_filter=None,query_items=None,query_dic=None,host=biomart_host):
"""
Queries BioMart.
:param query_attributes: list of attributes to recover from BioMart
:param query_dataset: dataset to query
:param query_filter: one BioMart filter associated with th... | python | def queryBM(query_attributes,query_dataset,query_filter=None,query_items=None,query_dic=None,host=biomart_host):
"""
Queries BioMart.
:param query_attributes: list of attributes to recover from BioMart
:param query_dataset: dataset to query
:param query_filter: one BioMart filter associated with th... | [
"def",
"queryBM",
"(",
"query_attributes",
",",
"query_dataset",
",",
"query_filter",
"=",
"None",
",",
"query_items",
"=",
"None",
",",
"query_dic",
"=",
"None",
",",
"host",
"=",
"biomart_host",
")",
":",
"server",
"=",
"BiomartServer",
"(",
"host",
")",
... | Queries BioMart.
:param query_attributes: list of attributes to recover from BioMart
:param query_dataset: dataset to query
:param query_filter: one BioMart filter associated with the items being queried
:param query_items: list of items to be queried (must assoiate with given filter)
:param query_... | [
"Queries",
"BioMart",
"."
] | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/biom.py#L79-L118 | train | Queries BioMart. BioMart. |
mpg-age-bioinformatics/AGEpy | AGEpy/biom.py | FilterGOstring | def FilterGOstring(names_filter=["age-", "aging", "aged", 'aging', 'aging.', 'aging,'],\
exclude_names=["packaging","voltage","cleavage-",\
"stage-1","cage-like","message-specific",\
"damage-associated","stage-specific","foraging",\
... | python | def FilterGOstring(names_filter=["age-", "aging", "aged", 'aging', 'aging.', 'aging,'],\
exclude_names=["packaging","voltage","cleavage-",\
"stage-1","cage-like","message-specific",\
"damage-associated","stage-specific","foraging",\
... | [
"def",
"FilterGOstring",
"(",
"names_filter",
"=",
"[",
"\"age-\"",
",",
"\"aging\"",
",",
"\"aged\"",
",",
"'aging'",
",",
"'aging.'",
",",
"'aging,'",
"]",
",",
"exclude_names",
"=",
"[",
"\"packaging\"",
",",
"\"voltage\"",
",",
"\"cleavage-\"",
",",
"\"sta... | Filters GO terms based on given strings using ENSEMBL's biomart homology mapping.
:param names_filter: list of substrings to filter GO names on
:param exclude_names: list of substrings to be used for exclusion of GO names
:param defs_filter: list of substrings to filter GO defenitions on
:param exc... | [
"Filters",
"GO",
"terms",
"based",
"on",
"given",
"strings",
"using",
"ENSEMBL",
"s",
"biomart",
"homology",
"mapping",
".",
":",
"param",
"names_filter",
":",
"list",
"of",
"substrings",
"to",
"filter",
"GO",
"names",
"on",
":",
"param",
"exclude_names",
":... | 887808a7a2c1504f39ce8d8cb36c15c1721cd29f | https://github.com/mpg-age-bioinformatics/AGEpy/blob/887808a7a2c1504f39ce8d8cb36c15c1721cd29f/AGEpy/biom.py#L120-L336 | train | Filters GO terms based on given string using ENSEMBL s homology mapping. |
acutesoftware/AIKIF | aikif/core_data.py | CoreData.format_csv | def format_csv(self, delim=',', qu='"'):
"""
Prepares the data in CSV format
"""
res = qu + self.name + qu + delim
if self.data:
for d in self.data:
res += qu + str(d) + qu + delim
return res + '\n' | python | def format_csv(self, delim=',', qu='"'):
"""
Prepares the data in CSV format
"""
res = qu + self.name + qu + delim
if self.data:
for d in self.data:
res += qu + str(d) + qu + delim
return res + '\n' | [
"def",
"format_csv",
"(",
"self",
",",
"delim",
"=",
"','",
",",
"qu",
"=",
"'\"'",
")",
":",
"res",
"=",
"qu",
"+",
"self",
".",
"name",
"+",
"qu",
"+",
"delim",
"if",
"self",
".",
"data",
":",
"for",
"d",
"in",
"self",
".",
"data",
":",
"re... | Prepares the data in CSV format | [
"Prepares",
"the",
"data",
"in",
"CSV",
"format"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/core_data.py#L40-L48 | train | Returns the CSV representation of the object |
acutesoftware/AIKIF | aikif/core_data.py | CoreData.format_dict | def format_dict(self, delim=':', qu="'"):
"""
Prepares the data as a dictionary with column headers
TODO - get variable names of data[] as strings for hdr
"""
res = 'name' + delim + qu + self.name + qu + ','
for num, d in enumerate(self.data):
res += 'col' + s... | python | def format_dict(self, delim=':', qu="'"):
"""
Prepares the data as a dictionary with column headers
TODO - get variable names of data[] as strings for hdr
"""
res = 'name' + delim + qu + self.name + qu + ','
for num, d in enumerate(self.data):
res += 'col' + s... | [
"def",
"format_dict",
"(",
"self",
",",
"delim",
"=",
"':'",
",",
"qu",
"=",
"\"'\"",
")",
":",
"res",
"=",
"'name'",
"+",
"delim",
"+",
"qu",
"+",
"self",
".",
"name",
"+",
"qu",
"+",
"','",
"for",
"num",
",",
"d",
"in",
"enumerate",
"(",
"sel... | Prepares the data as a dictionary with column headers
TODO - get variable names of data[] as strings for hdr | [
"Prepares",
"the",
"data",
"as",
"a",
"dictionary",
"with",
"column",
"headers",
"TODO",
"-",
"get",
"variable",
"names",
"of",
"data",
"[]",
"as",
"strings",
"for",
"hdr"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/core_data.py#L50-L58 | train | Returns a dictionary with the keys name and data as strings |
acutesoftware/AIKIF | aikif/core_data.py | CoreData.format_all | def format_all(self):
"""
return a trace of parents and children of the obect
"""
res = '\n--- Format all : ' + str(self.name) + ' -------------\n'
res += ' parent = ' + str(self.parent) + '\n'
res += self._get_all_children()
res += self._get_links()
... | python | def format_all(self):
"""
return a trace of parents and children of the obect
"""
res = '\n--- Format all : ' + str(self.name) + ' -------------\n'
res += ' parent = ' + str(self.parent) + '\n'
res += self._get_all_children()
res += self._get_links()
... | [
"def",
"format_all",
"(",
"self",
")",
":",
"res",
"=",
"'\\n--- Format all : '",
"+",
"str",
"(",
"self",
".",
"name",
")",
"+",
"' -------------\\n'",
"res",
"+=",
"' parent = '",
"+",
"str",
"(",
"self",
".",
"parent",
")",
"+",
"'\\n'",
"res",
"+=",
... | return a trace of parents and children of the obect | [
"return",
"a",
"trace",
"of",
"parents",
"and",
"children",
"of",
"the",
"obect"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/core_data.py#L60-L69 | train | return a trace of all the children of the object |
acutesoftware/AIKIF | aikif/core_data.py | CoreData._get_all_children | def _get_all_children(self,):
"""
return the list of children of a node
"""
res = ''
if self.child_nodes:
for c in self.child_nodes:
res += ' child = ' + str(c) + '\n'
if c.child_nodes:
for grandchild in c.child_nod... | python | def _get_all_children(self,):
"""
return the list of children of a node
"""
res = ''
if self.child_nodes:
for c in self.child_nodes:
res += ' child = ' + str(c) + '\n'
if c.child_nodes:
for grandchild in c.child_nod... | [
"def",
"_get_all_children",
"(",
"self",
",",
")",
":",
"res",
"=",
"''",
"if",
"self",
".",
"child_nodes",
":",
"for",
"c",
"in",
"self",
".",
"child_nodes",
":",
"res",
"+=",
"' child = '",
"+",
"str",
"(",
"c",
")",
"+",
"'\\n'",
"if",
"c",
".",... | return the list of children of a node | [
"return",
"the",
"list",
"of",
"children",
"of",
"a",
"node"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/core_data.py#L71-L84 | train | get all children of a node |
acutesoftware/AIKIF | aikif/core_data.py | CoreData._get_links | def _get_links(self,):
"""
return the list of links of a node
"""
res = ''
if self.links:
for l in self.links:
res += ' links = ' + str(l[0]) + '\n'
if l[0].child_nodes:
for chld in l[0].child_nodes:
... | python | def _get_links(self,):
"""
return the list of links of a node
"""
res = ''
if self.links:
for l in self.links:
res += ' links = ' + str(l[0]) + '\n'
if l[0].child_nodes:
for chld in l[0].child_nodes:
... | [
"def",
"_get_links",
"(",
"self",
",",
")",
":",
"res",
"=",
"''",
"if",
"self",
".",
"links",
":",
"for",
"l",
"in",
"self",
".",
"links",
":",
"res",
"+=",
"' links = '",
"+",
"str",
"(",
"l",
"[",
"0",
"]",
")",
"+",
"'\\n'",
"if",
"l",
"[... | return the list of links of a node | [
"return",
"the",
"list",
"of",
"links",
"of",
"a",
"node"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/core_data.py#L86-L103 | train | get the list of links of a node |
acutesoftware/AIKIF | aikif/core_data.py | CoreData.expand | def expand(self, process, child_nodes):
"""
this expands a current node by defining ALL the
children for that process
TODO = processes need to be recalculated
"""
#print('TODO: process check = ', process)
#print(self.name, ' expanded to ->', child_nodes)
... | python | def expand(self, process, child_nodes):
"""
this expands a current node by defining ALL the
children for that process
TODO = processes need to be recalculated
"""
#print('TODO: process check = ', process)
#print(self.name, ' expanded to ->', child_nodes)
... | [
"def",
"expand",
"(",
"self",
",",
"process",
",",
"child_nodes",
")",
":",
"#print('TODO: process check = ', process)",
"#print(self.name, ' expanded to ->', child_nodes)",
"self",
".",
"child_nodes",
"=",
"[",
"]",
"for",
"n",
"in",
"child_nodes",
":",
"self",
".",
... | this expands a current node by defining ALL the
children for that process
TODO = processes need to be recalculated | [
"this",
"expands",
"a",
"current",
"node",
"by",
"defining",
"ALL",
"the",
"children",
"for",
"that",
"process",
"TODO",
"=",
"processes",
"need",
"to",
"be",
"recalculated"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/core_data.py#L125-L135 | train | This expands a current node by defining ALL the
children for that process. |
acutesoftware/AIKIF | aikif/core_data.py | CoreData.contract | def contract(self, process):
"""
this contracts the current node to its parent and
then either caclulates the params and values if all
child data exists, OR uses the default parent data.
(In real terms it returns the parent and recalculates)
TODO = processes need to be ... | python | def contract(self, process):
"""
this contracts the current node to its parent and
then either caclulates the params and values if all
child data exists, OR uses the default parent data.
(In real terms it returns the parent and recalculates)
TODO = processes need to be ... | [
"def",
"contract",
"(",
"self",
",",
"process",
")",
":",
"print",
"(",
"'TODO: process check = '",
",",
"process",
")",
"print",
"(",
"self",
".",
"name",
",",
"' contracted to ->'",
",",
"self",
".",
"parent",
")",
"return",
"self",
".",
"parent"
] | this contracts the current node to its parent and
then either caclulates the params and values if all
child data exists, OR uses the default parent data.
(In real terms it returns the parent and recalculates)
TODO = processes need to be recalculated | [
"this",
"contracts",
"the",
"current",
"node",
"to",
"its",
"parent",
"and",
"then",
"either",
"caclulates",
"the",
"params",
"and",
"values",
"if",
"all",
"child",
"data",
"exists",
"OR",
"uses",
"the",
"default",
"parent",
"data",
".",
"(",
"In",
"real",... | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/core_data.py#L137-L147 | train | contracts the current node to its parent and returns the parent and the parent data |
acutesoftware/AIKIF | aikif/core_data.py | CoreData.get_child_by_name | def get_child_by_name(self, name):
"""
find the child object by name and return the object
"""
for c in self.child_nodes:
if c.name == name:
return c
return None | python | def get_child_by_name(self, name):
"""
find the child object by name and return the object
"""
for c in self.child_nodes:
if c.name == name:
return c
return None | [
"def",
"get_child_by_name",
"(",
"self",
",",
"name",
")",
":",
"for",
"c",
"in",
"self",
".",
"child_nodes",
":",
"if",
"c",
".",
"name",
"==",
"name",
":",
"return",
"c",
"return",
"None"
] | find the child object by name and return the object | [
"find",
"the",
"child",
"object",
"by",
"name",
"and",
"return",
"the",
"object"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/core_data.py#L149-L156 | train | find the child object by name and return the object |
acutesoftware/AIKIF | aikif/core_data.py | CoreData.links_to | def links_to(self, other, tpe):
"""
adds a link from this thing to other thing
using type (is_a, has_a, uses, contains, part_of)
"""
if self.check_type(tpe):
self.links.append([other, tpe])
else:
raise Exception('aikif.core_data cannot process this... | python | def links_to(self, other, tpe):
"""
adds a link from this thing to other thing
using type (is_a, has_a, uses, contains, part_of)
"""
if self.check_type(tpe):
self.links.append([other, tpe])
else:
raise Exception('aikif.core_data cannot process this... | [
"def",
"links_to",
"(",
"self",
",",
"other",
",",
"tpe",
")",
":",
"if",
"self",
".",
"check_type",
"(",
"tpe",
")",
":",
"self",
".",
"links",
".",
"append",
"(",
"[",
"other",
",",
"tpe",
"]",
")",
"else",
":",
"raise",
"Exception",
"(",
"'aik... | adds a link from this thing to other thing
using type (is_a, has_a, uses, contains, part_of) | [
"adds",
"a",
"link",
"from",
"this",
"thing",
"to",
"other",
"thing",
"using",
"type",
"(",
"is_a",
"has_a",
"uses",
"contains",
"part_of",
")"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/core_data.py#L158-L166 | train | Adds a link from this thing to other thing using type tpe. |
acutesoftware/AIKIF | aikif/core_data.py | CoreTable.get_filename | def get_filename(self, year):
"""
returns the filename
"""
res = self.fldr + os.sep + self.type + year + '.' + self.user
return res | python | def get_filename(self, year):
"""
returns the filename
"""
res = self.fldr + os.sep + self.type + year + '.' + self.user
return res | [
"def",
"get_filename",
"(",
"self",
",",
"year",
")",
":",
"res",
"=",
"self",
".",
"fldr",
"+",
"os",
".",
"sep",
"+",
"self",
".",
"type",
"+",
"year",
"+",
"'.'",
"+",
"self",
".",
"user",
"return",
"res"
] | returns the filename | [
"returns",
"the",
"filename"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/core_data.py#L301-L306 | train | returns the filename of the record |
acutesoftware/AIKIF | aikif/core_data.py | CoreTable.save | def save(self, file_tag='2016', add_header='N'):
"""
save table to folder in appropriate files
NOTE - ONLY APPEND AT THIS STAGE - THEN USE DATABASE
"""
fname = self.get_filename(file_tag)
with open(fname, 'a') as f:
if add_header == 'Y':
f.writ... | python | def save(self, file_tag='2016', add_header='N'):
"""
save table to folder in appropriate files
NOTE - ONLY APPEND AT THIS STAGE - THEN USE DATABASE
"""
fname = self.get_filename(file_tag)
with open(fname, 'a') as f:
if add_header == 'Y':
f.writ... | [
"def",
"save",
"(",
"self",
",",
"file_tag",
"=",
"'2016'",
",",
"add_header",
"=",
"'N'",
")",
":",
"fname",
"=",
"self",
".",
"get_filename",
"(",
"file_tag",
")",
"with",
"open",
"(",
"fname",
",",
"'a'",
")",
"as",
"f",
":",
"if",
"add_header",
... | save table to folder in appropriate files
NOTE - ONLY APPEND AT THIS STAGE - THEN USE DATABASE | [
"save",
"table",
"to",
"folder",
"in",
"appropriate",
"files",
"NOTE",
"-",
"ONLY",
"APPEND",
"AT",
"THIS",
"STAGE",
"-",
"THEN",
"USE",
"DATABASE"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/core_data.py#L320-L331 | train | save the table to file in appropriate files |
acutesoftware/AIKIF | aikif/core_data.py | CoreTable.format_hdr | def format_hdr(self, delim=',', qu='"'):
"""
Prepares the header in CSV format
"""
res = ''
if self.header:
for d in self.header:
res += qu + str(d) + qu + delim
return res + '\n' | python | def format_hdr(self, delim=',', qu='"'):
"""
Prepares the header in CSV format
"""
res = ''
if self.header:
for d in self.header:
res += qu + str(d) + qu + delim
return res + '\n' | [
"def",
"format_hdr",
"(",
"self",
",",
"delim",
"=",
"','",
",",
"qu",
"=",
"'\"'",
")",
":",
"res",
"=",
"''",
"if",
"self",
".",
"header",
":",
"for",
"d",
"in",
"self",
".",
"header",
":",
"res",
"+=",
"qu",
"+",
"str",
"(",
"d",
")",
"+",... | Prepares the header in CSV format | [
"Prepares",
"the",
"header",
"in",
"CSV",
"format"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/core_data.py#L333-L341 | train | Returns the header of the log entry in CSV format |
acutesoftware/AIKIF | aikif/core_data.py | CoreTable.generate_diary | def generate_diary(self):
"""
extracts event information from core tables into diary files
"""
print('Generate diary files from Event rows only')
for r in self.table:
print(str(type(r)) + ' = ', r) | python | def generate_diary(self):
"""
extracts event information from core tables into diary files
"""
print('Generate diary files from Event rows only')
for r in self.table:
print(str(type(r)) + ' = ', r) | [
"def",
"generate_diary",
"(",
"self",
")",
":",
"print",
"(",
"'Generate diary files from Event rows only'",
")",
"for",
"r",
"in",
"self",
".",
"table",
":",
"print",
"(",
"str",
"(",
"type",
"(",
"r",
")",
")",
"+",
"' = '",
",",
"r",
")"
] | extracts event information from core tables into diary files | [
"extracts",
"event",
"information",
"from",
"core",
"tables",
"into",
"diary",
"files"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/core_data.py#L344-L350 | train | Generate diary files from core tables |
Phelimb/atlas | mykatlas/typing/typer/variant.py | VariantTyper.type | def type(self, variant_probe_coverages, variant=None):
"""
Takes a list of VariantProbeCoverages and returns a Call for the Variant.
Note, in the simplest case the list will be of length one. However, we may be typing the
Variant on multiple backgrouds leading to multiple Var... | python | def type(self, variant_probe_coverages, variant=None):
"""
Takes a list of VariantProbeCoverages and returns a Call for the Variant.
Note, in the simplest case the list will be of length one. However, we may be typing the
Variant on multiple backgrouds leading to multiple Var... | [
"def",
"type",
"(",
"self",
",",
"variant_probe_coverages",
",",
"variant",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"variant_probe_coverages",
",",
"list",
")",
":",
"variant_probe_coverages",
"=",
"[",
"variant_probe_coverages",
"]",
"calls",
"="... | Takes a list of VariantProbeCoverages and returns a Call for the Variant.
Note, in the simplest case the list will be of length one. However, we may be typing the
Variant on multiple backgrouds leading to multiple VariantProbes for a single Variant. | [
"Takes",
"a",
"list",
"of",
"VariantProbeCoverages",
"and",
"returns",
"a",
"Call",
"for",
"the",
"Variant",
".",
"Note",
"in",
"the",
"simplest",
"case",
"the",
"list",
"will",
"be",
"of",
"length",
"one",
".",
"However",
"we",
"may",
"be",
"typing",
"t... | 02e85497bb5ac423d6452a10dca11964582ac4d7 | https://github.com/Phelimb/atlas/blob/02e85497bb5ac423d6452a10dca11964582ac4d7/mykatlas/typing/typer/variant.py#L64-L88 | train | Takes a list of VariantProbeCoverages and returns a Call for the Variant. |
Nachtfeuer/pipeline | spline/components/ansible.py | Ansible.creator | def creator(entry, config):
"""Creator function for creating an instance of an Ansible script."""
ansible_playbook = "ansible.playbook.dry.run.see.comment"
ansible_inventory = "ansible.inventory.dry.run.see.comment"
ansible_playbook_content = render(config.script, model=config.model, en... | python | def creator(entry, config):
"""Creator function for creating an instance of an Ansible script."""
ansible_playbook = "ansible.playbook.dry.run.see.comment"
ansible_inventory = "ansible.inventory.dry.run.see.comment"
ansible_playbook_content = render(config.script, model=config.model, en... | [
"def",
"creator",
"(",
"entry",
",",
"config",
")",
":",
"ansible_playbook",
"=",
"\"ansible.playbook.dry.run.see.comment\"",
"ansible_inventory",
"=",
"\"ansible.inventory.dry.run.see.comment\"",
"ansible_playbook_content",
"=",
"render",
"(",
"config",
".",
"script",
",",... | Creator function for creating an instance of an Ansible script. | [
"Creator",
"function",
"for",
"creating",
"an",
"instance",
"of",
"an",
"Ansible",
"script",
"."
] | 04ca18c4e95e4349532bb45b768206393e1f2c13 | https://github.com/Nachtfeuer/pipeline/blob/04ca18c4e95e4349532bb45b768206393e1f2c13/spline/components/ansible.py#L37-L64 | train | Creator function for creating an instance of an Ansible script. |
acutesoftware/AIKIF | aikif/toolbox/cls_grid_life.py | GameOfLife.update_gol | def update_gol(self):
"""
Function that performs one step of the Game of Life
"""
updated_grid = [[self.update_cell(row, col) \
for col in range(self.get_grid_width())] \
for row in range(self.get_grid_height())]
... | python | def update_gol(self):
"""
Function that performs one step of the Game of Life
"""
updated_grid = [[self.update_cell(row, col) \
for col in range(self.get_grid_width())] \
for row in range(self.get_grid_height())]
... | [
"def",
"update_gol",
"(",
"self",
")",
":",
"updated_grid",
"=",
"[",
"[",
"self",
".",
"update_cell",
"(",
"row",
",",
"col",
")",
"for",
"col",
"in",
"range",
"(",
"self",
".",
"get_grid_width",
"(",
")",
")",
"]",
"for",
"row",
"in",
"range",
"(... | Function that performs one step of the Game of Life | [
"Function",
"that",
"performs",
"one",
"step",
"of",
"the",
"Game",
"of",
"Life"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/toolbox/cls_grid_life.py#L19-L28 | train | Function that performs one step of the Game of Life
|
acutesoftware/AIKIF | aikif/toolbox/cls_grid_life.py | GameOfLife.update_cell | def update_cell(self, row, col):
"""
Function that computes the update for one cell in the Game of Life
"""
# compute number of living neighbors
neighbors = self.eight_neighbors(row, col)
living_neighbors = 0
for neighbor in neighbors:
if not self.is_e... | python | def update_cell(self, row, col):
"""
Function that computes the update for one cell in the Game of Life
"""
# compute number of living neighbors
neighbors = self.eight_neighbors(row, col)
living_neighbors = 0
for neighbor in neighbors:
if not self.is_e... | [
"def",
"update_cell",
"(",
"self",
",",
"row",
",",
"col",
")",
":",
"# compute number of living neighbors",
"neighbors",
"=",
"self",
".",
"eight_neighbors",
"(",
"row",
",",
"col",
")",
"living_neighbors",
"=",
"0",
"for",
"neighbor",
"in",
"neighbors",
":",... | Function that computes the update for one cell in the Game of Life | [
"Function",
"that",
"computes",
"the",
"update",
"for",
"one",
"cell",
"in",
"the",
"Game",
"of",
"Life"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/toolbox/cls_grid_life.py#L31-L46 | train | Function that computes the update for one cell in the Game of LifeCOOKIE. |
acutesoftware/AIKIF | aikif/toolbox/cls_grid_life.py | GameOfLifePatterns.bitmap_pattern_to_list | def bitmap_pattern_to_list(self, bmp_pat):
"""
takes a list of bitmap points (drawn via Life screen)
and converts to a list of full coordinates
"""
res = []
x = 1
y = 1
lines = bmp_pat.split('\n')
for line in lines:
y += 1
... | python | def bitmap_pattern_to_list(self, bmp_pat):
"""
takes a list of bitmap points (drawn via Life screen)
and converts to a list of full coordinates
"""
res = []
x = 1
y = 1
lines = bmp_pat.split('\n')
for line in lines:
y += 1
... | [
"def",
"bitmap_pattern_to_list",
"(",
"self",
",",
"bmp_pat",
")",
":",
"res",
"=",
"[",
"]",
"x",
"=",
"1",
"y",
"=",
"1",
"lines",
"=",
"bmp_pat",
".",
"split",
"(",
"'\\n'",
")",
"for",
"line",
"in",
"lines",
":",
"y",
"+=",
"1",
"for",
"char"... | takes a list of bitmap points (drawn via Life screen)
and converts to a list of full coordinates | [
"takes",
"a",
"list",
"of",
"bitmap",
"points",
"(",
"drawn",
"via",
"Life",
"screen",
")",
"and",
"converts",
"to",
"a",
"list",
"of",
"full",
"coordinates"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/toolbox/cls_grid_life.py#L83-L98 | train | Takes a list of bitmap points and converts to a list of full coordinates |
acutesoftware/AIKIF | aikif/toolbox/cls_grid_life.py | GameOfLifePatterns.random_offset | def random_offset(self, lst):
"""
offsets a pattern list generated below to a random
position in the grid
"""
res = []
x = random.randint(4,self.max_x - 42)
y = random.randint(4,self.max_y - 10)
for itm in lst:
res.append([itm[0] + y, itm[1] +... | python | def random_offset(self, lst):
"""
offsets a pattern list generated below to a random
position in the grid
"""
res = []
x = random.randint(4,self.max_x - 42)
y = random.randint(4,self.max_y - 10)
for itm in lst:
res.append([itm[0] + y, itm[1] +... | [
"def",
"random_offset",
"(",
"self",
",",
"lst",
")",
":",
"res",
"=",
"[",
"]",
"x",
"=",
"random",
".",
"randint",
"(",
"4",
",",
"self",
".",
"max_x",
"-",
"42",
")",
"y",
"=",
"random",
".",
"randint",
"(",
"4",
",",
"self",
".",
"max_y",
... | offsets a pattern list generated below to a random
position in the grid | [
"offsets",
"a",
"pattern",
"list",
"generated",
"below",
"to",
"a",
"random",
"position",
"in",
"the",
"grid"
] | fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03 | https://github.com/acutesoftware/AIKIF/blob/fcf1582dc5f884b9a4fa7c6e20e9de9d94d21d03/aikif/toolbox/cls_grid_life.py#L100-L110 | train | offsets a pattern list generated below to a random integer position in the grid |
JelleAalbers/multihist | multihist.py | Hist1d.from_histogram | def from_histogram(cls, histogram, bin_edges, axis_names=None):
"""Make a Hist1D from a numpy bin_edges + histogram pair
:param histogram: Initial histogram
:param bin_edges: Bin edges of histogram. Must be one longer than length of histogram
:param axis_names: Ignored. Sorry :-)
... | python | def from_histogram(cls, histogram, bin_edges, axis_names=None):
"""Make a Hist1D from a numpy bin_edges + histogram pair
:param histogram: Initial histogram
:param bin_edges: Bin edges of histogram. Must be one longer than length of histogram
:param axis_names: Ignored. Sorry :-)
... | [
"def",
"from_histogram",
"(",
"cls",
",",
"histogram",
",",
"bin_edges",
",",
"axis_names",
"=",
"None",
")",
":",
"if",
"len",
"(",
"bin_edges",
")",
"!=",
"len",
"(",
"histogram",
")",
"+",
"1",
":",
"raise",
"ValueError",
"(",
"\"Bin edges must be of le... | Make a Hist1D from a numpy bin_edges + histogram pair
:param histogram: Initial histogram
:param bin_edges: Bin edges of histogram. Must be one longer than length of histogram
:param axis_names: Ignored. Sorry :-)
:return: | [
"Make",
"a",
"Hist1D",
"from",
"a",
"numpy",
"bin_edges",
"+",
"histogram",
"pair",
":",
"param",
"histogram",
":",
"Initial",
"histogram",
":",
"param",
"bin_edges",
":",
"Bin",
"edges",
"of",
"histogram",
".",
"Must",
"be",
"one",
"longer",
"than",
"leng... | 072288277f807e7e388fdf424c3921c80576f3ab | https://github.com/JelleAalbers/multihist/blob/072288277f807e7e388fdf424c3921c80576f3ab/multihist.py#L130-L141 | train | Make a Hist1D from a numpy array bin_edges + histogram pair
|
JelleAalbers/multihist | multihist.py | Hist1d.density | def density(self):
"""Gives emprical PDF, like np.histogram(...., density=True)"""
h = self.histogram.astype(np.float)
bindifs = np.array(np.diff(self.bin_edges), float)
return h / (bindifs * self.n) | python | def density(self):
"""Gives emprical PDF, like np.histogram(...., density=True)"""
h = self.histogram.astype(np.float)
bindifs = np.array(np.diff(self.bin_edges), float)
return h / (bindifs * self.n) | [
"def",
"density",
"(",
"self",
")",
":",
"h",
"=",
"self",
".",
"histogram",
".",
"astype",
"(",
"np",
".",
"float",
")",
"bindifs",
"=",
"np",
".",
"array",
"(",
"np",
".",
"diff",
"(",
"self",
".",
"bin_edges",
")",
",",
"float",
")",
"return",... | Gives emprical PDF, like np.histogram(...., density=True) | [
"Gives",
"emprical",
"PDF",
"like",
"np",
".",
"histogram",
"(",
"....",
"density",
"=",
"True",
")"
] | 072288277f807e7e388fdf424c3921c80576f3ab | https://github.com/JelleAalbers/multihist/blob/072288277f807e7e388fdf424c3921c80576f3ab/multihist.py#L167-L171 | train | Gives emprical PDF like np. histogram (... density = True |
JelleAalbers/multihist | multihist.py | Hist1d.get_random | def get_random(self, size=10):
"""Returns random variates from the histogram.
Note this assumes the histogram is an 'events per bin', not a pdf.
Inside the bins, a uniform distribution is assumed.
"""
bin_i = np.random.choice(np.arange(len(self.bin_centers)), size=size, p=self.no... | python | def get_random(self, size=10):
"""Returns random variates from the histogram.
Note this assumes the histogram is an 'events per bin', not a pdf.
Inside the bins, a uniform distribution is assumed.
"""
bin_i = np.random.choice(np.arange(len(self.bin_centers)), size=size, p=self.no... | [
"def",
"get_random",
"(",
"self",
",",
"size",
"=",
"10",
")",
":",
"bin_i",
"=",
"np",
".",
"random",
".",
"choice",
"(",
"np",
".",
"arange",
"(",
"len",
"(",
"self",
".",
"bin_centers",
")",
")",
",",
"size",
"=",
"size",
",",
"p",
"=",
"sel... | Returns random variates from the histogram.
Note this assumes the histogram is an 'events per bin', not a pdf.
Inside the bins, a uniform distribution is assumed. | [
"Returns",
"random",
"variates",
"from",
"the",
"histogram",
".",
"Note",
"this",
"assumes",
"the",
"histogram",
"is",
"an",
"events",
"per",
"bin",
"not",
"a",
"pdf",
".",
"Inside",
"the",
"bins",
"a",
"uniform",
"distribution",
"is",
"assumed",
"."
] | 072288277f807e7e388fdf424c3921c80576f3ab | https://github.com/JelleAalbers/multihist/blob/072288277f807e7e388fdf424c3921c80576f3ab/multihist.py#L187-L193 | train | Returns random variates from the histogram. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.