hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
e639ca29605d9ea5247db0950151e3f25cfabc54
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_4.py
[ "MIT" ]
Python
solve_row0_tile
<not_specific>
def solve_row0_tile(self, target_col): """ Solve the tile in row zero at the specified column Updates puzzle and returns a move string """ empyt_str = '' target_row = 1 target_col -= 1 result_str = '' result_str += 'ld' self.updat...
Solve the tile in row zero at the specified column Updates puzzle and returns a move string
Solve the tile in row zero at the specified column Updates puzzle and returns a move string
[ "Solve", "the", "tile", "in", "row", "zero", "at", "the", "specified", "column", "Updates", "puzzle", "and", "returns", "a", "move", "string" ]
def solve_row0_tile(self, target_col): empyt_str = '' target_row = 1 target_col -= 1 result_str = '' result_str += 'ld' self.update_puzzle(result_str) if self.is_move_over(target_row,target_col,2): return result_str else: result_str...
[ "def", "solve_row0_tile", "(", "self", ",", "target_col", ")", ":", "empyt_str", "=", "''", "target_row", "=", "1", "target_col", "-=", "1", "result_str", "=", "''", "result_str", "+=", "'ld'", "self", ".", "update_puzzle", "(", "result_str", ")", "if", "s...
Solve the tile in row zero at the specified column Updates puzzle and returns a move string
[ "Solve", "the", "tile", "in", "row", "zero", "at", "the", "specified", "column", "Updates", "puzzle", "and", "returns", "a", "move", "string" ]
[ "\"\"\"\r\n Solve the tile in row zero at the specified column\r\n Updates puzzle and returns a move string\r\n \"\"\"", "# move_str = 'r'*(self.get_width()-2)\r", "# result_str += move_str\r", "# self.update_puzzle(move_str)\r" ]
[ { "param": "self", "type": null }, { "param": "target_col", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target_col", "type": null, "docstring": null, "docstring_toke...
e639ca29605d9ea5247db0950151e3f25cfabc54
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_4.py
[ "MIT" ]
Python
solve_row1_tile
<not_specific>
def solve_row1_tile(self, target_col): """ Solve the tile in row one at the specified column Updates puzzle and returns a move string """ empyt_str = '' target_row = 1 result_str = '' result_str += self.move_to_same_col_p2(empyt_str,target_row,targ...
Solve the tile in row one at the specified column Updates puzzle and returns a move string
Solve the tile in row one at the specified column Updates puzzle and returns a move string
[ "Solve", "the", "tile", "in", "row", "one", "at", "the", "specified", "column", "Updates", "puzzle", "and", "returns", "a", "move", "string" ]
def solve_row1_tile(self, target_col): empyt_str = '' target_row = 1 result_str = '' result_str += self.move_to_same_col_p2(empyt_str,target_row,target_col,0) if self.is_move_over(target_row,target_col,0): return result_str else: result_str += self...
[ "def", "solve_row1_tile", "(", "self", ",", "target_col", ")", ":", "empyt_str", "=", "''", "target_row", "=", "1", "result_str", "=", "''", "result_str", "+=", "self", ".", "move_to_same_col_p2", "(", "empyt_str", ",", "target_row", ",", "target_col", ",", ...
Solve the tile in row one at the specified column Updates puzzle and returns a move string
[ "Solve", "the", "tile", "in", "row", "one", "at", "the", "specified", "column", "Updates", "puzzle", "and", "returns", "a", "move", "string" ]
[ "\"\"\"\r\n Solve the tile in row one at the specified column\r\n Updates puzzle and returns a move string\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "target_col", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target_col", "type": null, "docstring": null, "docstring_toke...
e639ca29605d9ea5247db0950151e3f25cfabc54
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_4.py
[ "MIT" ]
Python
solve_2x2
<not_specific>
def solve_2x2(self): """ Solve the upper left 2x2 part of the puzzle Updates the puzzle and returns a move string """ empyt_str = '' result_str = '' result_str += 'ul' self.update_puzzle(result_str) if self.row0_invariant(0): ...
Solve the upper left 2x2 part of the puzzle Updates the puzzle and returns a move string
Solve the upper left 2x2 part of the puzzle Updates the puzzle and returns a move string
[ "Solve", "the", "upper", "left", "2x2", "part", "of", "the", "puzzle", "Updates", "the", "puzzle", "and", "returns", "a", "move", "string" ]
def solve_2x2(self): empyt_str = '' result_str = '' result_str += 'ul' self.update_puzzle(result_str) if self.row0_invariant(0): return result_str else: result_str += self.move_to_solve_tbt(empyt_str) return result_str
[ "def", "solve_2x2", "(", "self", ")", ":", "empyt_str", "=", "''", "result_str", "=", "''", "result_str", "+=", "'ul'", "self", ".", "update_puzzle", "(", "result_str", ")", "if", "self", ".", "row0_invariant", "(", "0", ")", ":", "return", "result_str", ...
Solve the upper left 2x2 part of the puzzle Updates the puzzle and returns a move string
[ "Solve", "the", "upper", "left", "2x2", "part", "of", "the", "puzzle", "Updates", "the", "puzzle", "and", "returns", "a", "move", "string" ]
[ "\"\"\"\r\n Solve the upper left 2x2 part of the puzzle\r\n Updates the puzzle and returns a move string\r\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e639ca29605d9ea5247db0950151e3f25cfabc54
Arthur-Lanc/coursera
python_data_scien/poc2/poc2_mini_proj_4.py
[ "MIT" ]
Python
solve_puzzle
<not_specific>
def solve_puzzle(self): """ Generate a solution string for a puzzle Updates the puzzle and returns a move string """ width = self.get_width() height =self.get_height() result_str = '' result_str += self.move_tile_to_end() if se...
Generate a solution string for a puzzle Updates the puzzle and returns a move string
Generate a solution string for a puzzle Updates the puzzle and returns a move string
[ "Generate", "a", "solution", "string", "for", "a", "puzzle", "Updates", "the", "puzzle", "and", "returns", "a", "move", "string" ]
def solve_puzzle(self): width = self.get_width() height =self.get_height() result_str = '' result_str += self.move_tile_to_end() if self.lower_row_invariant(height-1, width-1) == False: return for target_row in range(height-1, 1, -1): for target_c...
[ "def", "solve_puzzle", "(", "self", ")", ":", "width", "=", "self", ".", "get_width", "(", ")", "height", "=", "self", ".", "get_height", "(", ")", "result_str", "=", "''", "result_str", "+=", "self", ".", "move_tile_to_end", "(", ")", "if", "self", "....
Generate a solution string for a puzzle Updates the puzzle and returns a move string
[ "Generate", "a", "solution", "string", "for", "a", "puzzle", "Updates", "the", "puzzle", "and", "returns", "a", "move", "string" ]
[ "\"\"\"\r\n Generate a solution string for a puzzle\r\n Updates the puzzle and returns a move string\r\n \"\"\"", "#print 'phase1 start failed!'\r", "#print 'phase1 start!'\r", "#print self\r", "#print 'solve_col0_tile:',target_row,target_col\r", "#print self.lower_row_invariant(targe...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cbb91268662b9930ca5897f3a73fe712152fdc33
Arthur-Lanc/coursera
python_data_scien/algorithmic_thinking1/application2.py
[ "MIT" ]
Python
legend_example
null
def legend_example(p,m,node,comput_res_list,er_res_list,upa_res_list): """ Plot an example with two curves with legends """ xvals = [i for i in range(0,node+1)] plt.plot(xvals, comput_res_list, '-b', label='computer network graph') plt.plot(xvals, er_res_list, '-r', label='er graph(p:%s)...
Plot an example with two curves with legends
Plot an example with two curves with legends
[ "Plot", "an", "example", "with", "two", "curves", "with", "legends" ]
def legend_example(p,m,node,comput_res_list,er_res_list,upa_res_list): xvals = [i for i in range(0,node+1)] plt.plot(xvals, comput_res_list, '-b', label='computer network graph') plt.plot(xvals, er_res_list, '-r', label='er graph(p:%s)' % str(p)) plt.plot(xvals, upa_res_list, '-y', label='upa graph(m:%s...
[ "def", "legend_example", "(", "p", ",", "m", ",", "node", ",", "comput_res_list", ",", "er_res_list", ",", "upa_res_list", ")", ":", "xvals", "=", "[", "i", "for", "i", "in", "range", "(", "0", ",", "node", "+", "1", ")", "]", "plt", ".", "plot", ...
Plot an example with two curves with legends
[ "Plot", "an", "example", "with", "two", "curves", "with", "legends" ]
[ "\"\"\"\r\n Plot an example with two curves with legends\r\n \"\"\"" ]
[ { "param": "p", "type": null }, { "param": "m", "type": null }, { "param": "node", "type": null }, { "param": "comput_res_list", "type": null }, { "param": "er_res_list", "type": null }, { "param": "upa_res_list", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "p", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "m", "type": null, "docstring": null, "docstring_tokens": [], ...
4ce842c7f5323f767593e24d12d941937b5dc360
Arthur-Lanc/coursera
python_data_scien/poc1/min_porj_5(Cookie Clicker).py
[ "MIT" ]
Python
time_until
<not_specific>
def time_until(self, cookies): """ Return time until you have the given number of cookies (could be 0.0 if you already have enough cookies) Should return a float with no fractional part """ if self._current_cookies >= cookies: time_until_seconds = 0.0...
Return time until you have the given number of cookies (could be 0.0 if you already have enough cookies) Should return a float with no fractional part
Return time until you have the given number of cookies (could be 0.0 if you already have enough cookies) Should return a float with no fractional part
[ "Return", "time", "until", "you", "have", "the", "given", "number", "of", "cookies", "(", "could", "be", "0", ".", "0", "if", "you", "already", "have", "enough", "cookies", ")", "Should", "return", "a", "float", "with", "no", "fractional", "part" ]
def time_until(self, cookies): if self._current_cookies >= cookies: time_until_seconds = 0.0 else: time_until_seconds = float(math.ceil((cookies - self._current_cookies)/self._current_cps)) return time_until_seconds
[ "def", "time_until", "(", "self", ",", "cookies", ")", ":", "if", "self", ".", "_current_cookies", ">=", "cookies", ":", "time_until_seconds", "=", "0.0", "else", ":", "time_until_seconds", "=", "float", "(", "math", ".", "ceil", "(", "(", "cookies", "-", ...
Return time until you have the given number of cookies (could be 0.0 if you already have enough cookies)
[ "Return", "time", "until", "you", "have", "the", "given", "number", "of", "cookies", "(", "could", "be", "0", ".", "0", "if", "you", "already", "have", "enough", "cookies", ")" ]
[ "\"\"\"\r\n Return time until you have the given number of cookies\r\n (could be 0.0 if you already have enough cookies)\r\n\r\n Should return a float with no fractional part\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "cookies", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cookies", "type": null, "docstring": null, "docstring_tokens"...
4ce842c7f5323f767593e24d12d941937b5dc360
Arthur-Lanc/coursera
python_data_scien/poc1/min_porj_5(Cookie Clicker).py
[ "MIT" ]
Python
wait
null
def wait(self, time): """ Wait for given amount of time and update state Should do nothing if time <= 0.0 """ if time > 0.0: self._current_time += time self._current_cookies += self._current_cps * time self._total_cookies += self._cur...
Wait for given amount of time and update state Should do nothing if time <= 0.0
Wait for given amount of time and update state Should do nothing if time <= 0.0
[ "Wait", "for", "given", "amount", "of", "time", "and", "update", "state", "Should", "do", "nothing", "if", "time", "<", "=", "0", ".", "0" ]
def wait(self, time): if time > 0.0: self._current_time += time self._current_cookies += self._current_cps * time self._total_cookies += self._current_cps * time
[ "def", "wait", "(", "self", ",", "time", ")", ":", "if", "time", ">", "0.0", ":", "self", ".", "_current_time", "+=", "time", "self", ".", "_current_cookies", "+=", "self", ".", "_current_cps", "*", "time", "self", ".", "_total_cookies", "+=", "self", ...
Wait for given amount of time and update state Should do nothing if time <= 0.0
[ "Wait", "for", "given", "amount", "of", "time", "and", "update", "state", "Should", "do", "nothing", "if", "time", "<", "=", "0", ".", "0" ]
[ "\"\"\"\r\n Wait for given amount of time and update state\r\n\r\n Should do nothing if time <= 0.0\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "time", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "time", "type": null, "docstring": null, "docstring_tokens": [...
4ce842c7f5323f767593e24d12d941937b5dc360
Arthur-Lanc/coursera
python_data_scien/poc1/min_porj_5(Cookie Clicker).py
[ "MIT" ]
Python
buy_item
null
def buy_item(self, item_name, cost, additional_cps): """ Buy an item and update state Should do nothing if you cannot afford the item """ if self._current_cookies >= cost: self._current_cookies -= cost self._current_cps += additional_cps ...
Buy an item and update state Should do nothing if you cannot afford the item
Buy an item and update state Should do nothing if you cannot afford the item
[ "Buy", "an", "item", "and", "update", "state", "Should", "do", "nothing", "if", "you", "cannot", "afford", "the", "item" ]
def buy_item(self, item_name, cost, additional_cps): if self._current_cookies >= cost: self._current_cookies -= cost self._current_cps += additional_cps new_entry = (self._current_time,item_name,cost,self._total_cookies) self._history_list.append(new_entry)
[ "def", "buy_item", "(", "self", ",", "item_name", ",", "cost", ",", "additional_cps", ")", ":", "if", "self", ".", "_current_cookies", ">=", "cost", ":", "self", ".", "_current_cookies", "-=", "cost", "self", ".", "_current_cps", "+=", "additional_cps", "new...
Buy an item and update state Should do nothing if you cannot afford the item
[ "Buy", "an", "item", "and", "update", "state", "Should", "do", "nothing", "if", "you", "cannot", "afford", "the", "item" ]
[ "\"\"\"\r\n Buy an item and update state\r\n\r\n Should do nothing if you cannot afford the item\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "item_name", "type": null }, { "param": "cost", "type": null }, { "param": "additional_cps", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "item_name", "type": null, "docstring": null, "docstring_token...
4ce842c7f5323f767593e24d12d941937b5dc360
Arthur-Lanc/coursera
python_data_scien/poc1/min_porj_5(Cookie Clicker).py
[ "MIT" ]
Python
simulate_clicker
<not_specific>
def simulate_clicker(build_info, duration, strategy): """ Function to run a Cookie Clicker game for the given duration with the given strategy. Returns a ClickerState object corresponding to the final state of the game. """ build_info_clone = build_info.clone() clickerstate_obj = C...
Function to run a Cookie Clicker game for the given duration with the given strategy. Returns a ClickerState object corresponding to the final state of the game.
Function to run a Cookie Clicker game for the given duration with the given strategy. Returns a ClickerState object corresponding to the final state of the game.
[ "Function", "to", "run", "a", "Cookie", "Clicker", "game", "for", "the", "given", "duration", "with", "the", "given", "strategy", ".", "Returns", "a", "ClickerState", "object", "corresponding", "to", "the", "final", "state", "of", "the", "game", "." ]
def simulate_clicker(build_info, duration, strategy): build_info_clone = build_info.clone() clickerstate_obj = ClickerState() while clickerstate_obj.get_time() <= duration: cookies = clickerstate_obj.get_cookies() cps = clickerstate_obj.get_cps() history = clickerstate_obj.get_histor...
[ "def", "simulate_clicker", "(", "build_info", ",", "duration", ",", "strategy", ")", ":", "build_info_clone", "=", "build_info", ".", "clone", "(", ")", "clickerstate_obj", "=", "ClickerState", "(", ")", "while", "clickerstate_obj", ".", "get_time", "(", ")", ...
Function to run a Cookie Clicker game for the given duration with the given strategy.
[ "Function", "to", "run", "a", "Cookie", "Clicker", "game", "for", "the", "given", "duration", "with", "the", "given", "strategy", "." ]
[ "\"\"\"\r\n Function to run a Cookie Clicker game for the given\r\n duration with the given strategy. Returns a ClickerState\r\n object corresponding to the final state of the game.\r\n \"\"\"" ]
[ { "param": "build_info", "type": null }, { "param": "duration", "type": null }, { "param": "strategy", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "build_info", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "duration", "type": null, "docstring": null, "docstring_...
4ce842c7f5323f767593e24d12d941937b5dc360
Arthur-Lanc/coursera
python_data_scien/poc1/min_porj_5(Cookie Clicker).py
[ "MIT" ]
Python
strategy_cheap
<not_specific>
def strategy_cheap(cookies, cps, history, time_left, build_info): """ Always buy the cheapest item you can afford in the time left. """ build_items_list = build_info.build_items() cheapest_item_name = None for idx in range(len(build_items_list)): if build_info.get_cost(build_items...
Always buy the cheapest item you can afford in the time left.
Always buy the cheapest item you can afford in the time left.
[ "Always", "buy", "the", "cheapest", "item", "you", "can", "afford", "in", "the", "time", "left", "." ]
def strategy_cheap(cookies, cps, history, time_left, build_info): build_items_list = build_info.build_items() cheapest_item_name = None for idx in range(len(build_items_list)): if build_info.get_cost(build_items_list[idx]) <= cookies + cps * time_left: if cheapest_item_name == None: ...
[ "def", "strategy_cheap", "(", "cookies", ",", "cps", ",", "history", ",", "time_left", ",", "build_info", ")", ":", "build_items_list", "=", "build_info", ".", "build_items", "(", ")", "cheapest_item_name", "=", "None", "for", "idx", "in", "range", "(", "len...
Always buy the cheapest item you can afford in the time left.
[ "Always", "buy", "the", "cheapest", "item", "you", "can", "afford", "in", "the", "time", "left", "." ]
[ "\"\"\"\r\n Always buy the cheapest item you can afford in the time left.\r\n \"\"\"" ]
[ { "param": "cookies", "type": null }, { "param": "cps", "type": null }, { "param": "history", "type": null }, { "param": "time_left", "type": null }, { "param": "build_info", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cookies", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cps", "type": null, "docstring": null, "docstring_tokens":...
4ce842c7f5323f767593e24d12d941937b5dc360
Arthur-Lanc/coursera
python_data_scien/poc1/min_porj_5(Cookie Clicker).py
[ "MIT" ]
Python
strategy_expensive
<not_specific>
def strategy_expensive(cookies, cps, history, time_left, build_info): """ Always buy the most expensive item you can afford in the time left. """ build_items_list = build_info.build_items() expensive_item_name = None for idx in range(len(build_items_list)): if build_info.get_cost(...
Always buy the most expensive item you can afford in the time left.
Always buy the most expensive item you can afford in the time left.
[ "Always", "buy", "the", "most", "expensive", "item", "you", "can", "afford", "in", "the", "time", "left", "." ]
def strategy_expensive(cookies, cps, history, time_left, build_info): build_items_list = build_info.build_items() expensive_item_name = None for idx in range(len(build_items_list)): if build_info.get_cost(build_items_list[idx]) <= cookies + cps * time_left: if expensive_item_name == None...
[ "def", "strategy_expensive", "(", "cookies", ",", "cps", ",", "history", ",", "time_left", ",", "build_info", ")", ":", "build_items_list", "=", "build_info", ".", "build_items", "(", ")", "expensive_item_name", "=", "None", "for", "idx", "in", "range", "(", ...
Always buy the most expensive item you can afford in the time left.
[ "Always", "buy", "the", "most", "expensive", "item", "you", "can", "afford", "in", "the", "time", "left", "." ]
[ "\"\"\"\r\n Always buy the most expensive item you can afford in the time left.\r\n \"\"\"" ]
[ { "param": "cookies", "type": null }, { "param": "cps", "type": null }, { "param": "history", "type": null }, { "param": "time_left", "type": null }, { "param": "build_info", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cookies", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cps", "type": null, "docstring": null, "docstring_tokens":...
4ce842c7f5323f767593e24d12d941937b5dc360
Arthur-Lanc/coursera
python_data_scien/poc1/min_porj_5(Cookie Clicker).py
[ "MIT" ]
Python
strategy_best
<not_specific>
def strategy_best(cookies, cps, history, time_left, build_info): """ The best strategy that you are able to implement. """ build_items_list = build_info.build_items() max_cps_div_cost_item = None for idx in range(len(build_items_list)): if build_info.get_cost(build_items_list[idx]...
The best strategy that you are able to implement.
The best strategy that you are able to implement.
[ "The", "best", "strategy", "that", "you", "are", "able", "to", "implement", "." ]
def strategy_best(cookies, cps, history, time_left, build_info): build_items_list = build_info.build_items() max_cps_div_cost_item = None for idx in range(len(build_items_list)): if build_info.get_cost(build_items_list[idx]) <= cookies + cps * time_left: if max_cps_div_cost_item == None:...
[ "def", "strategy_best", "(", "cookies", ",", "cps", ",", "history", ",", "time_left", ",", "build_info", ")", ":", "build_items_list", "=", "build_info", ".", "build_items", "(", ")", "max_cps_div_cost_item", "=", "None", "for", "idx", "in", "range", "(", "l...
The best strategy that you are able to implement.
[ "The", "best", "strategy", "that", "you", "are", "able", "to", "implement", "." ]
[ "\"\"\"\r\n The best strategy that you are able to implement.\r\n \"\"\"" ]
[ { "param": "cookies", "type": null }, { "param": "cps", "type": null }, { "param": "history", "type": null }, { "param": "time_left", "type": null }, { "param": "build_info", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cookies", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cps", "type": null, "docstring": null, "docstring_tokens":...
4ce842c7f5323f767593e24d12d941937b5dc360
Arthur-Lanc/coursera
python_data_scien/poc1/min_porj_5(Cookie Clicker).py
[ "MIT" ]
Python
run_strategy
null
def run_strategy(strategy_name, time, strategy): """ Run a simulation for the given time with one strategy. """ state = simulate_clicker(provided.BuildInfo(), time, strategy) print strategy_name, ":", state # Plot total cookies over time # Uncomment out the lines below to see a pl...
Run a simulation for the given time with one strategy.
Run a simulation for the given time with one strategy.
[ "Run", "a", "simulation", "for", "the", "given", "time", "with", "one", "strategy", "." ]
def run_strategy(strategy_name, time, strategy): state = simulate_clicker(provided.BuildInfo(), time, strategy) print strategy_name, ":", state history = state.get_history() history = [(item[0], item[3]) for item in history] simpleplot.plot_lines(strategy_name, 1000, 400, 'Time', 'Total Cookies', [h...
[ "def", "run_strategy", "(", "strategy_name", ",", "time", ",", "strategy", ")", ":", "state", "=", "simulate_clicker", "(", "provided", ".", "BuildInfo", "(", ")", ",", "time", ",", "strategy", ")", "print", "strategy_name", ",", "\":\"", ",", "state", "hi...
Run a simulation for the given time with one strategy.
[ "Run", "a", "simulation", "for", "the", "given", "time", "with", "one", "strategy", "." ]
[ "\"\"\"\r\n Run a simulation for the given time with one strategy.\r\n \"\"\"", "# Plot total cookies over time\r", "# Uncomment out the lines below to see a plot of total cookies vs. time\r", "# Be sure to allow popups, if you do want to see it\r" ]
[ { "param": "strategy_name", "type": null }, { "param": "time", "type": null }, { "param": "strategy", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "strategy_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "time", "type": null, "docstring": null, "docstring_t...
396f9c28d1181f322728a622fb2724a4b65fdc55
Arthur-Lanc/coursera
python_data_scien/poc1/Greedy Boss.py
[ "MIT" ]
Python
run_simulations
null
def run_simulations(): """ Run simulations for several possible bribe increments """ #plot_type = STANDARD plot_type = LOGLOG days = 70 inc_0 = greedy_boss(days, 0, plot_type) inc_500 = greedy_boss(days, 500, plot_type) inc_1000 = greedy_boss(days, 1000, plot_type) inc_...
Run simulations for several possible bribe increments
Run simulations for several possible bribe increments
[ "Run", "simulations", "for", "several", "possible", "bribe", "increments" ]
def run_simulations(): plot_type = LOGLOG days = 70 inc_0 = greedy_boss(days, 0, plot_type) inc_500 = greedy_boss(days, 500, plot_type) inc_1000 = greedy_boss(days, 1000, plot_type) inc_2000 = greedy_boss(days, 2000, plot_type) simpleplot.plot_lines("Greedy boss", 600, 600, "days", "total ea...
[ "def", "run_simulations", "(", ")", ":", "plot_type", "=", "LOGLOG", "days", "=", "70", "inc_0", "=", "greedy_boss", "(", "days", ",", "0", ",", "plot_type", ")", "inc_500", "=", "greedy_boss", "(", "days", ",", "500", ",", "plot_type", ")", "inc_1000", ...
Run simulations for several possible bribe increments
[ "Run", "simulations", "for", "several", "possible", "bribe", "increments" ]
[ "\"\"\"\r\n Run simulations for several possible bribe increments\r\n \"\"\"", "#plot_type = STANDARD\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a217887ddc5de4090f933d6503f45f5e3f9ba621
Arthur-Lanc/coursera
python_data_scien/poc1/min_porj_4(Yahtzee).py
[ "MIT" ]
Python
score
<not_specific>
def score(hand): """ Compute the maximal score for a Yahtzee hand according to the upper section of the Yahtzee score card. hand: full yahtzee hand Returns an integer score """ max_score = 0 sorted_hand_list = sorted(list(set(hand))) for i_mem in sorted_hand_list: ...
Compute the maximal score for a Yahtzee hand according to the upper section of the Yahtzee score card. hand: full yahtzee hand Returns an integer score
Compute the maximal score for a Yahtzee hand according to the upper section of the Yahtzee score card. full yahtzee hand Returns an integer score
[ "Compute", "the", "maximal", "score", "for", "a", "Yahtzee", "hand", "according", "to", "the", "upper", "section", "of", "the", "Yahtzee", "score", "card", ".", "full", "yahtzee", "hand", "Returns", "an", "integer", "score" ]
def score(hand): max_score = 0 sorted_hand_list = sorted(list(set(hand))) for i_mem in sorted_hand_list: temp_score = 0 for j_mem in list(hand): if i_mem == j_mem: temp_score += i_mem if temp_score > max_score: max_score = temp_score return...
[ "def", "score", "(", "hand", ")", ":", "max_score", "=", "0", "sorted_hand_list", "=", "sorted", "(", "list", "(", "set", "(", "hand", ")", ")", ")", "for", "i_mem", "in", "sorted_hand_list", ":", "temp_score", "=", "0", "for", "j_mem", "in", "list", ...
Compute the maximal score for a Yahtzee hand according to the upper section of the Yahtzee score card.
[ "Compute", "the", "maximal", "score", "for", "a", "Yahtzee", "hand", "according", "to", "the", "upper", "section", "of", "the", "Yahtzee", "score", "card", "." ]
[ "\"\"\"\r\n Compute the maximal score for a Yahtzee hand according to the\r\n upper section of the Yahtzee score card.\r\n\r\n hand: full yahtzee hand\r\n\r\n Returns an integer score \r\n \"\"\"" ]
[ { "param": "hand", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "hand", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a217887ddc5de4090f933d6503f45f5e3f9ba621
Arthur-Lanc/coursera
python_data_scien/poc1/min_porj_4(Yahtzee).py
[ "MIT" ]
Python
expected_value
<not_specific>
def expected_value(held_dice, num_die_sides, num_free_dice): """ Compute the expected value based on held_dice given that there are num_free_dice to be rolled, each with num_die_sides. held_dice: dice that you will hold num_die_sides: number of sides on each die num_free_dice: number of ...
Compute the expected value based on held_dice given that there are num_free_dice to be rolled, each with num_die_sides. held_dice: dice that you will hold num_die_sides: number of sides on each die num_free_dice: number of dice to be rolled Returns a floating point expected value ...
Compute the expected value based on held_dice given that there are num_free_dice to be rolled, each with num_die_sides. dice that you will hold num_die_sides: number of sides on each die num_free_dice: number of dice to be rolled Returns a floating point expected value
[ "Compute", "the", "expected", "value", "based", "on", "held_dice", "given", "that", "there", "are", "num_free_dice", "to", "be", "rolled", "each", "with", "num_die_sides", ".", "dice", "that", "you", "will", "hold", "num_die_sides", ":", "number", "of", "sides...
def expected_value(held_dice, num_die_sides, num_free_dice): all_sequences_set = gen_all_sequences(range(1,num_die_sides+1), num_free_dice) all_sequences_list = list(all_sequences_set) possible_event_list = [] for i_tuple in all_sequences_list: temp_held_dice_list = list(held_dice) temp_...
[ "def", "expected_value", "(", "held_dice", ",", "num_die_sides", ",", "num_free_dice", ")", ":", "all_sequences_set", "=", "gen_all_sequences", "(", "range", "(", "1", ",", "num_die_sides", "+", "1", ")", ",", "num_free_dice", ")", "all_sequences_list", "=", "li...
Compute the expected value based on held_dice given that there are num_free_dice to be rolled, each with num_die_sides.
[ "Compute", "the", "expected", "value", "based", "on", "held_dice", "given", "that", "there", "are", "num_free_dice", "to", "be", "rolled", "each", "with", "num_die_sides", "." ]
[ "\"\"\"\r\n Compute the expected value based on held_dice given that there\r\n are num_free_dice to be rolled, each with num_die_sides.\r\n\r\n held_dice: dice that you will hold\r\n num_die_sides: number of sides on each die\r\n num_free_dice: number of dice to be rolled\r\n\r\n Returns a floatin...
[ { "param": "held_dice", "type": null }, { "param": "num_die_sides", "type": null }, { "param": "num_free_dice", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "held_dice", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "num_die_sides", "type": null, "docstring": null, "docstr...
a217887ddc5de4090f933d6503f45f5e3f9ba621
Arthur-Lanc/coursera
python_data_scien/poc1/min_porj_4(Yahtzee).py
[ "MIT" ]
Python
gen_all_holds
<not_specific>
def gen_all_holds(hand): """ Generate all possible choices of dice from hand to hold. hand: full yahtzee hand Returns a set of tuples, where each tuple is dice to hold """ sorted_hand_list = sorted(list(hand)) sorted_hand_len = len(sorted_hand_list) answer_set = set([]) ...
Generate all possible choices of dice from hand to hold. hand: full yahtzee hand Returns a set of tuples, where each tuple is dice to hold
Generate all possible choices of dice from hand to hold. hand: full yahtzee hand Returns a set of tuples, where each tuple is dice to hold
[ "Generate", "all", "possible", "choices", "of", "dice", "from", "hand", "to", "hold", ".", "hand", ":", "full", "yahtzee", "hand", "Returns", "a", "set", "of", "tuples", "where", "each", "tuple", "is", "dice", "to", "hold" ]
def gen_all_holds(hand): sorted_hand_list = sorted(list(hand)) sorted_hand_len = len(sorted_hand_list) answer_set = set([]) for i_idx in range(sorted_hand_len+1): if i_idx == 0: answer_set.add(tuple()) elif i_idx == sorted_hand_len: answer_set.add(tuple(sorted_han...
[ "def", "gen_all_holds", "(", "hand", ")", ":", "sorted_hand_list", "=", "sorted", "(", "list", "(", "hand", ")", ")", "sorted_hand_len", "=", "len", "(", "sorted_hand_list", ")", "answer_set", "=", "set", "(", "[", "]", ")", "for", "i_idx", "in", "range"...
Generate all possible choices of dice from hand to hold.
[ "Generate", "all", "possible", "choices", "of", "dice", "from", "hand", "to", "hold", "." ]
[ "\"\"\"\r\n Generate all possible choices of dice from hand to hold.\r\n\r\n hand: full yahtzee hand\r\n\r\n Returns a set of tuples, where each tuple is dice to hold\r\n \"\"\"", "#print '2:',answer_set\r" ]
[ { "param": "hand", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "hand", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a217887ddc5de4090f933d6503f45f5e3f9ba621
Arthur-Lanc/coursera
python_data_scien/poc1/min_porj_4(Yahtzee).py
[ "MIT" ]
Python
strategy
<not_specific>
def strategy(hand, num_die_sides): """ Compute the hold that maximizes the expected value when the discarded dice are rolled. hand: full yahtzee hand num_die_sides: number of sides on each die Returns a tuple where the first element is the expected score and the second element is ...
Compute the hold that maximizes the expected value when the discarded dice are rolled. hand: full yahtzee hand num_die_sides: number of sides on each die Returns a tuple where the first element is the expected score and the second element is a tuple of the dice to hold
Compute the hold that maximizes the expected value when the discarded dice are rolled. full yahtzee hand num_die_sides: number of sides on each die Returns a tuple where the first element is the expected score and the second element is a tuple of the dice to hold
[ "Compute", "the", "hold", "that", "maximizes", "the", "expected", "value", "when", "the", "discarded", "dice", "are", "rolled", ".", "full", "yahtzee", "hand", "num_die_sides", ":", "number", "of", "sides", "on", "each", "die", "Returns", "a", "tuple", "wher...
def strategy(hand, num_die_sides): all_possible_holds_set = gen_all_holds(hand) all_possible_holds_list = list(all_possible_holds_set) max_e_v = 0.0 for idx in range(len(all_possible_holds_list)): i_tuple = all_possible_holds_list[idx] held_dice = i_tuple num_free_dice = len(hand...
[ "def", "strategy", "(", "hand", ",", "num_die_sides", ")", ":", "all_possible_holds_set", "=", "gen_all_holds", "(", "hand", ")", "all_possible_holds_list", "=", "list", "(", "all_possible_holds_set", ")", "max_e_v", "=", "0.0", "for", "idx", "in", "range", "(",...
Compute the hold that maximizes the expected value when the discarded dice are rolled.
[ "Compute", "the", "hold", "that", "maximizes", "the", "expected", "value", "when", "the", "discarded", "dice", "are", "rolled", "." ]
[ "\"\"\"\r\n Compute the hold that maximizes the expected value when the\r\n discarded dice are rolled.\r\n\r\n hand: full yahtzee hand\r\n num_die_sides: number of sides on each die\r\n\r\n Returns a tuple where the first element is the expected score and\r\n the second element is a tuple of the d...
[ { "param": "hand", "type": null }, { "param": "num_die_sides", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "hand", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "num_die_sides", "type": null, "docstring": null, "docstring_t...
a217887ddc5de4090f933d6503f45f5e3f9ba621
Arthur-Lanc/coursera
python_data_scien/poc1/min_porj_4(Yahtzee).py
[ "MIT" ]
Python
run_example
null
def run_example(): """ Compute the dice to hold and expected score for an example hand """ num_die_sides = 6 hand = (1,3,4,5,5) hand_score, hold = strategy(hand, num_die_sides) print "Best strategy for hand", hand, "is to hold", hold, "with expected score", hand_score
Compute the dice to hold and expected score for an example hand
Compute the dice to hold and expected score for an example hand
[ "Compute", "the", "dice", "to", "hold", "and", "expected", "score", "for", "an", "example", "hand" ]
def run_example(): num_die_sides = 6 hand = (1,3,4,5,5) hand_score, hold = strategy(hand, num_die_sides) print "Best strategy for hand", hand, "is to hold", hold, "with expected score", hand_score
[ "def", "run_example", "(", ")", ":", "num_die_sides", "=", "6", "hand", "=", "(", "1", ",", "3", ",", "4", ",", "5", ",", "5", ")", "hand_score", ",", "hold", "=", "strategy", "(", "hand", ",", "num_die_sides", ")", "print", "\"Best strategy for hand\"...
Compute the dice to hold and expected score for an example hand
[ "Compute", "the", "dice", "to", "hold", "and", "expected", "score", "for", "an", "example", "hand" ]
[ "\"\"\"\r\n Compute the dice to hold and expected score for an example hand\r\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
e74c6734eded6edc7bf3202b58ed60957868757b
bakkerjarr/AutomatedTests
nmeta2dpae_datasets/iscx_2012_ddos_fold_1.py
[ "Apache-2.0" ]
Python
ddos_knn_data
<not_specific>
def ddos_knn_data(self): """Prepare data for the ml_ddos_knn classifier. The features are totalSourceBytes, totalDestinationBytes, and flow duration. :return: Tuple of data and labels as NumPy arrays. """ self._logging.debug("Preparing data for K Nearest Neighbours " ...
Prepare data for the ml_ddos_knn classifier. The features are totalSourceBytes, totalDestinationBytes, and flow duration. :return: Tuple of data and labels as NumPy arrays.
Prepare data for the ml_ddos_knn classifier. The features are totalSourceBytes, totalDestinationBytes, and flow duration.
[ "Prepare", "data", "for", "the", "ml_ddos_knn", "classifier", ".", "The", "features", "are", "totalSourceBytes", "totalDestinationBytes", "and", "flow", "duration", "." ]
def ddos_knn_data(self): self._logging.debug("Preparing data for K Nearest Neighbours " "DDoS attack classifier.") features = ["totalSourceBytes", "totalDestinationBytes", "startDateTime", "stopDateTime"] selected_data = self._return_features(self....
[ "def", "ddos_knn_data", "(", "self", ")", ":", "self", ".", "_logging", ".", "debug", "(", "\"Preparing data for K Nearest Neighbours \"", "\"DDoS attack classifier.\"", ")", "features", "=", "[", "\"totalSourceBytes\"", ",", "\"totalDestinationBytes\"", ",", "\"startDate...
Prepare data for the ml_ddos_knn classifier.
[ "Prepare", "data", "for", "the", "ml_ddos_knn", "classifier", "." ]
[ "\"\"\"Prepare data for the ml_ddos_knn classifier.\n\n The features are totalSourceBytes, totalDestinationBytes,\n and flow duration.\n\n :return: Tuple of data and labels as NumPy arrays.\n \"\"\"", "# copy in the first 2 elements" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Tuple of data and labels as NumPy arrays.", "docstring_tokens": [ "Tuple", "of", "data", "and", "labels", "as", "NumPy", "arrays", "." ], "type": null } ], "raises": [], "params...
e74c6734eded6edc7bf3202b58ed60957868757b
bakkerjarr/AutomatedTests
nmeta2dpae_datasets/iscx_2012_ddos_fold_1.py
[ "Apache-2.0" ]
Python
ddos_random_forest_data
<not_specific>
def ddos_random_forest_data(self): """Prepare data for the ml_ddos_random_forest classifier. The features are totalSourceBytes, totalSourcePackets, totalDestinationBytes, totalDestinationPackets and flow duration. :return: Tuple of data and labels as NumPy arrays. """ s...
Prepare data for the ml_ddos_random_forest classifier. The features are totalSourceBytes, totalSourcePackets, totalDestinationBytes, totalDestinationPackets and flow duration. :return: Tuple of data and labels as NumPy arrays.
Prepare data for the ml_ddos_random_forest classifier.
[ "Prepare", "data", "for", "the", "ml_ddos_random_forest", "classifier", "." ]
def ddos_random_forest_data(self): self._logging.debug("Preparing data for Random Forest DDoS " "attack classifier.") features = ["totalSourceBytes", "totalSourcePackets", "totalDestinationBytes", "totalDestinationPackets", "startDateTi...
[ "def", "ddos_random_forest_data", "(", "self", ")", ":", "self", ".", "_logging", ".", "debug", "(", "\"Preparing data for Random Forest DDoS \"", "\"attack classifier.\"", ")", "features", "=", "[", "\"totalSourceBytes\"", ",", "\"totalSourcePackets\"", ",", "\"totalDest...
Prepare data for the ml_ddos_random_forest classifier.
[ "Prepare", "data", "for", "the", "ml_ddos_random_forest", "classifier", "." ]
[ "\"\"\"Prepare data for the ml_ddos_random_forest classifier.\n\n The features are totalSourceBytes, totalSourcePackets,\n totalDestinationBytes, totalDestinationPackets and flow duration.\n\n :return: Tuple of data and labels as NumPy arrays.\n \"\"\"", "# copy in the first 4 elements...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Tuple of data and labels as NumPy arrays.", "docstring_tokens": [ "Tuple", "of", "data", "and", "labels", "as", "NumPy", "arrays", "." ], "type": null } ], "raises": [], "params...
e74c6734eded6edc7bf3202b58ed60957868757b
bakkerjarr/AutomatedTests
nmeta2dpae_datasets/iscx_2012_ddos_fold_1.py
[ "Apache-2.0" ]
Python
ddos_svm_rbf_data
<not_specific>
def ddos_svm_rbf_data(self): """Prepare data for the ml_ddos_svm_rbf classifier. The features are log(totalSourceBytes), totalSourcePackets, and flow duration. :return: Tuple of data and labels as NumPy arrays. """ self._logging.debug("Preparing data for SVM (RBF kernel...
Prepare data for the ml_ddos_svm_rbf classifier. The features are log(totalSourceBytes), totalSourcePackets, and flow duration. :return: Tuple of data and labels as NumPy arrays.
Prepare data for the ml_ddos_svm_rbf classifier. The features are log(totalSourceBytes), totalSourcePackets, and flow duration.
[ "Prepare", "data", "for", "the", "ml_ddos_svm_rbf", "classifier", ".", "The", "features", "are", "log", "(", "totalSourceBytes", ")", "totalSourcePackets", "and", "flow", "duration", "." ]
def ddos_svm_rbf_data(self): self._logging.debug("Preparing data for SVM (RBF kernel) " "DDoS attack classifier.") features = ["totalSourceBytes", "totalSourcePackets", "startDateTime", "stopDateTime"] selected_data = self._return_features(self._ra...
[ "def", "ddos_svm_rbf_data", "(", "self", ")", ":", "self", ".", "_logging", ".", "debug", "(", "\"Preparing data for SVM (RBF kernel) \"", "\"DDoS attack classifier.\"", ")", "features", "=", "[", "\"totalSourceBytes\"", ",", "\"totalSourcePackets\"", ",", "\"startDateTim...
Prepare data for the ml_ddos_svm_rbf classifier.
[ "Prepare", "data", "for", "the", "ml_ddos_svm_rbf", "classifier", "." ]
[ "\"\"\"Prepare data for the ml_ddos_svm_rbf classifier.\n\n The features are log(totalSourceBytes), totalSourcePackets,\n and flow duration.\n\n :return: Tuple of data and labels as NumPy arrays.\n \"\"\"", "# Log (base 10) could not be evaluated, so set it to 0.", "# This has arisen...
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "Tuple of data and labels as NumPy arrays.", "docstring_tokens": [ "Tuple", "of", "data", "and", "labels", "as", "NumPy", "arrays", "." ], "type": null } ], "raises": [], "params...
e74c6734eded6edc7bf3202b58ed60957868757b
bakkerjarr/AutomatedTests
nmeta2dpae_datasets/iscx_2012_ddos_fold_1.py
[ "Apache-2.0" ]
Python
_read_data
null
def _read_data(self, files): """Read data from ISCX dataset XML files. :param files: Name of the file to read the data from. """ for fname in files: self._logging.info("Reading data from: %s", fname) data_etree = None try: data_etree =...
Read data from ISCX dataset XML files. :param files: Name of the file to read the data from.
Read data from ISCX dataset XML files.
[ "Read", "data", "from", "ISCX", "dataset", "XML", "files", "." ]
def _read_data(self, files): for fname in files: self._logging.info("Reading data from: %s", fname) data_etree = None try: data_etree = etree.parse(fname) except IOError as err: self._logging.critical("Unable to open file: %s. " ...
[ "def", "_read_data", "(", "self", ",", "files", ")", ":", "for", "fname", "in", "files", ":", "self", ".", "_logging", ".", "info", "(", "\"Reading data from: %s\"", ",", "fname", ")", "data_etree", "=", "None", "try", ":", "data_etree", "=", "etree", "....
Read data from ISCX dataset XML files.
[ "Read", "data", "from", "ISCX", "dataset", "XML", "files", "." ]
[ "\"\"\"Read data from ISCX dataset XML files.\n\n :param files: Name of the file to read the data from.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "files", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "files", "type": null, "docstring": "Name of the file to read the da...
e74c6734eded6edc7bf3202b58ed60957868757b
bakkerjarr/AutomatedTests
nmeta2dpae_datasets/iscx_2012_ddos_fold_1.py
[ "Apache-2.0" ]
Python
_etree_to_dict
<not_specific>
def _etree_to_dict(self, xml_etree): """Convert an XML etree into a list of dicts. This method only takes care of elements, not attributes! :param xml_etree: Etree object to process :return: Data as a list of dict. """ root = xml_etree.getroot() data = [] ...
Convert an XML etree into a list of dicts. This method only takes care of elements, not attributes! :param xml_etree: Etree object to process :return: Data as a list of dict.
Convert an XML etree into a list of dicts. This method only takes care of elements, not attributes!
[ "Convert", "an", "XML", "etree", "into", "a", "list", "of", "dicts", ".", "This", "method", "only", "takes", "care", "of", "elements", "not", "attributes!" ]
def _etree_to_dict(self, xml_etree): root = xml_etree.getroot() data = [] labels = [] for flow in root: flow_data = {} for i in range(len(flow)): if flow[i].tag != "Tag": flow_data[flow[i].tag] = flow[i].text els...
[ "def", "_etree_to_dict", "(", "self", ",", "xml_etree", ")", ":", "root", "=", "xml_etree", ".", "getroot", "(", ")", "data", "=", "[", "]", "labels", "=", "[", "]", "for", "flow", "in", "root", ":", "flow_data", "=", "{", "}", "for", "i", "in", ...
Convert an XML etree into a list of dicts.
[ "Convert", "an", "XML", "etree", "into", "a", "list", "of", "dicts", "." ]
[ "\"\"\"Convert an XML etree into a list of dicts.\n\n This method only takes care of elements, not attributes!\n\n :param xml_etree: Etree object to process\n :return: Data as a list of dict.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "xml_etree", "type": null } ]
{ "returns": [ { "docstring": "Data as a list of dict.", "docstring_tokens": [ "Data", "as", "a", "list", "of", "dict", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null,...
e74c6734eded6edc7bf3202b58ed60957868757b
bakkerjarr/AutomatedTests
nmeta2dpae_datasets/iscx_2012_ddos_fold_1.py
[ "Apache-2.0" ]
Python
_return_features
<not_specific>
def _return_features(self, data, features): """Select specific raw features from the data. :param data: The data set to manipulate. :param features: A list of ISXC 2012 IDS specific features. :return: List of data with just the chosen features in the order they were req...
Select specific raw features from the data. :param data: The data set to manipulate. :param features: A list of ISXC 2012 IDS specific features. :return: List of data with just the chosen features in the order they were requested.
Select specific raw features from the data.
[ "Select", "specific", "raw", "features", "from", "the", "data", "." ]
def _return_features(self, data, features): processed_data = [] for flow in data: new_entry = [] for f in features: new_entry.append(flow[f]) processed_data.append(new_entry) return processed_data
[ "def", "_return_features", "(", "self", ",", "data", ",", "features", ")", ":", "processed_data", "=", "[", "]", "for", "flow", "in", "data", ":", "new_entry", "=", "[", "]", "for", "f", "in", "features", ":", "new_entry", ".", "append", "(", "flow", ...
Select specific raw features from the data.
[ "Select", "specific", "raw", "features", "from", "the", "data", "." ]
[ "\"\"\"Select specific raw features from the data.\n\n :param data: The data set to manipulate.\n :param features: A list of ISXC 2012 IDS specific features.\n :return: List of data with just the chosen features in the order\n they were requested.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "data", "type": null }, { "param": "features", "type": null } ]
{ "returns": [ { "docstring": "List of data with just the chosen features in the order\nthey were requested.", "docstring_tokens": [ "List", "of", "data", "with", "just", "the", "chosen", "features", "in", "the", "...
2d8c7876c881f7e5f59fd5ee04b358d16a1b2ba6
bakkerjarr/AutomatedTests
test_server.py
[ "Apache-2.0" ]
Python
handle
<not_specific>
def handle(self, host, port): """Handle completion notification requests on TCP port 8088. :return: True if the DPAE has complete training, False if an error occurred. """ sckt = None try: sckt = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s...
Handle completion notification requests on TCP port 8088. :return: True if the DPAE has complete training, False if an error occurred.
Handle completion notification requests on TCP port 8088.
[ "Handle", "completion", "notification", "requests", "on", "TCP", "port", "8088", "." ]
def handle(self, host, port): sckt = None try: sckt = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sckt.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) except socket.error as err: self._logger.error("Unable to create socket: " ...
[ "def", "handle", "(", "self", ",", "host", ",", "port", ")", ":", "sckt", "=", "None", "try", ":", "sckt", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "sckt", ".", "setsockopt", "(", "socket", ...
Handle completion notification requests on TCP port 8088.
[ "Handle", "completion", "notification", "requests", "on", "TCP", "port", "8088", "." ]
[ "\"\"\"Handle completion notification requests on TCP port 8088.\n\n :return: True if the DPAE has complete training, False if an\n error occurred.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "host", "type": null }, { "param": "port", "type": null } ]
{ "returns": [ { "docstring": "True if the DPAE has complete training, False if an\nerror occurred.", "docstring_tokens": [ "True", "if", "the", "DPAE", "has", "complete", "training", "False", "if", "an", "error", ...
2d8c7876c881f7e5f59fd5ee04b358d16a1b2ba6
bakkerjarr/AutomatedTests
test_server.py
[ "Apache-2.0" ]
Python
start_experiments
null
def start_experiments(self, exp_data): """Start a set of experiments. :param exp_data: Dict containing parameters for the experiments. """ self._logger.info("Starting experiment.") self._logger.info("Killing any existing evaluation processes " "on test...
Start a set of experiments. :param exp_data: Dict containing parameters for the experiments.
Start a set of experiments.
[ "Start", "a", "set", "of", "experiments", "." ]
def start_experiments(self, exp_data): self._logger.info("Starting experiment.") self._logger.info("Killing any existing evaluation processes " "on testbed hosts.") playbook_cmd = self._ANS_PLYBK + "kill_processes.yaml" os.system(playbook_cmd) self._logg...
[ "def", "start_experiments", "(", "self", ",", "exp_data", ")", ":", "self", ".", "_logger", ".", "info", "(", "\"Starting experiment.\"", ")", "self", ".", "_logger", ".", "info", "(", "\"Killing any existing evaluation processes \"", "\"on testbed hosts.\"", ")", "...
Start a set of experiments.
[ "Start", "a", "set", "of", "experiments", "." ]
[ "\"\"\"Start a set of experiments.\n\n :param exp_data: Dict containing parameters for the experiments.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "exp_data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "exp_data", "type": null, "docstring": "Dict containing parameters f...
014a2580e1661776b3982a9ad32561806b92b7f2
JoshuaHaustein/oracle_server
evaluations/plot.py
[ "BSD-3-Clause" ]
Python
configure_latex
null
def configure_latex(): """ Configure matplotlib to use latex in a pretty way """ plt.rcParams.update({ #'font.family': 'serif', 'font.serif': 'Palatino', 'font.size': 12, 'legend.fontsize': 14, 'legend.labelspacing': 0, 'text.usetex': True, 'sa...
Configure matplotlib to use latex in a pretty way
Configure matplotlib to use latex in a pretty way
[ "Configure", "matplotlib", "to", "use", "latex", "in", "a", "pretty", "way" ]
def configure_latex(): plt.rcParams.update({ 'font.serif': 'Palatino', 'font.size': 12, 'legend.fontsize': 14, 'legend.labelspacing': 0, 'text.usetex': True, 'savefig.dpi': 300})
[ "def", "configure_latex", "(", ")", ":", "plt", ".", "rcParams", ".", "update", "(", "{", "'font.serif'", ":", "'Palatino'", ",", "'font.size'", ":", "12", ",", "'legend.fontsize'", ":", "14", ",", "'legend.labelspacing'", ":", "0", ",", "'text.usetex'", ":"...
Configure matplotlib to use latex in a pretty way
[ "Configure", "matplotlib", "to", "use", "latex", "in", "a", "pretty", "way" ]
[ "\"\"\"\n Configure matplotlib to use latex in a pretty way\n \"\"\"", "#'font.family': 'serif'," ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
014a2580e1661776b3982a9ad32561806b92b7f2
JoshuaHaustein/oracle_server
evaluations/plot.py
[ "BSD-3-Clause" ]
Python
save_fig
null
def save_fig(fig_name, width=9, height=5): """ Save the current figure under filename fig_name """ plt.gcf().set_size_inches((width, height)) simplify_axis(plt.gca()) plt.savefig(fig_name, bbox_inches='tight', pad_inches=0.02)
Save the current figure under filename fig_name
Save the current figure under filename fig_name
[ "Save", "the", "current", "figure", "under", "filename", "fig_name" ]
def save_fig(fig_name, width=9, height=5): plt.gcf().set_size_inches((width, height)) simplify_axis(plt.gca()) plt.savefig(fig_name, bbox_inches='tight', pad_inches=0.02)
[ "def", "save_fig", "(", "fig_name", ",", "width", "=", "9", ",", "height", "=", "5", ")", ":", "plt", ".", "gcf", "(", ")", ".", "set_size_inches", "(", "(", "width", ",", "height", ")", ")", "simplify_axis", "(", "plt", ".", "gca", "(", ")", ")"...
Save the current figure under filename fig_name
[ "Save", "the", "current", "figure", "under", "filename", "fig_name" ]
[ "\"\"\"\n Save the current figure under filename fig_name\n \"\"\"" ]
[ { "param": "fig_name", "type": null }, { "param": "width", "type": null }, { "param": "height", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fig_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "width", "type": null, "docstring": null, "docstring_token...
bd4dc38a52ea3ad7488ec79f1ed3ecb7b850937c
TiramisuM/taobao-iphone-device
tidevice/__main__.py
[ "MIT" ]
Python
cmd_xctest
null
def cmd_xctest(args: argparse.Namespace): """ Run XCTest required WDA installed. """ d = _udid2device(args.udid) env = {} for kv in args.env or {}: key, val = kv.split(":", 1) env[key] = val if env: logger.info("Launch env: %s", env) d.xctest(args.bundle_id, logge...
Run XCTest required WDA installed.
Run XCTest required WDA installed.
[ "Run", "XCTest", "required", "WDA", "installed", "." ]
def cmd_xctest(args: argparse.Namespace): d = _udid2device(args.udid) env = {} for kv in args.env or {}: key, val = kv.split(":", 1) env[key] = val if env: logger.info("Launch env: %s", env) d.xctest(args.bundle_id, logger=setup_logger(level=logging.INFO), env=env)
[ "def", "cmd_xctest", "(", "args", ":", "argparse", ".", "Namespace", ")", ":", "d", "=", "_udid2device", "(", "args", ".", "udid", ")", "env", "=", "{", "}", "for", "kv", "in", "args", ".", "env", "or", "{", "}", ":", "key", ",", "val", "=", "k...
Run XCTest required WDA installed.
[ "Run", "XCTest", "required", "WDA", "installed", "." ]
[ "\"\"\"\n Run XCTest required WDA installed.\n \"\"\"" ]
[ { "param": "args", "type": "argparse.Namespace" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "args", "type": "argparse.Namespace", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
eb3a444071f77b12227fdc769b080b2c0b0e1b5b
LucasWolfgang/QAS-Editor
qas_editor/gui/forms.py
[ "MIT" ]
Python
verify
None
def verify(self) -> None: """ Iterate over the object list to verify if it is valid. """ pass
Iterate over the object list to verify if it is valid.
Iterate over the object list to verify if it is valid.
[ "Iterate", "over", "the", "object", "list", "to", "verify", "if", "it", "is", "valid", "." ]
def verify(self) -> None: pass
[ "def", "verify", "(", "self", ")", "->", "None", ":", "pass" ]
Iterate over the object list to verify if it is valid.
[ "Iterate", "over", "the", "object", "list", "to", "verify", "if", "it", "is", "valid", "." ]
[ "\"\"\"\n Iterate over the object list to verify if it is valid.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
749ffdac42055ce3b05de0a7b20910b2dd75b6df
LucasWolfgang/QAS-Editor
qas_editor/gui/utils.py
[ "MIT" ]
Python
update_editor
None
def update_editor(self, text_editor: GTextEditor) -> None: """Update the font format toolbar/actions when a new text selection is made. This is neccessary to keep toolbars/etc. in sync with the current edit state. """ self.setDisabled(text_editor is None) if text_editor == self...
Update the font format toolbar/actions when a new text selection is made. This is neccessary to keep toolbars/etc. in sync with the current edit state.
Update the font format toolbar/actions when a new text selection is made. This is neccessary to keep toolbars/etc. in sync with the current edit state.
[ "Update", "the", "font", "format", "toolbar", "/", "actions", "when", "a", "new", "text", "selection", "is", "made", ".", "This", "is", "neccessary", "to", "keep", "toolbars", "/", "etc", ".", "in", "sync", "with", "the", "current", "edit", "state", "." ...
def update_editor(self, text_editor: GTextEditor) -> None: self.setDisabled(text_editor is None) if text_editor == self.editor: return if self.editor is not None: self.text_type.currentIndexChanged.disconnect() self.fonts.currentFontChanged.disconnect() self....
[ "def", "update_editor", "(", "self", ",", "text_editor", ":", "GTextEditor", ")", "->", "None", ":", "self", ".", "setDisabled", "(", "text_editor", "is", "None", ")", "if", "text_editor", "==", "self", ".", "editor", ":", "return", "if", "self", ".", "e...
Update the font format toolbar/actions when a new text selection is made.
[ "Update", "the", "font", "format", "toolbar", "/", "actions", "when", "a", "new", "text", "selection", "is", "made", "." ]
[ "\"\"\"Update the font format toolbar/actions when a new text selection is made. \n This is neccessary to keep toolbars/etc. in sync with the current edit state.\n \"\"\"", "# Nothing to do here", "# Disable signals for all format widgets" ]
[ { "param": "self", "type": null }, { "param": "text_editor", "type": "GTextEditor" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "text_editor", "type": "GTextEditor", "docstring": null, "docs...
6d5525a8e31a13064734abd49f7a69d14cab4abe
LucasWolfgang/QAS-Editor
qas_editor/gui/exams.py
[ "MIT" ]
Python
char
<not_specific>
def char(self, x, y): """ Return a character from the solution grid. """ return self._puzzle[x, y]
Return a character from the solution grid.
Return a character from the solution grid.
[ "Return", "a", "character", "from", "the", "solution", "grid", "." ]
def char(self, x, y): return self._puzzle[x, y]
[ "def", "char", "(", "self", ",", "x", ",", "y", ")", ":", "return", "self", ".", "_puzzle", "[", "x", ",", "y", "]" ]
Return a character from the solution grid.
[ "Return", "a", "character", "from", "the", "solution", "grid", "." ]
[ "\"\"\"\n Return a character from the solution grid.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "x", "type": null }, { "param": "y", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], ...
6d5525a8e31a13064734abd49f7a69d14cab4abe
LucasWolfgang/QAS-Editor
qas_editor/gui/exams.py
[ "MIT" ]
Python
answerChar
<not_specific>
def answerChar(self, x, y): """ Return a character from the answer grid. """ return self._puzzle.getAnswerChar(x, y)
Return a character from the answer grid.
Return a character from the answer grid.
[ "Return", "a", "character", "from", "the", "answer", "grid", "." ]
def answerChar(self, x, y): return self._puzzle.getAnswerChar(x, y)
[ "def", "answerChar", "(", "self", ",", "x", ",", "y", ")", ":", "return", "self", ".", "_puzzle", ".", "getAnswerChar", "(", "x", ",", "y", ")" ]
Return a character from the answer grid.
[ "Return", "a", "character", "from", "the", "answer", "grid", "." ]
[ "\"\"\"\n Return a character from the answer grid.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "x", "type": null }, { "param": "y", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], ...
6d5525a8e31a13064734abd49f7a69d14cab4abe
LucasWolfgang/QAS-Editor
qas_editor/gui/exams.py
[ "MIT" ]
Python
startingPosition
<not_specific>
def startingPosition(self, x, y, direction): """ Returns the starting position of a word in the solution grid. """ return self._puzzle.getStartingPosition(x, y, direction)
Returns the starting position of a word in the solution grid.
Returns the starting position of a word in the solution grid.
[ "Returns", "the", "starting", "position", "of", "a", "word", "in", "the", "solution", "grid", "." ]
def startingPosition(self, x, y, direction): return self._puzzle.getStartingPosition(x, y, direction)
[ "def", "startingPosition", "(", "self", ",", "x", ",", "y", ",", "direction", ")", ":", "return", "self", ".", "_puzzle", ".", "getStartingPosition", "(", "x", ",", "y", ",", "direction", ")" ]
Returns the starting position of a word in the solution grid.
[ "Returns", "the", "starting", "position", "of", "a", "word", "in", "the", "solution", "grid", "." ]
[ "\"\"\"\n Returns the starting position of a word in the solution grid.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "x", "type": null }, { "param": "y", "type": null }, { "param": "direction", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], ...
6d5525a8e31a13064734abd49f7a69d14cab4abe
LucasWolfgang/QAS-Editor
qas_editor/gui/exams.py
[ "MIT" ]
Python
par
<not_specific>
def par(self): """ Return the par time for this puzzle. """ return self._puzzle.par
Return the par time for this puzzle.
Return the par time for this puzzle.
[ "Return", "the", "par", "time", "for", "this", "puzzle", "." ]
def par(self): return self._puzzle.par
[ "def", "par", "(", "self", ")", ":", "return", "self", ".", "_puzzle", ".", "par" ]
Return the par time for this puzzle.
[ "Return", "the", "par", "time", "for", "this", "puzzle", "." ]
[ "\"\"\"\n Return the par time for this puzzle.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6d5525a8e31a13064734abd49f7a69d14cab4abe
LucasWolfgang/QAS-Editor
qas_editor/gui/exams.py
[ "MIT" ]
Python
title
<not_specific>
def title(self): """ Return the title of the puzzle. """ return self._puzzle.title
Return the title of the puzzle.
Return the title of the puzzle.
[ "Return", "the", "title", "of", "the", "puzzle", "." ]
def title(self): return self._puzzle.title
[ "def", "title", "(", "self", ")", ":", "return", "self", ".", "_puzzle", ".", "title" ]
Return the title of the puzzle.
[ "Return", "the", "title", "of", "the", "puzzle", "." ]
[ "\"\"\"\n Return the title of the puzzle.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6d5525a8e31a13064734abd49f7a69d14cab4abe
LucasWolfgang/QAS-Editor
qas_editor/gui/exams.py
[ "MIT" ]
Python
moveCursor
null
def moveCursor(self, dx, dy): """ Move the cursor. While NOT in edit mode it will skip black squares (None's). """ x, y = self.cursor() if self.editMode() or not self.restrictedCursor(): x += dx y += dy if x < 0: x = self.puzzle...
Move the cursor. While NOT in edit mode it will skip black squares (None's).
Move the cursor. While NOT in edit mode it will skip black squares (None's).
[ "Move", "the", "cursor", ".", "While", "NOT", "in", "edit", "mode", "it", "will", "skip", "black", "squares", "(", "None", "'", "s", ")", "." ]
def moveCursor(self, dx, dy): x, y = self.cursor() if self.editMode() or not self.restrictedCursor(): x += dx y += dy if x < 0: x = self.puzzleWidth() - 1 elif x >= self.puzzleWidth(): x = 0 if y < 0: ...
[ "def", "moveCursor", "(", "self", ",", "dx", ",", "dy", ")", ":", "x", ",", "y", "=", "self", ".", "cursor", "(", ")", "if", "self", ".", "editMode", "(", ")", "or", "not", "self", ".", "restrictedCursor", "(", ")", ":", "x", "+=", "dx", "y", ...
Move the cursor.
[ "Move", "the", "cursor", "." ]
[ "\"\"\"\n Move the cursor. While NOT in edit mode it will skip black squares (None's).\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "dx", "type": null }, { "param": "dy", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dx", "type": null, "docstring": null, "docstring_tokens": [],...
6d5525a8e31a13064734abd49f7a69d14cab4abe
LucasWolfgang/QAS-Editor
qas_editor/gui/exams.py
[ "MIT" ]
Python
start
null
def start(self): """ Start the game. Does nothing if already active. """ self.setActive(True)
Start the game. Does nothing if already active.
Start the game. Does nothing if already active.
[ "Start", "the", "game", ".", "Does", "nothing", "if", "already", "active", "." ]
def start(self): self.setActive(True)
[ "def", "start", "(", "self", ")", ":", "self", ".", "setActive", "(", "True", ")" ]
Start the game.
[ "Start", "the", "game", "." ]
[ "\"\"\"\n Start the game. Does nothing if already active.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6d5525a8e31a13064734abd49f7a69d14cab4abe
LucasWolfgang/QAS-Editor
qas_editor/gui/exams.py
[ "MIT" ]
Python
stop
null
def stop(self): """ Stop the game. Does nothing if already inactive. """ self.setActive(False)
Stop the game. Does nothing if already inactive.
Stop the game. Does nothing if already inactive.
[ "Stop", "the", "game", ".", "Does", "nothing", "if", "already", "inactive", "." ]
def stop(self): self.setActive(False)
[ "def", "stop", "(", "self", ")", ":", "self", ".", "setActive", "(", "False", ")" ]
Stop the game.
[ "Stop", "the", "game", "." ]
[ "\"\"\"\n Stop the game. Does nothing if already inactive.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6d5525a8e31a13064734abd49f7a69d14cab4abe
LucasWolfgang/QAS-Editor
qas_editor/gui/exams.py
[ "MIT" ]
Python
drawableRect
<not_specific>
def drawableRect(self): """ Return rect for drawing in this widget. """ margin = 8 return QtCore.QRect(margin, margin, self.width() - margin * 2, self.height() - margin * 2)
Return rect for drawing in this widget.
Return rect for drawing in this widget.
[ "Return", "rect", "for", "drawing", "in", "this", "widget", "." ]
def drawableRect(self): margin = 8 return QtCore.QRect(margin, margin, self.width() - margin * 2, self.height() - margin * 2)
[ "def", "drawableRect", "(", "self", ")", ":", "margin", "=", "8", "return", "QtCore", ".", "QRect", "(", "margin", ",", "margin", ",", "self", ".", "width", "(", ")", "-", "margin", "*", "2", ",", "self", ".", "height", "(", ")", "-", "margin", "...
Return rect for drawing in this widget.
[ "Return", "rect", "for", "drawing", "in", "this", "widget", "." ]
[ "\"\"\"\n Return rect for drawing in this widget.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6d5525a8e31a13064734abd49f7a69d14cab4abe
LucasWolfgang/QAS-Editor
qas_editor/gui/exams.py
[ "MIT" ]
Python
pixelGeometry
<not_specific>
def pixelGeometry(self): """ Returns the width and height of each puzzle cell (in pixels). """ startingRect = self.drawableRect() pixelw = int(startingRect.width() / self.puzzleWidth()) pixelh = int(startingRect.height() / self.puzzleHeight()) return pixelw, pixel...
Returns the width and height of each puzzle cell (in pixels).
Returns the width and height of each puzzle cell (in pixels).
[ "Returns", "the", "width", "and", "height", "of", "each", "puzzle", "cell", "(", "in", "pixels", ")", "." ]
def pixelGeometry(self): startingRect = self.drawableRect() pixelw = int(startingRect.width() / self.puzzleWidth()) pixelh = int(startingRect.height() / self.puzzleHeight()) return pixelw, pixelh
[ "def", "pixelGeometry", "(", "self", ")", ":", "startingRect", "=", "self", ".", "drawableRect", "(", ")", "pixelw", "=", "int", "(", "startingRect", ".", "width", "(", ")", "/", "self", ".", "puzzleWidth", "(", ")", ")", "pixelh", "=", "int", "(", "...
Returns the width and height of each puzzle cell (in pixels).
[ "Returns", "the", "width", "and", "height", "of", "each", "puzzle", "cell", "(", "in", "pixels", ")", "." ]
[ "\"\"\"\n Returns the width and height of each puzzle cell (in pixels).\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6d5525a8e31a13064734abd49f7a69d14cab4abe
LucasWolfgang/QAS-Editor
qas_editor/gui/exams.py
[ "MIT" ]
Python
puzzleDrawingRect
<not_specific>
def puzzleDrawingRect(self): """ Returns the rect in which the puzzle is actualy drawn. """ startingRect = self.drawableRect() pixelw = int(startingRect.width() / self.puzzleWidth()) pixelh = int(startingRect.height() / self.puzzleHeight()) drawRect = QtCore.QRect...
Returns the rect in which the puzzle is actualy drawn.
Returns the rect in which the puzzle is actualy drawn.
[ "Returns", "the", "rect", "in", "which", "the", "puzzle", "is", "actualy", "drawn", "." ]
def puzzleDrawingRect(self): startingRect = self.drawableRect() pixelw = int(startingRect.width() / self.puzzleWidth()) pixelh = int(startingRect.height() / self.puzzleHeight()) drawRect = QtCore.QRect(0, 0, pixelw * self.puzzleWidth(), pixelh * self.puzzleHeight()) drawRect.move...
[ "def", "puzzleDrawingRect", "(", "self", ")", ":", "startingRect", "=", "self", ".", "drawableRect", "(", ")", "pixelw", "=", "int", "(", "startingRect", ".", "width", "(", ")", "/", "self", ".", "puzzleWidth", "(", ")", ")", "pixelh", "=", "int", "(",...
Returns the rect in which the puzzle is actualy drawn.
[ "Returns", "the", "rect", "in", "which", "the", "puzzle", "is", "actualy", "drawn", "." ]
[ "\"\"\"\n Returns the rect in which the puzzle is actualy drawn.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bc77a68911d3ebcca4381cb90a445286204ba6df
LucasWolfgang/QAS-Editor
qas_editor/quiz.py
[ "MIT" ]
Python
write_xml
null
def write_xml(self, file_path: str, pretty_print: bool=False): """Generates XML compatible with Moodle and saves to a file. Args: file_path (str): filename where the XML will be saved pretty_print (bool, optional): (not implemented) saves XML pretty printed. Defaults to False. ...
Generates XML compatible with Moodle and saves to a file. Args: file_path (str): filename where the XML will be saved pretty_print (bool, optional): (not implemented) saves XML pretty printed. Defaults to False.
Generates XML compatible with Moodle and saves to a file.
[ "Generates", "XML", "compatible", "with", "Moodle", "and", "saves", "to", "a", "file", "." ]
def write_xml(self, file_path: str, pretty_print: bool=False): quiz: et.ElementTree = et.ElementTree(et.Element("quiz")) root = quiz.getroot() self._to_xml_element(root) if pretty_print: self._indent(root) quiz.write(file_path, encoding="utf-8", xml_declaration=True, ...
[ "def", "write_xml", "(", "self", ",", "file_path", ":", "str", ",", "pretty_print", ":", "bool", "=", "False", ")", ":", "quiz", ":", "et", ".", "ElementTree", "=", "et", ".", "ElementTree", "(", "et", ".", "Element", "(", "\"quiz\"", ")", ")", "root...
Generates XML compatible with Moodle and saves to a file.
[ "Generates", "XML", "compatible", "with", "Moodle", "and", "saves", "to", "a", "file", "." ]
[ "\"\"\"Generates XML compatible with Moodle and saves to a file.\n\n Args:\n file_path (str): filename where the XML will be saved\n pretty_print (bool, optional): (not implemented) saves XML pretty printed. Defaults to False.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "file_path", "type": "str" }, { "param": "pretty_print", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "file_path", "type": "str", "docstring": "filename where the XML wil...
192abdcdb953fc238c05a359cacaab8207eb1acd
nathanblumenfeld/abstract
collegebaseball/boydsworld_scraper.py
[ "Apache-2.0" ]
Python
_get_data
<not_specific>
def _get_data(school, start, end=None, vs="all", parse_dates=True): """ A helper function to send GET request to boydsworld.com and parse data """ col_names = ["date", "team_1", "team_1_score", "team_2", "team_2_score", "field"] url = 'http://www.boydsworld.com/cgi/scores.pl' # if no end se...
A helper function to send GET request to boydsworld.com and parse data
A helper function to send GET request to boydsworld.com and parse data
[ "A", "helper", "function", "to", "send", "GET", "request", "to", "boydsworld", ".", "com", "and", "parse", "data" ]
def _get_data(school, start, end=None, vs="all", parse_dates=True): col_names = ["date", "team_1", "team_1_score", "team_2", "team_2_score", "field"] url = 'http://www.boydsworld.com/cgi/scores.pl' if end is None: end = start try: payload = {"team1":school, "firstyear":str(start), "tea...
[ "def", "_get_data", "(", "school", ",", "start", ",", "end", "=", "None", ",", "vs", "=", "\"all\"", ",", "parse_dates", "=", "True", ")", ":", "col_names", "=", "[", "\"date\"", ",", "\"team_1\"", ",", "\"team_1_score\"", ",", "\"team_2\"", ",", "\"team...
A helper function to send GET request to boydsworld.com and parse data
[ "A", "helper", "function", "to", "send", "GET", "request", "to", "boydsworld", ".", "com", "and", "parse", "data" ]
[ "\"\"\"\n A helper function to send GET request to boydsworld.com and parse data\n \"\"\"", "# if no end season give, obtain single-season results", "# make sure dates are parsed as type datetime64[ns]" ]
[ { "param": "school", "type": null }, { "param": "start", "type": null }, { "param": "end", "type": null }, { "param": "vs", "type": null }, { "param": "parse_dates", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "school", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "start", "type": null, "docstring": null, "docstring_tokens"...
192abdcdb953fc238c05a359cacaab8207eb1acd
nathanblumenfeld/abstract
collegebaseball/boydsworld_scraper.py
[ "Apache-2.0" ]
Python
_enrich_data
<not_specific>
def _enrich_data(df, school): """ A helper function that adds the following columns to a given DataFrame: opponent (str): opponent for each game. runs_allowed (int): the number of runs scored by team_1 in each game runs_scored (int): the number of runs scored by team_1 in each game ...
A helper function that adds the following columns to a given DataFrame: opponent (str): opponent for each game. runs_allowed (int): the number of runs scored by team_1 in each game runs_scored (int): the number of runs scored by team_1 in each game run_difference (int): the dif...
A helper function that adds the following columns to a given DataFrame: opponent (str): opponent for each game. runs_allowed (int): the number of runs scored by team_1 in each game runs_scored (int): the number of runs scored by team_1 in each game run_difference (int): the difference between team_1's runs scored and r...
[ "A", "helper", "function", "that", "adds", "the", "following", "columns", "to", "a", "given", "DataFrame", ":", "opponent", "(", "str", ")", ":", "opponent", "for", "each", "game", ".", "runs_allowed", "(", "int", ")", ":", "the", "number", "of", "runs",...
def _enrich_data(df, school): wins = df[(df["team_1"] == school) & \ (df["team_1_score"] > df["team_2_score"])].copy() losses = df[(df["team_2"] == school) & \ (df["team_1_score"] > df["team_2_score"])].copy() wins.loc[:,"runs_scored"] = wins.loc[:,"team_1_score"] wins.loc[...
[ "def", "_enrich_data", "(", "df", ",", "school", ")", ":", "wins", "=", "df", "[", "(", "df", "[", "\"team_1\"", "]", "==", "school", ")", "&", "(", "df", "[", "\"team_1_score\"", "]", ">", "df", "[", "\"team_2_score\"", "]", ")", "]", ".", "copy",...
A helper function that adds the following columns to a given DataFrame: opponent (str): opponent for each game.
[ "A", "helper", "function", "that", "adds", "the", "following", "columns", "to", "a", "given", "DataFrame", ":", "opponent", "(", "str", ")", ":", "opponent", "for", "each", "game", "." ]
[ "\"\"\"\n A helper function that adds the following columns to a given DataFrame:\n \n opponent (str): opponent for each game.\n runs_allowed (int): the number of runs scored by team_1 in each game\n runs_scored (int): the number of runs scored by team_1 in each game\n run_differen...
[ { "param": "df", "type": null }, { "param": "school", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "df", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "school", "type": null, "docstring": null, "docstring_tokens": [...
192abdcdb953fc238c05a359cacaab8207eb1acd
nathanblumenfeld/abstract
collegebaseball/boydsworld_scraper.py
[ "Apache-2.0" ]
Python
_set_dtypes
<not_specific>
def _set_dtypes(df): """ A helper function to sets the datatypes of newly added columns """ df.loc[:,"run_difference"] = df.loc[:,"run_difference"].astype(int) df.loc[:,"runs_allowed"] = df.loc[:,"runs_allowed"].astype(int) df.loc[:,"runs_scored"] = df.loc[:,"runs_scored"].astype(int) return...
A helper function to sets the datatypes of newly added columns
A helper function to sets the datatypes of newly added columns
[ "A", "helper", "function", "to", "sets", "the", "datatypes", "of", "newly", "added", "columns" ]
def _set_dtypes(df): df.loc[:,"run_difference"] = df.loc[:,"run_difference"].astype(int) df.loc[:,"runs_allowed"] = df.loc[:,"runs_allowed"].astype(int) df.loc[:,"runs_scored"] = df.loc[:,"runs_scored"].astype(int) return df
[ "def", "_set_dtypes", "(", "df", ")", ":", "df", ".", "loc", "[", ":", ",", "\"run_difference\"", "]", "=", "df", ".", "loc", "[", ":", ",", "\"run_difference\"", "]", ".", "astype", "(", "int", ")", "df", ".", "loc", "[", ":", ",", "\"runs_allowed...
A helper function to sets the datatypes of newly added columns
[ "A", "helper", "function", "to", "sets", "the", "datatypes", "of", "newly", "added", "columns" ]
[ "\"\"\"\n A helper function to sets the datatypes of newly added columns\n \"\"\"" ]
[ { "param": "df", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "df", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
8f375718f6033fa3f8480b2b2fdc1889741b0d09
nathanblumenfeld/abstract
collegebaseball/ncaa_scraper.py
[ "Apache-2.0" ]
Python
_format_names
<not_specific>
def _format_names(original): """ A helper function to turn names from "Last, First" to "First Last" Args: original (str): the name to reformat. must be in form "Last, First" Returns: str of format "First Last" Examples: _format_names("Blumenfeld, Nathan") ...
A helper function to turn names from "Last, First" to "First Last" Args: original (str): the name to reformat. must be in form "Last, First" Returns: str of format "First Last" Examples: _format_names("Blumenfeld, Nathan") >>> "Nathan Blumenfeld"
A helper function to turn names from "Last, First" to "First Last"
[ "A", "helper", "function", "to", "turn", "names", "from", "\"", "Last", "First", "\"", "to", "\"", "First", "Last", "\"" ]
def _format_names(original): try: split = original.split(',') split.reverse() res = ' '.join(split).strip().title() except: res = np.nan return res
[ "def", "_format_names", "(", "original", ")", ":", "try", ":", "split", "=", "original", ".", "split", "(", "','", ")", "split", ".", "reverse", "(", ")", "res", "=", "' '", ".", "join", "(", "split", ")", ".", "strip", "(", ")", ".", "title", "(...
A helper function to turn names from "Last, First" to "First Last"
[ "A", "helper", "function", "to", "turn", "names", "from", "\"", "Last", "First", "\"", "to", "\"", "First", "Last", "\"" ]
[ "\"\"\"\n A helper function to turn names from \"Last, First\" to \"First Last\"\n \n Args: \n original (str): the name to reformat. must be in form \"Last, First\"\n Returns: \n str of format \"First Last\"\n \n Examples: \n _format_names(\"Blumenfeld, Nathan\")\n ...
[ { "param": "original", "type": null } ]
{ "returns": [ { "docstring": "str of format \"First Last\"", "docstring_tokens": [ "str", "of", "format", "\"", "First", "Last", "\"" ], "type": null } ], "raises": [], "params": [ { "identifier": "original", ...
8f375718f6033fa3f8480b2b2fdc1889741b0d09
nathanblumenfeld/abstract
collegebaseball/ncaa_scraper.py
[ "Apache-2.0" ]
Python
_eliminate_dashes
<not_specific>
def _eliminate_dashes(df): """ A helper function to replace the weird dashes the NCAA uses with 0.00 Args: df (DataFrame): Returns: Dataframe with dashes replaced by 0.00 (not a copy!) """ df.replace('None', 0.00, inplace=True) df.replace('<NA>', 0.00, inplace=True) df...
A helper function to replace the weird dashes the NCAA uses with 0.00 Args: df (DataFrame): Returns: Dataframe with dashes replaced by 0.00 (not a copy!)
A helper function to replace the weird dashes the NCAA uses with 0.00
[ "A", "helper", "function", "to", "replace", "the", "weird", "dashes", "the", "NCAA", "uses", "with", "0", ".", "00" ]
def _eliminate_dashes(df): df.replace('None', 0.00, inplace=True) df.replace('<NA>', 0.00, inplace=True) df.replace('', 0.00, inplace=True) df.replace(' ', 0.00, inplace=True) df.replace('-', 0.00, inplace=True) df.replace('--', 0.00, inplace=True) df.replace('---', 0.00, inplace=True) d...
[ "def", "_eliminate_dashes", "(", "df", ")", ":", "df", ".", "replace", "(", "'None'", ",", "0.00", ",", "inplace", "=", "True", ")", "df", ".", "replace", "(", "'<NA>'", ",", "0.00", ",", "inplace", "=", "True", ")", "df", ".", "replace", "(", "''"...
A helper function to replace the weird dashes the NCAA uses with 0.00
[ "A", "helper", "function", "to", "replace", "the", "weird", "dashes", "the", "NCAA", "uses", "with", "0", ".", "00" ]
[ "\"\"\"\n A helper function to replace the weird dashes the NCAA uses with 0.00\n\n Args: \n df (DataFrame): \n Returns:\n Dataframe with dashes replaced by 0.00 (not a copy!)\n \"\"\"" ]
[ { "param": "df", "type": null } ]
{ "returns": [ { "docstring": "Dataframe with dashes replaced by 0.00 (not a copy!)", "docstring_tokens": [ "Dataframe", "with", "dashes", "replaced", "by", "0", ".", "00", "(", "not", "a", "copy!", ...
8f375718f6033fa3f8480b2b2fdc1889741b0d09
nathanblumenfeld/abstract
collegebaseball/ncaa_scraper.py
[ "Apache-2.0" ]
Python
lookup_season_ids_reverse
<not_specific>
def lookup_season_ids_reverse(season_id): """ A lookup function that returns the season and batting/pitching ids for a given season Args: season_id (int): NCAA season_id Returns: tuple of (season_id, batting_id, pitching_id) for desired season """ season_row = _SEA...
A lookup function that returns the season and batting/pitching ids for a given season Args: season_id (int): NCAA season_id Returns: tuple of (season_id, batting_id, pitching_id) for desired season
A lookup function that returns the season and batting/pitching ids for a given season
[ "A", "lookup", "function", "that", "returns", "the", "season", "and", "batting", "/", "pitching", "ids", "for", "a", "given", "season" ]
def lookup_season_ids_reverse(season_id): season_row = _SEASON_LU_DF.loc[_SEASON_LU_DF['season_id'] == season_id] season = season_row['season'].values[0] batting_id = season_row['batting_id'].values[0] pitching_id = season_row['pitching_id'].values[0] return (season, batting_id, pitching_id)
[ "def", "lookup_season_ids_reverse", "(", "season_id", ")", ":", "season_row", "=", "_SEASON_LU_DF", ".", "loc", "[", "_SEASON_LU_DF", "[", "'season_id'", "]", "==", "season_id", "]", "season", "=", "season_row", "[", "'season'", "]", ".", "values", "[", "0", ...
A lookup function that returns the season and batting/pitching ids for a given season
[ "A", "lookup", "function", "that", "returns", "the", "season", "and", "batting", "/", "pitching", "ids", "for", "a", "given", "season" ]
[ "\"\"\"\n A lookup function that returns the season and batting/pitching ids\n for a given season\n \n Args: \n season_id (int): NCAA season_id\n \n Returns:\n tuple of (season_id, batting_id, pitching_id) for desired season\n \"\"\"" ]
[ { "param": "season_id", "type": null } ]
{ "returns": [ { "docstring": "tuple of (season_id, batting_id, pitching_id) for desired season", "docstring_tokens": [ "tuple", "of", "(", "season_id", "batting_id", "pitching_id", ")", "for", "desired", "season" ],...
8f375718f6033fa3f8480b2b2fdc1889741b0d09
nathanblumenfeld/abstract
collegebaseball/ncaa_scraper.py
[ "Apache-2.0" ]
Python
lookup_seasons_played
<not_specific>
def lookup_seasons_played(stats_player_seq): """ A lookup function that gives the first and last seasons played by a given player Args: stats_player_seq (int): NCAA player_id Returns: tuple of ints: (debut season, most recent season) """ row = _PLAYERS_HISTOR...
A lookup function that gives the first and last seasons played by a given player Args: stats_player_seq (int): NCAA player_id Returns: tuple of ints: (debut season, most recent season)
A lookup function that gives the first and last seasons played by a given player
[ "A", "lookup", "function", "that", "gives", "the", "first", "and", "last", "seasons", "played", "by", "a", "given", "player" ]
def lookup_seasons_played(stats_player_seq): row = _PLAYERS_HISTORY_LU_DF.loc[_PLAYERS_HISTORY_LU_DF.stats_player_seq == stats_player_seq] return row['debut_season'].values[0], row['season_last'].values[0]
[ "def", "lookup_seasons_played", "(", "stats_player_seq", ")", ":", "row", "=", "_PLAYERS_HISTORY_LU_DF", ".", "loc", "[", "_PLAYERS_HISTORY_LU_DF", ".", "stats_player_seq", "==", "stats_player_seq", "]", "return", "row", "[", "'debut_season'", "]", ".", "values", "[...
A lookup function that gives the first and last seasons played by a given player
[ "A", "lookup", "function", "that", "gives", "the", "first", "and", "last", "seasons", "played", "by", "a", "given", "player" ]
[ "\"\"\"\n A lookup function that gives the first and last seasons played by a\n given player\n \n Args: \n stats_player_seq (int): NCAA player_id\n \n Returns: \n tuple of ints: (debut season, most recent season)\n \n \"\"\"" ]
[ { "param": "stats_player_seq", "type": null } ]
{ "returns": [ { "docstring": "tuple of ints: (debut season, most recent season)", "docstring_tokens": [ "tuple", "of", "ints", ":", "(", "debut", "season", "most", "recent", "season", ")" ], "type": nu...
6b5c8d59c1d88bbdc27f85da1481fea12b1558b4
qcr/armer_panda
armer_panda/robots/PandaROSRobot.py
[ "MIT" ]
Python
recover_cb
EmptyResponse
def recover_cb(self, req: EmptyRequest) -> EmptyResponse: # pylint: disable=no-self-use """[summary] ROS Service callback: Invoke any available error recovery functions on the robot when an error occurs :param req: an empty request :type req: EmptyRequest :return: an emp...
[summary] ROS Service callback: Invoke any available error recovery functions on the robot when an error occurs :param req: an empty request :type req: EmptyRequest :return: an empty response :rtype: EmptyResponse
[summary] ROS Service callback: Invoke any available error recovery functions on the robot when an error occurs
[ "[", "summary", "]", "ROS", "Service", "callback", ":", "Invoke", "any", "available", "error", "recovery", "functions", "on", "the", "robot", "when", "an", "error", "occurs" ]
def recover_cb(self, req: EmptyRequest) -> EmptyResponse: print('Recovering') self.reset_client.send_goal(ErrorRecoveryGoal()) self.reset_client.wait_for_result() return EmptyResponse()
[ "def", "recover_cb", "(", "self", ",", "req", ":", "EmptyRequest", ")", "->", "EmptyResponse", ":", "print", "(", "'Recovering'", ")", "self", ".", "reset_client", ".", "send_goal", "(", "ErrorRecoveryGoal", "(", ")", ")", "self", ".", "reset_client", ".", ...
[summary] ROS Service callback: Invoke any available error recovery functions on the robot when an error occurs
[ "[", "summary", "]", "ROS", "Service", "callback", ":", "Invoke", "any", "available", "error", "recovery", "functions", "on", "the", "robot", "when", "an", "error", "occurs" ]
[ "# pylint: disable=no-self-use", "\"\"\"[summary]\n ROS Service callback:\n Invoke any available error recovery functions on the robot when an error occurs\n\n :param req: an empty request\n :type req: EmptyRequest\n :return: an empty response\n :rtype: EmptyResponse\n ...
[ { "param": "self", "type": null }, { "param": "req", "type": "EmptyRequest" } ]
{ "returns": [ { "docstring": "an empty response", "docstring_tokens": [ "an", "empty", "response" ], "type": "EmptyResponse" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tok...
e0fd713b96f5b1732368747cbb22650d38ff7606
piechottam/i-vis-core
i_vis/core/file_utils.py
[ "MIT" ]
Python
prefix_fname
str
def prefix_fname(fname: str, pre: str, tag: Optional[str] = None) -> str: """Prefix filename and add optional tag. Args: fname: Filename to process. pre: Prefix to add to filename. tag: (Optional). Tag to add to filename. Default = None. Returns: Prefixed and optionally tag...
Prefix filename and add optional tag. Args: fname: Filename to process. pre: Prefix to add to filename. tag: (Optional). Tag to add to filename. Default = None. Returns: Prefixed and optionally tagged filename. Examples: >>> prefix_fname("file.txt", "backup") ...
Prefix filename and add optional tag.
[ "Prefix", "filename", "and", "add", "optional", "tag", "." ]
def prefix_fname(fname: str, pre: str, tag: Optional[str] = None) -> str: dname = os.path.dirname(fname) if dname: dname = dname + "/" fname = os.path.basename(fname).lstrip("_") if tag: pre = f"{pre}-{tag}" pre = f"{pre}-" return f"{dname}{pre}{fname}"
[ "def", "prefix_fname", "(", "fname", ":", "str", ",", "pre", ":", "str", ",", "tag", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "str", ":", "dname", "=", "os", ".", "path", ".", "dirname", "(", "fname", ")", "if", "dname", ":", "...
Prefix filename and add optional tag.
[ "Prefix", "filename", "and", "add", "optional", "tag", "." ]
[ "\"\"\"Prefix filename and add optional tag.\n\n Args:\n fname: Filename to process.\n pre: Prefix to add to filename.\n tag: (Optional). Tag to add to filename. Default = None.\n\n Returns:\n Prefixed and optionally tagged filename.\n\n Examples:\n >>> prefix_fname(\"fil...
[ { "param": "fname", "type": "str" }, { "param": "pre", "type": "str" }, { "param": "tag", "type": "Optional[str]" } ]
{ "returns": [ { "docstring": "Prefixed and optionally tagged filename.", "docstring_tokens": [ "Prefixed", "and", "optionally", "tagged", "filename", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "fna...
e0fd713b96f5b1732368747cbb22650d38ff7606
piechottam/i-vis-core
i_vis/core/file_utils.py
[ "MIT" ]
Python
change_suffix
str
def change_suffix(fname: str, new_suffix: str, old_suffix: Optional[str] = None) -> str: """Change suffix of filename. Changes suffix of a filename. If no old suffix is provided, the part that is replaced is guessed. Args: fname: Filename to process. new_suffix: Replace old suffix with thi...
Change suffix of filename. Changes suffix of a filename. If no old suffix is provided, the part that is replaced is guessed. Args: fname: Filename to process. new_suffix: Replace old suffix with this. old_suffix: (Optional) Old suffix of filename - must be part of filename. Default = N...
Change suffix of filename. Changes suffix of a filename. If no old suffix is provided, the part that is replaced is guessed.
[ "Change", "suffix", "of", "filename", ".", "Changes", "suffix", "of", "a", "filename", ".", "If", "no", "old", "suffix", "is", "provided", "the", "part", "that", "is", "replaced", "is", "guessed", "." ]
def change_suffix(fname: str, new_suffix: str, old_suffix: Optional[str] = None) -> str: if not old_suffix: old_suffix = os.path.splitext(fname)[1] return str(re.sub(old_suffix + "$", new_suffix, fname))
[ "def", "change_suffix", "(", "fname", ":", "str", ",", "new_suffix", ":", "str", ",", "old_suffix", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "str", ":", "if", "not", "old_suffix", ":", "old_suffix", "=", "os", ".", "path", ".", "spli...
Change suffix of filename.
[ "Change", "suffix", "of", "filename", "." ]
[ "\"\"\"Change suffix of filename.\n\n Changes suffix of a filename. If no old suffix is provided, the part that is replaced is guessed.\n\n Args:\n fname: Filename to process.\n new_suffix: Replace old suffix with this.\n old_suffix: (Optional) Old suffix of filename - must be part of fil...
[ { "param": "fname", "type": "str" }, { "param": "new_suffix", "type": "str" }, { "param": "old_suffix", "type": "Optional[str]" } ]
{ "returns": [ { "docstring": "Filename with replaced suffix.", "docstring_tokens": [ "Filename", "with", "replaced", "suffix", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "fname", "type": "str", ...
e0fd713b96f5b1732368747cbb22650d38ff7606
piechottam/i-vis-core
i_vis/core/file_utils.py
[ "MIT" ]
Python
md5
str
def md5(fname: str) -> str: """MD5 hash value for a file. Args: fname: File to calculate MD5. Returns: MD5 hash for filename. """ md5h = hashlib.md5() with open(fname, "rb") as file: while True: data = file.read(1024 * 64) if not data: ...
MD5 hash value for a file. Args: fname: File to calculate MD5. Returns: MD5 hash for filename.
MD5 hash value for a file.
[ "MD5", "hash", "value", "for", "a", "file", "." ]
def md5(fname: str) -> str: md5h = hashlib.md5() with open(fname, "rb") as file: while True: data = file.read(1024 * 64) if not data: break md5h.update(data) return md5h.hexdigest()
[ "def", "md5", "(", "fname", ":", "str", ")", "->", "str", ":", "md5h", "=", "hashlib", ".", "md5", "(", ")", "with", "open", "(", "fname", ",", "\"rb\"", ")", "as", "file", ":", "while", "True", ":", "data", "=", "file", ".", "read", "(", "1024...
MD5 hash value for a file.
[ "MD5", "hash", "value", "for", "a", "file", "." ]
[ "\"\"\"MD5 hash value for a file.\n\n Args:\n fname: File to calculate MD5.\n\n Returns:\n MD5 hash for filename.\n \"\"\"" ]
[ { "param": "fname", "type": "str" } ]
{ "returns": [ { "docstring": "MD5 hash for filename.", "docstring_tokens": [ "MD5", "hash", "for", "filename", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "fname", "type": "str", "docstring": "F...
e0fd713b96f5b1732368747cbb22650d38ff7606
piechottam/i-vis-core
i_vis/core/file_utils.py
[ "MIT" ]
Python
size
int
def size(fname: str) -> int: """Size of file in Bytes. Args: fname: Filename to determine the size. Returns: File size of filename in Bytes. """ return os.stat(fname).st_size
Size of file in Bytes. Args: fname: Filename to determine the size. Returns: File size of filename in Bytes.
Size of file in Bytes.
[ "Size", "of", "file", "in", "Bytes", "." ]
def size(fname: str) -> int: return os.stat(fname).st_size
[ "def", "size", "(", "fname", ":", "str", ")", "->", "int", ":", "return", "os", ".", "stat", "(", "fname", ")", ".", "st_size" ]
Size of file in Bytes.
[ "Size", "of", "file", "in", "Bytes", "." ]
[ "\"\"\"Size of file in Bytes.\n\n Args:\n fname: Filename to determine the size.\n\n Returns:\n File size of filename in Bytes.\n \"\"\"" ]
[ { "param": "fname", "type": "str" } ]
{ "returns": [ { "docstring": "File size of filename in Bytes.", "docstring_tokens": [ "File", "size", "of", "filename", "in", "Bytes", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "fname", ...
e0fd713b96f5b1732368747cbb22650d38ff7606
piechottam/i-vis-core
i_vis/core/file_utils.py
[ "MIT" ]
Python
create_dir
None
def create_dir(dname: str) -> None: """Create directory. If directory does not exist, create it and write a log message. Args: dname: Directory to create. """ if not os.path.exists(dname): pathlib.Path(dname).mkdir(parents=True) logging.debug("Created directory: %s", dname)
Create directory. If directory does not exist, create it and write a log message. Args: dname: Directory to create.
Create directory. If directory does not exist, create it and write a log message.
[ "Create", "directory", ".", "If", "directory", "does", "not", "exist", "create", "it", "and", "write", "a", "log", "message", "." ]
def create_dir(dname: str) -> None: if not os.path.exists(dname): pathlib.Path(dname).mkdir(parents=True) logging.debug("Created directory: %s", dname)
[ "def", "create_dir", "(", "dname", ":", "str", ")", "->", "None", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "dname", ")", ":", "pathlib", ".", "Path", "(", "dname", ")", ".", "mkdir", "(", "parents", "=", "True", ")", "logging", "....
Create directory.
[ "Create", "directory", "." ]
[ "\"\"\"Create directory.\n\n If directory does not exist, create it and write a log message.\n\n Args:\n dname: Directory to create.\n \"\"\"" ]
[ { "param": "dname", "type": "str" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dname", "type": "str", "docstring": "Directory to create.", "docstring_tokens": [ "Directory", "to", "create", "." ], "default": null, "is_optional": null } ], "outlier...
e0fd713b96f5b1732368747cbb22650d38ff7606
piechottam/i-vis-core
i_vis/core/file_utils.py
[ "MIT" ]
Python
read_query
str
def read_query(fname: str) -> str: """Read a query from file. Read query and remove all white space between tags. Args: fname: Filename tor read. Returns: Read query. """ with open(fname, "r") as file: s = file.read() return re.sub(r"\s+(?=<)", "", s)
Read a query from file. Read query and remove all white space between tags. Args: fname: Filename tor read. Returns: Read query.
Read a query from file. Read query and remove all white space between tags.
[ "Read", "a", "query", "from", "file", ".", "Read", "query", "and", "remove", "all", "white", "space", "between", "tags", "." ]
def read_query(fname: str) -> str: with open(fname, "r") as file: s = file.read() return re.sub(r"\s+(?=<)", "", s)
[ "def", "read_query", "(", "fname", ":", "str", ")", "->", "str", ":", "with", "open", "(", "fname", ",", "\"r\"", ")", "as", "file", ":", "s", "=", "file", ".", "read", "(", ")", "return", "re", ".", "sub", "(", "r\"\\s+(?=<)\"", ",", "\"\"", ","...
Read a query from file.
[ "Read", "a", "query", "from", "file", "." ]
[ "\"\"\"Read a query from file.\n\n Read query and remove all white space between tags.\n\n Args:\n fname: Filename tor read.\n\n Returns:\n Read query.\n \"\"\"" ]
[ { "param": "fname", "type": "str" } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "fname", "type": "str", "docstring": "Filename tor read.", "docstring_tokens": [ "Filename", "tor", ...
e0fd713b96f5b1732368747cbb22650d38ff7606
piechottam/i-vis-core
i_vis/core/file_utils.py
[ "MIT" ]
Python
path_md5
str
def path_md5(path: str) -> str: """MD5 hash value for a file. Args: fname: File to calculate MD5. Returns: MD5 hash for filename. """ md5h = hashlib.md5() for root, dirs, fnames in os.walk(path): for fname in fnames: with open(os.path.join(path, fname), "rb...
MD5 hash value for a file. Args: fname: File to calculate MD5. Returns: MD5 hash for filename.
MD5 hash value for a file.
[ "MD5", "hash", "value", "for", "a", "file", "." ]
def path_md5(path: str) -> str: md5h = hashlib.md5() for root, dirs, fnames in os.walk(path): for fname in fnames: with open(os.path.join(path, fname), "rb") as file: while True: data = file.read(1024 * 64) if not data: ...
[ "def", "path_md5", "(", "path", ":", "str", ")", "->", "str", ":", "md5h", "=", "hashlib", ".", "md5", "(", ")", "for", "root", ",", "dirs", ",", "fnames", "in", "os", ".", "walk", "(", "path", ")", ":", "for", "fname", "in", "fnames", ":", "wi...
MD5 hash value for a file.
[ "MD5", "hash", "value", "for", "a", "file", "." ]
[ "\"\"\"MD5 hash value for a file.\n\n Args:\n fname: File to calculate MD5.\n\n Returns:\n MD5 hash for filename.\n \"\"\"" ]
[ { "param": "path", "type": "str" } ]
{ "returns": [ { "docstring": "MD5 hash for filename.", "docstring_tokens": [ "MD5", "hash", "for", "filename", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "path", "type": "str", "docstring": nul...
7769857269f8ceee4b18eca30fff516c4b589c8d
piechottam/i-vis-core
i_vis/core/db_utils.py
[ "MIT" ]
Python
fname2tname
str
def fname2tname(fname: str) -> str: """Transform fname to tname. Create a database friendly table name for a given filename. Args: fname: Filename to transform. Returns: Transformed table name. """ # remove path fname = basename(fname) # remove suffix pos = fname....
Transform fname to tname. Create a database friendly table name for a given filename. Args: fname: Filename to transform. Returns: Transformed table name.
Transform fname to tname. Create a database friendly table name for a given filename.
[ "Transform", "fname", "to", "tname", ".", "Create", "a", "database", "friendly", "table", "name", "for", "a", "given", "filename", "." ]
def fname2tname(fname: str) -> str: fname = basename(fname) pos = fname.find(".") if pos >= 0: fname = fname[0:pos] tname = underscore(fname) return tname
[ "def", "fname2tname", "(", "fname", ":", "str", ")", "->", "str", ":", "fname", "=", "basename", "(", "fname", ")", "pos", "=", "fname", ".", "find", "(", "\".\"", ")", "if", "pos", ">=", "0", ":", "fname", "=", "fname", "[", "0", ":", "pos", "...
Transform fname to tname.
[ "Transform", "fname", "to", "tname", "." ]
[ "\"\"\"Transform fname to tname.\n\n Create a database friendly table name for a given filename.\n\n Args:\n fname: Filename to transform.\n\n Returns:\n Transformed table name.\n\n \"\"\"", "# remove path", "# remove suffix" ]
[ { "param": "fname", "type": "str" } ]
{ "returns": [ { "docstring": "Transformed table name.", "docstring_tokens": [ "Transformed", "table", "name", "." ], "type": null } ], "raises": [], "params": [ { "identifier": "fname", "type": "str", "docstring": "Filename t...
7769857269f8ceee4b18eca30fff516c4b589c8d
piechottam/i-vis-core
i_vis/core/db_utils.py
[ "MIT" ]
Python
row_count
int
def row_count(tname: str) -> int: """Get row count for table. Args: tname: The table name to retrieve row count. Returns: The number of rows for a table. """ table = get_table(tname) # TODO TEST primary_key = model.__mapper__.primary_key[0].name pks = tuple(pk for pk in ta...
Get row count for table. Args: tname: The table name to retrieve row count. Returns: The number of rows for a table.
Get row count for table.
[ "Get", "row", "count", "for", "table", "." ]
def row_count(tname: str) -> int: table = get_table(tname) pks = tuple(pk for pk in table.__table__.primary_key.columns) return int(db.session.query(func.count(*pks)).scalar())
[ "def", "row_count", "(", "tname", ":", "str", ")", "->", "int", ":", "table", "=", "get_table", "(", "tname", ")", "pks", "=", "tuple", "(", "pk", "for", "pk", "in", "table", ".", "__table__", ".", "primary_key", ".", "columns", ")", "return", "int",...
Get row count for table.
[ "Get", "row", "count", "for", "table", "." ]
[ "\"\"\"Get row count for table.\n\n Args:\n tname: The table name to retrieve row count.\n\n Returns:\n The number of rows for a table.\n \"\"\"", "# TODO TEST primary_key = model.__mapper__.primary_key[0].name", "# apparently slower: return model.query.count()" ]
[ { "param": "tname", "type": "str" } ]
{ "returns": [ { "docstring": "The number of rows for a table.", "docstring_tokens": [ "The", "number", "of", "rows", "for", "a", "table", "." ], "type": null } ], "raises": [], "params": [ { "identifier": ...
b13f282c755ee5fb960fcc15bc1a1e3294fd13ef
piechottam/i-vis-core
i_vis/core/config.py
[ "MIT" ]
Python
register_core_variable
str
def register_core_variable( self, name: str, required: bool = False, default: Optional[Any] = None ) -> str: """Register meta info for a general purpose variable. .. seealso:: :method:`ConfigMeta._register_var` """ return self.register_variable( name=name, vtype=...
Register meta info for a general purpose variable. .. seealso:: :method:`ConfigMeta._register_var`
Register meta info for a general purpose variable.
[ "Register", "meta", "info", "for", "a", "general", "purpose", "variable", "." ]
def register_core_variable( self, name: str, required: bool = False, default: Optional[Any] = None ) -> str: return self.register_variable( name=name, vtype="core", required=required, default=default )
[ "def", "register_core_variable", "(", "self", ",", "name", ":", "str", ",", "required", ":", "bool", "=", "False", ",", "default", ":", "Optional", "[", "Any", "]", "=", "None", ")", "->", "str", ":", "return", "self", ".", "register_variable", "(", "n...
Register meta info for a general purpose variable.
[ "Register", "meta", "info", "for", "a", "general", "purpose", "variable", "." ]
[ "\"\"\"Register meta info for a general purpose variable.\n\n .. seealso:: :method:`ConfigMeta._register_var`\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "name", "type": "str" }, { "param": "required", "type": "bool" }, { "param": "default", "type": "Optional[Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": "str", "docstring": null, "docstring_tokens": ...
b13f282c755ee5fb960fcc15bc1a1e3294fd13ef
piechottam/i-vis-core
i_vis/core/config.py
[ "MIT" ]
Python
register_plugin_variable
str
def register_plugin_variable( self, pname: str, name: str, required: bool = False, default: Optional[Any] = None, ) -> str: """Register meta info for a plugin specific variable. .. seealso:: :method:`ConfigMeta._register_var` .. seealso:: TODO referen...
Register meta info for a plugin specific variable. .. seealso:: :method:`ConfigMeta._register_var` .. seealso:: TODO reference show all variables
Register meta info for a plugin specific variable.
[ "Register", "meta", "info", "for", "a", "plugin", "specific", "variable", "." ]
def register_plugin_variable( self, pname: str, name: str, required: bool = False, default: Optional[Any] = None, ) -> str: return self.register_variable( name=name, vtype="plugin", required=required, pname=pname, default=default )
[ "def", "register_plugin_variable", "(", "self", ",", "pname", ":", "str", ",", "name", ":", "str", ",", "required", ":", "bool", "=", "False", ",", "default", ":", "Optional", "[", "Any", "]", "=", "None", ",", ")", "->", "str", ":", "return", "self"...
Register meta info for a plugin specific variable.
[ "Register", "meta", "info", "for", "a", "plugin", "specific", "variable", "." ]
[ "\"\"\"Register meta info for a plugin specific variable.\n\n .. seealso:: :method:`ConfigMeta._register_var`\n .. seealso:: TODO reference show all variables\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "pname", "type": "str" }, { "param": "name", "type": "str" }, { "param": "required", "type": "bool" }, { "param": "default", "type": "Optional[Any]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pname", "type": "str", "docstring": null, "docstring_tokens":...
b13f282c755ee5fb960fcc15bc1a1e3294fd13ef
piechottam/i-vis-core
i_vis/core/config.py
[ "MIT" ]
Python
check_core_config
None
def check_core_config(self) -> None: """Check if required core variables are set. Raises: :class:`MissingVariable` """ for var_name, meta in self._name2var.items(): if meta["pname"] is None: _check_meta(var_name, meta)
Check if required core variables are set. Raises: :class:`MissingVariable`
Check if required core variables are set.
[ "Check", "if", "required", "core", "variables", "are", "set", "." ]
def check_core_config(self) -> None: for var_name, meta in self._name2var.items(): if meta["pname"] is None: _check_meta(var_name, meta)
[ "def", "check_core_config", "(", "self", ")", "->", "None", ":", "for", "var_name", ",", "meta", "in", "self", ".", "_name2var", ".", "items", "(", ")", ":", "if", "meta", "[", "\"pname\"", "]", "is", "None", ":", "_check_meta", "(", "var_name", ",", ...
Check if required core variables are set.
[ "Check", "if", "required", "core", "variables", "are", "set", "." ]
[ "\"\"\"Check if required core variables are set.\n\n Raises:\n :class:`MissingVariable`\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "" } ], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
b13f282c755ee5fb960fcc15bc1a1e3294fd13ef
piechottam/i-vis-core
i_vis/core/config.py
[ "MIT" ]
Python
check_plugin_config
None
def check_plugin_config(self, pnames: Optional[Sequence[str]] = None) -> None: """Check if plugin specific required variables are set. Args: pnames: Plugin names. Default: None Raises: :class:`MissingVariable` """ if pnames is None: pnames = ...
Check if plugin specific required variables are set. Args: pnames: Plugin names. Default: None Raises: :class:`MissingVariable`
Check if plugin specific required variables are set.
[ "Check", "if", "plugin", "specific", "required", "variables", "are", "set", "." ]
def check_plugin_config(self, pnames: Optional[Sequence[str]] = None) -> None: if pnames is None: pnames = list(self._pname2vars.keys()) for pname in pnames: for var_name, meta in self._pname2vars.get(pname, {}).items(): _check_meta(var_name, meta)
[ "def", "check_plugin_config", "(", "self", ",", "pnames", ":", "Optional", "[", "Sequence", "[", "str", "]", "]", "=", "None", ")", "->", "None", ":", "if", "pnames", "is", "None", ":", "pnames", "=", "list", "(", "self", ".", "_pname2vars", ".", "ke...
Check if plugin specific required variables are set.
[ "Check", "if", "plugin", "specific", "required", "variables", "are", "set", "." ]
[ "\"\"\"Check if plugin specific required variables are set.\n\n Args:\n pnames: Plugin names. Default: None\n\n Raises:\n :class:`MissingVariable`\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "pnames", "type": "Optional[Sequence[str]]" } ]
{ "returns": [], "raises": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": "" } ], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
679251261f22cba7d1d64b14bef1f1ab23120254
piechottam/i-vis-core
i_vis/core/version.py
[ "MIT" ]
Python
from_url
"Date"
def from_url(url: str, **kwargs: Any) -> "Date": """Create version from date info for an url. Args: url: Url to check for modification. **kwargs: see :method:`last_modified` for details. Returns: :class:`Date` or ``None``, if no date information could be ret...
Create version from date info for an url. Args: url: Url to check for modification. **kwargs: see :method:`last_modified` for details. Returns: :class:`Date` or ``None``, if no date information could be retrieved.
Create version from date info for an url.
[ "Create", "version", "from", "date", "info", "for", "an", "url", "." ]
def from_url(url: str, **kwargs: Any) -> "Date": modified = last_modified(url, **kwargs) if not modified: raise ValueError(f"Could not retrieve last modified from '{url}'.") return Date(modified)
[ "def", "from_url", "(", "url", ":", "str", ",", "**", "kwargs", ":", "Any", ")", "->", "\"Date\"", ":", "modified", "=", "last_modified", "(", "url", ",", "**", "kwargs", ")", "if", "not", "modified", ":", "raise", "ValueError", "(", "f\"Could not retrie...
Create version from date info for an url.
[ "Create", "version", "from", "date", "info", "for", "an", "url", "." ]
[ "\"\"\"Create version from date info for an url.\n\n Args:\n url: Url to check for modification.\n **kwargs: see :method:`last_modified` for details.\n\n Returns:\n :class:`Date` or ``None``, if no date information could be retrieved.\n \"\"\"" ]
[ { "param": "url", "type": "str" }, { "param": "kwargs", "type": "Any" } ]
{ "returns": [ { "docstring": ":class:`Date` or ``None``, if no date information could be retrieved.", "docstring_tokens": [ ":", "class", ":", "`", "Date", "`", "or", "`", "`", "None", "`", "`", "i...
679251261f22cba7d1d64b14bef1f1ab23120254
piechottam/i-vis-core
i_vis/core/version.py
[ "MIT" ]
Python
less_than
bool
def less_than(self: Version, other: Version, attrs: Sequence[str]) -> bool: """Compare versions based on attributes. ``self`` and ``other`` be the same type. Args: self: A :class:`Version` instance to compare. other: An other :class:`Version` instance to compare against. attrs: Att...
Compare versions based on attributes. ``self`` and ``other`` be the same type. Args: self: A :class:`Version` instance to compare. other: An other :class:`Version` instance to compare against. attrs: Attributes to compare. Returns: True, if ``self`` is older than ``other``...
Compare versions based on attributes.
[ "Compare", "versions", "based", "on", "attributes", "." ]
def less_than(self: Version, other: Version, attrs: Sequence[str]) -> bool: for attr in attrs: attr1 = getattr(self, attr, None) attr2 = getattr(other, attr, None) if attr1 is not None: if attr2 is None: return False if attr1 < attr2: r...
[ "def", "less_than", "(", "self", ":", "Version", ",", "other", ":", "Version", ",", "attrs", ":", "Sequence", "[", "str", "]", ")", "->", "bool", ":", "for", "attr", "in", "attrs", ":", "attr1", "=", "getattr", "(", "self", ",", "attr", ",", "None"...
Compare versions based on attributes.
[ "Compare", "versions", "based", "on", "attributes", "." ]
[ "\"\"\"Compare versions based on attributes.\n\n ``self`` and ``other`` be the same type.\n\n Args:\n self: A :class:`Version` instance to compare.\n other: An other :class:`Version` instance to compare against.\n attrs: Attributes to compare.\n\n Returns:\n True, if ``self`` is...
[ { "param": "self", "type": "Version" }, { "param": "other", "type": "Version" }, { "param": "attrs", "type": "Sequence[str]" } ]
{ "returns": [ { "docstring": "True, if ``self`` is older than ``other``. False, otherwise.", "docstring_tokens": [ "True", "if", "`", "`", "self", "`", "`", "is", "older", "than", "`", "`", "other"...
679251261f22cba7d1d64b14bef1f1ab23120254
piechottam/i-vis-core
i_vis/core/version.py
[ "MIT" ]
Python
last_modified
Optional[datetime.date]
def last_modified( url: str, request_args: Optional[Dict[str, Any]] = None, date_format: str = "%a, %d %b %Y %H:%M:%S GMT", ) -> Optional[datetime.date]: """Retrieve last modified from header of url. Args: url: Url to check header info. request_args: (Optional) Arguments forwarded t...
Retrieve last modified from header of url. Args: url: Url to check header info. request_args: (Optional) Arguments forwarded to :module:`requests`. date_format: Expected data format in header info. Default: "%a, %d %b %Y %H:%M:%S GMT". Returns: Last modification datetime for ``...
Retrieve last modified from header of url.
[ "Retrieve", "last", "modified", "from", "header", "of", "url", "." ]
def last_modified( url: str, request_args: Optional[Dict[str, Any]] = None, date_format: str = "%a, %d %b %Y %H:%M:%S GMT", ) -> Optional[datetime.date]: if not request_args: request_args = {} r = requests.head(url, timeout=100, **request_args) if r.status_code != 200: return Non...
[ "def", "last_modified", "(", "url", ":", "str", ",", "request_args", ":", "Optional", "[", "Dict", "[", "str", ",", "Any", "]", "]", "=", "None", ",", "date_format", ":", "str", "=", "\"%a, %d %b %Y %H:%M:%S GMT\"", ",", ")", "->", "Optional", "[", "date...
Retrieve last modified from header of url.
[ "Retrieve", "last", "modified", "from", "header", "of", "url", "." ]
[ "\"\"\"Retrieve last modified from header of url.\n\n Args:\n url: Url to check header info.\n request_args: (Optional) Arguments forwarded to :module:`requests`.\n date_format: Expected data format in header info. Default: \"%a, %d %b %Y %H:%M:%S GMT\".\n\n Returns:\n Last modific...
[ { "param": "url", "type": "str" }, { "param": "request_args", "type": "Optional[Dict[str, Any]]" }, { "param": "date_format", "type": "str" } ]
{ "returns": [ { "docstring": "Last modification datetime for ``url`` or None.", "docstring_tokens": [ "Last", "modification", "datetime", "for", "`", "`", "url", "`", "`", "or", "None", "." ], ...
679251261f22cba7d1d64b14bef1f1ab23120254
piechottam/i-vis-core
i_vis/core/version.py
[ "MIT" ]
Python
recent
datetime.date
def recent(*dates: datetime.date) -> datetime.date: """Determine most recent date from list of dates. Args: *dates: Sequence of dates to check. Returns: Most recent date from ``*dates``. """ return max(*dates)
Determine most recent date from list of dates. Args: *dates: Sequence of dates to check. Returns: Most recent date from ``*dates``.
Determine most recent date from list of dates.
[ "Determine", "most", "recent", "date", "from", "list", "of", "dates", "." ]
def recent(*dates: datetime.date) -> datetime.date: return max(*dates)
[ "def", "recent", "(", "*", "dates", ":", "datetime", ".", "date", ")", "->", "datetime", ".", "date", ":", "return", "max", "(", "*", "dates", ")" ]
Determine most recent date from list of dates.
[ "Determine", "most", "recent", "date", "from", "list", "of", "dates", "." ]
[ "\"\"\"Determine most recent date from list of dates.\n\n Args:\n *dates: Sequence of dates to check.\n\n Returns:\n Most recent date from ``*dates``.\n \"\"\"" ]
[ { "param": "dates", "type": "datetime.date" } ]
{ "returns": [ { "docstring": "Most recent date from ``*dates``.", "docstring_tokens": [ "Most", "recent", "date", "from", "`", "`", "*", "dates", "`", "`", "." ], "type": null } ], "raises": []...
e9e6e789e3f6f9f678a0d7b0387f7b7bbf31e4d0
piechottam/i-vis-core
i_vis/core/utils.py
[ "MIT" ]
Python
is_safe_url
bool
def is_safe_url(target: str) -> bool: """Check if target url is safe. Check target url to prevent cross-site scripting attacks. Args: target: An url check if it is safe. Returns: True if target is safe or False otherwise. """ ref_url = urlparse(request.host_url) test_url =...
Check if target url is safe. Check target url to prevent cross-site scripting attacks. Args: target: An url check if it is safe. Returns: True if target is safe or False otherwise.
Check if target url is safe. Check target url to prevent cross-site scripting attacks.
[ "Check", "if", "target", "url", "is", "safe", ".", "Check", "target", "url", "to", "prevent", "cross", "-", "site", "scripting", "attacks", "." ]
def is_safe_url(target: str) -> bool: ref_url = urlparse(request.host_url) test_url = urlparse(urljoin(request.host_url, target)) return test_url.scheme in ("http", "https") and ref_url.netloc == test_url.netloc
[ "def", "is_safe_url", "(", "target", ":", "str", ")", "->", "bool", ":", "ref_url", "=", "urlparse", "(", "request", ".", "host_url", ")", "test_url", "=", "urlparse", "(", "urljoin", "(", "request", ".", "host_url", ",", "target", ")", ")", "return", ...
Check if target url is safe.
[ "Check", "if", "target", "url", "is", "safe", "." ]
[ "\"\"\"Check if target url is safe.\n\n Check target url to prevent cross-site scripting attacks.\n\n Args:\n target: An url check if it is safe.\n\n Returns:\n True if target is safe or False otherwise.\n \"\"\"" ]
[ { "param": "target", "type": "str" } ]
{ "returns": [ { "docstring": "True if target is safe or False otherwise.", "docstring_tokens": [ "True", "if", "target", "is", "safe", "or", "False", "otherwise", "." ], "type": null } ], "raises": [], "para...
6089239e57c0c089ae4faaabee4bcb17623e94cc
piechottam/i-vis-core
i_vis/core/models.py
[ "MIT" ]
Python
wrap_func
Callable
def wrap_func(col: Union[str, Any], func_: Callable) -> Callable: """Wrap a function with current context of col. Args: col: func_: Returns: """ if not isinstance(col, str): col = col.key def wrapped(context) -> Callable: return func_(context.current_parameters...
Wrap a function with current context of col. Args: col: func_: Returns:
Wrap a function with current context of col.
[ "Wrap", "a", "function", "with", "current", "context", "of", "col", "." ]
def wrap_func(col: Union[str, Any], func_: Callable) -> Callable: if not isinstance(col, str): col = col.key def wrapped(context) -> Callable: return func_(context.current_parameters.get(col)) return wrapped
[ "def", "wrap_func", "(", "col", ":", "Union", "[", "str", ",", "Any", "]", ",", "func_", ":", "Callable", ")", "->", "Callable", ":", "if", "not", "isinstance", "(", "col", ",", "str", ")", ":", "col", "=", "col", ".", "key", "def", "wrapped", "(...
Wrap a function with current context of col.
[ "Wrap", "a", "function", "with", "current", "context", "of", "col", "." ]
[ "\"\"\"Wrap a function with current context of col.\n\n Args:\n col:\n func_:\n\n Returns:\n \"\"\"" ]
[ { "param": "col", "type": "Union[str, Any]" }, { "param": "func_", "type": "Callable" } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "col", "type": "Union[str, Any]", "docstring": null, "docstring_tokens": [ "None" ], "default": ...
db2ac40b486b0a7c12ede36dd4f38e573bf8c9de
znicholls/ESMValTool
esmvaltool/diag_scripts/validation.py
[ "Apache-2.0" ]
Python
plot_contour
null
def plot_contour(cube, plt_title, file_name): """Plot a contour with iris.quickplot (qplot)""" if len(cube.shape) == 2: qplt.contourf(cube, cmap='RdYlBu_r', bbox_inches='tight') else: qplt.contourf(cube[0], cmap='RdYlBu_r', bbox_inches='tight') plt.title(plt_title) plt.gca().coastlin...
Plot a contour with iris.quickplot (qplot)
Plot a contour with iris.quickplot (qplot)
[ "Plot", "a", "contour", "with", "iris", ".", "quickplot", "(", "qplot", ")" ]
def plot_contour(cube, plt_title, file_name): if len(cube.shape) == 2: qplt.contourf(cube, cmap='RdYlBu_r', bbox_inches='tight') else: qplt.contourf(cube[0], cmap='RdYlBu_r', bbox_inches='tight') plt.title(plt_title) plt.gca().coastlines() plt.tight_layout() plt.savefig(file_name...
[ "def", "plot_contour", "(", "cube", ",", "plt_title", ",", "file_name", ")", ":", "if", "len", "(", "cube", ".", "shape", ")", "==", "2", ":", "qplt", ".", "contourf", "(", "cube", ",", "cmap", "=", "'RdYlBu_r'", ",", "bbox_inches", "=", "'tight'", "...
Plot a contour with iris.quickplot (qplot)
[ "Plot", "a", "contour", "with", "iris", ".", "quickplot", "(", "qplot", ")" ]
[ "\"\"\"Plot a contour with iris.quickplot (qplot)\"\"\"" ]
[ { "param": "cube", "type": null }, { "param": "plt_title", "type": null }, { "param": "file_name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cube", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "plt_title", "type": null, "docstring": null, "docstring_token...
db2ac40b486b0a7c12ede36dd4f38e573bf8c9de
znicholls/ESMValTool
esmvaltool/diag_scripts/validation.py
[ "Apache-2.0" ]
Python
plot_zonal_cubes
null
def plot_zonal_cubes(cube_1, cube_2, cfg, plot_data): """Plot cubes data vs latitude or longitude when zonal meaning""" # xcoordinate: latotude or longitude (str) data_names, xcoordinate, period = plot_data var = data_names.split('_')[0] cube_names = [data_names.split('_')[1], data_names.split('_')[...
Plot cubes data vs latitude or longitude when zonal meaning
Plot cubes data vs latitude or longitude when zonal meaning
[ "Plot", "cubes", "data", "vs", "latitude", "or", "longitude", "when", "zonal", "meaning" ]
def plot_zonal_cubes(cube_1, cube_2, cfg, plot_data): data_names, xcoordinate, period = plot_data var = data_names.split('_')[0] cube_names = [data_names.split('_')[1], data_names.split('_')[3]] lat_points = cube_1.coord(xcoordinate).points plt.plot(lat_points, cube_1.data, label=cube_names[0]) ...
[ "def", "plot_zonal_cubes", "(", "cube_1", ",", "cube_2", ",", "cfg", ",", "plot_data", ")", ":", "data_names", ",", "xcoordinate", ",", "period", "=", "plot_data", "var", "=", "data_names", ".", "split", "(", "'_'", ")", "[", "0", "]", "cube_names", "=",...
Plot cubes data vs latitude or longitude when zonal meaning
[ "Plot", "cubes", "data", "vs", "latitude", "or", "longitude", "when", "zonal", "meaning" ]
[ "\"\"\"Plot cubes data vs latitude or longitude when zonal meaning\"\"\"", "# xcoordinate: latotude or longitude (str)" ]
[ { "param": "cube_1", "type": null }, { "param": "cube_2", "type": null }, { "param": "cfg", "type": null }, { "param": "plot_data", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cube_1", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cube_2", "type": null, "docstring": null, "docstring_tokens...
db2ac40b486b0a7c12ede36dd4f38e573bf8c9de
znicholls/ESMValTool
esmvaltool/diag_scripts/validation.py
[ "Apache-2.0" ]
Python
apply_seasons
<not_specific>
def apply_seasons(data_set_dict): """Extract seaons and apply a time mean per season""" data_file = data_set_dict['filename'] logger.info("Loading %s for seasonal extraction", data_file) data_cube = iris.load_cube(data_file) seasons = ['DJF', 'MAM', 'JJA', 'SON'] season_cubes = [extract_season(d...
Extract seaons and apply a time mean per season
Extract seaons and apply a time mean per season
[ "Extract", "seaons", "and", "apply", "a", "time", "mean", "per", "season" ]
def apply_seasons(data_set_dict): data_file = data_set_dict['filename'] logger.info("Loading %s for seasonal extraction", data_file) data_cube = iris.load_cube(data_file) seasons = ['DJF', 'MAM', 'JJA', 'SON'] season_cubes = [extract_season(data_cube, season) for season in seasons] season_meaned...
[ "def", "apply_seasons", "(", "data_set_dict", ")", ":", "data_file", "=", "data_set_dict", "[", "'filename'", "]", "logger", ".", "info", "(", "\"Loading %s for seasonal extraction\"", ",", "data_file", ")", "data_cube", "=", "iris", ".", "load_cube", "(", "data_f...
Extract seaons and apply a time mean per season
[ "Extract", "seaons", "and", "apply", "a", "time", "mean", "per", "season" ]
[ "\"\"\"Extract seaons and apply a time mean per season\"\"\"" ]
[ { "param": "data_set_dict", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data_set_dict", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
db2ac40b486b0a7c12ede36dd4f38e573bf8c9de
znicholls/ESMValTool
esmvaltool/diag_scripts/validation.py
[ "Apache-2.0" ]
Python
coordinate_collapse
<not_specific>
def coordinate_collapse(data_set, cfg): """Perform coordinate-specific collapse and (if) area slicing and mask""" # see what analysis needs performing analysis_type = cfg['analysis_type'] # if subset on LAT-LON if 'lat_lon_slice' in cfg: start_longitude = cfg['lat_lon_slice']['start_longitu...
Perform coordinate-specific collapse and (if) area slicing and mask
Perform coordinate-specific collapse and (if) area slicing and mask
[ "Perform", "coordinate", "-", "specific", "collapse", "and", "(", "if", ")", "area", "slicing", "and", "mask" ]
def coordinate_collapse(data_set, cfg): analysis_type = cfg['analysis_type'] if 'lat_lon_slice' in cfg: start_longitude = cfg['lat_lon_slice']['start_longitude'] end_longitude = cfg['lat_lon_slice']['end_longitude'] start_latitude = cfg['lat_lon_slice']['start_latitude'] end_lati...
[ "def", "coordinate_collapse", "(", "data_set", ",", "cfg", ")", ":", "analysis_type", "=", "cfg", "[", "'analysis_type'", "]", "if", "'lat_lon_slice'", "in", "cfg", ":", "start_longitude", "=", "cfg", "[", "'lat_lon_slice'", "]", "[", "'start_longitude'", "]", ...
Perform coordinate-specific collapse and (if) area slicing and mask
[ "Perform", "coordinate", "-", "specific", "collapse", "and", "(", "if", ")", "area", "slicing", "and", "mask" ]
[ "\"\"\"Perform coordinate-specific collapse and (if) area slicing and mask\"\"\"", "# see what analysis needs performing", "# if subset on LAT-LON", "# if apply mask", "# if zonal mean on LON", "# if zonal mean on LAT", "# if vertical mean" ]
[ { "param": "data_set", "type": null }, { "param": "cfg", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data_set", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cfg", "type": null, "docstring": null, "docstring_tokens"...
db2ac40b486b0a7c12ede36dd4f38e573bf8c9de
znicholls/ESMValTool
esmvaltool/diag_scripts/validation.py
[ "Apache-2.0" ]
Python
plot_ctrl_exper
null
def plot_ctrl_exper(ctrl, exper, cfg, plot_key): """Call plotting functions and make plots depending on case""" if cfg['analysis_type'] == 'lat_lon': plot_latlon_cubes(ctrl, exper, cfg, plot_key) elif cfg['analysis_type'] == 'zonal_mean': plot_info = [plot_key, 'latitude', 'alltime'] ...
Call plotting functions and make plots depending on case
Call plotting functions and make plots depending on case
[ "Call", "plotting", "functions", "and", "make", "plots", "depending", "on", "case" ]
def plot_ctrl_exper(ctrl, exper, cfg, plot_key): if cfg['analysis_type'] == 'lat_lon': plot_latlon_cubes(ctrl, exper, cfg, plot_key) elif cfg['analysis_type'] == 'zonal_mean': plot_info = [plot_key, 'latitude', 'alltime'] plot_zonal_cubes(ctrl, exper, cfg, plot_info) elif cfg['analys...
[ "def", "plot_ctrl_exper", "(", "ctrl", ",", "exper", ",", "cfg", ",", "plot_key", ")", ":", "if", "cfg", "[", "'analysis_type'", "]", "==", "'lat_lon'", ":", "plot_latlon_cubes", "(", "ctrl", ",", "exper", ",", "cfg", ",", "plot_key", ")", "elif", "cfg",...
Call plotting functions and make plots depending on case
[ "Call", "plotting", "functions", "and", "make", "plots", "depending", "on", "case" ]
[ "\"\"\"Call plotting functions and make plots depending on case\"\"\"" ]
[ { "param": "ctrl", "type": null }, { "param": "exper", "type": null }, { "param": "cfg", "type": null }, { "param": "plot_key", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ctrl", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "exper", "type": null, "docstring": null, "docstring_tokens": ...
db2ac40b486b0a7c12ede36dd4f38e573bf8c9de
znicholls/ESMValTool
esmvaltool/diag_scripts/validation.py
[ "Apache-2.0" ]
Python
plot_ctrl_exper_seasons
null
def plot_ctrl_exper_seasons(ctrl_seasons, exper_seasons, cfg, plot_key): """Call plotting functions and make plots with seasons""" seasons = ['DJF', 'MAM', 'JJA', 'SON'] if cfg['analysis_type'] == 'zonal_mean': for c_i, e_i, s_n in zip(ctrl_seasons, exper_seasons, seasons): plot_info = [...
Call plotting functions and make plots with seasons
Call plotting functions and make plots with seasons
[ "Call", "plotting", "functions", "and", "make", "plots", "with", "seasons" ]
def plot_ctrl_exper_seasons(ctrl_seasons, exper_seasons, cfg, plot_key): seasons = ['DJF', 'MAM', 'JJA', 'SON'] if cfg['analysis_type'] == 'zonal_mean': for c_i, e_i, s_n in zip(ctrl_seasons, exper_seasons, seasons): plot_info = [plot_key, 'latitude', s_n] plot_zonal_cubes(c_i, e...
[ "def", "plot_ctrl_exper_seasons", "(", "ctrl_seasons", ",", "exper_seasons", ",", "cfg", ",", "plot_key", ")", ":", "seasons", "=", "[", "'DJF'", ",", "'MAM'", ",", "'JJA'", ",", "'SON'", "]", "if", "cfg", "[", "'analysis_type'", "]", "==", "'zonal_mean'", ...
Call plotting functions and make plots with seasons
[ "Call", "plotting", "functions", "and", "make", "plots", "with", "seasons" ]
[ "\"\"\"Call plotting functions and make plots with seasons\"\"\"" ]
[ { "param": "ctrl_seasons", "type": null }, { "param": "exper_seasons", "type": null }, { "param": "cfg", "type": null }, { "param": "plot_key", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ctrl_seasons", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "exper_seasons", "type": null, "docstring": null, "doc...
ec6c9cda693af675eb71f39aa0b8a3cdce011f7a
znicholls/ESMValTool
esmvaltool/diag_scripts/thermodyn_diagtool/provenance_meta.py
[ "Apache-2.0" ]
Python
meta_direntr
null
def meta_direntr(cfg, model, inlist, flist): """Write metadata to components of the direct entropy prod maps. Arguments:r - model: the name of the model; - inlist: the list of the input filenames; - flist: the list of the entropy filenames; @author: Valerio Lembo, University of Hamburg, 2019. ...
Write metadata to components of the direct entropy prod maps. Arguments:r - model: the name of the model; - inlist: the list of the input filenames; - flist: the list of the entropy filenames; @author: Valerio Lembo, University of Hamburg, 2019.
Write metadata to components of the direct entropy prod maps. Arguments:r model: the name of the model; inlist: the list of the input filenames; flist: the list of the entropy filenames.
[ "Write", "metadata", "to", "components", "of", "the", "direct", "entropy", "prod", "maps", ".", "Arguments", ":", "r", "model", ":", "the", "name", "of", "the", "model", ";", "inlist", ":", "the", "list", "of", "the", "input", "filenames", ";", "flist", ...
def meta_direntr(cfg, model, inlist, flist): with ProvenanceLogger(cfg) as provlog: attr = ['sensible heat entropy production', model] ancestor = [ inlist[1], inlist[2], inlist[5], inlist[15], inlist[17], inlist[19] ] record = get_prov_map(attr, ancestor) prov...
[ "def", "meta_direntr", "(", "cfg", ",", "model", ",", "inlist", ",", "flist", ")", ":", "with", "ProvenanceLogger", "(", "cfg", ")", "as", "provlog", ":", "attr", "=", "[", "'sensible heat entropy production'", ",", "model", "]", "ancestor", "=", "[", "inl...
Write metadata to components of the direct entropy prod maps.
[ "Write", "metadata", "to", "components", "of", "the", "direct", "entropy", "prod", "maps", "." ]
[ "\"\"\"Write metadata to components of the direct entropy prod maps.\n\n Arguments:r\n - model: the name of the model;\n - inlist: the list of the input filenames;\n - flist: the list of the entropy filenames;\n\n @author: Valerio Lembo, University of Hamburg, 2019.\n \"\"\"" ]
[ { "param": "cfg", "type": null }, { "param": "model", "type": null }, { "param": "inlist", "type": null }, { "param": "flist", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cfg", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "model", "type": null, "docstring": null, "docstring_tokens": [...
ec6c9cda693af675eb71f39aa0b8a3cdce011f7a
znicholls/ESMValTool
esmvaltool/diag_scripts/thermodyn_diagtool/provenance_meta.py
[ "Apache-2.0" ]
Python
meta_indentr
null
def meta_indentr(cfg, model, inlist, flist): """Write metadata to components of the indirect entropy prod maps. Arguments: - model: the name of the model; - inlist: the list of the input filenames; - flist: the list of the entropy filenames; @author: Valerio Lembo, University of Hamburg, 2019....
Write metadata to components of the indirect entropy prod maps. Arguments: - model: the name of the model; - inlist: the list of the input filenames; - flist: the list of the entropy filenames; @author: Valerio Lembo, University of Hamburg, 2019.
Write metadata to components of the indirect entropy prod maps. Arguments: model: the name of the model; inlist: the list of the input filenames; flist: the list of the entropy filenames.
[ "Write", "metadata", "to", "components", "of", "the", "indirect", "entropy", "prod", "maps", ".", "Arguments", ":", "model", ":", "the", "name", "of", "the", "model", ";", "inlist", ":", "the", "list", "of", "the", "input", "filenames", ";", "flist", ":"...
def meta_indentr(cfg, model, inlist, flist): with ProvenanceLogger(cfg) as provlog: attr = ['horizontal entropy production', model] ancestor = [inlist[8], inlist[10], inlist[12]] record = get_prov_map(attr, ancestor) provlog.log(flist[0], record) attr = ['vertical entropy pro...
[ "def", "meta_indentr", "(", "cfg", ",", "model", ",", "inlist", ",", "flist", ")", ":", "with", "ProvenanceLogger", "(", "cfg", ")", "as", "provlog", ":", "attr", "=", "[", "'horizontal entropy production'", ",", "model", "]", "ancestor", "=", "[", "inlist...
Write metadata to components of the indirect entropy prod maps.
[ "Write", "metadata", "to", "components", "of", "the", "indirect", "entropy", "prod", "maps", "." ]
[ "\"\"\"Write metadata to components of the indirect entropy prod maps.\n\n Arguments:\n - model: the name of the model;\n - inlist: the list of the input filenames;\n - flist: the list of the entropy filenames;\n\n @author: Valerio Lembo, University of Hamburg, 2019.\n \"\"\"" ]
[ { "param": "cfg", "type": null }, { "param": "model", "type": null }, { "param": "inlist", "type": null }, { "param": "flist", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cfg", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "model", "type": null, "docstring": null, "docstring_tokens": [...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
add_ee_layer
null
def add_ee_layer( self, ee_object, vis_params={}, name=None, shown=True, opacity=1.0 ): """Adds a given EE object to the map as a layer. Args: ee_object (Collection|Feature|Image|MapId): The object to add to the map. vis_params (dict, optional): The visualizat...
Adds a given EE object to the map as a layer. Args: ee_object (Collection|Feature|Image|MapId): The object to add to the map. vis_params (dict, optional): The visualization parameters. Defaults to {}. name (str, optional): The name of the layer. Defaults to 'Layer N'. ...
Adds a given EE object to the map as a layer.
[ "Adds", "a", "given", "EE", "object", "to", "the", "map", "as", "a", "layer", "." ]
def add_ee_layer( self, ee_object, vis_params={}, name=None, shown=True, opacity=1.0 ): image = None if vis_params is None: vis_params = {} if name is None: layer_count = len(self.layers) name = "Layer " + str(layer_count + 1) if ( ...
[ "def", "add_ee_layer", "(", "self", ",", "ee_object", ",", "vis_params", "=", "{", "}", ",", "name", "=", "None", ",", "shown", "=", "True", ",", "opacity", "=", "1.0", ")", ":", "image", "=", "None", "if", "vis_params", "is", "None", ":", "vis_param...
Adds a given EE object to the map as a layer.
[ "Adds", "a", "given", "EE", "object", "to", "the", "map", "as", "a", "layer", "." ]
[ "\"\"\"Adds a given EE object to the map as a layer.\r\n\r\n Args:\r\n ee_object (Collection|Feature|Image|MapId): The object to add to the map.\r\n vis_params (dict, optional): The visualization parameters. Defaults to {}.\r\n name (str, optional): The name of the layer. Def...
[ { "param": "self", "type": null }, { "param": "ee_object", "type": null }, { "param": "vis_params", "type": null }, { "param": "name", "type": null }, { "param": "shown", "type": null }, { "param": "opacity", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ee_object", "type": null, "docstring": "The object to add to the ma...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
remove_ee_layer
null
def remove_ee_layer(self, name): """Removes an Earth Engine layer. Args: name (str): The name of the Earth Engine layer to remove. """ if name in self.ee_layer_dict: ee_object = self.ee_layer_dict[name]["ee_object"] ee_layer = self.ee_layer_di...
Removes an Earth Engine layer. Args: name (str): The name of the Earth Engine layer to remove.
Removes an Earth Engine layer.
[ "Removes", "an", "Earth", "Engine", "layer", "." ]
def remove_ee_layer(self, name): if name in self.ee_layer_dict: ee_object = self.ee_layer_dict[name]["ee_object"] ee_layer = self.ee_layer_dict[name]["ee_layer"] if name in self.ee_raster_layer_names: self.ee_raster_layer_names.remove(name) sel...
[ "def", "remove_ee_layer", "(", "self", ",", "name", ")", ":", "if", "name", "in", "self", ".", "ee_layer_dict", ":", "ee_object", "=", "self", ".", "ee_layer_dict", "[", "name", "]", "[", "\"ee_object\"", "]", "ee_layer", "=", "self", ".", "ee_layer_dict",...
Removes an Earth Engine layer.
[ "Removes", "an", "Earth", "Engine", "layer", "." ]
[ "\"\"\"Removes an Earth Engine layer.\r\n\r\n Args:\r\n name (str): The name of the Earth Engine layer to remove.\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": "The name of the Earth Engine lay...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
draw_layer_on_top
null
def draw_layer_on_top(self): """Move user-drawn feature layer to the top of all layers.""" draw_layer_index = self.find_layer_index(name="Drawn Features") if draw_layer_index > -1 and draw_layer_index < (len(self.layers) - 1): layers = list(self.layers) layers = ( ...
Move user-drawn feature layer to the top of all layers.
Move user-drawn feature layer to the top of all layers.
[ "Move", "user", "-", "drawn", "feature", "layer", "to", "the", "top", "of", "all", "layers", "." ]
def draw_layer_on_top(self): draw_layer_index = self.find_layer_index(name="Drawn Features") if draw_layer_index > -1 and draw_layer_index < (len(self.layers) - 1): layers = list(self.layers) layers = ( layers[0:draw_layer_index] + layers[(draw_lay...
[ "def", "draw_layer_on_top", "(", "self", ")", ":", "draw_layer_index", "=", "self", ".", "find_layer_index", "(", "name", "=", "\"Drawn Features\"", ")", "if", "draw_layer_index", ">", "-", "1", "and", "draw_layer_index", "<", "(", "len", "(", "self", ".", "...
Move user-drawn feature layer to the top of all layers.
[ "Move", "user", "-", "drawn", "feature", "layer", "to", "the", "top", "of", "all", "layers", "." ]
[ "\"\"\"Move user-drawn feature layer to the top of all layers.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
center_object
null
def center_object(self, ee_object, zoom=None): """Centers the map view on a given object. Args: ee_object (Element|Geometry): An Earth Engine object to center on a geometry, image or feature. zoom (int, optional): The zoom level, from 1 to 24. Defaults to None. """...
Centers the map view on a given object. Args: ee_object (Element|Geometry): An Earth Engine object to center on a geometry, image or feature. zoom (int, optional): The zoom level, from 1 to 24. Defaults to None.
Centers the map view on a given object.
[ "Centers", "the", "map", "view", "on", "a", "given", "object", "." ]
def center_object(self, ee_object, zoom=None): maxError = 0.001 if isinstance(ee_object, ee.Geometry): geometry = ee_object.transform(maxError=maxError) else: try: geometry = ee_object.geometry(maxError=maxError).transform( maxError=max...
[ "def", "center_object", "(", "self", ",", "ee_object", ",", "zoom", "=", "None", ")", ":", "maxError", "=", "0.001", "if", "isinstance", "(", "ee_object", ",", "ee", ".", "Geometry", ")", ":", "geometry", "=", "ee_object", ".", "transform", "(", "maxErro...
Centers the map view on a given object.
[ "Centers", "the", "map", "view", "on", "a", "given", "object", "." ]
[ "\"\"\"Centers the map view on a given object.\r\n\r\n Args:\r\n ee_object (Element|Geometry): An Earth Engine object to center on a geometry, image or feature.\r\n zoom (int, optional): The zoom level, from 1 to 24. Defaults to None.\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "ee_object", "type": null }, { "param": "zoom", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ee_object", "type": null, "docstring": "An Earth Engine object to c...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
zoom_to_me
null
def zoom_to_me(self, zoom=14, add_marker=True): """Zoom to the current device location. Args: zoom (int, optional): Zoom level. Defaults to 14. add_marker (bool, optional): Whether to add a marker of the current device location. Defaults to True. """ lat, ...
Zoom to the current device location. Args: zoom (int, optional): Zoom level. Defaults to 14. add_marker (bool, optional): Whether to add a marker of the current device location. Defaults to True.
Zoom to the current device location.
[ "Zoom", "to", "the", "current", "device", "location", "." ]
def zoom_to_me(self, zoom=14, add_marker=True): lat, lon = get_current_latlon() self.set_center(lon, lat, zoom) if add_marker: marker = ipyleaflet.Marker( location=(lat, lon), draggable=False, name="Device location", ) ...
[ "def", "zoom_to_me", "(", "self", ",", "zoom", "=", "14", ",", "add_marker", "=", "True", ")", ":", "lat", ",", "lon", "=", "get_current_latlon", "(", ")", "self", ".", "set_center", "(", "lon", ",", "lat", ",", "zoom", ")", "if", "add_marker", ":", ...
Zoom to the current device location.
[ "Zoom", "to", "the", "current", "device", "location", "." ]
[ "\"\"\"Zoom to the current device location.\r\n\r\n Args:\r\n zoom (int, optional): Zoom level. Defaults to 14.\r\n add_marker (bool, optional): Whether to add a marker of the current device location. Defaults to True.\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "zoom", "type": null }, { "param": "add_marker", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "zoom", "type": null, "docstring": "Zoom level. Defaults to 14.", ...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
zoom_to_gdf
null
def zoom_to_gdf(self, gdf): """Zooms to the bounding box of a GeoPandas GeoDataFrame. Args: gdf (GeoDataFrame): A GeoPandas GeoDataFrame. """ bounds = gdf.total_bounds self.zoom_to_bounds(bounds)
Zooms to the bounding box of a GeoPandas GeoDataFrame. Args: gdf (GeoDataFrame): A GeoPandas GeoDataFrame.
Zooms to the bounding box of a GeoPandas GeoDataFrame.
[ "Zooms", "to", "the", "bounding", "box", "of", "a", "GeoPandas", "GeoDataFrame", "." ]
def zoom_to_gdf(self, gdf): bounds = gdf.total_bounds self.zoom_to_bounds(bounds)
[ "def", "zoom_to_gdf", "(", "self", ",", "gdf", ")", ":", "bounds", "=", "gdf", ".", "total_bounds", "self", ".", "zoom_to_bounds", "(", "bounds", ")" ]
Zooms to the bounding box of a GeoPandas GeoDataFrame.
[ "Zooms", "to", "the", "bounding", "box", "of", "a", "GeoPandas", "GeoDataFrame", "." ]
[ "\"\"\"Zooms to the bounding box of a GeoPandas GeoDataFrame.\r\n\r\n Args:\r\n gdf (GeoDataFrame): A GeoPandas GeoDataFrame.\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "gdf", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "gdf", "type": null, "docstring": "A GeoPandas GeoDataFrame.", ...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
add_basemap
null
def add_basemap(self, basemap="HYBRID"): """Adds a basemap to the map. Args: basemap (str, optional): Can be one of string from basemaps. Defaults to 'HYBRID'. """ try: if ( basemap in basemap_tiles.keys() and basemap_tile...
Adds a basemap to the map. Args: basemap (str, optional): Can be one of string from basemaps. Defaults to 'HYBRID'.
Adds a basemap to the map.
[ "Adds", "a", "basemap", "to", "the", "map", "." ]
def add_basemap(self, basemap="HYBRID"): try: if ( basemap in basemap_tiles.keys() and basemap_tiles[basemap] not in self.layers ): self.add_layer(basemap_tiles[basemap]) except Exception: raise ValueError( ...
[ "def", "add_basemap", "(", "self", ",", "basemap", "=", "\"HYBRID\"", ")", ":", "try", ":", "if", "(", "basemap", "in", "basemap_tiles", ".", "keys", "(", ")", "and", "basemap_tiles", "[", "basemap", "]", "not", "in", "self", ".", "layers", ")", ":", ...
Adds a basemap to the map.
[ "Adds", "a", "basemap", "to", "the", "map", "." ]
[ "\"\"\"Adds a basemap to the map.\r\n\r\n Args:\r\n basemap (str, optional): Can be one of string from basemaps. Defaults to 'HYBRID'.\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "basemap", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "basemap", "type": null, "docstring": "Can be one of string from bas...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
add_marker
null
def add_marker(self, location, **kwargs): """Adds a marker to the map. More info about marker at https://ipyleaflet.readthedocs.io/en/latest/api_reference/marker.html. Args: location (list | tuple): The location of the marker in the format of [lat, lng]. **kwargs: Keyword...
Adds a marker to the map. More info about marker at https://ipyleaflet.readthedocs.io/en/latest/api_reference/marker.html. Args: location (list | tuple): The location of the marker in the format of [lat, lng]. **kwargs: Keyword arguments for the marker.
Adds a marker to the map.
[ "Adds", "a", "marker", "to", "the", "map", "." ]
def add_marker(self, location, **kwargs): if isinstance(location, list): location = tuple(location) if isinstance(location, tuple): marker = ipyleaflet.Marker(location=location, **kwargs) self.add_layer(marker) else: raise TypeError("The location m...
[ "def", "add_marker", "(", "self", ",", "location", ",", "**", "kwargs", ")", ":", "if", "isinstance", "(", "location", ",", "list", ")", ":", "location", "=", "tuple", "(", "location", ")", "if", "isinstance", "(", "location", ",", "tuple", ")", ":", ...
Adds a marker to the map.
[ "Adds", "a", "marker", "to", "the", "map", "." ]
[ "\"\"\"Adds a marker to the map. More info about marker at https://ipyleaflet.readthedocs.io/en/latest/api_reference/marker.html.\r\n\r\n Args:\r\n location (list | tuple): The location of the marker in the format of [lat, lng].\r\n\r\n **kwargs: Keyword arguments for the marker.\r\n ...
[ { "param": "self", "type": null }, { "param": "location", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "location", "type": null, "docstring": "The location of the marker i...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
add_tile_layer
null
def add_tile_layer( self, url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", name="Untitled", attribution="", opacity=1.0, shown=True, **kwargs, ): """Adds a TileLayer to the map. Args: url (str, optional): The U...
Adds a TileLayer to the map. Args: url (str, optional): The URL of the tile layer. Defaults to 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'. name (str, optional): The layer name to use for the layer. Defaults to 'Untitled'. attribution (str, optional): The attri...
Adds a TileLayer to the map.
[ "Adds", "a", "TileLayer", "to", "the", "map", "." ]
def add_tile_layer( self, url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", name="Untitled", attribution="", opacity=1.0, shown=True, **kwargs, ): try: tile_layer = ipyleaflet.TileLayer( url=url, name...
[ "def", "add_tile_layer", "(", "self", ",", "url", "=", "\"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\"", ",", "name", "=", "\"Untitled\"", ",", "attribution", "=", "\"\"", ",", "opacity", "=", "1.0", ",", "shown", "=", "True", ",", "**", "kwargs", ",", ...
Adds a TileLayer to the map.
[ "Adds", "a", "TileLayer", "to", "the", "map", "." ]
[ "\"\"\"Adds a TileLayer to the map.\r\n\r\n Args:\r\n url (str, optional): The URL of the tile layer. Defaults to 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'.\r\n name (str, optional): The layer name to use for the layer. Defaults to 'Untitled'.\r\n attribution (str,...
[ { "param": "self", "type": null }, { "param": "url", "type": null }, { "param": "name", "type": null }, { "param": "attribution", "type": null }, { "param": "opacity", "type": null }, { "param": "shown", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "url", "type": null, "docstring": "The URL of the tile layer. Defaul...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
add_cog_layer
null
def add_cog_layer( self, url, name="Untitled", attribution="", opacity=1.0, shown=True, bands=None, titiler_endpoint="https://titiler.xyz", **kwargs, ): """Adds a COG TileLayer to the map. Args: url (s...
Adds a COG TileLayer to the map. Args: url (str): The URL of the COG tile layer. name (str, optional): The layer name to use for the layer. Defaults to 'Untitled'. attribution (str, optional): The attribution to use. Defaults to ''. opacity (float, optional...
Adds a COG TileLayer to the map.
[ "Adds", "a", "COG", "TileLayer", "to", "the", "map", "." ]
def add_cog_layer( self, url, name="Untitled", attribution="", opacity=1.0, shown=True, bands=None, titiler_endpoint="https://titiler.xyz", **kwargs, ): tile_url = cog_tile(url, bands, titiler_endpoint, **kwargs) bounds = cog_bo...
[ "def", "add_cog_layer", "(", "self", ",", "url", ",", "name", "=", "\"Untitled\"", ",", "attribution", "=", "\"\"", ",", "opacity", "=", "1.0", ",", "shown", "=", "True", ",", "bands", "=", "None", ",", "titiler_endpoint", "=", "\"https://titiler.xyz\"", "...
Adds a COG TileLayer to the map.
[ "Adds", "a", "COG", "TileLayer", "to", "the", "map", "." ]
[ "\"\"\"Adds a COG TileLayer to the map.\r\n\r\n Args:\r\n url (str): The URL of the COG tile layer.\r\n name (str, optional): The layer name to use for the layer. Defaults to 'Untitled'.\r\n attribution (str, optional): The attribution to use. Defaults to ''.\r\n o...
[ { "param": "self", "type": null }, { "param": "url", "type": null }, { "param": "name", "type": null }, { "param": "attribution", "type": null }, { "param": "opacity", "type": null }, { "param": "shown", "type": null }, { "param": "bands", ...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "url", "type": null, "docstring": "The URL of the COG tile layer.", ...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
add_stac_layer
null
def add_stac_layer( self, url=None, collection=None, item=None, assets=None, bands=None, titiler_endpoint=None, name="STAC Layer", attribution="", opacity=1.0, shown=True, **kwargs, ): """Adds a STA...
Adds a STAC TileLayer to the map. Args: url (str): HTTP URL to a STAC item, e.g., https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json collection (str): The Microsoft Planetary Computer...
Adds a STAC TileLayer to the map.
[ "Adds", "a", "STAC", "TileLayer", "to", "the", "map", "." ]
def add_stac_layer( self, url=None, collection=None, item=None, assets=None, bands=None, titiler_endpoint=None, name="STAC Layer", attribution="", opacity=1.0, shown=True, **kwargs, ): tile_url = stac_tile( ...
[ "def", "add_stac_layer", "(", "self", ",", "url", "=", "None", ",", "collection", "=", "None", ",", "item", "=", "None", ",", "assets", "=", "None", ",", "bands", "=", "None", ",", "titiler_endpoint", "=", "None", ",", "name", "=", "\"STAC Layer\"", ",...
Adds a STAC TileLayer to the map.
[ "Adds", "a", "STAC", "TileLayer", "to", "the", "map", "." ]
[ "\"\"\"Adds a STAC TileLayer to the map.\r\n\r\n Args:\r\n url (str): HTTP URL to a STAC item, e.g., https://canada-spot-ortho.s3.amazonaws.com/canada_spot_orthoimages/canada_spot5_orthoimages/S5_2007/S5_11055_6057_20070622/S5_11055_6057_20070622.json\r\n collection (str): The Microsoft...
[ { "param": "self", "type": null }, { "param": "url", "type": null }, { "param": "collection", "type": null }, { "param": "item", "type": null }, { "param": "assets", "type": null }, { "param": "bands", "type": null }, { "param": "titiler_en...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "url", "type": null, "docstring": null, "docstring_tokens": [ ...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
add_minimap
null
def add_minimap(self, zoom=5, position="bottomright"): """Adds a minimap (overview) to the ipyleaflet map. Args: zoom (int, optional): Initial map zoom level. Defaults to 5. position (str, optional): Position of the minimap. Defaults to "bottomright". """ ...
Adds a minimap (overview) to the ipyleaflet map. Args: zoom (int, optional): Initial map zoom level. Defaults to 5. position (str, optional): Position of the minimap. Defaults to "bottomright".
Adds a minimap (overview) to the ipyleaflet map.
[ "Adds", "a", "minimap", "(", "overview", ")", "to", "the", "ipyleaflet", "map", "." ]
def add_minimap(self, zoom=5, position="bottomright"): minimap = ipyleaflet.Map( zoom_control=False, attribution_control=False, zoom=zoom, center=self.center, layers=[basemap_tiles["ROADMAP"]], ) minimap.layout.width = "150px" m...
[ "def", "add_minimap", "(", "self", ",", "zoom", "=", "5", ",", "position", "=", "\"bottomright\"", ")", ":", "minimap", "=", "ipyleaflet", ".", "Map", "(", "zoom_control", "=", "False", ",", "attribution_control", "=", "False", ",", "zoom", "=", "zoom", ...
Adds a minimap (overview) to the ipyleaflet map.
[ "Adds", "a", "minimap", "(", "overview", ")", "to", "the", "ipyleaflet", "map", "." ]
[ "\"\"\"Adds a minimap (overview) to the ipyleaflet map.\r\n\r\n Args:\r\n zoom (int, optional): Initial map zoom level. Defaults to 5.\r\n position (str, optional): Position of the minimap. Defaults to \"bottomright\".\r\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "zoom", "type": null }, { "param": "position", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "zoom", "type": null, "docstring": "Initial map zoom level. Defaults...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
marker_cluster
null
def marker_cluster(self): """Adds a marker cluster to the map and returns a list of ee.Feature, which can be accessed using Map.ee_marker_cluster. Returns: object: a list of ee.Feature """ coordinates = [] markers = [] marker_cluster = ipyleaflet.Mark...
Adds a marker cluster to the map and returns a list of ee.Feature, which can be accessed using Map.ee_marker_cluster. Returns: object: a list of ee.Feature
Adds a marker cluster to the map and returns a list of ee.Feature, which can be accessed using Map.ee_marker_cluster.
[ "Adds", "a", "marker", "cluster", "to", "the", "map", "and", "returns", "a", "list", "of", "ee", ".", "Feature", "which", "can", "be", "accessed", "using", "Map", ".", "ee_marker_cluster", "." ]
def marker_cluster(self): coordinates = [] markers = [] marker_cluster = ipyleaflet.MarkerCluster(name="Marker Cluster") self.last_click = [] self.all_clicks = [] self.ee_markers = [] self.add_layer(marker_cluster) def handle_interaction(**kwargs): ...
[ "def", "marker_cluster", "(", "self", ")", ":", "coordinates", "=", "[", "]", "markers", "=", "[", "]", "marker_cluster", "=", "ipyleaflet", ".", "MarkerCluster", "(", "name", "=", "\"Marker Cluster\"", ")", "self", ".", "last_click", "=", "[", "]", "self"...
Adds a marker cluster to the map and returns a list of ee.Feature, which can be accessed using Map.ee_marker_cluster.
[ "Adds", "a", "marker", "cluster", "to", "the", "map", "and", "returns", "a", "list", "of", "ee", ".", "Feature", "which", "can", "be", "accessed", "using", "Map", ".", "ee_marker_cluster", "." ]
[ "\"\"\"Adds a marker cluster to the map and returns a list of ee.Feature, which can be accessed using Map.ee_marker_cluster.\r\n\r\n Returns:\r\n object: a list of ee.Feature\r\n \"\"\"", "# cursor style: https://www.w3schools.com/cssref/pr_class_cursor.asp\r" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": "a list of ee.Feature", "docstring_tokens": [ "a", "list", "of", "ee", ".", "Feature" ], "type": "object" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docs...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
add_marker_cluster
null
def add_marker_cluster(self, event="click", add_marker=True): """Captures user inputs and add markers to the map. Args: event (str, optional): [description]. Defaults to 'click'. add_marker (bool, optional): If True, add markers to the map. Defaults to True. Retu...
Captures user inputs and add markers to the map. Args: event (str, optional): [description]. Defaults to 'click'. add_marker (bool, optional): If True, add markers to the map. Defaults to True. Returns: object: a marker cluster.
Captures user inputs and add markers to the map.
[ "Captures", "user", "inputs", "and", "add", "markers", "to", "the", "map", "." ]
def add_marker_cluster(self, event="click", add_marker=True): coordinates = [] markers = [] marker_cluster = ipyleaflet.MarkerCluster(name="Marker Cluster") self.last_click = [] self.all_clicks = [] if add_marker: self.add_layer(marker_cluster) def han...
[ "def", "add_marker_cluster", "(", "self", ",", "event", "=", "\"click\"", ",", "add_marker", "=", "True", ")", ":", "coordinates", "=", "[", "]", "markers", "=", "[", "]", "marker_cluster", "=", "ipyleaflet", ".", "MarkerCluster", "(", "name", "=", "\"Mark...
Captures user inputs and add markers to the map.
[ "Captures", "user", "inputs", "and", "add", "markers", "to", "the", "map", "." ]
[ "\"\"\"Captures user inputs and add markers to the map.\r\n\r\n Args:\r\n event (str, optional): [description]. Defaults to 'click'.\r\n add_marker (bool, optional): If True, add markers to the map. Defaults to True.\r\n\r\n Returns:\r\n object: a marker cluster.\r\n ...
[ { "param": "self", "type": null }, { "param": "event", "type": null }, { "param": "add_marker", "type": null } ]
{ "returns": [ { "docstring": "a marker cluster.", "docstring_tokens": [ "a", "marker", "cluster", "." ], "type": "object" } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstrin...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
ts_inspector
<not_specific>
def ts_inspector( self, left_ts, right_ts, left_names, right_names, left_vis={}, right_vis={}, width="130px", **kwargs, ): """Creates a split-panel map for inspecting timeseries images. Args: left_ts (...
Creates a split-panel map for inspecting timeseries images. Args: left_ts (object): An ee.ImageCollection to show on the left panel. right_ts (object): An ee.ImageCollection to show on the right panel. left_names (list): A list of names to show under the left dropdown. ...
Creates a split-panel map for inspecting timeseries images.
[ "Creates", "a", "split", "-", "panel", "map", "for", "inspecting", "timeseries", "images", "." ]
def ts_inspector( self, left_ts, right_ts, left_names, right_names, left_vis={}, right_vis={}, width="130px", **kwargs, ): controls = self.controls layers = self.layers left_count = int(left_ts.size().getInfo()) ...
[ "def", "ts_inspector", "(", "self", ",", "left_ts", ",", "right_ts", ",", "left_names", ",", "right_names", ",", "left_vis", "=", "{", "}", ",", "right_vis", "=", "{", "}", ",", "width", "=", "\"130px\"", ",", "**", "kwargs", ",", ")", ":", "controls",...
Creates a split-panel map for inspecting timeseries images.
[ "Creates", "a", "split", "-", "panel", "map", "for", "inspecting", "timeseries", "images", "." ]
[ "\"\"\"Creates a split-panel map for inspecting timeseries images.\r\n\r\n Args:\r\n left_ts (object): An ee.ImageCollection to show on the left panel.\r\n right_ts (object): An ee.ImageCollection to show on the right panel.\r\n left_names (list): A list of names to show unde...
[ { "param": "self", "type": null }, { "param": "left_ts", "type": null }, { "param": "right_ts", "type": null }, { "param": "left_names", "type": null }, { "param": "right_names", "type": null }, { "param": "left_vis", "type": null }, { "par...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "left_ts", "type": null, "docstring": "An ee.ImageCollection to show...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
basemap_demo
null
def basemap_demo(self): """A demo for using geemap basemaps.""" dropdown = widgets.Dropdown( options=list(basemap_tiles.keys()), value="HYBRID", description="Basemaps", ) def on_click(change): basemap_name = change["new"] ...
A demo for using geemap basemaps.
A demo for using geemap basemaps.
[ "A", "demo", "for", "using", "geemap", "basemaps", "." ]
def basemap_demo(self): dropdown = widgets.Dropdown( options=list(basemap_tiles.keys()), value="HYBRID", description="Basemaps", ) def on_click(change): basemap_name = change["new"] old_basemap = self.layers[-1] self.substit...
[ "def", "basemap_demo", "(", "self", ")", ":", "dropdown", "=", "widgets", ".", "Dropdown", "(", "options", "=", "list", "(", "basemap_tiles", ".", "keys", "(", ")", ")", ",", "value", "=", "\"HYBRID\"", ",", "description", "=", "\"Basemaps\"", ",", ")", ...
A demo for using geemap basemaps.
[ "A", "demo", "for", "using", "geemap", "basemaps", "." ]
[ "\"\"\"A demo for using geemap basemaps.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
add_legend
<not_specific>
def add_legend( self, legend_title="Legend", legend_dict=None, legend_keys=None, legend_colors=None, position="bottomright", builtin_legend=None, layer_name=None, **kwargs, ): """Adds a customized basemap to the map. ...
Adds a customized basemap to the map. Args: legend_title (str, optional): Title of the legend. Defaults to 'Legend'. legend_dict (dict, optional): A dictionary containing legend items as keys and color as values. If provided, legend_keys and legend_colors will be ignored. Defaults t...
Adds a customized basemap to the map.
[ "Adds", "a", "customized", "basemap", "to", "the", "map", "." ]
def add_legend( self, legend_title="Legend", legend_dict=None, legend_keys=None, legend_colors=None, position="bottomright", builtin_legend=None, layer_name=None, **kwargs, ): import pkg_resources from IPython.display import dis...
[ "def", "add_legend", "(", "self", ",", "legend_title", "=", "\"Legend\"", ",", "legend_dict", "=", "None", ",", "legend_keys", "=", "None", ",", "legend_colors", "=", "None", ",", "position", "=", "\"bottomright\"", ",", "builtin_legend", "=", "None", ",", "...
Adds a customized basemap to the map.
[ "Adds", "a", "customized", "basemap", "to", "the", "map", "." ]
[ "\"\"\"Adds a customized basemap to the map.\r\n\r\n Args:\r\n legend_title (str, optional): Title of the legend. Defaults to 'Legend'.\r\n legend_dict (dict, optional): A dictionary containing legend items as keys and color as values. If provided, legend_keys and legend_colors will be ...
[ { "param": "self", "type": null }, { "param": "legend_title", "type": null }, { "param": "legend_dict", "type": null }, { "param": "legend_keys", "type": null }, { "param": "legend_colors", "type": null }, { "param": "position", "type": null }, ...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "legend_title", "type": null, "docstring": "Title of the legend. Def...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
add_colorbar
null
def add_colorbar( self, vis_params=None, cmap="gray", discrete=False, label=None, orientation="horizontal", position="bottomright", transparent_bg=False, layer_name=None, **kwargs, ): """Add a matplotlib colorbar to ...
Add a matplotlib colorbar to the map Args: vis_params (dict): Visualization parameters as a dictionary. See https://developers.google.com/earth-engine/guides/image_visualization for options. cmap (str, optional): Matplotlib colormap. Defaults to "gray". See https://matplotlib.org/3....
Add a matplotlib colorbar to the map
[ "Add", "a", "matplotlib", "colorbar", "to", "the", "map" ]
def add_colorbar( self, vis_params=None, cmap="gray", discrete=False, label=None, orientation="horizontal", position="bottomright", transparent_bg=False, layer_name=None, **kwargs, ): import matplotlib as mpl import matp...
[ "def", "add_colorbar", "(", "self", ",", "vis_params", "=", "None", ",", "cmap", "=", "\"gray\"", ",", "discrete", "=", "False", ",", "label", "=", "None", ",", "orientation", "=", "\"horizontal\"", ",", "position", "=", "\"bottomright\"", ",", "transparent_...
Add a matplotlib colorbar to the map
[ "Add", "a", "matplotlib", "colorbar", "to", "the", "map" ]
[ "\"\"\"Add a matplotlib colorbar to the map\r\n\r\n Args:\r\n vis_params (dict): Visualization parameters as a dictionary. See https://developers.google.com/earth-engine/guides/image_visualization for options.\r\n cmap (str, optional): Matplotlib colormap. Defaults to \"gray\". See http...
[ { "param": "self", "type": null }, { "param": "vis_params", "type": null }, { "param": "cmap", "type": null }, { "param": "discrete", "type": null }, { "param": "label", "type": null }, { "param": "orientation", "type": null }, { "param": "...
{ "returns": [], "raises": [ { "docstring": "If the vis_params is not a dictionary.", "docstring_tokens": [ "If", "the", "vis_params", "is", "not", "a", "dictionary", "." ], "type": "TypeError" }, { "docstring"...
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
remove_colorbars
null
def remove_colorbars(self): """Remove all colorbars from the map.""" if hasattr(self, "colorbars"): for colorbar in self.colorbars: if colorbar in self.controls: self.remove_control(colorbar)
Remove all colorbars from the map.
Remove all colorbars from the map.
[ "Remove", "all", "colorbars", "from", "the", "map", "." ]
def remove_colorbars(self): if hasattr(self, "colorbars"): for colorbar in self.colorbars: if colorbar in self.controls: self.remove_control(colorbar)
[ "def", "remove_colorbars", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "\"colorbars\"", ")", ":", "for", "colorbar", "in", "self", ".", "colorbars", ":", "if", "colorbar", "in", "self", ".", "controls", ":", "self", ".", "remove_control", "...
Remove all colorbars from the map.
[ "Remove", "all", "colorbars", "from", "the", "map", "." ]
[ "\"\"\"Remove all colorbars from the map.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
remove_legend
null
def remove_legend(self): """Remove legend from the map.""" if self.legend is not None: if self.legend in self.controls: self.remove_control(self.legend)
Remove legend from the map.
Remove legend from the map.
[ "Remove", "legend", "from", "the", "map", "." ]
def remove_legend(self): if self.legend is not None: if self.legend in self.controls: self.remove_control(self.legend)
[ "def", "remove_legend", "(", "self", ")", ":", "if", "self", ".", "legend", "is", "not", "None", ":", "if", "self", ".", "legend", "in", "self", ".", "controls", ":", "self", ".", "remove_control", "(", "self", ".", "legend", ")" ]
Remove legend from the map.
[ "Remove", "legend", "from", "the", "map", "." ]
[ "\"\"\"Remove legend from the map.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
56aa720715ab102858e4cbb04cbd753f11c089af
hanzlan/geemap
geemap/geemap.py
[ "MIT" ]
Python
remove_legends
null
def remove_legends(self): """Remove all legends from the map.""" if hasattr(self, "legends"): for legend in self.legends: if legend in self.controls: self.remove_control(legend)
Remove all legends from the map.
Remove all legends from the map.
[ "Remove", "all", "legends", "from", "the", "map", "." ]
def remove_legends(self): if hasattr(self, "legends"): for legend in self.legends: if legend in self.controls: self.remove_control(legend)
[ "def", "remove_legends", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "\"legends\"", ")", ":", "for", "legend", "in", "self", ".", "legends", ":", "if", "legend", "in", "self", ".", "controls", ":", "self", ".", "remove_control", "(", "leg...
Remove all legends from the map.
[ "Remove", "all", "legends", "from", "the", "map", "." ]
[ "\"\"\"Remove all legends from the map.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }