body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
76dd715f53137bddff28cc9eab115bac614de1dcf66a486705819ddd88bf37e0
@classmethod def _get_by_sid(cls, sid, **kwargs): 'Returns a session given a session id.' data = memcache.get(sid) if (data is not None): return cls(data, sid) return cls(new=True)
Returns a session given a session id.
tipfy/appengine/sessions.py
_get_by_sid
pombreda/tipfy
23
python
@classmethod def _get_by_sid(cls, sid, **kwargs): data = memcache.get(sid) if (data is not None): return cls(data, sid) return cls(new=True)
@classmethod def _get_by_sid(cls, sid, **kwargs): data = memcache.get(sid) if (data is not None): return cls(data, sid) return cls(new=True)<|docstring|>Returns a session given a session id.<|endoftext|>
cda544fb3f71e6c7885536f09f841877d83cf6b0298bfdcc0c0bf9b532127315
def seed_everything(seed=42, seed_gpu=True): '\n Fix ramdom seed to make all processes reproducable.\n Call this before running scripts.\n Note deterministic operation may have a negative single-run performance impact.\n To avoid seeding gpu, pass seed_gpu=None.\n Frameworks below are not supported; ...
Fix ramdom seed to make all processes reproducable. Call this before running scripts. Note deterministic operation may have a negative single-run performance impact. To avoid seeding gpu, pass seed_gpu=None. Frameworks below are not supported; You have to fix when calling the method. - Scikit-learn - Optuna Ref...
src/train_v1/util/seeder.py
seed_everything
yota-p/kaggle_titanic
0
python
def seed_everything(seed=42, seed_gpu=True): '\n Fix ramdom seed to make all processes reproducable.\n Call this before running scripts.\n Note deterministic operation may have a negative single-run performance impact.\n To avoid seeding gpu, pass seed_gpu=None.\n Frameworks below are not supported; ...
def seed_everything(seed=42, seed_gpu=True): '\n Fix ramdom seed to make all processes reproducable.\n Call this before running scripts.\n Note deterministic operation may have a negative single-run performance impact.\n To avoid seeding gpu, pass seed_gpu=None.\n Frameworks below are not supported; ...
8345e696c4c61a3dbc84c79873f512c80d2d55ed6dbcc78d84be086bb2502259
@api.depends('report_layout_id', 'logo', 'font', 'primary_color', 'secondary_color', 'report_header', 'report_footer') def _compute_preview(self): ' compute a qweb based preview to display on the wizard ' styles = self._get_asset_style() for wizard in self: if wizard.report_layout_id: pr...
compute a qweb based preview to display on the wizard
addons/web/models/base_document_layout.py
_compute_preview
SHIVJITH/Odoo_Machine_Test
0
python
@api.depends('report_layout_id', 'logo', 'font', 'primary_color', 'secondary_color', 'report_header', 'report_footer') def _compute_preview(self): ' ' styles = self._get_asset_style() for wizard in self: if wizard.report_layout_id: preview_css = self._get_css_for_preview(styles, wizard....
@api.depends('report_layout_id', 'logo', 'font', 'primary_color', 'secondary_color', 'report_header', 'report_footer') def _compute_preview(self): ' ' styles = self._get_asset_style() for wizard in self: if wizard.report_layout_id: preview_css = self._get_css_for_preview(styles, wizard....
a6c0a6dfa00679302dfad0d0d8ec20c83fcbd679c9f4cf6dbe9e8c61243c8ef0
def _parse_logo_colors(self, logo=None, white_threshold=225): '\n Identifies dominant colors\n\n First resizes the original image to improve performance, then discards\n transparent colors and white-ish colors, then calls the averaging\n method twice to evaluate both primary and secondar...
Identifies dominant colors First resizes the original image to improve performance, then discards transparent colors and white-ish colors, then calls the averaging method twice to evaluate both primary and secondary colors. :param logo: alternate logo to process :param white_threshold: arbitrary value defining the ma...
addons/web/models/base_document_layout.py
_parse_logo_colors
SHIVJITH/Odoo_Machine_Test
0
python
def _parse_logo_colors(self, logo=None, white_threshold=225): '\n Identifies dominant colors\n\n First resizes the original image to improve performance, then discards\n transparent colors and white-ish colors, then calls the averaging\n method twice to evaluate both primary and secondar...
def _parse_logo_colors(self, logo=None, white_threshold=225): '\n Identifies dominant colors\n\n First resizes the original image to improve performance, then discards\n transparent colors and white-ish colors, then calls the averaging\n method twice to evaluate both primary and secondar...
6042227019e47f7617cd7050f6bede7acf2dacb11b7b49d47db5c8a82eb27501
def _get_asset_style(self): "\n Compile the style template. It is a qweb template expecting company ids to generate all the code in one batch.\n We give a useless company_ids arg, but provide the PREVIEW_ID arg that will prepare the template for\n '_get_css_for_preview' processing later.\n ...
Compile the style template. It is a qweb template expecting company ids to generate all the code in one batch. We give a useless company_ids arg, but provide the PREVIEW_ID arg that will prepare the template for '_get_css_for_preview' processing later. :return:
addons/web/models/base_document_layout.py
_get_asset_style
SHIVJITH/Odoo_Machine_Test
0
python
def _get_asset_style(self): "\n Compile the style template. It is a qweb template expecting company ids to generate all the code in one batch.\n We give a useless company_ids arg, but provide the PREVIEW_ID arg that will prepare the template for\n '_get_css_for_preview' processing later.\n ...
def _get_asset_style(self): "\n Compile the style template. It is a qweb template expecting company ids to generate all the code in one batch.\n We give a useless company_ids arg, but provide the PREVIEW_ID arg that will prepare the template for\n '_get_css_for_preview' processing later.\n ...
2378d0a51bb3481613850a45532e3f7c3551a44740c3c8cfe46333ba2554addd
@api.model def _get_css_for_preview(self, scss, new_id): '\n Compile the scss into css.\n ' css_code = self._compile_scss(scss) return css_code
Compile the scss into css.
addons/web/models/base_document_layout.py
_get_css_for_preview
SHIVJITH/Odoo_Machine_Test
0
python
@api.model def _get_css_for_preview(self, scss, new_id): '\n \n ' css_code = self._compile_scss(scss) return css_code
@api.model def _get_css_for_preview(self, scss, new_id): '\n \n ' css_code = self._compile_scss(scss) return css_code<|docstring|>Compile the scss into css.<|endoftext|>
966285cdc1814f53d01e59dd4e4726cd838920d30937babc0a761b7e1d9e411e
@api.model def _compile_scss(self, scss_source): '\n This code will compile valid scss into css.\n Parameters are the same from odoo/addons/base/models/assetsbundle.py\n Simply copied and adapted slightly\n ' if (not scss_source.strip()): return '' precision = 8 outpu...
This code will compile valid scss into css. Parameters are the same from odoo/addons/base/models/assetsbundle.py Simply copied and adapted slightly
addons/web/models/base_document_layout.py
_compile_scss
SHIVJITH/Odoo_Machine_Test
0
python
@api.model def _compile_scss(self, scss_source): '\n This code will compile valid scss into css.\n Parameters are the same from odoo/addons/base/models/assetsbundle.py\n Simply copied and adapted slightly\n ' if (not scss_source.strip()): return precision = 8 output_...
@api.model def _compile_scss(self, scss_source): '\n This code will compile valid scss into css.\n Parameters are the same from odoo/addons/base/models/assetsbundle.py\n Simply copied and adapted slightly\n ' if (not scss_source.strip()): return precision = 8 output_...
40717a684208671b49e658ffbc4e42731929e124992e388992c9bc0f4710747a
def editor(pretitle='', prebody=''): '\n A simple editor for posting questions or answers. Returns the title and body of the post\n It can also edit post given the title and body of the post wanted to be modified\n ' stdscr = curses.initscr() curses.noecho() curses.cbreak() stdscr.keypad(Tr...
A simple editor for posting questions or answers. Returns the title and body of the post It can also edit post given the title and body of the post wanted to be modified
Code/systemFunctions.py
editor
flyrobot27/cmputDB2-MongoDB
0
python
def editor(pretitle=, prebody=): '\n A simple editor for posting questions or answers. Returns the title and body of the post\n It can also edit post given the title and body of the post wanted to be modified\n ' stdscr = curses.initscr() curses.noecho() curses.cbreak() stdscr.keypad(True) ...
def editor(pretitle=, prebody=): '\n A simple editor for posting questions or answers. Returns the title and body of the post\n It can also edit post given the title and body of the post wanted to be modified\n ' stdscr = curses.initscr() curses.noecho() curses.cbreak() stdscr.keypad(True) ...
1b5cb058cbdbc1a4104cad23d4e67ab02a04bc024d68c19ba0eae077b5bc2cd5
def get_currentTime(): ' Return current date + time in the required format ' date = str(datetime.now()) date = ((date[:10] + 'T') + date[11:23]) return date
Return current date + time in the required format
Code/systemFunctions.py
get_currentTime
flyrobot27/cmputDB2-MongoDB
0
python
def get_currentTime(): ' ' date = str(datetime.now()) date = ((date[:10] + 'T') + date[11:23]) return date
def get_currentTime(): ' ' date = str(datetime.now()) date = ((date[:10] + 'T') + date[11:23]) return date<|docstring|>Return current date + time in the required format<|endoftext|>
666bff7e29235872e73df637ebe52398e61b18f9d58f52537f607fb29a3c48fd
def display_result(columnNames, result, displayStart): '\n Display results in a command line table\n columnNames and results will be tuple of strings or integer\n It will only display at most 10 results\n ' resultLength = len(result) displayEnd = (displayStart + 10) if (displayEnd >= resultL...
Display results in a command line table columnNames and results will be tuple of strings or integer It will only display at most 10 results
Code/systemFunctions.py
display_result
flyrobot27/cmputDB2-MongoDB
0
python
def display_result(columnNames, result, displayStart): '\n Display results in a command line table\n columnNames and results will be tuple of strings or integer\n It will only display at most 10 results\n ' resultLength = len(result) displayEnd = (displayStart + 10) if (displayEnd >= resultL...
def display_result(columnNames, result, displayStart): '\n Display results in a command line table\n columnNames and results will be tuple of strings or integer\n It will only display at most 10 results\n ' resultLength = len(result) displayEnd = (displayStart + 10) if (displayEnd >= resultL...
8156b16880bd7b9179904aad1475ad973755d82c117409069f684029e7d276c7
def print_report(client, db, userID): ' Print user report given a userID ' assert (type(userID) == str), 'input type incorrect' collection_posts = db['Posts'] reportStr = '' print('\nGenerating User Report...') reportStr += (('\n*** Report for u/' + userID) + ': ***\n\n') questions = collect...
Print user report given a userID
Code/systemFunctions.py
print_report
flyrobot27/cmputDB2-MongoDB
0
python
def print_report(client, db, userID): ' ' assert (type(userID) == str), 'input type incorrect' collection_posts = db['Posts'] reportStr = print('\nGenerating User Report...') reportStr += (('\n*** Report for u/' + userID) + ': ***\n\n') questions = collection_posts.find({'OwnerUserId': use...
def print_report(client, db, userID): ' ' assert (type(userID) == str), 'input type incorrect' collection_posts = db['Posts'] reportStr = print('\nGenerating User Report...') reportStr += (('\n*** Report for u/' + userID) + ': ***\n\n') questions = collection_posts.find({'OwnerUserId': use...
7bc608a73d03e860d1a6313da513c1cad47d7692426308e91c16dbbbc529e465
def print_text(title, body): '\n A simple function to print the title and body\n Imported from project 1\n ' def _parse(text): '\n Parse the given text to the length 90\n ' newtext = list(text) accu = 0 i = 0 while (i < len(text)): if (...
A simple function to print the title and body Imported from project 1
Code/systemFunctions.py
print_text
flyrobot27/cmputDB2-MongoDB
0
python
def print_text(title, body): '\n A simple function to print the title and body\n Imported from project 1\n ' def _parse(text): '\n Parse the given text to the length 90\n ' newtext = list(text) accu = 0 i = 0 while (i < len(text)): if (...
def print_text(title, body): '\n A simple function to print the title and body\n Imported from project 1\n ' def _parse(text): '\n Parse the given text to the length 90\n ' newtext = list(text) accu = 0 i = 0 while (i < len(text)): if (...
c13ceffab196751d807b988cab797b53a35b31e03c2ba15efbd4c7f59e9470f1
def _parse(text): '\n Parse the given text to the length 90\n ' newtext = list(text) accu = 0 i = 0 while (i < len(text)): if (newtext[i] == '\n'): accu = 0 i += 1 else: if (accu > 88): if (newtext[i] == ' '): ...
Parse the given text to the length 90
Code/systemFunctions.py
_parse
flyrobot27/cmputDB2-MongoDB
0
python
def _parse(text): '\n \n ' newtext = list(text) accu = 0 i = 0 while (i < len(text)): if (newtext[i] == '\n'): accu = 0 i += 1 else: if (accu > 88): if (newtext[i] == ' '): newtext.insert((i + 1), '...
def _parse(text): '\n \n ' newtext = list(text) accu = 0 i = 0 while (i < len(text)): if (newtext[i] == '\n'): accu = 0 i += 1 else: if (accu > 88): if (newtext[i] == ' '): newtext.insert((i + 1), '...
219ae6e5a1cafbbbba731944049ec03ad1490f10175b2d19ba1368aee86fd2f0
def _is_one_arg_pos_call(call: nodes.NodeNG) -> bool: 'Is this a call with exactly 1 positional argument ?' return (isinstance(call, nodes.Call) and (len(call.args) == 1) and (not call.keywords))
Is this a call with exactly 1 positional argument ?
Lib/site-packages/pylint/checkers/base/comparison_checker.py
_is_one_arg_pos_call
edupyter/EDUPYTER
0
python
def _is_one_arg_pos_call(call: nodes.NodeNG) -> bool: return (isinstance(call, nodes.Call) and (len(call.args) == 1) and (not call.keywords))
def _is_one_arg_pos_call(call: nodes.NodeNG) -> bool: return (isinstance(call, nodes.Call) and (len(call.args) == 1) and (not call.keywords))<|docstring|>Is this a call with exactly 1 positional argument ?<|endoftext|>
fed5c31bf05fe160d24ed5440aaa6869e29f011139e4aa92bfc13effed3aa419
def _check_singleton_comparison(self, left_value: nodes.NodeNG, right_value: nodes.NodeNG, root_node: nodes.Compare, checking_for_absence: bool=False) -> None: 'Check if == or != is being used to compare a singleton value.' singleton_values = (True, False, None) def _is_singleton_const(node: nodes.NodeNG) ...
Check if == or != is being used to compare a singleton value.
Lib/site-packages/pylint/checkers/base/comparison_checker.py
_check_singleton_comparison
edupyter/EDUPYTER
0
python
def _check_singleton_comparison(self, left_value: nodes.NodeNG, right_value: nodes.NodeNG, root_node: nodes.Compare, checking_for_absence: bool=False) -> None: singleton_values = (True, False, None) def _is_singleton_const(node: nodes.NodeNG) -> bool: return (isinstance(node, nodes.Const) and any(...
def _check_singleton_comparison(self, left_value: nodes.NodeNG, right_value: nodes.NodeNG, root_node: nodes.Compare, checking_for_absence: bool=False) -> None: singleton_values = (True, False, None) def _is_singleton_const(node: nodes.NodeNG) -> bool: return (isinstance(node, nodes.Const) and any(...
6fed843014dfc6d48111adda295fbbb860938e76b9eec02cff2f8bf12a916d31
def _check_literal_comparison(self, literal: nodes.NodeNG, node: nodes.Compare) -> None: 'Check if we compare to a literal, which is usually what we do not want to do.' is_other_literal = isinstance(literal, (nodes.List, nodes.Dict, nodes.Set)) is_const = False if isinstance(literal, nodes.Const): ...
Check if we compare to a literal, which is usually what we do not want to do.
Lib/site-packages/pylint/checkers/base/comparison_checker.py
_check_literal_comparison
edupyter/EDUPYTER
0
python
def _check_literal_comparison(self, literal: nodes.NodeNG, node: nodes.Compare) -> None: is_other_literal = isinstance(literal, (nodes.List, nodes.Dict, nodes.Set)) is_const = False if isinstance(literal, nodes.Const): if (isinstance(literal.value, bool) or (literal.value is None)): ...
def _check_literal_comparison(self, literal: nodes.NodeNG, node: nodes.Compare) -> None: is_other_literal = isinstance(literal, (nodes.List, nodes.Dict, nodes.Set)) is_const = False if isinstance(literal, nodes.Const): if (isinstance(literal.value, bool) or (literal.value is None)): ...
48f5726ee78fe8430522d585ab811058530077e92135d4729663c068ab5eb195
def _check_logical_tautology(self, node: nodes.Compare) -> None: 'Check if identifier is compared against itself.\n\n :param node: Compare node\n :Example:\n val = 786\n if val == val: # [comparison-with-itself]\n pass\n ' left_operand = node.left right_operand...
Check if identifier is compared against itself. :param node: Compare node :Example: val = 786 if val == val: # [comparison-with-itself] pass
Lib/site-packages/pylint/checkers/base/comparison_checker.py
_check_logical_tautology
edupyter/EDUPYTER
0
python
def _check_logical_tautology(self, node: nodes.Compare) -> None: 'Check if identifier is compared against itself.\n\n :param node: Compare node\n :Example:\n val = 786\n if val == val: # [comparison-with-itself]\n pass\n ' left_operand = node.left right_operand...
def _check_logical_tautology(self, node: nodes.Compare) -> None: 'Check if identifier is compared against itself.\n\n :param node: Compare node\n :Example:\n val = 786\n if val == val: # [comparison-with-itself]\n pass\n ' left_operand = node.left right_operand...
7945532d51a2e8f536750688060f62afaff49230e5a7b5257f46044089f9bf43
def _check_two_literals_being_compared(self, node: nodes.Compare) -> None: 'Check if two literals are being compared; this is always a logical tautology.' left_operand = node.left if (not isinstance(left_operand, nodes.Const)): return right_operand = node.ops[0][1] if (not isinstance(right_o...
Check if two literals are being compared; this is always a logical tautology.
Lib/site-packages/pylint/checkers/base/comparison_checker.py
_check_two_literals_being_compared
edupyter/EDUPYTER
0
python
def _check_two_literals_being_compared(self, node: nodes.Compare) -> None: left_operand = node.left if (not isinstance(left_operand, nodes.Const)): return right_operand = node.ops[0][1] if (not isinstance(right_operand, nodes.Const)): return operator = node.ops[0][0] self.ad...
def _check_two_literals_being_compared(self, node: nodes.Compare) -> None: left_operand = node.left if (not isinstance(left_operand, nodes.Const)): return right_operand = node.ops[0][1] if (not isinstance(right_operand, nodes.Const)): return operator = node.ops[0][0] self.ad...
54288fef135506ac2e143df0751563746f09087fcf9337c69ff2d102971b4dc1
def _check_type_x_is_y(self, node: nodes.Compare, left: nodes.NodeNG, operator: str, right: nodes.NodeNG) -> None: 'Check for expressions like type(x) == Y.' left_func = utils.safe_infer(left.func) if (not (isinstance(left_func, nodes.ClassDef) and (left_func.qname() == TYPE_QNAME))): return if ...
Check for expressions like type(x) == Y.
Lib/site-packages/pylint/checkers/base/comparison_checker.py
_check_type_x_is_y
edupyter/EDUPYTER
0
python
def _check_type_x_is_y(self, node: nodes.Compare, left: nodes.NodeNG, operator: str, right: nodes.NodeNG) -> None: left_func = utils.safe_infer(left.func) if (not (isinstance(left_func, nodes.ClassDef) and (left_func.qname() == TYPE_QNAME))): return if ((operator in {'is', 'is not'}) and _is_on...
def _check_type_x_is_y(self, node: nodes.Compare, left: nodes.NodeNG, operator: str, right: nodes.NodeNG) -> None: left_func = utils.safe_infer(left.func) if (not (isinstance(left_func, nodes.ClassDef) and (left_func.qname() == TYPE_QNAME))): return if ((operator in {'is', 'is not'}) and _is_on...
be50694c7ad7ee61385a623adcb5e2be744aa6d5757d76a97cb3ca54cd1e7bb5
def add_edit(edit_dict: dict, ReviewStatus='P', ApprovedBy=None, DateEffective=None): '\n Saves a new edit given a dict with these key-value pairs.\n The kwargs allow saving an approved or rejected edit.\n ' edit = Edit() edit.ChangedBy = edit_dict.get('User') edit.DateRequested = timezone.now(...
Saves a new edit given a dict with these key-value pairs. The kwargs allow saving an approved or rejected edit.
server/ahj_app/views_edits.py
add_edit
SunSpecOrangeButton/ahj-registry
4
python
def add_edit(edit_dict: dict, ReviewStatus='P', ApprovedBy=None, DateEffective=None): '\n Saves a new edit given a dict with these key-value pairs.\n The kwargs allow saving an approved or rejected edit.\n ' edit = Edit() edit.ChangedBy = edit_dict.get('User') edit.DateRequested = timezone.now(...
def add_edit(edit_dict: dict, ReviewStatus='P', ApprovedBy=None, DateEffective=None): '\n Saves a new edit given a dict with these key-value pairs.\n The kwargs allow saving an approved or rejected edit.\n ' edit = Edit() edit.ChangedBy = edit_dict.get('User') edit.DateRequested = timezone.now(...
a61acae8f9057c650f4ee1a0fd450586827f1c8623052bc29b2ddd831674b44c
def edit_get_source_column_value(edit): '\n Gets the current value of the source column of the edited row.\n ' row = edit.get_edited_row() current_value = getattr(row, edit.SourceColumn) if (edit.SourceColumn in ENUM_FIELDS): current_value = (current_value.Value if (current_value is not No...
Gets the current value of the source column of the edited row.
server/ahj_app/views_edits.py
edit_get_source_column_value
SunSpecOrangeButton/ahj-registry
4
python
def edit_get_source_column_value(edit): '\n \n ' row = edit.get_edited_row() current_value = getattr(row, edit.SourceColumn) if (edit.SourceColumn in ENUM_FIELDS): current_value = (current_value.Value if (current_value is not None) else ) return current_value
def edit_get_source_column_value(edit): '\n \n ' row = edit.get_edited_row() current_value = getattr(row, edit.SourceColumn) if (edit.SourceColumn in ENUM_FIELDS): current_value = (current_value.Value if (current_value is not None) else ) return current_value<|docstring|>Gets the curre...
ed1e372cc9b9ee55be030c3832831bc3840206a773749f45141519696f856925
def edit_get_old_new_value(edit, old_new_field): "\n Gets the edit's OldValue or NewValue (specified by old_new_field).\n " edit_value = getattr(edit, old_new_field) if (edit.SourceColumn in ENUM_FIELDS): edit_value = get_enum_value_row_else_null(edit.SourceColumn, edit_value) return edit_...
Gets the edit's OldValue or NewValue (specified by old_new_field).
server/ahj_app/views_edits.py
edit_get_old_new_value
SunSpecOrangeButton/ahj-registry
4
python
def edit_get_old_new_value(edit, old_new_field): "\n \n " edit_value = getattr(edit, old_new_field) if (edit.SourceColumn in ENUM_FIELDS): edit_value = get_enum_value_row_else_null(edit.SourceColumn, edit_value) return edit_value
def edit_get_old_new_value(edit, old_new_field): "\n \n " edit_value = getattr(edit, old_new_field) if (edit.SourceColumn in ENUM_FIELDS): edit_value = get_enum_value_row_else_null(edit.SourceColumn, edit_value) return edit_value<|docstring|>Gets the edit's OldValue or NewValue (specified ...
7f787f06ff9d9c29758ad03a9b6405d34519622b6a9dc6cdcbd2fcbc7aea6dab
def apply_edits(ready_edits=None): '\n Applies the changes of a list of edits.\n If a list is not provided, it applies all edits whose DateEffective is today.\n For rejected edit additions, this sets the SourceColumn of the edited row to False.\n ' if (ready_edits is None): ready_edits = Edi...
Applies the changes of a list of edits. If a list is not provided, it applies all edits whose DateEffective is today. For rejected edit additions, this sets the SourceColumn of the edited row to False.
server/ahj_app/views_edits.py
apply_edits
SunSpecOrangeButton/ahj-registry
4
python
def apply_edits(ready_edits=None): '\n Applies the changes of a list of edits.\n If a list is not provided, it applies all edits whose DateEffective is today.\n For rejected edit additions, this sets the SourceColumn of the edited row to False.\n ' if (ready_edits is None): ready_edits = Edi...
def apply_edits(ready_edits=None): '\n Applies the changes of a list of edits.\n If a list is not provided, it applies all edits whose DateEffective is today.\n For rejected edit additions, this sets the SourceColumn of the edited row to False.\n ' if (ready_edits is None): ready_edits = Edi...
a140d5704d08f61853377bd0e1b5862959f5bc8c9edae90e96ddf61faf5d3a42
def revert_edit(user, edit): '\n Creates and applies an edit that reverses the change of the given edit.\n The OldValue of the created edit is the current value of the edited field.\n ' if (edit.ReviewStatus == 'P'): return current_value = edit_get_source_column_value(edit) if (edit.Edi...
Creates and applies an edit that reverses the change of the given edit. The OldValue of the created edit is the current value of the edited field.
server/ahj_app/views_edits.py
revert_edit
SunSpecOrangeButton/ahj-registry
4
python
def revert_edit(user, edit): '\n Creates and applies an edit that reverses the change of the given edit.\n The OldValue of the created edit is the current value of the edited field.\n ' if (edit.ReviewStatus == 'P'): return current_value = edit_get_source_column_value(edit) if (edit.Edi...
def revert_edit(user, edit): '\n Creates and applies an edit that reverses the change of the given edit.\n The OldValue of the created edit is the current value of the edited field.\n ' if (edit.ReviewStatus == 'P'): return current_value = edit_get_source_column_value(edit) if (edit.Edi...
40f96bac29ed562104c626355f9c83ac9c5b9568a8e3d0033a75e1cb78740ae8
def edit_is_applied(edit): "\n Determines if an edit has been approved and applied.\n Edits are applied if their ReviewStatus is 'A' for approved,\n and if their DateEffective has passed.\n " edit_is_approved = (edit.ReviewStatus == 'A') date_effective_passed = ((edit.DateEffective is not None) ...
Determines if an edit has been approved and applied. Edits are applied if their ReviewStatus is 'A' for approved, and if their DateEffective has passed.
server/ahj_app/views_edits.py
edit_is_applied
SunSpecOrangeButton/ahj-registry
4
python
def edit_is_applied(edit): "\n Determines if an edit has been approved and applied.\n Edits are applied if their ReviewStatus is 'A' for approved,\n and if their DateEffective has passed.\n " edit_is_approved = (edit.ReviewStatus == 'A') date_effective_passed = ((edit.DateEffective is not None) ...
def edit_is_applied(edit): "\n Determines if an edit has been approved and applied.\n Edits are applied if their ReviewStatus is 'A' for approved,\n and if their DateEffective has passed.\n " edit_is_approved = (edit.ReviewStatus == 'A') date_effective_passed = ((edit.DateEffective is not None) ...
bb6e3f5622134b40c30500878646d047008952b38f575ac0455fede6a10a34da
def edit_is_resettable(edit): '\n Determines if an edit can be reset. To be resettable, it must either be:\n - Rejected.\n - Approved, but whose changes have not been applied to the edited row.\n - Approved and applied, but no other edits have been applied after it.\n ' is_rejected = (edit.Rev...
Determines if an edit can be reset. To be resettable, it must either be: - Rejected. - Approved, but whose changes have not been applied to the edited row. - Approved and applied, but no other edits have been applied after it.
server/ahj_app/views_edits.py
edit_is_resettable
SunSpecOrangeButton/ahj-registry
4
python
def edit_is_resettable(edit): '\n Determines if an edit can be reset. To be resettable, it must either be:\n - Rejected.\n - Approved, but whose changes have not been applied to the edited row.\n - Approved and applied, but no other edits have been applied after it.\n ' is_rejected = (edit.Rev...
def edit_is_resettable(edit): '\n Determines if an edit can be reset. To be resettable, it must either be:\n - Rejected.\n - Approved, but whose changes have not been applied to the edited row.\n - Approved and applied, but no other edits have been applied after it.\n ' is_rejected = (edit.Rev...
c7c6975f1a58430e09b1f207d5c06b7d7ccb21949ae86fd74cd04962dc4588e5
def edit_make_pending(edit): '\n Sets an edit to a pending approval or rejection state.\n ' edit.ReviewStatus = 'P' edit.ApprovedBy = None edit.DateEffective = None edit.save()
Sets an edit to a pending approval or rejection state.
server/ahj_app/views_edits.py
edit_make_pending
SunSpecOrangeButton/ahj-registry
4
python
def edit_make_pending(edit): '\n \n ' edit.ReviewStatus = 'P' edit.ApprovedBy = None edit.DateEffective = None edit.save()
def edit_make_pending(edit): '\n \n ' edit.ReviewStatus = 'P' edit.ApprovedBy = None edit.DateEffective = None edit.save()<|docstring|>Sets an edit to a pending approval or rejection state.<|endoftext|>
2e90e060de5d2d6d081bab06d67d901ae8b0d949ab7344cd68c89617027c911d
def edit_update_old_value(edit): '\n Updates the OldValue of an edit to the current value of\n the SourceColumn of the edited row.\n ' edit.OldValue = edit_get_source_column_value(edit) edit.save()
Updates the OldValue of an edit to the current value of the SourceColumn of the edited row.
server/ahj_app/views_edits.py
edit_update_old_value
SunSpecOrangeButton/ahj-registry
4
python
def edit_update_old_value(edit): '\n Updates the OldValue of an edit to the current value of\n the SourceColumn of the edited row.\n ' edit.OldValue = edit_get_source_column_value(edit) edit.save()
def edit_update_old_value(edit): '\n Updates the OldValue of an edit to the current value of\n the SourceColumn of the edited row.\n ' edit.OldValue = edit_get_source_column_value(edit) edit.save()<|docstring|>Updates the OldValue of an edit to the current value of the SourceColumn of the edited ro...
7a05e0d92a7850054f3d5404e071b1ad54d2e8abb15781b5ba92ebea17ea7231
def edit_undo_apply(edit): '\n Sets the SourceColumn of the edited row to\n the OldValue of the edit.\n ' row = edit.get_edited_row() old_value = edit_get_old_new_value(edit, 'OldValue') setattr(row, edit.SourceColumn, old_value) row.save()
Sets the SourceColumn of the edited row to the OldValue of the edit.
server/ahj_app/views_edits.py
edit_undo_apply
SunSpecOrangeButton/ahj-registry
4
python
def edit_undo_apply(edit): '\n Sets the SourceColumn of the edited row to\n the OldValue of the edit.\n ' row = edit.get_edited_row() old_value = edit_get_old_new_value(edit, 'OldValue') setattr(row, edit.SourceColumn, old_value) row.save()
def edit_undo_apply(edit): '\n Sets the SourceColumn of the edited row to\n the OldValue of the edit.\n ' row = edit.get_edited_row() old_value = edit_get_old_new_value(edit, 'OldValue') setattr(row, edit.SourceColumn, old_value) row.save()<|docstring|>Sets the SourceColumn of the edited ro...
58e878daa861b2ec689ac5e1a828bd6a08f511ac9c3d50e0d0f7686a246a3746
def edit_is_rejected_addition(edit): '\n Returns boolean whether an edit is a rejected addition.\n ' return ((edit.EditType == 'A') and (edit.ReviewStatus == 'R'))
Returns boolean whether an edit is a rejected addition.
server/ahj_app/views_edits.py
edit_is_rejected_addition
SunSpecOrangeButton/ahj-registry
4
python
def edit_is_rejected_addition(edit): '\n \n ' return ((edit.EditType == 'A') and (edit.ReviewStatus == 'R'))
def edit_is_rejected_addition(edit): '\n \n ' return ((edit.EditType == 'A') and (edit.ReviewStatus == 'R'))<|docstring|>Returns boolean whether an edit is a rejected addition.<|endoftext|>
5372cb5753829031c479e1665b9dcefb33033ed08e6a7ec92e89ebf219705b78
def reset_edit(user, edit, force_resettable=False, skip_undo=False): "\n Rolls back the an edit in a similar way to Git's 'git reset' command.\n When an edit is reset, it returns to a pending state, again awaiting\n approval or rejection. If the edit was applied already, its changes\n to the edited row ...
Rolls back the an edit in a similar way to Git's 'git reset' command. When an edit is reset, it returns to a pending state, again awaiting approval or rejection. If the edit was applied already, its changes to the edited row are undone. If an edit is not resettable, it is instead reverted.
server/ahj_app/views_edits.py
reset_edit
SunSpecOrangeButton/ahj-registry
4
python
def reset_edit(user, edit, force_resettable=False, skip_undo=False): "\n Rolls back the an edit in a similar way to Git's 'git reset' command.\n When an edit is reset, it returns to a pending state, again awaiting\n approval or rejection. If the edit was applied already, its changes\n to the edited row ...
def reset_edit(user, edit, force_resettable=False, skip_undo=False): "\n Rolls back the an edit in a similar way to Git's 'git reset' command.\n When an edit is reset, it returns to a pending state, again awaiting\n approval or rejection. If the edit was applied already, its changes\n to the edited row ...
afcbafaa4b94e6794a4d4223181296f87bf9688d1daeea9f42213f14597f729d
@api_view(['POST']) @authentication_classes([WebpageTokenAuth]) @permission_classes([IsAuthenticated]) def edit_review(request): "\n Sets an edit's ReviewStatus for approval or rejection,\n and sets the DateEffective.\n " try: eid = request.data['EditID'] stat = request.data['Status'] ...
Sets an edit's ReviewStatus for approval or rejection, and sets the DateEffective.
server/ahj_app/views_edits.py
edit_review
SunSpecOrangeButton/ahj-registry
4
python
@api_view(['POST']) @authentication_classes([WebpageTokenAuth]) @permission_classes([IsAuthenticated]) def edit_review(request): "\n Sets an edit's ReviewStatus for approval or rejection,\n and sets the DateEffective.\n " try: eid = request.data['EditID'] stat = request.data['Status'] ...
@api_view(['POST']) @authentication_classes([WebpageTokenAuth]) @permission_classes([IsAuthenticated]) def edit_review(request): "\n Sets an edit's ReviewStatus for approval or rejection,\n and sets the DateEffective.\n " try: eid = request.data['EditID'] stat = request.data['Status'] ...
0083e34ba3867900f21847227e068500f46b7609e577843e67b8ef075565ba2d
@api_view(['POST']) @authentication_classes([WebpageTokenAuth]) @permission_classes([IsAuthenticated]) def edit_addition(request): '\n Private front-end endpoint for passing an edit type=Addition request\n ' try: source_table = request.data.get('SourceTable') (response_data, response_statu...
Private front-end endpoint for passing an edit type=Addition request
server/ahj_app/views_edits.py
edit_addition
SunSpecOrangeButton/ahj-registry
4
python
@api_view(['POST']) @authentication_classes([WebpageTokenAuth]) @permission_classes([IsAuthenticated]) def edit_addition(request): '\n \n ' try: source_table = request.data.get('SourceTable') (response_data, response_status) = ([], status.HTTP_200_OK) with transaction.atomic(): ...
@api_view(['POST']) @authentication_classes([WebpageTokenAuth]) @permission_classes([IsAuthenticated]) def edit_addition(request): '\n \n ' try: source_table = request.data.get('SourceTable') (response_data, response_status) = ([], status.HTTP_200_OK) with transaction.atomic(): ...
3c01b36e21a335ace02228da9ba6dc3692903cb32e1f3241d9bcd5e0fcdc92dd
@api_view(['POST']) @authentication_classes([WebpageTokenAuth]) @permission_classes([IsAuthenticated]) def edit_deletion(request): '\n Private front-end endpoint for passing an edit type=Deletion request\n ' try: source_table = request.data.get('SourceTable') (response_data, response_statu...
Private front-end endpoint for passing an edit type=Deletion request
server/ahj_app/views_edits.py
edit_deletion
SunSpecOrangeButton/ahj-registry
4
python
@api_view(['POST']) @authentication_classes([WebpageTokenAuth]) @permission_classes([IsAuthenticated]) def edit_deletion(request): '\n \n ' try: source_table = request.data.get('SourceTable') (response_data, response_status) = ([], status.HTTP_200_OK) with transaction.atomic(): ...
@api_view(['POST']) @authentication_classes([WebpageTokenAuth]) @permission_classes([IsAuthenticated]) def edit_deletion(request): '\n \n ' try: source_table = request.data.get('SourceTable') (response_data, response_status) = ([], status.HTTP_200_OK) with transaction.atomic(): ...
fa77291ddf55bc12d27e3f2cf21ce4f5ab501f532f36e14752a41c51bae01389
@api_view(['POST']) @authentication_classes([WebpageTokenAuth]) @permission_classes([IsAuthenticated]) def edit_update(request): '\n Private front-end endpoint for passing an edit type=Addition request\n ' try: (response_data, response_status) = ([], status.HTTP_200_OK) with transaction.at...
Private front-end endpoint for passing an edit type=Addition request
server/ahj_app/views_edits.py
edit_update
SunSpecOrangeButton/ahj-registry
4
python
@api_view(['POST']) @authentication_classes([WebpageTokenAuth]) @permission_classes([IsAuthenticated]) def edit_update(request): '\n \n ' try: (response_data, response_status) = ([], status.HTTP_200_OK) with transaction.atomic(): es = request.data edits = [] ...
@api_view(['POST']) @authentication_classes([WebpageTokenAuth]) @permission_classes([IsAuthenticated]) def edit_update(request): '\n \n ' try: (response_data, response_status) = ([], status.HTTP_200_OK) with transaction.atomic(): es = request.data edits = [] ...
d97052da5d8992c17437ba0f9001192c6688337b649710532ca891490149d3c3
@api_view(['GET']) def edit_list(request): '\n Endpoint returning all edits made to an AHJ specified by AHJPK.\n ' try: edits = Edit.objects.filter(AHJPK=request.query_params.get('AHJPK')) return Response(EditSerializer(edits, many=True, context={'drop_users': True}).data, status=status.HT...
Endpoint returning all edits made to an AHJ specified by AHJPK.
server/ahj_app/views_edits.py
edit_list
SunSpecOrangeButton/ahj-registry
4
python
@api_view(['GET']) def edit_list(request): '\n \n ' try: edits = Edit.objects.filter(AHJPK=request.query_params.get('AHJPK')) return Response(EditSerializer(edits, many=True, context={'drop_users': True}).data, status=status.HTTP_200_OK) except Exception as e: return Response(s...
@api_view(['GET']) def edit_list(request): '\n \n ' try: edits = Edit.objects.filter(AHJPK=request.query_params.get('AHJPK')) return Response(EditSerializer(edits, many=True, context={'drop_users': True}).data, status=status.HTTP_200_OK) except Exception as e: return Response(s...
0b4487b49658a649889e9259b10303b94009551003dfaefc4ce9df045c05394d
@overrides def optimize_policy(self, itr, samples_data): '\n Perform policy optimization with TRPO, then draw samples from paths\n to fit discriminator/surrogate reward network.\n ' all_input_values = tuple(ext.extract(samples_data, 'observations', 'actions', 'advantages')) agent_infos ...
Perform policy optimization with TRPO, then draw samples from paths to fit discriminator/surrogate reward network.
tf_rllab/algos/gail.py
optimize_policy
Sawato/gail-driver
96
python
@overrides def optimize_policy(self, itr, samples_data): '\n Perform policy optimization with TRPO, then draw samples from paths\n to fit discriminator/surrogate reward network.\n ' all_input_values = tuple(ext.extract(samples_data, 'observations', 'actions', 'advantages')) agent_infos ...
@overrides def optimize_policy(self, itr, samples_data): '\n Perform policy optimization with TRPO, then draw samples from paths\n to fit discriminator/surrogate reward network.\n ' all_input_values = tuple(ext.extract(samples_data, 'observations', 'actions', 'advantages')) agent_infos ...
7a6aba0c35f94d64276a56b9a93f407f5de00ea1c6cc6c6724d76066854d1f34
@classmethod def process_text(cls, text, file_id): 'Build index for the file' cls.stream_length.set(file_id, len(text)) temp_word_count = defaultdict(int) for (w_position, stemmed_word) in cls.tokenizer_stemmer.tokenize(text): cls.word_occurrences.set(file_id, stemmed_word, w_position) t...
Build index for the file
search_backend/wiki_index.py
process_text
mindartyr/websearch
0
python
@classmethod def process_text(cls, text, file_id): cls.stream_length.set(file_id, len(text)) temp_word_count = defaultdict(int) for (w_position, stemmed_word) in cls.tokenizer_stemmer.tokenize(text): cls.word_occurrences.set(file_id, stemmed_word, w_position) temp_word_count[stemmed_wor...
@classmethod def process_text(cls, text, file_id): cls.stream_length.set(file_id, len(text)) temp_word_count = defaultdict(int) for (w_position, stemmed_word) in cls.tokenizer_stemmer.tokenize(text): cls.word_occurrences.set(file_id, stemmed_word, w_position) temp_word_count[stemmed_wor...
9498576c69ecbb66c5bf0b6dade98aa7dbf438e71d8e5eff8750c5833a33d49c
@classmethod def next(cls, term, file_id, current): 'Get a next occurrence of a term in the document after the current position' occurrence_list = list(cls.word_occurrences.select_positions(file_id, term)) curr_cache = (cls.cache_next[term][file_id] if (file_id in cls.cache_next[term]) else 0) if ((len(...
Get a next occurrence of a term in the document after the current position
search_backend/wiki_index.py
next
mindartyr/websearch
0
python
@classmethod def next(cls, term, file_id, current): occurrence_list = list(cls.word_occurrences.select_positions(file_id, term)) curr_cache = (cls.cache_next[term][file_id] if (file_id in cls.cache_next[term]) else 0) if ((len(occurrence_list) == 0) or (occurrence_list[(- 1)] <= current)): retu...
@classmethod def next(cls, term, file_id, current): occurrence_list = list(cls.word_occurrences.select_positions(file_id, term)) curr_cache = (cls.cache_next[term][file_id] if (file_id in cls.cache_next[term]) else 0) if ((len(occurrence_list) == 0) or (occurrence_list[(- 1)] <= current)): retu...
f15392bf15672f7fe3f9419de752c304373530f83ef9254d560be32b21595384
@classmethod def prev(cls, term, file_id, current): 'Get a previous occurrence of a term in the document before the current position' occurrence_list = list(cls.word_occurrences.select_positions(file_id, term)) curr_cache = (cls.cache_prev[term][file_id] if (file_id in cls.cache_prev[term]) else 0) if (...
Get a previous occurrence of a term in the document before the current position
search_backend/wiki_index.py
prev
mindartyr/websearch
0
python
@classmethod def prev(cls, term, file_id, current): occurrence_list = list(cls.word_occurrences.select_positions(file_id, term)) curr_cache = (cls.cache_prev[term][file_id] if (file_id in cls.cache_prev[term]) else 0) if ((len(occurrence_list) == 0) or (occurrence_list[0] >= current)): return N...
@classmethod def prev(cls, term, file_id, current): occurrence_list = list(cls.word_occurrences.select_positions(file_id, term)) curr_cache = (cls.cache_prev[term][file_id] if (file_id in cls.cache_prev[term]) else 0) if ((len(occurrence_list) == 0) or (occurrence_list[0] >= current)): return N...
bc525534edb52d4df31bf655023546689f63f5224d5d8956f9901109e97cb8c8
@classmethod def next_phrase(cls, terms, file_id, position, precision): 'Find the position of a phrase in the document' cur_pos = position for term in terms: cur_pos = cls.next(term, file_id, cur_pos) if (not cur_pos): return None back_pos = cur_pos for term in terms[:(- ...
Find the position of a phrase in the document
search_backend/wiki_index.py
next_phrase
mindartyr/websearch
0
python
@classmethod def next_phrase(cls, terms, file_id, position, precision): cur_pos = position for term in terms: cur_pos = cls.next(term, file_id, cur_pos) if (not cur_pos): return None back_pos = cur_pos for term in terms[:(- 1)][::(- 1)]: back_pos = cls.prev(term,...
@classmethod def next_phrase(cls, terms, file_id, position, precision): cur_pos = position for term in terms: cur_pos = cls.next(term, file_id, cur_pos) if (not cur_pos): return None back_pos = cur_pos for term in terms[:(- 1)][::(- 1)]: back_pos = cls.prev(term,...
2544d77de2413759fa4f8bba730a74b79912cd2143695af3ad0f0155a41bee31
@classmethod def get_docs_query_intersection(cls, terms): 'Get all documents id which consist all the query terms' if (len(terms) == 0): return set() docs_ids = set(cls.word_occurrences.select_documents(terms[0])) for term in terms[1:]: docs_ids.intersection_update(cls.word_occurrences.s...
Get all documents id which consist all the query terms
search_backend/wiki_index.py
get_docs_query_intersection
mindartyr/websearch
0
python
@classmethod def get_docs_query_intersection(cls, terms): if (len(terms) == 0): return set() docs_ids = set(cls.word_occurrences.select_documents(terms[0])) for term in terms[1:]: docs_ids.intersection_update(cls.word_occurrences.select_documents(term)) return docs_ids
@classmethod def get_docs_query_intersection(cls, terms): if (len(terms) == 0): return set() docs_ids = set(cls.word_occurrences.select_documents(terms[0])) for term in terms[1:]: docs_ids.intersection_update(cls.word_occurrences.select_documents(term)) return docs_ids<|docstring|>G...
bf612896273f3ad1f8f5cd356088de140f9b89b5fbf6a85cf880ce7d7d506eb0
def build_index_root(self, root_path): 'Build index for all files in the directory' for (dirName, subdirList, fileList) in os.walk(root_path): for file_name in fileList: if file_name.endswith('.bz2'): self.build_index_file(os.path.join(dirName, file_name)) return self
Build index for all files in the directory
search_backend/wiki_index.py
build_index_root
mindartyr/websearch
0
python
def build_index_root(self, root_path): for (dirName, subdirList, fileList) in os.walk(root_path): for file_name in fileList: if file_name.endswith('.bz2'): self.build_index_file(os.path.join(dirName, file_name)) return self
def build_index_root(self, root_path): for (dirName, subdirList, fileList) in os.walk(root_path): for file_name in fileList: if file_name.endswith('.bz2'): self.build_index_file(os.path.join(dirName, file_name)) return self<|docstring|>Build index for all files in the di...
00af774acb18192241a42ddc85d7fbbca0fc585d4c82236bb45896796014e36f
def build_index_file(self, file_name=None): 'Build index for one file' if (not file_name): file_name = self.dump_path BodyIndex.drop() AnchorIndex.drop() TitleIndex.drop() for (xml, line_number, page_id) in tqdm(self.read_wiki_file(file_name)): WikiPageIndex(xml=xml, file_id=page...
Build index for one file
search_backend/wiki_index.py
build_index_file
mindartyr/websearch
0
python
def build_index_file(self, file_name=None): if (not file_name): file_name = self.dump_path BodyIndex.drop() AnchorIndex.drop() TitleIndex.drop() for (xml, line_number, page_id) in tqdm(self.read_wiki_file(file_name)): WikiPageIndex(xml=xml, file_id=page_id, line_number=line_numb...
def build_index_file(self, file_name=None): if (not file_name): file_name = self.dump_path BodyIndex.drop() AnchorIndex.drop() TitleIndex.drop() for (xml, line_number, page_id) in tqdm(self.read_wiki_file(file_name)): WikiPageIndex(xml=xml, file_id=page_id, line_number=line_numb...
990c29a974ad19b8e35ab0d5cd11d70caa64a97aa65d5b0a5126454d2e1a4a67
@staticmethod def read_wiki_file_bz2(file_path): 'Read wiki documents from bz2 wiki dump' with bz2.open(file_path) as f: page = '' for line in f: line = str(line, encoding='utf-8').strip() if (line == '<page>'): page = line elif (line == '</pag...
Read wiki documents from bz2 wiki dump
search_backend/wiki_index.py
read_wiki_file_bz2
mindartyr/websearch
0
python
@staticmethod def read_wiki_file_bz2(file_path): with bz2.open(file_path) as f: page = for line in f: line = str(line, encoding='utf-8').strip() if (line == '<page>'): page = line elif (line == '</page>'): page += ('\n' + line...
@staticmethod def read_wiki_file_bz2(file_path): with bz2.open(file_path) as f: page = for line in f: line = str(line, encoding='utf-8').strip() if (line == '<page>'): page = line elif (line == '</page>'): page += ('\n' + line...
a11c2301ed51c821bfc46a70124419ed8273a086ef74ca08713808b9ad018448
@staticmethod def read_wiki_file(file_path): 'Read wiki documents from wiki dump' beginning = 0 page_id = 0 with open(file_path) as f: page = '' for (line_number, line) in enumerate(f): line = line.strip() if (line == '<page>'): beginning = line_nu...
Read wiki documents from wiki dump
search_backend/wiki_index.py
read_wiki_file
mindartyr/websearch
0
python
@staticmethod def read_wiki_file(file_path): beginning = 0 page_id = 0 with open(file_path) as f: page = for (line_number, line) in enumerate(f): line = line.strip() if (line == '<page>'): beginning = line_number page = line ...
@staticmethod def read_wiki_file(file_path): beginning = 0 page_id = 0 with open(file_path) as f: page = for (line_number, line) in enumerate(f): line = line.strip() if (line == '<page>'): beginning = line_number page = line ...
dd8ea89ae8bc615415e893de90f136c9245971ca2e13dc16d4b6092fc846d577
def search_query(self, query): 'Find relevant documents for the query' matched_ids = [] matched_in_text = dict() query_terms = [word for (_, word) in TextIndex.tokenizer_stemmer.tokenize(query)] found_docs = BodyIndex.get_docs_query_intersection(query_terms) print('Length of first filtering: ', ...
Find relevant documents for the query
search_backend/wiki_index.py
search_query
mindartyr/websearch
0
python
def search_query(self, query): matched_ids = [] matched_in_text = dict() query_terms = [word for (_, word) in TextIndex.tokenizer_stemmer.tokenize(query)] found_docs = BodyIndex.get_docs_query_intersection(query_terms) print('Length of first filtering: ', len(found_docs)) for document_id in...
def search_query(self, query): matched_ids = [] matched_in_text = dict() query_terms = [word for (_, word) in TextIndex.tokenizer_stemmer.tokenize(query)] found_docs = BodyIndex.get_docs_query_intersection(query_terms) print('Length of first filtering: ', len(found_docs)) for document_id in...
0011e6a025804d1f557d75dd592112693ea9974e15670cffc04d554a3370c82e
def ccw(A, B, C): 'Tests whether the line formed by A, B, and C is ccw' return (((B.x - A.x) * (C.y - A.y)) < ((B.y - A.y) * (C.x - A.x)))
Tests whether the line formed by A, B, and C is ccw
pathfinder/pathfinder.py
ccw
margaeor/map-shortest-path
1
python
def ccw(A, B, C): return (((B.x - A.x) * (C.y - A.y)) < ((B.y - A.y) * (C.x - A.x)))
def ccw(A, B, C): return (((B.x - A.x) * (C.y - A.y)) < ((B.y - A.y) * (C.x - A.x)))<|docstring|>Tests whether the line formed by A, B, and C is ccw<|endoftext|>
ea8f7909f03dff901acc8b6fd982251e212680acf5799eb2b7b1ba895d290360
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, global_validation: Optional[pulumi.Input[pulumi.InputType['GlobalValidationArgs']]]=None, http_settings: Optional[pulumi.Input[pulumi.InputType['HttpSettingsArgs']]]=None, identity_providers: Optional[pulumi.Input[pulumi.InputType['...
Create a WebAppAuthSettingsV2 resource with the given unique name, props, and options. :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] kind: Kind of resource. :param pulumi.Input[str] name: Name of web app. :param pulumi.Input[st...
sdk/python/pulumi_azure_nextgen/web/v20200601/web_app_auth_settings_v2.py
__init__
pulumi/pulumi-azure-nextgen
31
python
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, global_validation: Optional[pulumi.Input[pulumi.InputType['GlobalValidationArgs']]]=None, http_settings: Optional[pulumi.Input[pulumi.InputType['HttpSettingsArgs']]]=None, identity_providers: Optional[pulumi.Input[pulumi.InputType['...
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, global_validation: Optional[pulumi.Input[pulumi.InputType['GlobalValidationArgs']]]=None, http_settings: Optional[pulumi.Input[pulumi.InputType['HttpSettingsArgs']]]=None, identity_providers: Optional[pulumi.Input[pulumi.InputType['...
6d8fd269917067892564184c9abdc2cad628a383692bf5ed53f90792ef696bb6
@staticmethod def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'WebAppAuthSettingsV2': "\n Get an existing WebAppAuthSettingsV2 resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str ...
Get an existing WebAppAuthSettingsV2 resource's state with the given name, id, and optional extra properties used to qualify the lookup. :param str resource_name: The unique name of the resulting resource. :param pulumi.Input[str] id: The unique provider ID of the resource to lookup. :param pulumi.ResourceOptions opts...
sdk/python/pulumi_azure_nextgen/web/v20200601/web_app_auth_settings_v2.py
get
pulumi/pulumi-azure-nextgen
31
python
@staticmethod def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'WebAppAuthSettingsV2': "\n Get an existing WebAppAuthSettingsV2 resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str ...
@staticmethod def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'WebAppAuthSettingsV2': "\n Get an existing WebAppAuthSettingsV2 resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str ...
ecb4790ac98a25294818e9dc4dbcf665a036fa8112cefe502e392b1152353012
@property @pulumi.getter def kind(self) -> pulumi.Output[Optional[str]]: '\n Kind of resource.\n ' return pulumi.get(self, 'kind')
Kind of resource.
sdk/python/pulumi_azure_nextgen/web/v20200601/web_app_auth_settings_v2.py
kind
pulumi/pulumi-azure-nextgen
31
python
@property @pulumi.getter def kind(self) -> pulumi.Output[Optional[str]]: '\n \n ' return pulumi.get(self, 'kind')
@property @pulumi.getter def kind(self) -> pulumi.Output[Optional[str]]: '\n \n ' return pulumi.get(self, 'kind')<|docstring|>Kind of resource.<|endoftext|>
afe8154c8d1328a2988f8653b2f2772612e900c4624dad90774240f38597b0b9
@property @pulumi.getter def name(self) -> pulumi.Output[str]: '\n Resource Name.\n ' return pulumi.get(self, 'name')
Resource Name.
sdk/python/pulumi_azure_nextgen/web/v20200601/web_app_auth_settings_v2.py
name
pulumi/pulumi-azure-nextgen
31
python
@property @pulumi.getter def name(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'name')
@property @pulumi.getter def name(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'name')<|docstring|>Resource Name.<|endoftext|>
c15c1dc56245d583a9bb3efd3c3335f1e16831d01076e7f735161462641f2693
@property @pulumi.getter def type(self) -> pulumi.Output[str]: '\n Resource type.\n ' return pulumi.get(self, 'type')
Resource type.
sdk/python/pulumi_azure_nextgen/web/v20200601/web_app_auth_settings_v2.py
type
pulumi/pulumi-azure-nextgen
31
python
@property @pulumi.getter def type(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'type')
@property @pulumi.getter def type(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'type')<|docstring|>Resource type.<|endoftext|>
34c1d91a2a2851e50d98547fe4eab92f57c96cab728ee5333e43b4874032adac
def __init__(self, args): ' Create a new Scanner3D object\n args = arguments passed in the command line\n ' self.config = Config() self.sceneLeft = None self.sceneRight = None self.turntable = None self.arduino = None self.gui = None self.directory = None self.logLevel ...
Create a new Scanner3D object args = arguments passed in the command line
src/scan.py
__init__
fhennecker/semiteleporter
0
python
def __init__(self, args): ' Create a new Scanner3D object\n args = arguments passed in the command line\n ' self.config = Config() self.sceneLeft = None self.sceneRight = None self.turntable = None self.arduino = None self.gui = None self.directory = None self.logLevel ...
def __init__(self, args): ' Create a new Scanner3D object\n args = arguments passed in the command line\n ' self.config = Config() self.sceneLeft = None self.sceneRight = None self.turntable = None self.arduino = None self.gui = None self.directory = None self.logLevel ...
e340f5328f0634e0c250cdd6c7019a99668f724326af9d64b0d3de46e3ec8c65
def parseArgv(self, args): ' This method parse command line ' try: (opts, arguments) = getopt.getopt(args[1:], 'c:l:p:a:h', ['file=', 'loglevel=', 'directory=', 'arduino', 'help']) except getopt.GetoptError as err: logging.error(str(err)) self.usage(args) sys.exit(2) for ...
This method parse command line
src/scan.py
parseArgv
fhennecker/semiteleporter
0
python
def parseArgv(self, args): ' ' try: (opts, arguments) = getopt.getopt(args[1:], 'c:l:p:a:h', ['file=', 'loglevel=', 'directory=', 'arduino', 'help']) except getopt.GetoptError as err: logging.error(str(err)) self.usage(args) sys.exit(2) for (o, a) in opts: if (o ...
def parseArgv(self, args): ' ' try: (opts, arguments) = getopt.getopt(args[1:], 'c:l:p:a:h', ['file=', 'loglevel=', 'directory=', 'arduino', 'help']) except getopt.GetoptError as err: logging.error(str(err)) self.usage(args) sys.exit(2) for (o, a) in opts: if (o ...
2e9f8f5ca839627629d3ccb4a61eb4ff0c37fa13ac0e71f59e73f7ae6ac8636d
def init_normalized_(x, init_=nn.init.normal_, dim=(- 1), **kwargs): ' initialize x inp-place by sampling random normal values and normalizing them over dim ' init_(x) x.data = F.normalize(x, dim=dim, **kwargs) return x
initialize x inp-place by sampling random normal values and normalizing them over dim
lib/utils/init.py
init_normalized_
xtinkt/editable
27
python
def init_normalized_(x, init_=nn.init.normal_, dim=(- 1), **kwargs): ' ' init_(x) x.data = F.normalize(x, dim=dim, **kwargs) return x
def init_normalized_(x, init_=nn.init.normal_, dim=(- 1), **kwargs): ' ' init_(x) x.data = F.normalize(x, dim=dim, **kwargs) return x<|docstring|>initialize x inp-place by sampling random normal values and normalizing them over dim<|endoftext|>
ab298a2be6ae4af2be7d4ecc645a75176b2dbeda26006f7477dc8250b65968af
def initialize(self, *args, **kwargs): ' initialize module tensors using first batch of data ' raise NotImplementedError('Please implement ')
initialize module tensors using first batch of data
lib/utils/init.py
initialize
xtinkt/editable
27
python
def initialize(self, *args, **kwargs): ' ' raise NotImplementedError('Please implement ')
def initialize(self, *args, **kwargs): ' ' raise NotImplementedError('Please implement ')<|docstring|>initialize module tensors using first batch of data<|endoftext|>
1f877b632adbde4b4ab86e8c67e59815190290fa2a129dfa5c3d3be54fd34881
def is_initialized(self): ' whether data aware initialization was already performed ' if (self._is_initialized_bool is None): self._is_initialized_bool = bool(self._is_initialized_tensor.item()) return self._is_initialized_bool
whether data aware initialization was already performed
lib/utils/init.py
is_initialized
xtinkt/editable
27
python
def is_initialized(self): ' ' if (self._is_initialized_bool is None): self._is_initialized_bool = bool(self._is_initialized_tensor.item()) return self._is_initialized_bool
def is_initialized(self): ' ' if (self._is_initialized_bool is None): self._is_initialized_bool = bool(self._is_initialized_tensor.item()) return self._is_initialized_bool<|docstring|>whether data aware initialization was already performed<|endoftext|>
fb67f46556cc3425b0eefad423f72bcce012dac872128145a4b45daeda2feba0
@classmethod def run(cls, config: Config, line: str, line_num: int, file_path: str, rule: Rule, lines: List[str]) -> Optional[Candidate]: 'Check if regex pattern defined in a rule is present in a line\n\n Args:\n config: config object of user configs\n line: Line to check\n l...
Check if regex pattern defined in a rule is present in a line Args: config: config object of user configs line: Line to check line_num: Line number of a current line file_path: Path to the file that contain current line rule: Rule object to check current line lines: All lines if the file Retur...
credsweeper/scanner/scan_type/single_pattern.py
run
ARKAD97/CredSweeper
1
python
@classmethod def run(cls, config: Config, line: str, line_num: int, file_path: str, rule: Rule, lines: List[str]) -> Optional[Candidate]: 'Check if regex pattern defined in a rule is present in a line\n\n Args:\n config: config object of user configs\n line: Line to check\n l...
@classmethod def run(cls, config: Config, line: str, line_num: int, file_path: str, rule: Rule, lines: List[str]) -> Optional[Candidate]: 'Check if regex pattern defined in a rule is present in a line\n\n Args:\n config: config object of user configs\n line: Line to check\n l...
e6a32bf18a41840acfe1a09bf24a9cdd84ee194b966ff2bd327eab7a20947a18
@app.route('/favicon.ico') def favicon(): 'Serves the web icon from the static images.' return app.send_static_file('img/favicon.ico')
Serves the web icon from the static images.
truestory/views/__init__.py
favicon
savvybit/TrueStory
2
python
@app.route('/favicon.ico') def favicon(): return app.send_static_file('img/favicon.ico')
@app.route('/favicon.ico') def favicon(): return app.send_static_file('img/favicon.ico')<|docstring|>Serves the web icon from the static images.<|endoftext|>
ef65e89c29c8a62506825a86195d76cab102f1a63043f90bd4e48a35ab60cb5d
@app.route('/debug') def debug(): 'Triggers debugger on local environment only.' assert (app.debug is False) return 'Running in production.'
Triggers debugger on local environment only.
truestory/views/__init__.py
debug
savvybit/TrueStory
2
python
@app.route('/debug') def debug(): assert (app.debug is False) return 'Running in production.'
@app.route('/debug') def debug(): assert (app.debug is False) return 'Running in production.'<|docstring|>Triggers debugger on local environment only.<|endoftext|>
90a9ff6ccf97ba8cda84a750e34ca42dc86931b3c086510fded2e25e19fa6ef4
@commands.command(aliases=['mdm']) @commands.guild_only() @checks.admin_or_permissions(manage_guild=True) async def massdm(self, ctx: commands.Context, role: discord.Role, *, message: str) -> None: 'Sends a DM to all Members with the given Role.\n\n Allows for the following customizations:\n `{membe...
Sends a DM to all Members with the given Role. Allows for the following customizations: `{member}` is the member being messaged `{role}` is the role through which they are being messaged `{server}` is the server through which they are being messaged `{sender}` is you, the person sending the message
massdm/massdm.py
massdm
1illeke/myownrank-cogs
1
python
@commands.command(aliases=['mdm']) @commands.guild_only() @checks.admin_or_permissions(manage_guild=True) async def massdm(self, ctx: commands.Context, role: discord.Role, *, message: str) -> None: 'Sends a DM to all Members with the given Role.\n\n Allows for the following customizations:\n `{membe...
@commands.command(aliases=['mdm']) @commands.guild_only() @checks.admin_or_permissions(manage_guild=True) async def massdm(self, ctx: commands.Context, role: discord.Role, *, message: str) -> None: 'Sends a DM to all Members with the given Role.\n\n Allows for the following customizations:\n `{membe...
91e653ace39cb643348d62de4a527a89ad34e055cd961d3559973aed715aae5a
def extract_q_score(read_files, reference_file, workdir, n_processes=2): '\n DESCRIPTION:\n \n :param reference_file: [str] route to the reference file to align.\n :param q_score_threshold: [float] the value to filter.\n ' data = [] pairs = map((lambda x: (x, reference_file)), read_files) ...
DESCRIPTION: :param reference_file: [str] route to the reference file to align. :param q_score_threshold: [float] the value to filter.
statistics/extract_q_scores.py
extract_q_score
mrubio-chavarria/project_2
0
python
def extract_q_score(read_files, reference_file, workdir, n_processes=2): '\n DESCRIPTION:\n \n :param reference_file: [str] route to the reference file to align.\n :param q_score_threshold: [float] the value to filter.\n ' data = [] pairs = map((lambda x: (x, reference_file)), read_files) ...
def extract_q_score(read_files, reference_file, workdir, n_processes=2): '\n DESCRIPTION:\n \n :param reference_file: [str] route to the reference file to align.\n :param q_score_threshold: [float] the value to filter.\n ' data = [] pairs = map((lambda x: (x, reference_file)), read_files) ...
b6e1b3e22bd08f0456d8d0f147718969e43960b8454b4e69429df6d9619b0cac
def get_file_binary(file_path: str) -> bytes: '\n Get a file binary content from path.\n :param file_path: Path to wanted file\n :return: Binary content of the desired file\n ' with open(file_path, 'rb') as bf: file_content = bf.read() return file_content
Get a file binary content from path. :param file_path: Path to wanted file :return: Binary content of the desired file
cryton_worker/lib/util/module_util.py
get_file_binary
slashsec-edu/cryton-worker
0
python
def get_file_binary(file_path: str) -> bytes: '\n Get a file binary content from path.\n :param file_path: Path to wanted file\n :return: Binary content of the desired file\n ' with open(file_path, 'rb') as bf: file_content = bf.read() return file_content
def get_file_binary(file_path: str) -> bytes: '\n Get a file binary content from path.\n :param file_path: Path to wanted file\n :return: Binary content of the desired file\n ' with open(file_path, 'rb') as bf: file_content = bf.read() return file_content<|docstring|>Get a file binary co...
57f9e738ef16c074c1d36bcf1708b80af9bcfa143829d4ed14434a7e24b8cae4
def validate(self, data: str) -> str: '\n Validate data using defined sub schema/expressions ensuring all values are valid.\n :param data: Data to be validated with sub defined schemas.\n :return: Validated data\n ' for s in [self._schema(s, error=self._error, ignore_extra_keys=self....
Validate data using defined sub schema/expressions ensuring all values are valid. :param data: Data to be validated with sub defined schemas. :return: Validated data
cryton_worker/lib/util/module_util.py
validate
slashsec-edu/cryton-worker
0
python
def validate(self, data: str) -> str: '\n Validate data using defined sub schema/expressions ensuring all values are valid.\n :param data: Data to be validated with sub defined schemas.\n :return: Validated data\n ' for s in [self._schema(s, error=self._error, ignore_extra_keys=self....
def validate(self, data: str) -> str: '\n Validate data using defined sub schema/expressions ensuring all values are valid.\n :param data: Data to be validated with sub defined schemas.\n :return: Validated data\n ' for s in [self._schema(s, error=self._error, ignore_extra_keys=self....
a4c9db6e8f61d22245ea45282df3730ab5c28f9091ef03b963d561ffe33d93e1
def validate(self, data: str) -> str: '\n Validate data using defined sub schema/expressions ensuring all values are valid.\n :param data: Data to be validated with sub defined schemas.\n :return: Validated data\n ' for s in [self._schema(s, error=self._error, ignore_extra_keys=self....
Validate data using defined sub schema/expressions ensuring all values are valid. :param data: Data to be validated with sub defined schemas. :return: Validated data
cryton_worker/lib/util/module_util.py
validate
slashsec-edu/cryton-worker
0
python
def validate(self, data: str) -> str: '\n Validate data using defined sub schema/expressions ensuring all values are valid.\n :param data: Data to be validated with sub defined schemas.\n :return: Validated data\n ' for s in [self._schema(s, error=self._error, ignore_extra_keys=self....
def validate(self, data: str) -> str: '\n Validate data using defined sub schema/expressions ensuring all values are valid.\n :param data: Data to be validated with sub defined schemas.\n :return: Validated data\n ' for s in [self._schema(s, error=self._error, ignore_extra_keys=self....
45d96a0c476f910f72f3152d24f369f5b4d88d3cc35fbdd5050926ec55b9fff0
def __init__(self, robotPath, floor=True, fixed=False, transparent=False, gui=True, realTime=True, panels=False, useUrdfInertia=True, dt=0.002, physicsClient=None): 'Creates an instance of humanoid simulation\n\n Keyword Arguments:\n field {bool} -- enable the display of the field (default: {False...
Creates an instance of humanoid simulation Keyword Arguments: field {bool} -- enable the display of the field (default: {False}) fixed {bool} -- makes the base of the robot floating/fixed (default: {False}) transparent {bool} -- makes the robot transparent (default: {False}) gui {bool} -- enables the g...
onshape_to_robot/simulation.py
__init__
DeepBlueRobotics/onshape-to-robot
118
python
def __init__(self, robotPath, floor=True, fixed=False, transparent=False, gui=True, realTime=True, panels=False, useUrdfInertia=True, dt=0.002, physicsClient=None): 'Creates an instance of humanoid simulation\n\n Keyword Arguments:\n field {bool} -- enable the display of the field (default: {False...
def __init__(self, robotPath, floor=True, fixed=False, transparent=False, gui=True, realTime=True, panels=False, useUrdfInertia=True, dt=0.002, physicsClient=None): 'Creates an instance of humanoid simulation\n\n Keyword Arguments:\n field {bool} -- enable the display of the field (default: {False...
3f972a3621fd848d242b152776f4939c81d742ca4f4cc3ae162aa653605ff4fd
def setFloorFrictions(self, lateral=1, spinning=(- 1), rolling=(- 1)): 'Sets the frictions with the plane object\n\n Keyword Arguments:\n lateral {float} -- lateral friction (default: {1.0})\n spinning {float} -- spinning friction (default: {-1.0})\n rolling {float} -- rollin...
Sets the frictions with the plane object Keyword Arguments: lateral {float} -- lateral friction (default: {1.0}) spinning {float} -- spinning friction (default: {-1.0}) rolling {float} -- rolling friction (default: {-1.0})
onshape_to_robot/simulation.py
setFloorFrictions
DeepBlueRobotics/onshape-to-robot
118
python
def setFloorFrictions(self, lateral=1, spinning=(- 1), rolling=(- 1)): 'Sets the frictions with the plane object\n\n Keyword Arguments:\n lateral {float} -- lateral friction (default: {1.0})\n spinning {float} -- spinning friction (default: {-1.0})\n rolling {float} -- rollin...
def setFloorFrictions(self, lateral=1, spinning=(- 1), rolling=(- 1)): 'Sets the frictions with the plane object\n\n Keyword Arguments:\n lateral {float} -- lateral friction (default: {1.0})\n spinning {float} -- spinning friction (default: {-1.0})\n rolling {float} -- rollin...
d0f922c1ea61565dfd152ae4c0f96b24ba9a75ad1fa93c39ea006b14cd531c48
def lookAt(self, target): 'Control the look of the visualizer camera\n\n Arguments:\n target {tuple} -- target as (x,y,z) tuple\n ' if self.gui: params = p.getDebugVisualizerCamera() p.resetDebugVisualizerCamera(params[10], params[8], params[9], target)
Control the look of the visualizer camera Arguments: target {tuple} -- target as (x,y,z) tuple
onshape_to_robot/simulation.py
lookAt
DeepBlueRobotics/onshape-to-robot
118
python
def lookAt(self, target): 'Control the look of the visualizer camera\n\n Arguments:\n target {tuple} -- target as (x,y,z) tuple\n ' if self.gui: params = p.getDebugVisualizerCamera() p.resetDebugVisualizerCamera(params[10], params[8], params[9], target)
def lookAt(self, target): 'Control the look of the visualizer camera\n\n Arguments:\n target {tuple} -- target as (x,y,z) tuple\n ' if self.gui: params = p.getDebugVisualizerCamera() p.resetDebugVisualizerCamera(params[10], params[8], params[9], target)<|docstring|>Contr...
f3159254fd15d95f19459d120699d1180cb2dd6d8c7eb6d9d24274ade2580a74
def getRobotPose(self): 'Gets the robot (origin) position\n\n Returns:\n (tuple(3), tuple(3)) -- (x,y,z), (roll, pitch, yaw)\n ' pose = p.getBasePositionAndOrientation(self.robot) return (pose[0], p.getEulerFromQuaternion(pose[1]))
Gets the robot (origin) position Returns: (tuple(3), tuple(3)) -- (x,y,z), (roll, pitch, yaw)
onshape_to_robot/simulation.py
getRobotPose
DeepBlueRobotics/onshape-to-robot
118
python
def getRobotPose(self): 'Gets the robot (origin) position\n\n Returns:\n (tuple(3), tuple(3)) -- (x,y,z), (roll, pitch, yaw)\n ' pose = p.getBasePositionAndOrientation(self.robot) return (pose[0], p.getEulerFromQuaternion(pose[1]))
def getRobotPose(self): 'Gets the robot (origin) position\n\n Returns:\n (tuple(3), tuple(3)) -- (x,y,z), (roll, pitch, yaw)\n ' pose = p.getBasePositionAndOrientation(self.robot) return (pose[0], p.getEulerFromQuaternion(pose[1]))<|docstring|>Gets the robot (origin) position Retur...
13c6807c21cdaffc4244ac3d9ba34ed252e1bfae5ecd9044ace86676bbf9f4b6
def frameToWorldMatrix(self, frame): 'Gets the given frame to world matrix transformation. can be a frame name\n from URDF/SDF or "origin" for the part origin\n\n Arguments:\n frame {str} -- frame name\n\n Returns:\n np.matrix -- a 4x4 matrix\n ' if (frame == 'o...
Gets the given frame to world matrix transformation. can be a frame name from URDF/SDF or "origin" for the part origin Arguments: frame {str} -- frame name Returns: np.matrix -- a 4x4 matrix
onshape_to_robot/simulation.py
frameToWorldMatrix
DeepBlueRobotics/onshape-to-robot
118
python
def frameToWorldMatrix(self, frame): 'Gets the given frame to world matrix transformation. can be a frame name\n from URDF/SDF or "origin" for the part origin\n\n Arguments:\n frame {str} -- frame name\n\n Returns:\n np.matrix -- a 4x4 matrix\n ' if (frame == 'o...
def frameToWorldMatrix(self, frame): 'Gets the given frame to world matrix transformation. can be a frame name\n from URDF/SDF or "origin" for the part origin\n\n Arguments:\n frame {str} -- frame name\n\n Returns:\n np.matrix -- a 4x4 matrix\n ' if (frame == 'o...
96d10e67ac6701e29e7f87c5cf242331bdb3c8f38d478d2620cb542ed291e4eb
def transformation(self, frameA, frameB): 'Transformation matrix AtoB\n\n Arguments:\n frameA {str} -- frame A name\n frameB {str} -- frame B name\n\n Returns:\n np.matrix -- A 4x4 matrix\n ' AtoWorld = self.frameToWorldMatrix(frameA) BtoWorld = self.fra...
Transformation matrix AtoB Arguments: frameA {str} -- frame A name frameB {str} -- frame B name Returns: np.matrix -- A 4x4 matrix
onshape_to_robot/simulation.py
transformation
DeepBlueRobotics/onshape-to-robot
118
python
def transformation(self, frameA, frameB): 'Transformation matrix AtoB\n\n Arguments:\n frameA {str} -- frame A name\n frameB {str} -- frame B name\n\n Returns:\n np.matrix -- A 4x4 matrix\n ' AtoWorld = self.frameToWorldMatrix(frameA) BtoWorld = self.fra...
def transformation(self, frameA, frameB): 'Transformation matrix AtoB\n\n Arguments:\n frameA {str} -- frame A name\n frameB {str} -- frame B name\n\n Returns:\n np.matrix -- A 4x4 matrix\n ' AtoWorld = self.frameToWorldMatrix(frameA) BtoWorld = self.fra...
a17c1ba7c960c5d2192c0ca41612514ffaf9ac8a33a2016695296cc03372d0b7
def poseToMatrix(self, pose): 'Converts a pyBullet pose to a transformation matrix' translation = pose[0] quaternion = pose[1] rotation = quat2mat([quaternion[3], quaternion[0], quaternion[1], quaternion[2]]) m = np.identity(4) m[(0:3, 0:3)] = rotation m.T[(3, 0:3)] = translation return ...
Converts a pyBullet pose to a transformation matrix
onshape_to_robot/simulation.py
poseToMatrix
DeepBlueRobotics/onshape-to-robot
118
python
def poseToMatrix(self, pose): translation = pose[0] quaternion = pose[1] rotation = quat2mat([quaternion[3], quaternion[0], quaternion[1], quaternion[2]]) m = np.identity(4) m[(0:3, 0:3)] = rotation m.T[(3, 0:3)] = translation return np.matrix(m)
def poseToMatrix(self, pose): translation = pose[0] quaternion = pose[1] rotation = quat2mat([quaternion[3], quaternion[0], quaternion[1], quaternion[2]]) m = np.identity(4) m[(0:3, 0:3)] = rotation m.T[(3, 0:3)] = translation return np.matrix(m)<|docstring|>Converts a pyBullet pose to ...
885118c66d3abace3e9f1ada3342e177d01aefbcee2a0b0d0907f478bf85a496
def matrixToPose(self, matrix): 'Converts a transformation matrix to a pyBullet pose' arr = np.array(matrix) translation = list(arr.T[(3, 0:3)]) quaternion = mat2quat(arr[(0:3, 0:3)]) quaternion = [quaternion[1], quaternion[2], quaternion[3], quaternion[0]] return (translation, quaternion)
Converts a transformation matrix to a pyBullet pose
onshape_to_robot/simulation.py
matrixToPose
DeepBlueRobotics/onshape-to-robot
118
python
def matrixToPose(self, matrix): arr = np.array(matrix) translation = list(arr.T[(3, 0:3)]) quaternion = mat2quat(arr[(0:3, 0:3)]) quaternion = [quaternion[1], quaternion[2], quaternion[3], quaternion[0]] return (translation, quaternion)
def matrixToPose(self, matrix): arr = np.array(matrix) translation = list(arr.T[(3, 0:3)]) quaternion = mat2quat(arr[(0:3, 0:3)]) quaternion = [quaternion[1], quaternion[2], quaternion[3], quaternion[0]] return (translation, quaternion)<|docstring|>Converts a transformation matrix to a pyBullet...
4423043391c53a56fbb3cc3a5035bfe69021ddf45f1269b0187e69ced8b3b594
def setRobotPose(self, pos, orn): 'Sets the robot (origin) pose\n\n Arguments:\n pos {tuple} -- (x,y,z) position\n orn {tuple} -- (x,y,z,w) quaternions\n ' p.resetBasePositionAndOrientation(self.robot, pos, orn)
Sets the robot (origin) pose Arguments: pos {tuple} -- (x,y,z) position orn {tuple} -- (x,y,z,w) quaternions
onshape_to_robot/simulation.py
setRobotPose
DeepBlueRobotics/onshape-to-robot
118
python
def setRobotPose(self, pos, orn): 'Sets the robot (origin) pose\n\n Arguments:\n pos {tuple} -- (x,y,z) position\n orn {tuple} -- (x,y,z,w) quaternions\n ' p.resetBasePositionAndOrientation(self.robot, pos, orn)
def setRobotPose(self, pos, orn): 'Sets the robot (origin) pose\n\n Arguments:\n pos {tuple} -- (x,y,z) position\n orn {tuple} -- (x,y,z,w) quaternions\n ' p.resetBasePositionAndOrientation(self.robot, pos, orn)<|docstring|>Sets the robot (origin) pose Arguments: pos {tu...
b16af1d25ce1c0bb9260700f913bf6d1f5311b4f778d71d8b7fa50ef969e332f
def reset(self, height=0.5, orientation='straight'): "Resets the robot for experiment (joints, robot position, simulator time)\n\n Keyword Arguments:\n height {float} -- height of the reset (m) (default: {0.55})\n orientation {str} -- orientation (straight, front or back) of the robot (...
Resets the robot for experiment (joints, robot position, simulator time) Keyword Arguments: height {float} -- height of the reset (m) (default: {0.55}) orientation {str} -- orientation (straight, front or back) of the robot (default: {'straight'})
onshape_to_robot/simulation.py
reset
DeepBlueRobotics/onshape-to-robot
118
python
def reset(self, height=0.5, orientation='straight'): "Resets the robot for experiment (joints, robot position, simulator time)\n\n Keyword Arguments:\n height {float} -- height of the reset (m) (default: {0.55})\n orientation {str} -- orientation (straight, front or back) of the robot (...
def reset(self, height=0.5, orientation='straight'): "Resets the robot for experiment (joints, robot position, simulator time)\n\n Keyword Arguments:\n height {float} -- height of the reset (m) (default: {0.55})\n orientation {str} -- orientation (straight, front or back) of the robot (...
358967e8644c7f3c109a0fe31455d2a80ef741e2d70792069041353cc5f63f1c
def resetPose(self, pos, orn): 'Called by reset() with the robot pose\n\n Arguments:\n pos {tuple} -- (x,y,z) position\n orn {tuple} -- (x,y,z,w) quaternions\n ' self.setRobotPose(pos, orn)
Called by reset() with the robot pose Arguments: pos {tuple} -- (x,y,z) position orn {tuple} -- (x,y,z,w) quaternions
onshape_to_robot/simulation.py
resetPose
DeepBlueRobotics/onshape-to-robot
118
python
def resetPose(self, pos, orn): 'Called by reset() with the robot pose\n\n Arguments:\n pos {tuple} -- (x,y,z) position\n orn {tuple} -- (x,y,z,w) quaternions\n ' self.setRobotPose(pos, orn)
def resetPose(self, pos, orn): 'Called by reset() with the robot pose\n\n Arguments:\n pos {tuple} -- (x,y,z) position\n orn {tuple} -- (x,y,z,w) quaternions\n ' self.setRobotPose(pos, orn)<|docstring|>Called by reset() with the robot pose Arguments: pos {tuple} -- (x,y,...
8d8020b37e8f81e6f3bf0ba3fbae21173e53ee317790749b1cf5077b8eb26aa1
def getFrame(self, frame): 'Gets the given frame\n\n Arguments:\n frame {str} -- frame name\n\n Returns:\n tuple -- (pos, orn), where pos is (x, y, z) and orn is quaternions (x, y, z, w)\n ' jointState = p.getLinkState(self.robot, self.frames[frame]) return (jointS...
Gets the given frame Arguments: frame {str} -- frame name Returns: tuple -- (pos, orn), where pos is (x, y, z) and orn is quaternions (x, y, z, w)
onshape_to_robot/simulation.py
getFrame
DeepBlueRobotics/onshape-to-robot
118
python
def getFrame(self, frame): 'Gets the given frame\n\n Arguments:\n frame {str} -- frame name\n\n Returns:\n tuple -- (pos, orn), where pos is (x, y, z) and orn is quaternions (x, y, z, w)\n ' jointState = p.getLinkState(self.robot, self.frames[frame]) return (jointS...
def getFrame(self, frame): 'Gets the given frame\n\n Arguments:\n frame {str} -- frame name\n\n Returns:\n tuple -- (pos, orn), where pos is (x, y, z) and orn is quaternions (x, y, z, w)\n ' jointState = p.getLinkState(self.robot, self.frames[frame]) return (jointS...
f68e302af9e3c557d3317983e5462b0dfbeb9f04d6a11a21ba3dfff684aa9508
def getFrames(self): 'Gets the available frames in the current robot model\n\n Returns:\n dict -- dict of str -> (pos, orientation)\n ' frames = {} for name in self.frames.keys(): jointState = p.getLinkState(self.robot, self.frames[name]) pos = jointState[0] ...
Gets the available frames in the current robot model Returns: dict -- dict of str -> (pos, orientation)
onshape_to_robot/simulation.py
getFrames
DeepBlueRobotics/onshape-to-robot
118
python
def getFrames(self): 'Gets the available frames in the current robot model\n\n Returns:\n dict -- dict of str -> (pos, orientation)\n ' frames = {} for name in self.frames.keys(): jointState = p.getLinkState(self.robot, self.frames[name]) pos = jointState[0] ...
def getFrames(self): 'Gets the available frames in the current robot model\n\n Returns:\n dict -- dict of str -> (pos, orientation)\n ' frames = {} for name in self.frames.keys(): jointState = p.getLinkState(self.robot, self.frames[name]) pos = jointState[0] ...
31cf3cfc08f00bb0c599ed13eca0c47c9782e288e26161cfb1ce1d655981ba38
def resetJoints(self, joints): 'Reset all the joints to a given position\n\n Arguments:\n joints {dict} -- dict of joint name -> angle (float, radian)\n ' for name in joints: p.resetJointState(self.robot, self.joints[name], joints[name])
Reset all the joints to a given position Arguments: joints {dict} -- dict of joint name -> angle (float, radian)
onshape_to_robot/simulation.py
resetJoints
DeepBlueRobotics/onshape-to-robot
118
python
def resetJoints(self, joints): 'Reset all the joints to a given position\n\n Arguments:\n joints {dict} -- dict of joint name -> angle (float, radian)\n ' for name in joints: p.resetJointState(self.robot, self.joints[name], joints[name])
def resetJoints(self, joints): 'Reset all the joints to a given position\n\n Arguments:\n joints {dict} -- dict of joint name -> angle (float, radian)\n ' for name in joints: p.resetJointState(self.robot, self.joints[name], joints[name])<|docstring|>Reset all the joints to a giv...
5467617fa75b8b05c0341628cbaf45c5acb29ef558a75464f7a221c1bca6f716
def setJoints(self, joints): 'Set joint targets for motor control in simulation\n\n Arguments:\n joints {dict} -- dict of joint name -> angle (float, radian)\n\n Raises:\n Exception: if a joint is not found, exception is raised\n\n Returns:\n applied {dict} -- d...
Set joint targets for motor control in simulation Arguments: joints {dict} -- dict of joint name -> angle (float, radian) Raises: Exception: if a joint is not found, exception is raised Returns: applied {dict} -- dict of joint states (position, velocity, reaction forces, applied torque)
onshape_to_robot/simulation.py
setJoints
DeepBlueRobotics/onshape-to-robot
118
python
def setJoints(self, joints): 'Set joint targets for motor control in simulation\n\n Arguments:\n joints {dict} -- dict of joint name -> angle (float, radian)\n\n Raises:\n Exception: if a joint is not found, exception is raised\n\n Returns:\n applied {dict} -- d...
def setJoints(self, joints): 'Set joint targets for motor control in simulation\n\n Arguments:\n joints {dict} -- dict of joint name -> angle (float, radian)\n\n Raises:\n Exception: if a joint is not found, exception is raised\n\n Returns:\n applied {dict} -- d...
c9d82d0a055061b2704118e9c4e13c742e85f4cfbea3a6dae090bf7d12a1d6f0
def getJoints(self): 'Get all the joints names\n\n Returns:\n list -- list of str, with joint names\n ' return self.joints.keys()
Get all the joints names Returns: list -- list of str, with joint names
onshape_to_robot/simulation.py
getJoints
DeepBlueRobotics/onshape-to-robot
118
python
def getJoints(self): 'Get all the joints names\n\n Returns:\n list -- list of str, with joint names\n ' return self.joints.keys()
def getJoints(self): 'Get all the joints names\n\n Returns:\n list -- list of str, with joint names\n ' return self.joints.keys()<|docstring|>Get all the joints names Returns: list -- list of str, with joint names<|endoftext|>
6a434e4bd2be6ec2d83d08f2a73f6d61328da76cbb8b563cd3a2f6323852ce22
def getJointsInfos(self, name): 'Get informations about a joint\n\n Return:\n list -- a list with key type, lowerLimit & upperLimit (if defined)\n ' return self.jointsInfos[name]
Get informations about a joint Return: list -- a list with key type, lowerLimit & upperLimit (if defined)
onshape_to_robot/simulation.py
getJointsInfos
DeepBlueRobotics/onshape-to-robot
118
python
def getJointsInfos(self, name): 'Get informations about a joint\n\n Return:\n list -- a list with key type, lowerLimit & upperLimit (if defined)\n ' return self.jointsInfos[name]
def getJointsInfos(self, name): 'Get informations about a joint\n\n Return:\n list -- a list with key type, lowerLimit & upperLimit (if defined)\n ' return self.jointsInfos[name]<|docstring|>Get informations about a joint Return: list -- a list with key type, lowerLimit & upperLimi...
31e37b551f821f0298481154d3c6e293cfb50230dd7d9f9152542cdfbfa51271
def getRobotMass(self): 'Returns the robot mass\n\n Returns:\n float -- the robot mass (kg)\n ' if (self.mass is None): k = (- 1) self.mass = 0 while True: if ((k == (- 1)) or (p.getLinkState(self.robot, k) is not None)): d = p.getDyna...
Returns the robot mass Returns: float -- the robot mass (kg)
onshape_to_robot/simulation.py
getRobotMass
DeepBlueRobotics/onshape-to-robot
118
python
def getRobotMass(self): 'Returns the robot mass\n\n Returns:\n float -- the robot mass (kg)\n ' if (self.mass is None): k = (- 1) self.mass = 0 while True: if ((k == (- 1)) or (p.getLinkState(self.robot, k) is not None)): d = p.getDyna...
def getRobotMass(self): 'Returns the robot mass\n\n Returns:\n float -- the robot mass (kg)\n ' if (self.mass is None): k = (- 1) self.mass = 0 while True: if ((k == (- 1)) or (p.getLinkState(self.robot, k) is not None)): d = p.getDyna...
9e5ae82158d21a95553b934234b81762fc1dd486ce5a99572049156cabc9e48c
def getCenterOfMassPosition(self): 'Returns center of mass of the robot\n\n Returns:\n pos -- (x, y, z) robot center of mass\n ' k = (- 1) mass = 0 com = np.array([0.0, 0.0, 0.0]) while True: if (k == (- 1)): (pos, _) = p.getBasePositionAndOrientation(sel...
Returns center of mass of the robot Returns: pos -- (x, y, z) robot center of mass
onshape_to_robot/simulation.py
getCenterOfMassPosition
DeepBlueRobotics/onshape-to-robot
118
python
def getCenterOfMassPosition(self): 'Returns center of mass of the robot\n\n Returns:\n pos -- (x, y, z) robot center of mass\n ' k = (- 1) mass = 0 com = np.array([0.0, 0.0, 0.0]) while True: if (k == (- 1)): (pos, _) = p.getBasePositionAndOrientation(sel...
def getCenterOfMassPosition(self): 'Returns center of mass of the robot\n\n Returns:\n pos -- (x, y, z) robot center of mass\n ' k = (- 1) mass = 0 com = np.array([0.0, 0.0, 0.0]) while True: if (k == (- 1)): (pos, _) = p.getBasePositionAndOrientation(sel...
a65158cb7aafe907f98f58b9e72ea171dfc9ff2929938456a4b7f103440be15e
def addDebugPosition(self, position, color=None, duration=30): 'Adds a debug position to be drawn as a line\n\n Arguments:\n position {tuple} -- (x,y,z) (m)\n\n Keyword Arguments:\n color {tuple} -- (r,g,b) (0->1) (default: {None})\n duration {float} -- line duration o...
Adds a debug position to be drawn as a line Arguments: position {tuple} -- (x,y,z) (m) Keyword Arguments: color {tuple} -- (r,g,b) (0->1) (default: {None}) duration {float} -- line duration on screen before disapearing (default: {30})
onshape_to_robot/simulation.py
addDebugPosition
DeepBlueRobotics/onshape-to-robot
118
python
def addDebugPosition(self, position, color=None, duration=30): 'Adds a debug position to be drawn as a line\n\n Arguments:\n position {tuple} -- (x,y,z) (m)\n\n Keyword Arguments:\n color {tuple} -- (r,g,b) (0->1) (default: {None})\n duration {float} -- line duration o...
def addDebugPosition(self, position, color=None, duration=30): 'Adds a debug position to be drawn as a line\n\n Arguments:\n position {tuple} -- (x,y,z) (m)\n\n Keyword Arguments:\n color {tuple} -- (r,g,b) (0->1) (default: {None})\n duration {float} -- line duration o...
36b6ea01479df593b3b0ea507956efa47bf75af3faff3c86cdc07249cce87e0a
def drawDebugLines(self): 'Updates the drawing of debug lines' self.currentLine = 0 if ((time.time() - self.lastLinesDraw) > 0.05): for line in self.lines: if ('from' in line): if (line['update'] == True): p.addUserDebugLine(line['from'], line['to'], l...
Updates the drawing of debug lines
onshape_to_robot/simulation.py
drawDebugLines
DeepBlueRobotics/onshape-to-robot
118
python
def drawDebugLines(self): self.currentLine = 0 if ((time.time() - self.lastLinesDraw) > 0.05): for line in self.lines: if ('from' in line): if (line['update'] == True): p.addUserDebugLine(line['from'], line['to'], line['color'], 2, line['duration']) ...
def drawDebugLines(self): self.currentLine = 0 if ((time.time() - self.lastLinesDraw) > 0.05): for line in self.lines: if ('from' in line): if (line['update'] == True): p.addUserDebugLine(line['from'], line['to'], line['color'], 2, line['duration']) ...
3bdc5b9cdf4500cd1cd76215b45420989d86ab2989ecdf348614739ba6cfb5e9
def contactPoints(self): 'Gets all contact points and forces\n\n Returns:\n list -- list of entries (link_name, position in m, normal force vector, force in N)\n ' result = [] contacts = p.getContactPoints(bodyA=self.floor, bodyB=self.robot) for contact in contacts: link...
Gets all contact points and forces Returns: list -- list of entries (link_name, position in m, normal force vector, force in N)
onshape_to_robot/simulation.py
contactPoints
DeepBlueRobotics/onshape-to-robot
118
python
def contactPoints(self): 'Gets all contact points and forces\n\n Returns:\n list -- list of entries (link_name, position in m, normal force vector, force in N)\n ' result = [] contacts = p.getContactPoints(bodyA=self.floor, bodyB=self.robot) for contact in contacts: link...
def contactPoints(self): 'Gets all contact points and forces\n\n Returns:\n list -- list of entries (link_name, position in m, normal force vector, force in N)\n ' result = [] contacts = p.getContactPoints(bodyA=self.floor, bodyB=self.robot) for contact in contacts: link...
4b4aa319b6396e5be767d5627b9b5748b9fdb56f0607365866a745dba1fdf1bf
def autoCollisions(self): 'Returns the total amount of N in autocollisions (not with ground)\n\n Returns:\n float -- Newtons of collisions not with ground\n ' total = 0 for k in range(1, p.getNumJoints(self.robot)): contacts = p.getContactPoints(bodyA=k) for contact ...
Returns the total amount of N in autocollisions (not with ground) Returns: float -- Newtons of collisions not with ground
onshape_to_robot/simulation.py
autoCollisions
DeepBlueRobotics/onshape-to-robot
118
python
def autoCollisions(self): 'Returns the total amount of N in autocollisions (not with ground)\n\n Returns:\n float -- Newtons of collisions not with ground\n ' total = 0 for k in range(1, p.getNumJoints(self.robot)): contacts = p.getContactPoints(bodyA=k) for contact ...
def autoCollisions(self): 'Returns the total amount of N in autocollisions (not with ground)\n\n Returns:\n float -- Newtons of collisions not with ground\n ' total = 0 for k in range(1, p.getNumJoints(self.robot)): contacts = p.getContactPoints(bodyA=k) for contact ...
7bd84f73ee2d7a3dd5acf0584bfdff3d32d645ba7811345923d44fbd92baad81
def execute(self): 'Executes the simulaiton infinitely (blocks)' while True: self.tick()
Executes the simulaiton infinitely (blocks)
onshape_to_robot/simulation.py
execute
DeepBlueRobotics/onshape-to-robot
118
python
def execute(self): while True: self.tick()
def execute(self): while True: self.tick()<|docstring|>Executes the simulaiton infinitely (blocks)<|endoftext|>
b6f773f89d29fae00246e872bc069fcfef577e7f9da1c209ceac79c939aa1185
def tick(self): 'Ticks one step of simulation. If realTime is True, sleeps to compensate real time' self.t += self.dt self.drawDebugLines() p.stepSimulation() delay = (self.t - (time.time() - self.start)) if ((delay > 0) and self.realTime): time.sleep(delay)
Ticks one step of simulation. If realTime is True, sleeps to compensate real time
onshape_to_robot/simulation.py
tick
DeepBlueRobotics/onshape-to-robot
118
python
def tick(self): self.t += self.dt self.drawDebugLines() p.stepSimulation() delay = (self.t - (time.time() - self.start)) if ((delay > 0) and self.realTime): time.sleep(delay)
def tick(self): self.t += self.dt self.drawDebugLines() p.stepSimulation() delay = (self.t - (time.time() - self.start)) if ((delay > 0) and self.realTime): time.sleep(delay)<|docstring|>Ticks one step of simulation. If realTime is True, sleeps to compensate real time<|endoftext|>
853701d2d33c21add601ac547cfb95e8a3c89bdbe2d2d107b07708a5eab3a9bc
def add_arguments(self, parser): '\n TODO:\n argument to allow file output, for instance Android project path\n argument to execute some command, e.g: call gradle build task\n ' pass
TODO: argument to allow file output, for instance Android project path argument to execute some command, e.g: call gradle build task
databuilder/management/commands/toandroid.py
add_arguments
gnud/python-to-android-db
3
python
def add_arguments(self, parser): '\n TODO:\n argument to allow file output, for instance Android project path\n argument to execute some command, e.g: call gradle build task\n ' pass
def add_arguments(self, parser): '\n TODO:\n argument to allow file output, for instance Android project path\n argument to execute some command, e.g: call gradle build task\n ' pass<|docstring|>TODO: argument to allow file output, for instance Android project path argument to execu...
aac07d0166cb832917d35a18a10fe50c1eb0c5c006a79e534561e9d17e93fd14
@staticmethod def setup(): '\n Clean and migrate stuff\n ' utils.cleanup() call_command('makemigrations', 'databuilder', verbosity=0) call_command('migrate', 'databuilder', verbosity=0)
Clean and migrate stuff
databuilder/management/commands/toandroid.py
setup
gnud/python-to-android-db
3
python
@staticmethod def setup(): '\n \n ' utils.cleanup() call_command('makemigrations', 'databuilder', verbosity=0) call_command('migrate', 'databuilder', verbosity=0)
@staticmethod def setup(): '\n \n ' utils.cleanup() call_command('makemigrations', 'databuilder', verbosity=0) call_command('migrate', 'databuilder', verbosity=0)<|docstring|>Clean and migrate stuff<|endoftext|>
0ab9661f819523af0bedad02c25759f5a35e493ef46fa3361b3e952d10f74fe5
@staticmethod def extract_user_tables(): '\n Extract user created model tables defined in models.py.\n\n @:rtype List\n ' dump_file = utils.locate_sql_dump() ddl_data = open(dump_file, 'r').readlines() assert len(ddl_data), 'Try running:\n./manage migrate' ...
Extract user created model tables defined in models.py. @:rtype List
databuilder/management/commands/toandroid.py
extract_user_tables
gnud/python-to-android-db
3
python
@staticmethod def extract_user_tables(): '\n Extract user created model tables defined in models.py.\n\n @:rtype List\n ' dump_file = utils.locate_sql_dump() ddl_data = open(dump_file, 'r').readlines() assert len(ddl_data), 'Try running:\n./manage migrate' ...
@staticmethod def extract_user_tables(): '\n Extract user created model tables defined in models.py.\n\n @:rtype List\n ' dump_file = utils.locate_sql_dump() ddl_data = open(dump_file, 'r').readlines() assert len(ddl_data), 'Try running:\n./manage migrate' ...
314f8c74f1144cd4e52828ad25ae3b138f2d710dc06e307c3bdca7403d20d685
@staticmethod def do_backup(): '\n Performs the backend command that does the actual SQL dump\n ' _dumps_dir = settings.DUMPS_DIR _file = utils.generate_file().replace('.dump', '.sql') full_path = os.path.join(_dumps_dir, _file) call_command('dbbackup', '-O', full_path, verbosity=0)
Performs the backend command that does the actual SQL dump
databuilder/management/commands/toandroid.py
do_backup
gnud/python-to-android-db
3
python
@staticmethod def do_backup(): '\n \n ' _dumps_dir = settings.DUMPS_DIR _file = utils.generate_file().replace('.dump', '.sql') full_path = os.path.join(_dumps_dir, _file) call_command('dbbackup', '-O', full_path, verbosity=0)
@staticmethod def do_backup(): '\n \n ' _dumps_dir = settings.DUMPS_DIR _file = utils.generate_file().replace('.dump', '.sql') full_path = os.path.join(_dumps_dir, _file) call_command('dbbackup', '-O', full_path, verbosity=0)<|docstring|>Performs the backend command that does the actua...
08ee394627786126fab270e5f92ecccd12e8fc1a05c5ae23fe587132971c678e
def _port_in_use(port, server_type='tcp'): 'Check to see whether a given port is already in use on localhost.' if (server_type == 'tcp'): server = TCPServer elif (server_type == 'udp'): server = UDPServer else: raise ValueError('Server type can only be: udp or tcp.') try: ...
Check to see whether a given port is already in use on localhost.
streamparse/util.py
_port_in_use
Parsely/streamparse
1,050
python
def _port_in_use(port, server_type='tcp'): if (server_type == 'tcp'): server = TCPServer elif (server_type == 'udp'): server = UDPServer else: raise ValueError('Server type can only be: udp or tcp.') try: server(('localhost', port), None) except SocketError: ...
def _port_in_use(port, server_type='tcp'): if (server_type == 'tcp'): server = TCPServer elif (server_type == 'udp'): server = UDPServer else: raise ValueError('Server type can only be: udp or tcp.') try: server(('localhost', port), None) except SocketError: ...
e883a98b69cb8159a97daf81e4b6032237c4363eab3c590045de6f171dd1480a
@contextmanager def ssh_tunnel(env_config, local_port=6627, remote_port=None, quiet=False): 'Setup an optional ssh_tunnel to Nimbus.\n\n If use_ssh_for_nimbus is False, no tunnel will be created.\n ' (host, nimbus_port) = get_nimbus_host_port(env_config) if (remote_port is None): remote_port =...
Setup an optional ssh_tunnel to Nimbus. If use_ssh_for_nimbus is False, no tunnel will be created.
streamparse/util.py
ssh_tunnel
Parsely/streamparse
1,050
python
@contextmanager def ssh_tunnel(env_config, local_port=6627, remote_port=None, quiet=False): 'Setup an optional ssh_tunnel to Nimbus.\n\n If use_ssh_for_nimbus is False, no tunnel will be created.\n ' (host, nimbus_port) = get_nimbus_host_port(env_config) if (remote_port is None): remote_port =...
@contextmanager def ssh_tunnel(env_config, local_port=6627, remote_port=None, quiet=False): 'Setup an optional ssh_tunnel to Nimbus.\n\n If use_ssh_for_nimbus is False, no tunnel will be created.\n ' (host, nimbus_port) = get_nimbus_host_port(env_config) if (remote_port is None): remote_port =...
6c0da6c14db04d5904495370533c9d64277bf2548782288ca81d1dc27217b08e
def activate_env(env_name=None, options=None, config_file=None): 'Activate a particular environment from a streamparse project\'s\n config.json file and populate fabric\'s env dictionary with appropriate\n values.\n\n :param env_name: a `str` corresponding to the key within the config file\'s\n ...
Activate a particular environment from a streamparse project's config.json file and populate fabric's env dictionary with appropriate values. :param env_name: a `str` corresponding to the key within the config file's "envs" dictionary. :param config_file: a `file`-like object that contains the config....
streamparse/util.py
activate_env
Parsely/streamparse
1,050
python
def activate_env(env_name=None, options=None, config_file=None): 'Activate a particular environment from a streamparse project\'s\n config.json file and populate fabric\'s env dictionary with appropriate\n values.\n\n :param env_name: a `str` corresponding to the key within the config file\'s\n ...
def activate_env(env_name=None, options=None, config_file=None): 'Activate a particular environment from a streamparse project\'s\n config.json file and populate fabric\'s env dictionary with appropriate\n values.\n\n :param env_name: a `str` corresponding to the key within the config file\'s\n ...
fc63093a5348c7cb6eb4c121ef99450acd9452bbb32f2d1dcb2ab527fa282ee1
def get_config(config_file=None): '\n Parses the config file and returns it as a `dict`.\n\n :param config_file: a `file`-like object that contains the config.json\n contents. If `None`, we look for a file named\n ``config.json`` in the working directory.\n\n :...
Parses the config file and returns it as a `dict`. :param config_file: a `file`-like object that contains the config.json contents. If `None`, we look for a file named ``config.json`` in the working directory. :returns: a `dict` representing the parsed `config_file`.
streamparse/util.py
get_config
Parsely/streamparse
1,050
python
def get_config(config_file=None): '\n Parses the config file and returns it as a `dict`.\n\n :param config_file: a `file`-like object that contains the config.json\n contents. If `None`, we look for a file named\n ``config.json`` in the working directory.\n\n :...
def get_config(config_file=None): '\n Parses the config file and returns it as a `dict`.\n\n :param config_file: a `file`-like object that contains the config.json\n contents. If `None`, we look for a file named\n ``config.json`` in the working directory.\n\n :...
1ab6d291f851173cb42523580fc52883493bcc9c47bb517d571e66fb3732f4f8
def get_topology_definition(topology_name=None, config_file=None): "Fetch a topology name and definition file. If the topology_name is\n None, and there's only one topology definiton listed, we'll select that\n one, otherwise we'll die to avoid ambiguity.\n\n :param topology_name: a `str`, the topology_na...
Fetch a topology name and definition file. If the topology_name is None, and there's only one topology definiton listed, we'll select that one, otherwise we'll die to avoid ambiguity. :param topology_name: a `str`, the topology_name of the topology (without .py extension). :param config_file: a ...
streamparse/util.py
get_topology_definition
Parsely/streamparse
1,050
python
def get_topology_definition(topology_name=None, config_file=None): "Fetch a topology name and definition file. If the topology_name is\n None, and there's only one topology definiton listed, we'll select that\n one, otherwise we'll die to avoid ambiguity.\n\n :param topology_name: a `str`, the topology_na...
def get_topology_definition(topology_name=None, config_file=None): "Fetch a topology name and definition file. If the topology_name is\n None, and there's only one topology definiton listed, we'll select that\n one, otherwise we'll die to avoid ambiguity.\n\n :param topology_name: a `str`, the topology_na...