repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
dpgaspar/Flask-AppBuilder
flask_appbuilder/console.py
list_views
def list_views(app, appbuilder): """ List all registered views """ _appbuilder = import_application(app, appbuilder) echo_header("List of registered views") for view in _appbuilder.baseviews: click.echo( "View:{0} | Route:{1} | Perms:{2}".format( view.__cl...
python
def list_views(app, appbuilder): """ List all registered views """ _appbuilder = import_application(app, appbuilder) echo_header("List of registered views") for view in _appbuilder.baseviews: click.echo( "View:{0} | Route:{1} | Perms:{2}".format( view.__cl...
[ "def", "list_views", "(", "app", ",", "appbuilder", ")", ":", "_appbuilder", "=", "import_application", "(", "app", ",", "appbuilder", ")", "echo_header", "(", "\"List of registered views\"", ")", "for", "view", "in", "_appbuilder", ".", "baseviews", ":", "click...
List all registered views
[ "List", "all", "registered", "views" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/console.py#L230-L241
train
List all registered views
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/console.py
list_users
def list_users(app, appbuilder): """ List all users on the database """ _appbuilder = import_application(app, appbuilder) echo_header("List of users") for user in _appbuilder.sm.get_all_users(): click.echo( "username:{0} | email:{1} | role:{2}".format( use...
python
def list_users(app, appbuilder): """ List all users on the database """ _appbuilder = import_application(app, appbuilder) echo_header("List of users") for user in _appbuilder.sm.get_all_users(): click.echo( "username:{0} | email:{1} | role:{2}".format( use...
[ "def", "list_users", "(", "app", ",", "appbuilder", ")", ":", "_appbuilder", "=", "import_application", "(", "app", ",", "appbuilder", ")", "echo_header", "(", "\"List of users\"", ")", "for", "user", "in", "_appbuilder", ".", "sm", ".", "get_all_users", "(", ...
List all users on the database
[ "List", "all", "users", "on", "the", "database" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/console.py#L247-L258
train
List all users on the database
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/console.py
collect_static
def collect_static(static_folder): """ Copies flask-appbuilder static files to your projects static folder """ appbuilder_static_path = os.path.join( os.path.dirname(os.path.abspath(__file__)), "static/appbuilder" ) app_static_path = os.path.join(os.getcwd(), static_folder) if no...
python
def collect_static(static_folder): """ Copies flask-appbuilder static files to your projects static folder """ appbuilder_static_path = os.path.join( os.path.dirname(os.path.abspath(__file__)), "static/appbuilder" ) app_static_path = os.path.join(os.getcwd(), static_folder) if no...
[ "def", "collect_static", "(", "static_folder", ")", ":", "appbuilder_static_path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file__", ")", ")", ",", "\"static/appbuilder\"",...
Copies flask-appbuilder static files to your projects static folder
[ "Copies", "flask", "-", "appbuilder", "static", "files", "to", "your", "projects", "static", "folder" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/console.py#L388-L413
train
Collect static files from flask - appbuilder static folder to your projects static folder
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/models/group.py
aggregate_avg
def aggregate_avg(items, col): """ Function to use on Group by Charts. accepts a list and returns the average of the list's items """ try: return aggregate_sum(items, col) / aggregate_count(items, col) except Exception: log.warning(c.LOGMSG_WAR_DBI_AVG_ZERODIV) re...
python
def aggregate_avg(items, col): """ Function to use on Group by Charts. accepts a list and returns the average of the list's items """ try: return aggregate_sum(items, col) / aggregate_count(items, col) except Exception: log.warning(c.LOGMSG_WAR_DBI_AVG_ZERODIV) re...
[ "def", "aggregate_avg", "(", "items", ",", "col", ")", ":", "try", ":", "return", "aggregate_sum", "(", "items", ",", "col", ")", "/", "aggregate_count", "(", "items", ",", "col", ")", "except", "Exception", ":", "log", ".", "warning", "(", "c", ".", ...
Function to use on Group by Charts. accepts a list and returns the average of the list's items
[ "Function", "to", "use", "on", "Group", "by", "Charts", ".", "accepts", "a", "list", "and", "returns", "the", "average", "of", "the", "list", "s", "items" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/models/group.py#L51-L60
train
Function to use on Group by Charts. accepts a list and returns the average of the list s items
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/models/group.py
BaseProcessData.to_json
def to_json(self, data, labels=None): """ Will return a dict with Google JSON structure for charts The Google structure:: { cols: [{id:<COL_NAME>, label:<LABEL FOR COL>, type: <COL TYPE>}, ...] rows: [{c: [{v: <COL VALUE}, ...], ....
python
def to_json(self, data, labels=None): """ Will return a dict with Google JSON structure for charts The Google structure:: { cols: [{id:<COL_NAME>, label:<LABEL FOR COL>, type: <COL TYPE>}, ...] rows: [{c: [{v: <COL VALUE}, ...], ....
[ "def", "to_json", "(", "self", ",", "data", ",", "labels", "=", "None", ")", ":", "labels", "=", "labels", "or", "dict", "(", ")", "json_data", "=", "dict", "(", ")", "json_data", "[", "\"cols\"", "]", "=", "[", "]", "# Create Structure to identify the g...
Will return a dict with Google JSON structure for charts The Google structure:: { cols: [{id:<COL_NAME>, label:<LABEL FOR COL>, type: <COL TYPE>}, ...] rows: [{c: [{v: <COL VALUE}, ...], ... ] } :param data: :...
[ "Will", "return", "a", "dict", "with", "Google", "JSON", "structure", "for", "charts" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/models/group.py#L267-L315
train
Returns a dict with Google JSON structure for charts
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseView.create_blueprint
def create_blueprint(self, appbuilder, endpoint=None, static_folder=None): """ Create Flask blueprint. You will generally not use it :param appbuilder: the AppBuilder object :param endpoint: endpoint override for this blueprint, w...
python
def create_blueprint(self, appbuilder, endpoint=None, static_folder=None): """ Create Flask blueprint. You will generally not use it :param appbuilder: the AppBuilder object :param endpoint: endpoint override for this blueprint, w...
[ "def", "create_blueprint", "(", "self", ",", "appbuilder", ",", "endpoint", "=", "None", ",", "static_folder", "=", "None", ")", ":", "# Store appbuilder instance", "self", ".", "appbuilder", "=", "appbuilder", "# If endpoint name is not provided, get it from the class na...
Create Flask blueprint. You will generally not use it :param appbuilder: the AppBuilder object :param endpoint: endpoint override for this blueprint, will assume class name if not provided :param static_folder: the relative...
[ "Create", "Flask", "blueprint", ".", "You", "will", "generally", "not", "use", "it" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L120-L160
train
Create Flask blueprint. You will generally not use it.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseView.render_template
def render_template(self, template, **kwargs): """ Use this method on your own endpoints, will pass the extra_args to the templates. :param template: The template relative path :param kwargs: arguments to be passed to the template """ kwargs["base...
python
def render_template(self, template, **kwargs): """ Use this method on your own endpoints, will pass the extra_args to the templates. :param template: The template relative path :param kwargs: arguments to be passed to the template """ kwargs["base...
[ "def", "render_template", "(", "self", ",", "template", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "\"base_template\"", "]", "=", "self", ".", "appbuilder", ".", "base_template", "kwargs", "[", "\"appbuilder\"", "]", "=", "self", ".", "appbuilder", ...
Use this method on your own endpoints, will pass the extra_args to the templates. :param template: The template relative path :param kwargs: arguments to be passed to the template
[ "Use", "this", "method", "on", "your", "own", "endpoints", "will", "pass", "the", "extra_args", "to", "the", "templates", "." ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L172-L184
train
Render the template with the extra_args as keyword arguments
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseView.update_redirect
def update_redirect(self): """ Call it on your own endpoint's to update the back history navigation. If you bypass it, the next submit or back will go over it. """ page_history = Stack(session.get("page_history", [])) page_history.push(request.url) session...
python
def update_redirect(self): """ Call it on your own endpoint's to update the back history navigation. If you bypass it, the next submit or back will go over it. """ page_history = Stack(session.get("page_history", [])) page_history.push(request.url) session...
[ "def", "update_redirect", "(", "self", ")", ":", "page_history", "=", "Stack", "(", "session", ".", "get", "(", "\"page_history\"", ",", "[", "]", ")", ")", "page_history", ".", "push", "(", "request", ".", "url", ")", "session", "[", "\"page_history\"", ...
Call it on your own endpoint's to update the back history navigation. If you bypass it, the next submit or back will go over it.
[ "Call", "it", "on", "your", "own", "endpoint", "s", "to", "update", "the", "back", "history", "navigation", ".", "If", "you", "bypass", "it", "the", "next", "submit", "or", "back", "will", "go", "over", "it", "." ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L208-L215
train
Update the back history navigation.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseView.get_redirect
def get_redirect(self): """ Returns the previous url. """ index_url = self.appbuilder.get_url_for_index page_history = Stack(session.get("page_history", [])) if page_history.pop() is None: return index_url session["page_history"] = page_history.to...
python
def get_redirect(self): """ Returns the previous url. """ index_url = self.appbuilder.get_url_for_index page_history = Stack(session.get("page_history", [])) if page_history.pop() is None: return index_url session["page_history"] = page_history.to...
[ "def", "get_redirect", "(", "self", ")", ":", "index_url", "=", "self", ".", "appbuilder", ".", "get_url_for_index", "page_history", "=", "Stack", "(", "session", ".", "get", "(", "\"page_history\"", ",", "[", "]", ")", ")", "if", "page_history", ".", "pop...
Returns the previous url.
[ "Returns", "the", "previous", "url", "." ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L217-L228
train
Returns the previous url.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseModelView._label_columns_json
def _label_columns_json(self): """ Prepares dict with labels to be JSON serializable """ ret = {} for key, value in list(self.label_columns.items()): ret[key] = as_unicode(value.encode("UTF-8")) return ret
python
def _label_columns_json(self): """ Prepares dict with labels to be JSON serializable """ ret = {} for key, value in list(self.label_columns.items()): ret[key] = as_unicode(value.encode("UTF-8")) return ret
[ "def", "_label_columns_json", "(", "self", ")", ":", "ret", "=", "{", "}", "for", "key", ",", "value", "in", "list", "(", "self", ".", "label_columns", ".", "items", "(", ")", ")", ":", "ret", "[", "key", "]", "=", "as_unicode", "(", "value", ".", ...
Prepares dict with labels to be JSON serializable
[ "Prepares", "dict", "with", "labels", "to", "be", "JSON", "serializable" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L487-L494
train
Returns a dict with labels to be JSON serializable
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseCRUDView._init_forms
def _init_forms(self): """ Init forms for Add and Edit """ super(BaseCRUDView, self)._init_forms() conv = GeneralModelConverter(self.datamodel) if not self.add_form: self.add_form = conv.create_form( self.label_columns, self...
python
def _init_forms(self): """ Init forms for Add and Edit """ super(BaseCRUDView, self)._init_forms() conv = GeneralModelConverter(self.datamodel) if not self.add_form: self.add_form = conv.create_form( self.label_columns, self...
[ "def", "_init_forms", "(", "self", ")", ":", "super", "(", "BaseCRUDView", ",", "self", ")", ".", "_init_forms", "(", ")", "conv", "=", "GeneralModelConverter", "(", "self", ".", "datamodel", ")", "if", "not", "self", ".", "add_form", ":", "self", ".", ...
Init forms for Add and Edit
[ "Init", "forms", "for", "Add", "and", "Edit" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L705-L728
train
Initializes the add and edit forms for Add and Edit.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseCRUDView._init_properties
def _init_properties(self): """ Init Properties """ super(BaseCRUDView, self)._init_properties() # Reset init props self.related_views = self.related_views or [] self._related_views = self._related_views or [] self.description_columns = self.descriptio...
python
def _init_properties(self): """ Init Properties """ super(BaseCRUDView, self)._init_properties() # Reset init props self.related_views = self.related_views or [] self._related_views = self._related_views or [] self.description_columns = self.descriptio...
[ "def", "_init_properties", "(", "self", ")", ":", "super", "(", "BaseCRUDView", ",", "self", ")", ".", "_init_properties", "(", ")", "# Reset init props", "self", ".", "related_views", "=", "self", ".", "related_views", "or", "[", "]", "self", ".", "_related...
Init Properties
[ "Init", "Properties" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L746-L802
train
Initialize base properties of the base CRUD view.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseCRUDView._get_related_views_widgets
def _get_related_views_widgets( self, item, orders=None, pages=None, page_sizes=None, widgets=None, **args ): """ :return: Returns a dict with 'related_views' key with a list of Model View widgets """ widgets = widgets or {} widgets...
python
def _get_related_views_widgets( self, item, orders=None, pages=None, page_sizes=None, widgets=None, **args ): """ :return: Returns a dict with 'related_views' key with a list of Model View widgets """ widgets = widgets or {} widgets...
[ "def", "_get_related_views_widgets", "(", "self", ",", "item", ",", "orders", "=", "None", ",", "pages", "=", "None", ",", "page_sizes", "=", "None", ",", "widgets", "=", "None", ",", "*", "*", "args", ")", ":", "widgets", "=", "widgets", "or", "{", ...
:return: Returns a dict with 'related_views' key with a list of Model View widgets
[ ":", "return", ":", "Returns", "a", "dict", "with", "related_views", "key", "with", "a", "list", "of", "Model", "View", "widgets" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L851-L876
train
Returns a dict with related_views key with a list of Model View widgets
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseCRUDView._get_list_widget
def _get_list_widget( self, filters, actions=None, order_column="", order_direction="", page=None, page_size=None, widgets=None, **args ): """ get joined base filter and current active filter for query """ widgets = widgets or ...
python
def _get_list_widget( self, filters, actions=None, order_column="", order_direction="", page=None, page_size=None, widgets=None, **args ): """ get joined base filter and current active filter for query """ widgets = widgets or ...
[ "def", "_get_list_widget", "(", "self", ",", "filters", ",", "actions", "=", "None", ",", "order_column", "=", "\"\"", ",", "order_direction", "=", "\"\"", ",", "page", "=", "None", ",", "page_size", "=", "None", ",", "widgets", "=", "None", ",", "*", ...
get joined base filter and current active filter for query
[ "get", "joined", "base", "filter", "and", "current", "active", "filter", "for", "query" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L885-L930
train
get list widget for this object
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseCRUDView._list
def _list(self): """ list function logic, override to implement different logic returns list and search widget """ if get_order_args().get(self.__class__.__name__): order_column, order_direction = get_order_args().get( self.__class__.__name__ ...
python
def _list(self): """ list function logic, override to implement different logic returns list and search widget """ if get_order_args().get(self.__class__.__name__): order_column, order_direction = get_order_args().get( self.__class__.__name__ ...
[ "def", "_list", "(", "self", ")", ":", "if", "get_order_args", "(", ")", ".", "get", "(", "self", ".", "__class__", ".", "__name__", ")", ":", "order_column", ",", "order_direction", "=", "get_order_args", "(", ")", ".", "get", "(", "self", ".", "__cla...
list function logic, override to implement different logic returns list and search widget
[ "list", "function", "logic", "override", "to", "implement", "different", "logic", "returns", "list", "and", "search", "widget" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L991-L1014
train
Internal method that returns list and search widget
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseCRUDView._show
def _show(self, pk): """ show function logic, override to implement different logic returns show and related list widget """ pages = get_page_args() page_sizes = get_page_size_args() orders = get_order_args() item = self.datamodel.get(pk, self._ba...
python
def _show(self, pk): """ show function logic, override to implement different logic returns show and related list widget """ pages = get_page_args() page_sizes = get_page_size_args() orders = get_order_args() item = self.datamodel.get(pk, self._ba...
[ "def", "_show", "(", "self", ",", "pk", ")", ":", "pages", "=", "get_page_args", "(", ")", "page_sizes", "=", "get_page_size_args", "(", ")", "orders", "=", "get_order_args", "(", ")", "item", "=", "self", ".", "datamodel", ".", "get", "(", "pk", ",", ...
show function logic, override to implement different logic returns show and related list widget
[ "show", "function", "logic", "override", "to", "implement", "different", "logic", "returns", "show", "and", "related", "list", "widget" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L1016-L1032
train
show function logic override to implement different logic returns show and related list widget
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseCRUDView._add
def _add(self): """ Add function logic, override to implement different logic returns add widget or None """ is_valid_form = True get_filter_args(self._filters) exclude_cols = self._filters.get_relation_cols() form = self.add_form.refresh() ...
python
def _add(self): """ Add function logic, override to implement different logic returns add widget or None """ is_valid_form = True get_filter_args(self._filters) exclude_cols = self._filters.get_relation_cols() form = self.add_form.refresh() ...
[ "def", "_add", "(", "self", ")", ":", "is_valid_form", "=", "True", "get_filter_args", "(", "self", ".", "_filters", ")", "exclude_cols", "=", "self", ".", "_filters", ".", "get_relation_cols", "(", ")", "form", "=", "self", ".", "add_form", ".", "refresh"...
Add function logic, override to implement different logic returns add widget or None
[ "Add", "function", "logic", "override", "to", "implement", "different", "logic", "returns", "add", "widget", "or", "None" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L1034-L1065
train
Add function logic override to implement different logic Add function logic return add widget or None
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseCRUDView._edit
def _edit(self, pk): """ Edit function logic, override to implement different logic returns Edit widget and related list or None """ is_valid_form = True pages = get_page_args() page_sizes = get_page_size_args() orders = get_order_args() ge...
python
def _edit(self, pk): """ Edit function logic, override to implement different logic returns Edit widget and related list or None """ is_valid_form = True pages = get_page_args() page_sizes = get_page_size_args() orders = get_order_args() ge...
[ "def", "_edit", "(", "self", ",", "pk", ")", ":", "is_valid_form", "=", "True", "pages", "=", "get_page_args", "(", ")", "page_sizes", "=", "get_page_size_args", "(", ")", "orders", "=", "get_order_args", "(", ")", "get_filter_args", "(", "self", ".", "_fi...
Edit function logic, override to implement different logic returns Edit widget and related list or None
[ "Edit", "function", "logic", "override", "to", "implement", "different", "logic", "returns", "Edit", "widget", "and", "related", "list", "or", "None" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L1067-L1123
train
Edit function logic override to implement different logic returns Edit widget and related list or None
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseCRUDView._delete
def _delete(self, pk): """ Delete function logic, override to implement different logic deletes the record with primary_key = pk :param pk: record primary key to delete """ item = self.datamodel.get(pk, self._base_filters) if not item:...
python
def _delete(self, pk): """ Delete function logic, override to implement different logic deletes the record with primary_key = pk :param pk: record primary key to delete """ item = self.datamodel.get(pk, self._base_filters) if not item:...
[ "def", "_delete", "(", "self", ",", "pk", ")", ":", "item", "=", "self", ".", "datamodel", ".", "get", "(", "pk", ",", "self", ".", "_base_filters", ")", "if", "not", "item", ":", "abort", "(", "404", ")", "try", ":", "self", ".", "pre_delete", "...
Delete function logic, override to implement different logic deletes the record with primary_key = pk :param pk: record primary key to delete
[ "Delete", "function", "logic", "override", "to", "implement", "different", "logic", "deletes", "the", "record", "with", "primary_key", "=", "pk" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L1125-L1144
train
Delete function logic override to implement different logic deletes the record with primary key pk
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
dpgaspar/Flask-AppBuilder
flask_appbuilder/baseviews.py
BaseCRUDView._fill_form_exclude_cols
def _fill_form_exclude_cols(self, exclude_cols, form): """ fill the form with the suppressed cols, generated from exclude_cols """ for filter_key in exclude_cols: filter_value = self._filters.get_filter_value(filter_key) rel_obj = self.datamodel.get_related_ob...
python
def _fill_form_exclude_cols(self, exclude_cols, form): """ fill the form with the suppressed cols, generated from exclude_cols """ for filter_key in exclude_cols: filter_value = self._filters.get_filter_value(filter_key) rel_obj = self.datamodel.get_related_ob...
[ "def", "_fill_form_exclude_cols", "(", "self", ",", "exclude_cols", ",", "form", ")", ":", "for", "filter_key", "in", "exclude_cols", ":", "filter_value", "=", "self", ".", "_filters", ".", "get_filter_value", "(", "filter_key", ")", "rel_obj", "=", "self", "....
fill the form with the suppressed cols, generated from exclude_cols
[ "fill", "the", "form", "with", "the", "suppressed", "cols", "generated", "from", "exclude_cols" ]
c293734c1b86e176a3ba57ee2deab6676d125576
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/baseviews.py#L1186-L1195
train
Fill the form with the suppressed cols generated from exclude_cols
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/transfer.py
Transfer.get
def get(self, remote, local=None, preserve_mode=True): """ Download a file from the current connection to the local filesystem. :param str remote: Remote file to download. May be absolute, or relative to the remote working directory. .. note:: ...
python
def get(self, remote, local=None, preserve_mode=True): """ Download a file from the current connection to the local filesystem. :param str remote: Remote file to download. May be absolute, or relative to the remote working directory. .. note:: ...
[ "def", "get", "(", "self", ",", "remote", ",", "local", "=", "None", ",", "preserve_mode", "=", "True", ")", ":", "# TODO: how does this API change if we want to implement", "# remote-to-remote file transfer? (Is that even realistic?)", "# TODO: handle v1's string interpolation b...
Download a file from the current connection to the local filesystem. :param str remote: Remote file to download. May be absolute, or relative to the remote working directory. .. note:: Most SFTP servers set the remote working directory to the ...
[ "Download", "a", "file", "from", "the", "current", "connection", "to", "the", "local", "filesystem", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/transfer.py#L41-L145
train
Download a file from the remote system to the local filesystem.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/transfer.py
Transfer.put
def put(self, local, remote=None, preserve_mode=True): """ Upload a file from the local filesystem to the current connection. :param local: Local path of file to upload, or a file-like object. **If a string is given**, it should be a path to a local (regular) ...
python
def put(self, local, remote=None, preserve_mode=True): """ Upload a file from the local filesystem to the current connection. :param local: Local path of file to upload, or a file-like object. **If a string is given**, it should be a path to a local (regular) ...
[ "def", "put", "(", "self", ",", "local", ",", "remote", "=", "None", ",", "preserve_mode", "=", "True", ")", ":", "if", "not", "local", ":", "raise", "ValueError", "(", "\"Local path must not be empty!\"", ")", "is_file_like", "=", "hasattr", "(", "local", ...
Upload a file from the local filesystem to the current connection. :param local: Local path of file to upload, or a file-like object. **If a string is given**, it should be a path to a local (regular) file (not a directory). .. note:: When deali...
[ "Upload", "a", "file", "from", "the", "local", "filesystem", "to", "the", "current", "connection", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/transfer.py#L147-L283
train
Uploads a file from the local filesystem to the remote system.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/config.py
Config.load_ssh_config
def load_ssh_config(self): """ Load SSH config file(s) from disk. Also (beforehand) ensures that Invoke-level config re: runtime SSH config file paths, is accounted for. .. versionadded:: 2.0 """ # Update the runtime SSH config path (assumes enough regular confi...
python
def load_ssh_config(self): """ Load SSH config file(s) from disk. Also (beforehand) ensures that Invoke-level config re: runtime SSH config file paths, is accounted for. .. versionadded:: 2.0 """ # Update the runtime SSH config path (assumes enough regular confi...
[ "def", "load_ssh_config", "(", "self", ")", ":", "# Update the runtime SSH config path (assumes enough regular config", "# levels have been loaded that anyone wanting to transmit this info", "# from a 'vanilla' Invoke config, has gotten it set.)", "if", "self", ".", "ssh_config_path", ":",...
Load SSH config file(s) from disk. Also (beforehand) ensures that Invoke-level config re: runtime SSH config file paths, is accounted for. .. versionadded:: 2.0
[ "Load", "SSH", "config", "file", "(", "s", ")", "from", "disk", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/config.py#L110-L127
train
Load the SSH config files from disk.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/config.py
Config._load_ssh_files
def _load_ssh_files(self): """ Trigger loading of configured SSH config file paths. Expects that ``base_ssh_config`` has already been set to an `~paramiko.config.SSHConfig` object. :returns: ``None``. """ # TODO: does this want to more closely ape the behavior o...
python
def _load_ssh_files(self): """ Trigger loading of configured SSH config file paths. Expects that ``base_ssh_config`` has already been set to an `~paramiko.config.SSHConfig` object. :returns: ``None``. """ # TODO: does this want to more closely ape the behavior o...
[ "def", "_load_ssh_files", "(", "self", ")", ":", "# TODO: does this want to more closely ape the behavior of", "# InvokeConfig.load_files? re: having a _found attribute for each that", "# determines whether to load or skip", "if", "self", ".", "_runtime_ssh_path", "is", "not", "None", ...
Trigger loading of configured SSH config file paths. Expects that ``base_ssh_config`` has already been set to an `~paramiko.config.SSHConfig` object. :returns: ``None``.
[ "Trigger", "loading", "of", "configured", "SSH", "config", "file", "paths", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/config.py#L168-L189
train
Loads the SSH config files for the current instance of an anatomical class.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/config.py
Config._load_ssh_file
def _load_ssh_file(self, path): """ Attempt to open and parse an SSH config file at ``path``. Does nothing if ``path`` is not a path to a valid file. :returns: ``None``. """ if os.path.isfile(path): old_rules = len(self.base_ssh_config._config) w...
python
def _load_ssh_file(self, path): """ Attempt to open and parse an SSH config file at ``path``. Does nothing if ``path`` is not a path to a valid file. :returns: ``None``. """ if os.path.isfile(path): old_rules = len(self.base_ssh_config._config) w...
[ "def", "_load_ssh_file", "(", "self", ",", "path", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "old_rules", "=", "len", "(", "self", ".", "base_ssh_config", ".", "_config", ")", "with", "open", "(", "path", ")", "as", "...
Attempt to open and parse an SSH config file at ``path``. Does nothing if ``path`` is not a path to a valid file. :returns: ``None``.
[ "Attempt", "to", "open", "and", "parse", "an", "SSH", "config", "file", "at", "path", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/config.py#L191-L207
train
Attempts to open and parse an SSH config file at path.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/config.py
Config.global_defaults
def global_defaults(): """ Default configuration values and behavior toggles. Fabric only extends this method in order to make minor adjustments and additions to Invoke's `~invoke.config.Config.global_defaults`; see its documentation for the base values, such as the config subtr...
python
def global_defaults(): """ Default configuration values and behavior toggles. Fabric only extends this method in order to make minor adjustments and additions to Invoke's `~invoke.config.Config.global_defaults`; see its documentation for the base values, such as the config subtr...
[ "def", "global_defaults", "(", ")", ":", "# TODO: hrm should the run-related things actually be derived from the", "# runner_class? E.g. Local defines local stuff, Remote defines remote", "# stuff? Doesn't help with the final config tree tho...", "# TODO: as to that, this is a core problem, Fabric w...
Default configuration values and behavior toggles. Fabric only extends this method in order to make minor adjustments and additions to Invoke's `~invoke.config.Config.global_defaults`; see its documentation for the base values, such as the config subtrees controlling behavior of ``run``...
[ "Default", "configuration", "values", "and", "behavior", "toggles", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/config.py#L210-L253
train
This method is used to set the default values for all the config - level values in the Invoke - level.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/tunnels.py
Tunnel.read_and_write
def read_and_write(self, reader, writer, chunk_size): """ Read ``chunk_size`` from ``reader``, writing result to ``writer``. Returns ``None`` if successful, or ``True`` if the read was empty. .. versionadded:: 2.0 """ data = reader.recv(chunk_size) if len(data) ...
python
def read_and_write(self, reader, writer, chunk_size): """ Read ``chunk_size`` from ``reader``, writing result to ``writer``. Returns ``None`` if successful, or ``True`` if the read was empty. .. versionadded:: 2.0 """ data = reader.recv(chunk_size) if len(data) ...
[ "def", "read_and_write", "(", "self", ",", "reader", ",", "writer", ",", "chunk_size", ")", ":", "data", "=", "reader", ".", "recv", "(", "chunk_size", ")", "if", "len", "(", "data", ")", "==", "0", ":", "return", "True", "writer", ".", "sendall", "(...
Read ``chunk_size`` from ``reader``, writing result to ``writer``. Returns ``None`` if successful, or ``True`` if the read was empty. .. versionadded:: 2.0
[ "Read", "chunk_size", "from", "reader", "writing", "result", "to", "writer", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/tunnels.py#L146-L157
train
Read chunk_size from reader and write result to writer.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/util.py
get_local_user
def get_local_user(): """ Return the local executing username, or ``None`` if one can't be found. .. versionadded:: 2.0 """ # TODO: I don't understand why these lines were added outside the # try/except, since presumably it means the attempt at catching ImportError # wouldn't work. However,...
python
def get_local_user(): """ Return the local executing username, or ``None`` if one can't be found. .. versionadded:: 2.0 """ # TODO: I don't understand why these lines were added outside the # try/except, since presumably it means the attempt at catching ImportError # wouldn't work. However,...
[ "def", "get_local_user", "(", ")", ":", "# TODO: I don't understand why these lines were added outside the", "# try/except, since presumably it means the attempt at catching ImportError", "# wouldn't work. However, that's how the contributing user committed it.", "# Need an older Windows box to test...
Return the local executing username, or ``None`` if one can't be found. .. versionadded:: 2.0
[ "Return", "the", "local", "executing", "username", "or", "None", "if", "one", "can", "t", "be", "found", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/util.py#L16-L45
train
Return the local executing username or None if one can t be found.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/executor.py
FabExecutor.parameterize
def parameterize(self, call, host): """ Parameterize a Call with its Context set to a per-host Config. """ debug("Parameterizing {!r} for host {!r}".format(call, host)) # Generate a custom ConnectionCall that knows how to yield a Connection # in its make_context(), specif...
python
def parameterize(self, call, host): """ Parameterize a Call with its Context set to a per-host Config. """ debug("Parameterizing {!r} for host {!r}".format(call, host)) # Generate a custom ConnectionCall that knows how to yield a Connection # in its make_context(), specif...
[ "def", "parameterize", "(", "self", ",", "call", ",", "host", ")", ":", "debug", "(", "\"Parameterizing {!r} for host {!r}\"", ".", "format", "(", "call", ",", "host", ")", ")", "# Generate a custom ConnectionCall that knows how to yield a Connection", "# in its make_cont...
Parameterize a Call with its Context set to a per-host Config.
[ "Parameterize", "a", "Call", "with", "its", "Context", "set", "to", "a", "per", "-", "host", "Config", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/executor.py#L58-L68
train
Parameterize a Call with its Context set to a per - host Config.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
integration/connection.py
Connection_.mixed_use_of_local_and_run
def mixed_use_of_local_and_run(self): """ Run command truly locally, and over SSH via localhost """ cxn = Connection("localhost") result = cxn.local("echo foo", hide=True) assert result.stdout == "foo\n" assert not cxn.is_connected # meh way of proving it didn't ...
python
def mixed_use_of_local_and_run(self): """ Run command truly locally, and over SSH via localhost """ cxn = Connection("localhost") result = cxn.local("echo foo", hide=True) assert result.stdout == "foo\n" assert not cxn.is_connected # meh way of proving it didn't ...
[ "def", "mixed_use_of_local_and_run", "(", "self", ")", ":", "cxn", "=", "Connection", "(", "\"localhost\"", ")", "result", "=", "cxn", ".", "local", "(", "\"echo foo\"", ",", "hide", "=", "True", ")", "assert", "result", ".", "stdout", "==", "\"foo\\n\"", ...
Run command truly locally, and over SSH via localhost
[ "Run", "command", "truly", "locally", "and", "over", "SSH", "via", "localhost" ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/integration/connection.py#L67-L77
train
mixed use of local and run command truly over SSH via localhost
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/connection.py
Connection.open
def open(self): """ Initiate an SSH connection to the host/port this object is bound to. This may include activating the configured gateway connection, if one is set. Also saves a handle to the now-set Transport object for easier access. Various connect-time settings (...
python
def open(self): """ Initiate an SSH connection to the host/port this object is bound to. This may include activating the configured gateway connection, if one is set. Also saves a handle to the now-set Transport object for easier access. Various connect-time settings (...
[ "def", "open", "(", "self", ")", ":", "# Short-circuit", "if", "self", ".", "is_connected", ":", "return", "err", "=", "\"Refusing to be ambiguous: connect() kwarg '{}' was given both via regular arg and via connect_kwargs!\"", "# noqa", "# These may not be given, period", "for",...
Initiate an SSH connection to the host/port this object is bound to. This may include activating the configured gateway connection, if one is set. Also saves a handle to the now-set Transport object for easier access. Various connect-time settings (and/or their corresponding :ref:`SSH...
[ "Initiate", "an", "SSH", "connection", "to", "the", "host", "/", "port", "this", "object", "is", "bound", "to", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/connection.py#L475-L525
train
Open an SSH connection to the host and port.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/connection.py
Connection.open_gateway
def open_gateway(self): """ Obtain a socket-like object from `gateway`. :returns: A ``direct-tcpip`` `paramiko.channel.Channel`, if `gateway` was a `.Connection`; or a `~paramiko.proxy.ProxyCommand`, if `gateway` was a string. .. versionadded:: 2.0 ...
python
def open_gateway(self): """ Obtain a socket-like object from `gateway`. :returns: A ``direct-tcpip`` `paramiko.channel.Channel`, if `gateway` was a `.Connection`; or a `~paramiko.proxy.ProxyCommand`, if `gateway` was a string. .. versionadded:: 2.0 ...
[ "def", "open_gateway", "(", "self", ")", ":", "# ProxyCommand is faster to set up, so do it first.", "if", "isinstance", "(", "self", ".", "gateway", ",", "string_types", ")", ":", "# Leverage a dummy SSHConfig to ensure %h/%p/etc are parsed.", "# TODO: use real SSH config once l...
Obtain a socket-like object from `gateway`. :returns: A ``direct-tcpip`` `paramiko.channel.Channel`, if `gateway` was a `.Connection`; or a `~paramiko.proxy.ProxyCommand`, if `gateway` was a string. .. versionadded:: 2.0
[ "Obtain", "a", "socket", "-", "like", "object", "from", "gateway", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/connection.py#L527-L565
train
Open a new connection from the gateway.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/connection.py
Connection.close
def close(self): """ Terminate the network connection to the remote end, if open. If no connection is open, this method does nothing. .. versionadded:: 2.0 """ if self.is_connected: self.client.close() if self.forward_agent and self._agent_handle...
python
def close(self): """ Terminate the network connection to the remote end, if open. If no connection is open, this method does nothing. .. versionadded:: 2.0 """ if self.is_connected: self.client.close() if self.forward_agent and self._agent_handle...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "is_connected", ":", "self", ".", "client", ".", "close", "(", ")", "if", "self", ".", "forward_agent", "and", "self", ".", "_agent_handler", "is", "not", "None", ":", "self", ".", "_agent_handl...
Terminate the network connection to the remote end, if open. If no connection is open, this method does nothing. .. versionadded:: 2.0
[ "Terminate", "the", "network", "connection", "to", "the", "remote", "end", "if", "open", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/connection.py#L567-L578
train
Terminate the network connection to the remote end if open.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/connection.py
Connection.run
def run(self, command, **kwargs): """ Execute a shell command on the remote end of this connection. This method wraps an SSH-capable implementation of `invoke.runners.Runner.run`; see its documentation for details. .. warning:: There are a few spots where Fabric dep...
python
def run(self, command, **kwargs): """ Execute a shell command on the remote end of this connection. This method wraps an SSH-capable implementation of `invoke.runners.Runner.run`; see its documentation for details. .. warning:: There are a few spots where Fabric dep...
[ "def", "run", "(", "self", ",", "command", ",", "*", "*", "kwargs", ")", ":", "runner", "=", "self", ".", "config", ".", "runners", ".", "remote", "(", "self", ")", "return", "self", ".", "_run", "(", "runner", ",", "command", ",", "*", "*", "kwa...
Execute a shell command on the remote end of this connection. This method wraps an SSH-capable implementation of `invoke.runners.Runner.run`; see its documentation for details. .. warning:: There are a few spots where Fabric departs from Invoke's default settings/behavi...
[ "Execute", "a", "shell", "command", "on", "the", "remote", "end", "of", "this", "connection", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/connection.py#L594-L609
train
Execute a shell command on the remote end of this connection.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/connection.py
Connection.sudo
def sudo(self, command, **kwargs): """ Execute a shell command, via ``sudo``, on the remote end. This method is identical to `invoke.context.Context.sudo` in every way, except in that -- like `run` -- it honors per-host/per-connection configuration overrides in addition to the g...
python
def sudo(self, command, **kwargs): """ Execute a shell command, via ``sudo``, on the remote end. This method is identical to `invoke.context.Context.sudo` in every way, except in that -- like `run` -- it honors per-host/per-connection configuration overrides in addition to the g...
[ "def", "sudo", "(", "self", ",", "command", ",", "*", "*", "kwargs", ")", ":", "runner", "=", "self", ".", "config", ".", "runners", ".", "remote", "(", "self", ")", "return", "self", ".", "_sudo", "(", "runner", ",", "command", ",", "*", "*", "k...
Execute a shell command, via ``sudo``, on the remote end. This method is identical to `invoke.context.Context.sudo` in every way, except in that -- like `run` -- it honors per-host/per-connection configuration overrides in addition to the generic/global ones. Thus, for example, per-host...
[ "Execute", "a", "shell", "command", "via", "sudo", "on", "the", "remote", "end", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/connection.py#L612-L624
train
Execute a shell command on the remote end.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/connection.py
Connection.local
def local(self, *args, **kwargs): """ Execute a shell command on the local system. This method is effectively a wrapper of `invoke.run`; see its docs for details and call signature. .. versionadded:: 2.0 """ # Superclass run() uses runners.local, so we can liter...
python
def local(self, *args, **kwargs): """ Execute a shell command on the local system. This method is effectively a wrapper of `invoke.run`; see its docs for details and call signature. .. versionadded:: 2.0 """ # Superclass run() uses runners.local, so we can liter...
[ "def", "local", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Superclass run() uses runners.local, so we can literally just call it", "# straight.", "return", "super", "(", "Connection", ",", "self", ")", ".", "run", "(", "*", "args", ",",...
Execute a shell command on the local system. This method is effectively a wrapper of `invoke.run`; see its docs for details and call signature. .. versionadded:: 2.0
[ "Execute", "a", "shell", "command", "on", "the", "local", "system", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/connection.py#L626-L637
train
Execute a shell command on the local system.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/connection.py
Connection.sftp
def sftp(self): """ Return a `~paramiko.sftp_client.SFTPClient` object. If called more than one time, memoizes the first result; thus, any given `.Connection` instance will only ever have a single SFTP client, and state (such as that managed by `~paramiko.sftp_client.SFT...
python
def sftp(self): """ Return a `~paramiko.sftp_client.SFTPClient` object. If called more than one time, memoizes the first result; thus, any given `.Connection` instance will only ever have a single SFTP client, and state (such as that managed by `~paramiko.sftp_client.SFT...
[ "def", "sftp", "(", "self", ")", ":", "if", "self", ".", "_sftp", "is", "None", ":", "self", ".", "_sftp", "=", "self", ".", "client", ".", "open_sftp", "(", ")", "return", "self", ".", "_sftp" ]
Return a `~paramiko.sftp_client.SFTPClient` object. If called more than one time, memoizes the first result; thus, any given `.Connection` instance will only ever have a single SFTP client, and state (such as that managed by `~paramiko.sftp_client.SFTPClient.chdir`) will be preserved. ...
[ "Return", "a", "~paramiko", ".", "sftp_client", ".", "SFTPClient", "object", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/connection.py#L640-L653
train
Return a new instance of the SFTP client.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/connection.py
Connection.forward_local
def forward_local( self, local_port, remote_port=None, remote_host="localhost", local_host="localhost", ): """ Open a tunnel connecting ``local_port`` to the server's environment. For example, say you want to connect to a remote PostgreSQL database ...
python
def forward_local( self, local_port, remote_port=None, remote_host="localhost", local_host="localhost", ): """ Open a tunnel connecting ``local_port`` to the server's environment. For example, say you want to connect to a remote PostgreSQL database ...
[ "def", "forward_local", "(", "self", ",", "local_port", ",", "remote_port", "=", "None", ",", "remote_host", "=", "\"localhost\"", ",", "local_host", "=", "\"localhost\"", ",", ")", ":", "if", "not", "remote_port", ":", "remote_port", "=", "local_port", "# Tun...
Open a tunnel connecting ``local_port`` to the server's environment. For example, say you want to connect to a remote PostgreSQL database which is locked down and only accessible via the system it's running on. You have SSH access to this server, so you can temporarily make port 5432 on...
[ "Open", "a", "tunnel", "connecting", "local_port", "to", "the", "server", "s", "environment", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/connection.py#L682-L772
train
Forward a local entry to the local operating system.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
fabric/fabric
fabric/connection.py
Connection.forward_remote
def forward_remote( self, remote_port, local_port=None, remote_host="127.0.0.1", local_host="localhost", ): """ Open a tunnel connecting ``remote_port`` to the local environment. For example, say you're running a daemon in development mode on your ...
python
def forward_remote( self, remote_port, local_port=None, remote_host="127.0.0.1", local_host="localhost", ): """ Open a tunnel connecting ``remote_port`` to the local environment. For example, say you're running a daemon in development mode on your ...
[ "def", "forward_remote", "(", "self", ",", "remote_port", ",", "local_port", "=", "None", ",", "remote_host", "=", "\"127.0.0.1\"", ",", "local_host", "=", "\"localhost\"", ",", ")", ":", "if", "not", "local_port", ":", "local_port", "=", "remote_port", "# Cal...
Open a tunnel connecting ``remote_port`` to the local environment. For example, say you're running a daemon in development mode on your workstation at port 8080, and want to funnel traffic to it from a production or staging environment. In most situations this isn't possible as your of...
[ "Open", "a", "tunnel", "connecting", "remote_port", "to", "the", "local", "environment", "." ]
e9939d68b734935f0c98d98817912ad7c698238f
https://github.com/fabric/fabric/blob/e9939d68b734935f0c98d98817912ad7c698238f/fabric/connection.py#L781-L882
train
Forward a new connection to the remote server.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/utils.py
dedup_list
def dedup_list(l): """Given a list (l) will removing duplicates from the list, preserving the original order of the list. Assumes that the list entrie are hashable.""" dedup = set() return [ x for x in l if not (x in dedup or dedup.add(x))]
python
def dedup_list(l): """Given a list (l) will removing duplicates from the list, preserving the original order of the list. Assumes that the list entrie are hashable.""" dedup = set() return [ x for x in l if not (x in dedup or dedup.add(x))]
[ "def", "dedup_list", "(", "l", ")", ":", "dedup", "=", "set", "(", ")", "return", "[", "x", "for", "x", "in", "l", "if", "not", "(", "x", "in", "dedup", "or", "dedup", ".", "add", "(", "x", ")", ")", "]" ]
Given a list (l) will removing duplicates from the list, preserving the original order of the list. Assumes that the list entrie are hashable.
[ "Given", "a", "list", "(", "l", ")", "will", "removing", "duplicates", "from", "the", "list", "preserving", "the", "original", "order", "of", "the", "list", ".", "Assumes", "that", "the", "list", "entrie", "are", "hashable", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/utils.py#L182-L187
train
Given a list l will remove duplicates from the list and return a list with the original order of the list.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/parsers/cyk.py
_parse
def _parse(s, g): """Parses sentence 's' using CNF grammar 'g'.""" # The CYK table. Indexed with a 2-tuple: (start pos, end pos) table = defaultdict(set) # Top-level structure is similar to the CYK table. Each cell is a dict from # rule name to the best (lightest) tree for that rule. trees = def...
python
def _parse(s, g): """Parses sentence 's' using CNF grammar 'g'.""" # The CYK table. Indexed with a 2-tuple: (start pos, end pos) table = defaultdict(set) # Top-level structure is similar to the CYK table. Each cell is a dict from # rule name to the best (lightest) tree for that rule. trees = def...
[ "def", "_parse", "(", "s", ",", "g", ")", ":", "# The CYK table. Indexed with a 2-tuple: (start pos, end pos)", "table", "=", "defaultdict", "(", "set", ")", "# Top-level structure is similar to the CYK table. Each cell is a dict from", "# rule name to the best (lightest) tree for th...
Parses sentence 's' using CNF grammar 'g'.
[ "Parses", "sentence", "s", "using", "CNF", "grammar", "g", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/cyk.py#L136-L170
train
Parses a sentence s using CNF grammar g.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/parsers/cyk.py
get_any_nt_unit_rule
def get_any_nt_unit_rule(g): """Returns a non-terminal unit rule from 'g', or None if there is none.""" for rule in g.rules: if len(rule.rhs) == 1 and isinstance(rule.rhs[0], NT): return rule return None
python
def get_any_nt_unit_rule(g): """Returns a non-terminal unit rule from 'g', or None if there is none.""" for rule in g.rules: if len(rule.rhs) == 1 and isinstance(rule.rhs[0], NT): return rule return None
[ "def", "get_any_nt_unit_rule", "(", "g", ")", ":", "for", "rule", "in", "g", ".", "rules", ":", "if", "len", "(", "rule", ".", "rhs", ")", "==", "1", "and", "isinstance", "(", "rule", ".", "rhs", "[", "0", "]", ",", "NT", ")", ":", "return", "r...
Returns a non-terminal unit rule from 'g', or None if there is none.
[ "Returns", "a", "non", "-", "terminal", "unit", "rule", "from", "g", "or", "None", "if", "there", "is", "none", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/cyk.py#L242-L247
train
Returns a non - terminal unit rule from g or None if there is none.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/parsers/cyk.py
_remove_unit_rule
def _remove_unit_rule(g, rule): """Removes 'rule' from 'g' without changing the langugage produced by 'g'.""" new_rules = [x for x in g.rules if x != rule] refs = [x for x in g.rules if x.lhs == rule.rhs[0]] new_rules += [build_unit_skiprule(rule, ref) for ref in refs] return Grammar(new_rules)
python
def _remove_unit_rule(g, rule): """Removes 'rule' from 'g' without changing the langugage produced by 'g'.""" new_rules = [x for x in g.rules if x != rule] refs = [x for x in g.rules if x.lhs == rule.rhs[0]] new_rules += [build_unit_skiprule(rule, ref) for ref in refs] return Grammar(new_rules)
[ "def", "_remove_unit_rule", "(", "g", ",", "rule", ")", ":", "new_rules", "=", "[", "x", "for", "x", "in", "g", ".", "rules", "if", "x", "!=", "rule", "]", "refs", "=", "[", "x", "for", "x", "in", "g", ".", "rules", "if", "x", ".", "lhs", "==...
Removes 'rule' from 'g' without changing the langugage produced by 'g'.
[ "Removes", "rule", "from", "g", "without", "changing", "the", "langugage", "produced", "by", "g", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/cyk.py#L250-L255
train
Removes a rule from g without changing the langugage produced by g.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/parsers/cyk.py
_split
def _split(rule): """Splits a rule whose len(rhs) > 2 into shorter rules.""" rule_str = str(rule.lhs) + '__' + '_'.join(str(x) for x in rule.rhs) rule_name = '__SP_%s' % (rule_str) + '_%d' yield Rule(rule.lhs, [rule.rhs[0], NT(rule_name % 1)], weight=rule.weight, alias=rule.alias) for i in xrange(1,...
python
def _split(rule): """Splits a rule whose len(rhs) > 2 into shorter rules.""" rule_str = str(rule.lhs) + '__' + '_'.join(str(x) for x in rule.rhs) rule_name = '__SP_%s' % (rule_str) + '_%d' yield Rule(rule.lhs, [rule.rhs[0], NT(rule_name % 1)], weight=rule.weight, alias=rule.alias) for i in xrange(1,...
[ "def", "_split", "(", "rule", ")", ":", "rule_str", "=", "str", "(", "rule", ".", "lhs", ")", "+", "'__'", "+", "'_'", ".", "join", "(", "str", "(", "x", ")", "for", "x", "in", "rule", ".", "rhs", ")", "rule_name", "=", "'__SP_%s'", "%", "(", ...
Splits a rule whose len(rhs) > 2 into shorter rules.
[ "Splits", "a", "rule", "whose", "len", "(", "rhs", ")", ">", "2", "into", "shorter", "rules", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/cyk.py#L258-L265
train
Splits a rule into shorter rules.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/parsers/cyk.py
_term
def _term(g): """Applies the TERM rule on 'g' (see top comment).""" all_t = {x for rule in g.rules for x in rule.rhs if isinstance(x, T)} t_rules = {t: Rule(NT('__T_%s' % str(t)), [t], weight=0, alias='Term') for t in all_t} new_rules = [] for rule in g.rules: if len(rule.rhs) > 1 and any(is...
python
def _term(g): """Applies the TERM rule on 'g' (see top comment).""" all_t = {x for rule in g.rules for x in rule.rhs if isinstance(x, T)} t_rules = {t: Rule(NT('__T_%s' % str(t)), [t], weight=0, alias='Term') for t in all_t} new_rules = [] for rule in g.rules: if len(rule.rhs) > 1 and any(is...
[ "def", "_term", "(", "g", ")", ":", "all_t", "=", "{", "x", "for", "rule", "in", "g", ".", "rules", "for", "x", "in", "rule", ".", "rhs", "if", "isinstance", "(", "x", ",", "T", ")", "}", "t_rules", "=", "{", "t", ":", "Rule", "(", "NT", "(...
Applies the TERM rule on 'g' (see top comment).
[ "Applies", "the", "TERM", "rule", "on", "g", "(", "see", "top", "comment", ")", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/cyk.py#L268-L280
train
Applies the TERM rule on g.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/parsers/cyk.py
_bin
def _bin(g): """Applies the BIN rule to 'g' (see top comment).""" new_rules = [] for rule in g.rules: if len(rule.rhs) > 2: new_rules += _split(rule) else: new_rules.append(rule) return Grammar(new_rules)
python
def _bin(g): """Applies the BIN rule to 'g' (see top comment).""" new_rules = [] for rule in g.rules: if len(rule.rhs) > 2: new_rules += _split(rule) else: new_rules.append(rule) return Grammar(new_rules)
[ "def", "_bin", "(", "g", ")", ":", "new_rules", "=", "[", "]", "for", "rule", "in", "g", ".", "rules", ":", "if", "len", "(", "rule", ".", "rhs", ")", ">", "2", ":", "new_rules", "+=", "_split", "(", "rule", ")", "else", ":", "new_rules", ".", ...
Applies the BIN rule to 'g' (see top comment).
[ "Applies", "the", "BIN", "rule", "to", "g", "(", "see", "top", "comment", ")", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/cyk.py#L283-L291
train
Applies the BIN rule to g.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/parsers/cyk.py
_unit
def _unit(g): """Applies the UNIT rule to 'g' (see top comment).""" nt_unit_rule = get_any_nt_unit_rule(g) while nt_unit_rule: g = _remove_unit_rule(g, nt_unit_rule) nt_unit_rule = get_any_nt_unit_rule(g) return g
python
def _unit(g): """Applies the UNIT rule to 'g' (see top comment).""" nt_unit_rule = get_any_nt_unit_rule(g) while nt_unit_rule: g = _remove_unit_rule(g, nt_unit_rule) nt_unit_rule = get_any_nt_unit_rule(g) return g
[ "def", "_unit", "(", "g", ")", ":", "nt_unit_rule", "=", "get_any_nt_unit_rule", "(", "g", ")", "while", "nt_unit_rule", ":", "g", "=", "_remove_unit_rule", "(", "g", ",", "nt_unit_rule", ")", "nt_unit_rule", "=", "get_any_nt_unit_rule", "(", "g", ")", "retu...
Applies the UNIT rule to 'g' (see top comment).
[ "Applies", "the", "UNIT", "rule", "to", "g", "(", "see", "top", "comment", ")", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/cyk.py#L294-L300
train
Applies the UNIT rule to g.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/parsers/cyk.py
revert_cnf
def revert_cnf(node): """Reverts a parse tree (RuleNode) to its original non-CNF form (Node).""" if isinstance(node, T): return node # Reverts TERM rule. if node.rule.lhs.name.startswith('__T_'): return node.children[0] else: children = [] for child in map(revert_cnf,...
python
def revert_cnf(node): """Reverts a parse tree (RuleNode) to its original non-CNF form (Node).""" if isinstance(node, T): return node # Reverts TERM rule. if node.rule.lhs.name.startswith('__T_'): return node.children[0] else: children = [] for child in map(revert_cnf,...
[ "def", "revert_cnf", "(", "node", ")", ":", "if", "isinstance", "(", "node", ",", "T", ")", ":", "return", "node", "# Reverts TERM rule.", "if", "node", ".", "rule", ".", "lhs", ".", "name", ".", "startswith", "(", "'__T_'", ")", ":", "return", "node",...
Reverts a parse tree (RuleNode) to its original non-CNF form (Node).
[ "Reverts", "a", "parse", "tree", "(", "RuleNode", ")", "to", "its", "original", "non", "-", "CNF", "form", "(", "Node", ")", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/cyk.py#L322-L343
train
Reverts a parse tree ( RuleNode to its original non - CNF form ( Node ).
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/parsers/cyk.py
Parser._to_rule
def _to_rule(self, lark_rule): """Converts a lark rule, (lhs, rhs, callback, options), to a Rule.""" assert isinstance(lark_rule.origin, NT) assert all(isinstance(x, Symbol) for x in lark_rule.expansion) return Rule( lark_rule.origin, lark_rule.expansion, weight=l...
python
def _to_rule(self, lark_rule): """Converts a lark rule, (lhs, rhs, callback, options), to a Rule.""" assert isinstance(lark_rule.origin, NT) assert all(isinstance(x, Symbol) for x in lark_rule.expansion) return Rule( lark_rule.origin, lark_rule.expansion, weight=l...
[ "def", "_to_rule", "(", "self", ",", "lark_rule", ")", ":", "assert", "isinstance", "(", "lark_rule", ".", "origin", ",", "NT", ")", "assert", "all", "(", "isinstance", "(", "x", ",", "Symbol", ")", "for", "x", "in", "lark_rule", ".", "expansion", ")",...
Converts a lark rule, (lhs, rhs, callback, options), to a Rule.
[ "Converts", "a", "lark", "rule", "(", "lhs", "rhs", "callback", "options", ")", "to", "a", "Rule", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/cyk.py#L94-L101
train
Converts a lark rule from a Lark VM to a Rule.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/parsers/cyk.py
Parser.parse
def parse(self, tokenized): # pylint: disable=invalid-name """Parses input, which is a list of tokens.""" table, trees = _parse(tokenized, self.grammar) # Check if the parse succeeded. if all(r.lhs != self.start for r in table[(0, len(tokenized) - 1)]): raise ParseError('Par...
python
def parse(self, tokenized): # pylint: disable=invalid-name """Parses input, which is a list of tokens.""" table, trees = _parse(tokenized, self.grammar) # Check if the parse succeeded. if all(r.lhs != self.start for r in table[(0, len(tokenized) - 1)]): raise ParseError('Par...
[ "def", "parse", "(", "self", ",", "tokenized", ")", ":", "# pylint: disable=invalid-name", "table", ",", "trees", "=", "_parse", "(", "tokenized", ",", "self", ".", "grammar", ")", "# Check if the parse succeeded.", "if", "all", "(", "r", ".", "lhs", "!=", "...
Parses input, which is a list of tokens.
[ "Parses", "input", "which", "is", "a", "list", "of", "tokens", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/cyk.py#L103-L110
train
Parses input which is a list of tokens.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/parsers/cyk.py
Parser._to_tree
def _to_tree(self, rule_node): """Converts a RuleNode parse tree to a lark Tree.""" orig_rule = self.orig_rules[rule_node.rule.alias] children = [] for child in rule_node.children: if isinstance(child, RuleNode): children.append(self._to_tree(child)) ...
python
def _to_tree(self, rule_node): """Converts a RuleNode parse tree to a lark Tree.""" orig_rule = self.orig_rules[rule_node.rule.alias] children = [] for child in rule_node.children: if isinstance(child, RuleNode): children.append(self._to_tree(child)) ...
[ "def", "_to_tree", "(", "self", ",", "rule_node", ")", ":", "orig_rule", "=", "self", ".", "orig_rules", "[", "rule_node", ".", "rule", ".", "alias", "]", "children", "=", "[", "]", "for", "child", "in", "rule_node", ".", "children", ":", "if", "isinst...
Converts a RuleNode parse tree to a lark Tree.
[ "Converts", "a", "RuleNode", "parse", "tree", "to", "a", "lark", "Tree", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/cyk.py#L112-L124
train
Converts a RuleNode parse tree to a lark Tree.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/tree.py
pydot__tree_to_png
def pydot__tree_to_png(tree, filename, rankdir="LR"): """Creates a colorful image that represents the tree (data+children, without meta) Possible values for `rankdir` are "TB", "LR", "BT", "RL", corresponding to directed graphs drawn from top to bottom, from left to right, from bottom to top, and from ...
python
def pydot__tree_to_png(tree, filename, rankdir="LR"): """Creates a colorful image that represents the tree (data+children, without meta) Possible values for `rankdir` are "TB", "LR", "BT", "RL", corresponding to directed graphs drawn from top to bottom, from left to right, from bottom to top, and from ...
[ "def", "pydot__tree_to_png", "(", "tree", ",", "filename", ",", "rankdir", "=", "\"LR\"", ")", ":", "import", "pydot", "graph", "=", "pydot", ".", "Dot", "(", "graph_type", "=", "'digraph'", ",", "rankdir", "=", "rankdir", ")", "i", "=", "[", "0", "]",...
Creates a colorful image that represents the tree (data+children, without meta) Possible values for `rankdir` are "TB", "LR", "BT", "RL", corresponding to directed graphs drawn from top to bottom, from left to right, from bottom to top, and from right to left, respectively. See: https://www.graphviz.or...
[ "Creates", "a", "colorful", "image", "that", "represents", "the", "tree", "(", "data", "+", "children", "without", "meta", ")" ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/tree.py#L144-L180
train
Writes a colorful image that represents the tree.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/tree.py
Tree.expand_kids_by_index
def expand_kids_by_index(self, *indices): "Expand (inline) children at the given indices" for i in sorted(indices, reverse=True): # reverse so that changing tail won't affect indices kid = self.children[i] self.children[i:i+1] = kid.children
python
def expand_kids_by_index(self, *indices): "Expand (inline) children at the given indices" for i in sorted(indices, reverse=True): # reverse so that changing tail won't affect indices kid = self.children[i] self.children[i:i+1] = kid.children
[ "def", "expand_kids_by_index", "(", "self", ",", "*", "indices", ")", ":", "for", "i", "in", "sorted", "(", "indices", ",", "reverse", "=", "True", ")", ":", "# reverse so that changing tail won't affect indices", "kid", "=", "self", ".", "children", "[", "i",...
Expand (inline) children at the given indices
[ "Expand", "(", "inline", ")", "children", "at", "the", "given", "indices" ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/tree.py#L61-L65
train
Expand ( inline ) children at the given indices
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
examples/standalone/json_parser.py
visit_children_decor
def visit_children_decor(func): "See Interpreter" @wraps(func) def inner(cls, tree): values = cls.visit_children(tree) return func(cls, values) return inner
python
def visit_children_decor(func): "See Interpreter" @wraps(func) def inner(cls, tree): values = cls.visit_children(tree) return func(cls, values) return inner
[ "def", "visit_children_decor", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "inner", "(", "cls", ",", "tree", ")", ":", "values", "=", "cls", ".", "visit_children", "(", "tree", ")", "return", "func", "(", "cls", ",", "values", ")", ...
See Interpreter
[ "See", "Interpreter" ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/examples/standalone/json_parser.py#L453-L459
train
See Interpreter
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
examples/standalone/json_parser.py
v_args
def v_args(inline=False, meta=False, tree=False): "A convenience decorator factory, for modifying the behavior of user-supplied visitor methods" if [tree, meta, inline].count(True) > 1: raise ValueError("Visitor functions can either accept tree, or meta, or be inlined. These cannot be combined.") de...
python
def v_args(inline=False, meta=False, tree=False): "A convenience decorator factory, for modifying the behavior of user-supplied visitor methods" if [tree, meta, inline].count(True) > 1: raise ValueError("Visitor functions can either accept tree, or meta, or be inlined. These cannot be combined.") de...
[ "def", "v_args", "(", "inline", "=", "False", ",", "meta", "=", "False", ",", "tree", "=", "False", ")", ":", "if", "[", "tree", ",", "meta", ",", "inline", "]", ".", "count", "(", "True", ")", ">", "1", ":", "raise", "ValueError", "(", "\"Visito...
A convenience decorator factory, for modifying the behavior of user-supplied visitor methods
[ "A", "convenience", "decorator", "factory", "for", "modifying", "the", "behavior", "of", "user", "-", "supplied", "visitor", "methods" ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/examples/standalone/json_parser.py#L539-L545
train
A convenience decorator factory for modifying the behavior of user - supplied visitor methods
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
examples/standalone/json_parser.py
UnexpectedInput.match_examples
def match_examples(self, parse_fn, examples): """ Given a parser instance and a dictionary mapping some label with some malformed syntax examples, it'll return the label for the example that bests matches the current error. """ assert self.state is not None, "Not supporte...
python
def match_examples(self, parse_fn, examples): """ Given a parser instance and a dictionary mapping some label with some malformed syntax examples, it'll return the label for the example that bests matches the current error. """ assert self.state is not None, "Not supporte...
[ "def", "match_examples", "(", "self", ",", "parse_fn", ",", "examples", ")", ":", "assert", "self", ".", "state", "is", "not", "None", ",", "\"Not supported for this exception\"", "candidate", "=", "None", "for", "label", ",", "example", "in", "examples", ".",...
Given a parser instance and a dictionary mapping some label with some malformed syntax examples, it'll return the label for the example that bests matches the current error.
[ "Given", "a", "parser", "instance", "and", "a", "dictionary", "mapping", "some", "label", "with", "some", "malformed", "syntax", "examples", "it", "ll", "return", "the", "label", "for", "the", "example", "that", "bests", "matches", "the", "current", "error", ...
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/examples/standalone/json_parser.py#L61-L85
train
Given a parser instance and a dictionary mapping some label with the same name and a list of malformed syntax examples it ll return the label for the other examples that bests matches the current error.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
examples/standalone/json_parser.py
LineCounter.feed
def feed(self, token, test_newline=True): """Consume a token and calculate the new line & column. As an optional optimization, set test_newline=False is token doesn't contain a newline. """ if test_newline: newlines = token.count(self.newline_char) if newlines: ...
python
def feed(self, token, test_newline=True): """Consume a token and calculate the new line & column. As an optional optimization, set test_newline=False is token doesn't contain a newline. """ if test_newline: newlines = token.count(self.newline_char) if newlines: ...
[ "def", "feed", "(", "self", ",", "token", ",", "test_newline", "=", "True", ")", ":", "if", "test_newline", ":", "newlines", "=", "token", ".", "count", "(", "self", ".", "newline_char", ")", "if", "newlines", ":", "self", ".", "line", "+=", "newlines"...
Consume a token and calculate the new line & column. As an optional optimization, set test_newline=False is token doesn't contain a newline.
[ "Consume", "a", "token", "and", "calculate", "the", "new", "line", "&", "column", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/examples/standalone/json_parser.py#L825-L837
train
Consume a token and calculate the new line & column.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
examples/standalone/json_parser.py
Lark.open
def open(cls, grammar_filename, rel_to=None, **options): """Create an instance of Lark with the grammar given by its filename If rel_to is provided, the function will find the grammar filename in relation to it. Example: >>> Lark.open("grammar_file.lark", rel_to=__file__, parser="...
python
def open(cls, grammar_filename, rel_to=None, **options): """Create an instance of Lark with the grammar given by its filename If rel_to is provided, the function will find the grammar filename in relation to it. Example: >>> Lark.open("grammar_file.lark", rel_to=__file__, parser="...
[ "def", "open", "(", "cls", ",", "grammar_filename", ",", "rel_to", "=", "None", ",", "*", "*", "options", ")", ":", "if", "rel_to", ":", "basepath", "=", "os", ".", "path", ".", "dirname", "(", "rel_to", ")", "grammar_filename", "=", "os", ".", "path...
Create an instance of Lark with the grammar given by its filename If rel_to is provided, the function will find the grammar filename in relation to it. Example: >>> Lark.open("grammar_file.lark", rel_to=__file__, parser="lalr") Lark(...)
[ "Create", "an", "instance", "of", "Lark", "with", "the", "grammar", "given", "by", "its", "filename" ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/examples/standalone/json_parser.py#L1793-L1808
train
Create an instance of Lark with the grammar given by its filename.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
examples/standalone/json_parser.py
Lark.lex
def lex(self, text): "Only lex (and postlex) the text, without parsing it. Only relevant when lexer='standard'" if not hasattr(self, 'lexer'): self.lexer = self._build_lexer() stream = self.lexer.lex(text) if self.options.postlex: return self.options.postlex.proce...
python
def lex(self, text): "Only lex (and postlex) the text, without parsing it. Only relevant when lexer='standard'" if not hasattr(self, 'lexer'): self.lexer = self._build_lexer() stream = self.lexer.lex(text) if self.options.postlex: return self.options.postlex.proce...
[ "def", "lex", "(", "self", ",", "text", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'lexer'", ")", ":", "self", ".", "lexer", "=", "self", ".", "_build_lexer", "(", ")", "stream", "=", "self", ".", "lexer", ".", "lex", "(", "text", ")", ...
Only lex (and postlex) the text, without parsing it. Only relevant when lexer='standard
[ "Only", "lex", "(", "and", "postlex", ")", "the", "text", "without", "parsing", "it", ".", "Only", "relevant", "when", "lexer", "=", "standard" ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/examples/standalone/json_parser.py#L1814-L1821
train
Only lex ( and postlex ) the text without parsing it. Only relevant when lexer = standard
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/parsers/grammar_analysis.py
calculate_sets
def calculate_sets(rules): """Calculate FOLLOW sets. Adapted from: http://lara.epfl.ch/w/cc09:algorithm_for_first_and_follow_sets""" symbols = {sym for rule in rules for sym in rule.expansion} | {rule.origin for rule in rules} # foreach grammar rule X ::= Y(1) ... Y(k) # if k=0 or {Y(1),...,Y(k)} ...
python
def calculate_sets(rules): """Calculate FOLLOW sets. Adapted from: http://lara.epfl.ch/w/cc09:algorithm_for_first_and_follow_sets""" symbols = {sym for rule in rules for sym in rule.expansion} | {rule.origin for rule in rules} # foreach grammar rule X ::= Y(1) ... Y(k) # if k=0 or {Y(1),...,Y(k)} ...
[ "def", "calculate_sets", "(", "rules", ")", ":", "symbols", "=", "{", "sym", "for", "rule", "in", "rules", "for", "sym", "in", "rule", ".", "expansion", "}", "|", "{", "rule", ".", "origin", "for", "rule", "in", "rules", "}", "# foreach grammar rule X ::...
Calculate FOLLOW sets. Adapted from: http://lara.epfl.ch/w/cc09:algorithm_for_first_and_follow_sets
[ "Calculate", "FOLLOW", "sets", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/grammar_analysis.py#L48-L105
train
Calculate FOLLOW sets.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/parsers/grammar_analysis.py
GrammarAnalyzer.expand_rule
def expand_rule(self, rule): "Returns all init_ptrs accessible by rule (recursive)" init_ptrs = set() def _expand_rule(rule): assert not rule.is_term, rule for r in self.rules_by_origin[rule]: init_ptr = RulePtr(r, 0) init_ptrs.add(init_pt...
python
def expand_rule(self, rule): "Returns all init_ptrs accessible by rule (recursive)" init_ptrs = set() def _expand_rule(rule): assert not rule.is_term, rule for r in self.rules_by_origin[rule]: init_ptr = RulePtr(r, 0) init_ptrs.add(init_pt...
[ "def", "expand_rule", "(", "self", ",", "rule", ")", ":", "init_ptrs", "=", "set", "(", ")", "def", "_expand_rule", "(", "rule", ")", ":", "assert", "not", "rule", ".", "is_term", ",", "rule", "for", "r", "in", "self", ".", "rules_by_origin", "[", "r...
Returns all init_ptrs accessible by rule (recursive)
[ "Returns", "all", "init_ptrs", "accessible", "by", "rule", "(", "recursive", ")" ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/grammar_analysis.py#L128-L146
train
Returns all init_ptrs accessible by rule ( recursive )
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/load_grammar.py
import_from_grammar_into_namespace
def import_from_grammar_into_namespace(grammar, namespace, aliases): """Returns all rules and terminals of grammar, prepended with a 'namespace' prefix, except for those which are aliased. """ imported_terms = dict(grammar.term_defs) imported_rules = {n:(n,deepcopy(t),o) for n,t,o in grammar.rule_d...
python
def import_from_grammar_into_namespace(grammar, namespace, aliases): """Returns all rules and terminals of grammar, prepended with a 'namespace' prefix, except for those which are aliased. """ imported_terms = dict(grammar.term_defs) imported_rules = {n:(n,deepcopy(t),o) for n,t,o in grammar.rule_d...
[ "def", "import_from_grammar_into_namespace", "(", "grammar", ",", "namespace", ",", "aliases", ")", ":", "imported_terms", "=", "dict", "(", "grammar", ".", "term_defs", ")", "imported_rules", "=", "{", "n", ":", "(", "n", ",", "deepcopy", "(", "t", ")", "...
Returns all rules and terminals of grammar, prepended with a 'namespace' prefix, except for those which are aliased.
[ "Returns", "all", "rules", "and", "terminals", "of", "grammar", "prepended", "with", "a", "namespace", "prefix", "except", "for", "those", "which", "are", "aliased", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/load_grammar.py#L577-L618
train
Returns all rules and terminals of grammar prepended by a namespace prefix except for those which are aliased.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/load_grammar.py
GrammarLoader.load_grammar
def load_grammar(self, grammar_text, grammar_name='<?>'): "Parse grammar_text, verify, and create Grammar object. Display nice messages on error." try: tree = self.canonize_tree.transform( self.parser.parse(grammar_text+'\n') ) except UnexpectedCharacters as e: context =...
python
def load_grammar(self, grammar_text, grammar_name='<?>'): "Parse grammar_text, verify, and create Grammar object. Display nice messages on error." try: tree = self.canonize_tree.transform( self.parser.parse(grammar_text+'\n') ) except UnexpectedCharacters as e: context =...
[ "def", "load_grammar", "(", "self", ",", "grammar_text", ",", "grammar_name", "=", "'<?>'", ")", ":", "try", ":", "tree", "=", "self", ".", "canonize_tree", ".", "transform", "(", "self", ".", "parser", ".", "parse", "(", "grammar_text", "+", "'\\n'", ")...
Parse grammar_text, verify, and create Grammar object. Display nice messages on error.
[ "Parse", "grammar_text", "verify", "and", "create", "Grammar", "object", ".", "Display", "nice", "messages", "on", "error", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/load_grammar.py#L686-L843
train
Parse grammar_text verify and create Grammar object. Display nice messages on error.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lark-parser/lark
lark/parsers/earley.py
Parser.predict_and_complete
def predict_and_complete(self, i, to_scan, columns, transitives): """The core Earley Predictor and Completer. At each stage of the input, we handling any completed items (things that matched on the last cycle) and use those to predict what should come next in the input stream. The compl...
python
def predict_and_complete(self, i, to_scan, columns, transitives): """The core Earley Predictor and Completer. At each stage of the input, we handling any completed items (things that matched on the last cycle) and use those to predict what should come next in the input stream. The compl...
[ "def", "predict_and_complete", "(", "self", ",", "i", ",", "to_scan", ",", "columns", ",", "transitives", ")", ":", "# Held Completions (H in E.Scotts paper).", "node_cache", "=", "{", "}", "held_completions", "=", "{", "}", "column", "=", "columns", "[", "i", ...
The core Earley Predictor and Completer. At each stage of the input, we handling any completed items (things that matched on the last cycle) and use those to predict what should come next in the input stream. The completions and any predicted non-terminals are recursively processed unti...
[ "The", "core", "Earley", "Predictor", "and", "Completer", "." ]
a798dec77907e74520dd7e90c7b6a4acc680633a
https://github.com/lark-parser/lark/blob/a798dec77907e74520dd7e90c7b6a4acc680633a/lark/parsers/earley.py#L56-L147
train
The core Earley Predictor and Completer.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/components/widgets/radio_group.py
RadioGroup.applyStyleRules
def applyStyleRules(self): """ Conditionally disabled/enables form fields based on the current section in the radio group """ for button, widget in zip(self.radioButtons, self.widgets): if isinstance(widget, CheckBox): widget.hideInput() ...
python
def applyStyleRules(self): """ Conditionally disabled/enables form fields based on the current section in the radio group """ for button, widget in zip(self.radioButtons, self.widgets): if isinstance(widget, CheckBox): widget.hideInput() ...
[ "def", "applyStyleRules", "(", "self", ")", ":", "for", "button", ",", "widget", "in", "zip", "(", "self", ".", "radioButtons", ",", "self", ".", "widgets", ")", ":", "if", "isinstance", "(", "widget", ",", "CheckBox", ")", ":", "widget", ".", "hideInp...
Conditionally disabled/enables form fields based on the current section in the radio group
[ "Conditionally", "disabled", "/", "enables", "form", "fields", "based", "on", "the", "current", "section", "in", "the", "radio", "group" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/widgets/radio_group.py#L95-L106
train
Applies the style rules to the radio group.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/components/widgets/radio_group.py
RadioGroup.handleImplicitCheck
def handleImplicitCheck(self): """ Checkboxes are hidden when inside of a RadioGroup as a selection of the Radio button is an implicit selection of the Checkbox. As such, we have to manually "check" any checkbox as needed. """ for button, widget in zip(self.radioBut...
python
def handleImplicitCheck(self): """ Checkboxes are hidden when inside of a RadioGroup as a selection of the Radio button is an implicit selection of the Checkbox. As such, we have to manually "check" any checkbox as needed. """ for button, widget in zip(self.radioBut...
[ "def", "handleImplicitCheck", "(", "self", ")", ":", "for", "button", ",", "widget", "in", "zip", "(", "self", ".", "radioButtons", ",", "self", ".", "widgets", ")", ":", "if", "isinstance", "(", "widget", ",", "CheckBox", ")", ":", "if", "button", "."...
Checkboxes are hidden when inside of a RadioGroup as a selection of the Radio button is an implicit selection of the Checkbox. As such, we have to manually "check" any checkbox as needed.
[ "Checkboxes", "are", "hidden", "when", "inside", "of", "a", "RadioGroup", "as", "a", "selection", "of", "the", "Radio", "button", "is", "an", "implicit", "selection", "of", "the", "Checkbox", ".", "As", "such", "we", "have", "to", "manually", "check", "any...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/widgets/radio_group.py#L108-L119
train
Handles implicit check of the Radio button.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/components/widgets/radio_group.py
RadioGroup.createWidgets
def createWidgets(self): """ Instantiate the Gooey Widgets that are used within the RadioGroup """ from gooey.gui.components import widgets return [getattr(widgets, item['type'])(self, item) for item in getin(self.widgetInfo, ['data', 'widgets'], [])]
python
def createWidgets(self): """ Instantiate the Gooey Widgets that are used within the RadioGroup """ from gooey.gui.components import widgets return [getattr(widgets, item['type'])(self, item) for item in getin(self.widgetInfo, ['data', 'widgets'], [])]
[ "def", "createWidgets", "(", "self", ")", ":", "from", "gooey", ".", "gui", ".", "components", "import", "widgets", "return", "[", "getattr", "(", "widgets", ",", "item", "[", "'type'", "]", ")", "(", "self", ",", "item", ")", "for", "item", "in", "g...
Instantiate the Gooey Widgets that are used within the RadioGroup
[ "Instantiate", "the", "Gooey", "Widgets", "that", "are", "used", "within", "the", "RadioGroup" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/widgets/radio_group.py#L136-L142
train
Instantiate the Gooey Widgets that are used within the RadioGroup
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/containers/application.py
GooeyApplication.onStart
def onStart(self, *args, **kwarg): """ Verify user input and kick off the client's program if valid """ with transactUI(self): config = self.navbar.getActiveConfig() config.resetErrors() if config.isValid(): self.clientRunner.ru...
python
def onStart(self, *args, **kwarg): """ Verify user input and kick off the client's program if valid """ with transactUI(self): config = self.navbar.getActiveConfig() config.resetErrors() if config.isValid(): self.clientRunner.ru...
[ "def", "onStart", "(", "self", ",", "*", "args", ",", "*", "*", "kwarg", ")", ":", "with", "transactUI", "(", "self", ")", ":", "config", "=", "self", ".", "navbar", ".", "getActiveConfig", "(", ")", "config", ".", "resetErrors", "(", ")", "if", "c...
Verify user input and kick off the client's program if valid
[ "Verify", "user", "input", "and", "kick", "off", "the", "client", "s", "program", "if", "valid" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/containers/application.py#L71-L83
train
Called when the user is ready to start the client.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/containers/application.py
GooeyApplication.onEdit
def onEdit(self): """Return the user to the settings screen for further editing""" with transactUI(self): if self.buildSpec['poll_external_updates']: self.fetchExternalUpdates() self.showSettings()
python
def onEdit(self): """Return the user to the settings screen for further editing""" with transactUI(self): if self.buildSpec['poll_external_updates']: self.fetchExternalUpdates() self.showSettings()
[ "def", "onEdit", "(", "self", ")", ":", "with", "transactUI", "(", "self", ")", ":", "if", "self", ".", "buildSpec", "[", "'poll_external_updates'", "]", ":", "self", ".", "fetchExternalUpdates", "(", ")", "self", ".", "showSettings", "(", ")" ]
Return the user to the settings screen for further editing
[ "Return", "the", "user", "to", "the", "settings", "screen", "for", "further", "editing" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/containers/application.py#L86-L91
train
Return the user to the settings screen for further editing
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/containers/application.py
GooeyApplication.buildCliString
def buildCliString(self): """ Collect all of the required information from the config screen and build a CLI string which can be used to invoke the client program """ config = self.navbar.getActiveConfig() group = self.buildSpec['widgets'][self.navbar.getSelectedGro...
python
def buildCliString(self): """ Collect all of the required information from the config screen and build a CLI string which can be used to invoke the client program """ config = self.navbar.getActiveConfig() group = self.buildSpec['widgets'][self.navbar.getSelectedGro...
[ "def", "buildCliString", "(", "self", ")", ":", "config", "=", "self", ".", "navbar", ".", "getActiveConfig", "(", ")", "group", "=", "self", ".", "buildSpec", "[", "'widgets'", "]", "[", "self", ".", "navbar", ".", "getSelectedGroup", "(", ")", "]", "...
Collect all of the required information from the config screen and build a CLI string which can be used to invoke the client program
[ "Collect", "all", "of", "the", "required", "information", "from", "the", "config", "screen", "and", "build", "a", "CLI", "string", "which", "can", "be", "used", "to", "invoke", "the", "client", "program" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/containers/application.py#L94-L114
train
Collect all of the required information from the config screen and build a CLI string which can be used to invoke the client program
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/containers/application.py
GooeyApplication.onComplete
def onComplete(self, *args, **kwargs): """ Display the appropriate screen based on the success/fail of the host program """ with transactUI(self): if self.clientRunner.was_success(): if self.buildSpec.get('return_to_config', False): ...
python
def onComplete(self, *args, **kwargs): """ Display the appropriate screen based on the success/fail of the host program """ with transactUI(self): if self.clientRunner.was_success(): if self.buildSpec.get('return_to_config', False): ...
[ "def", "onComplete", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "transactUI", "(", "self", ")", ":", "if", "self", ".", "clientRunner", ".", "was_success", "(", ")", ":", "if", "self", ".", "buildSpec", ".", "get", "(...
Display the appropriate screen based on the success/fail of the host program
[ "Display", "the", "appropriate", "screen", "based", "on", "the", "success", "/", "fail", "of", "the", "host", "program" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/containers/application.py#L117-L135
train
Called when the client is finished.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/containers/application.py
GooeyApplication.fetchExternalUpdates
def fetchExternalUpdates(self): """ !Experimental! Calls out to the client code requesting seed values to use in the UI !Experimental! """ seeds = seeder.fetchDynamicProperties( self.buildSpec['target'], self.buildSpec['encoding'] ...
python
def fetchExternalUpdates(self): """ !Experimental! Calls out to the client code requesting seed values to use in the UI !Experimental! """ seeds = seeder.fetchDynamicProperties( self.buildSpec['target'], self.buildSpec['encoding'] ...
[ "def", "fetchExternalUpdates", "(", "self", ")", ":", "seeds", "=", "seeder", ".", "fetchDynamicProperties", "(", "self", ".", "buildSpec", "[", "'target'", "]", ",", "self", ".", "buildSpec", "[", "'encoding'", "]", ")", "for", "config", "in", "self", "."...
!Experimental! Calls out to the client code requesting seed values to use in the UI !Experimental!
[ "!Experimental!", "Calls", "out", "to", "the", "client", "code", "requesting", "seed", "values", "to", "use", "in", "the", "UI", "!Experimental!" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/containers/application.py#L145-L156
train
Fetch the seed values from the seeder and update the UI
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/containers/application.py
GooeyApplication.buildNavigation
def buildNavigation(self): """ Chooses the appropriate layout navigation component based on user prefs """ if self.buildSpec['navigation'] == constants.TABBED: navigation = Tabbar(self, self.buildSpec, self.configs) else: navigation = Sidebar(self, ...
python
def buildNavigation(self): """ Chooses the appropriate layout navigation component based on user prefs """ if self.buildSpec['navigation'] == constants.TABBED: navigation = Tabbar(self, self.buildSpec, self.configs) else: navigation = Sidebar(self, ...
[ "def", "buildNavigation", "(", "self", ")", ":", "if", "self", ".", "buildSpec", "[", "'navigation'", "]", "==", "constants", ".", "TABBED", ":", "navigation", "=", "Tabbar", "(", "self", ",", "self", ".", "buildSpec", ",", "self", ".", "configs", ")", ...
Chooses the appropriate layout navigation component based on user prefs
[ "Chooses", "the", "appropriate", "layout", "navigation", "component", "based", "on", "user", "prefs" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/containers/application.py#L189-L199
train
Returns the appropriate layout navigation component based on user preferences
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/components/console.py
Console.getFontFace
def getFontFace(self): """Choose the best font face available given the user options""" userFace = self.buildSpec['terminal_font_family'] or self.defaultFont.GetFaceName() return ('' if self.buildSpec['monospace_display'] else userFace)
python
def getFontFace(self): """Choose the best font face available given the user options""" userFace = self.buildSpec['terminal_font_family'] or self.defaultFont.GetFaceName() return ('' if self.buildSpec['monospace_display'] else userFace)
[ "def", "getFontFace", "(", "self", ")", ":", "userFace", "=", "self", ".", "buildSpec", "[", "'terminal_font_family'", "]", "or", "self", ".", "defaultFont", ".", "GetFaceName", "(", ")", "return", "(", "''", "if", "self", ".", "buildSpec", "[", "'monospac...
Choose the best font face available given the user options
[ "Choose", "the", "best", "font", "face", "available", "given", "the", "user", "options" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/console.py#L46-L51
train
Choose the best font face available given the user options
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/processor.py
ProcessController._forward_stdout
def _forward_stdout(self, process): ''' Reads the stdout of `process` and forwards lines and progress to any interested subscribers ''' while True: line = process.stdout.readline() if not line: break pub.send_message(ev...
python
def _forward_stdout(self, process): ''' Reads the stdout of `process` and forwards lines and progress to any interested subscribers ''' while True: line = process.stdout.readline() if not line: break pub.send_message(ev...
[ "def", "_forward_stdout", "(", "self", ",", "process", ")", ":", "while", "True", ":", "line", "=", "process", ".", "stdout", ".", "readline", "(", ")", "if", "not", "line", ":", "break", "pub", ".", "send_message", "(", "events", ".", "CONSOLE_UPDATE", ...
Reads the stdout of `process` and forwards lines and progress to any interested subscribers
[ "Reads", "the", "stdout", "of", "process", "and", "forwards", "lines", "and", "progress", "to", "any", "interested", "subscribers" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/processor.py#L60-L72
train
Reads the stdout of process and forwards lines and progress to any interested subscribers.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/processor.py
ProcessController._extract_progress
def _extract_progress(self, text): ''' Finds progress information in the text using the user-supplied regex and calculation instructions ''' # monad-ish dispatch to avoid the if/else soup find = partial(re.search, string=text.strip().decode(self.encoding)) ...
python
def _extract_progress(self, text): ''' Finds progress information in the text using the user-supplied regex and calculation instructions ''' # monad-ish dispatch to avoid the if/else soup find = partial(re.search, string=text.strip().decode(self.encoding)) ...
[ "def", "_extract_progress", "(", "self", ",", "text", ")", ":", "# monad-ish dispatch to avoid the if/else soup\r", "find", "=", "partial", "(", "re", ".", "search", ",", "string", "=", "text", ".", "strip", "(", ")", ".", "decode", "(", "self", ".", "encodi...
Finds progress information in the text using the user-supplied regex and calculation instructions
[ "Finds", "progress", "information", "in", "the", "text", "using", "the", "user", "-", "supplied", "regex", "and", "calculation", "instructions" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/processor.py#L74-L84
train
Extracts the progress information from the text using the progress_regex and calculate instructions
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/processor.py
ProcessController._calculate_progress
def _calculate_progress(self, match): ''' Calculates the final progress value found by the regex ''' if not self.progress_expr: return safe_float(match.group(1)) else: return self._eval_progress(match)
python
def _calculate_progress(self, match): ''' Calculates the final progress value found by the regex ''' if not self.progress_expr: return safe_float(match.group(1)) else: return self._eval_progress(match)
[ "def", "_calculate_progress", "(", "self", ",", "match", ")", ":", "if", "not", "self", ".", "progress_expr", ":", "return", "safe_float", "(", "match", ".", "group", "(", "1", ")", ")", "else", ":", "return", "self", ".", "_eval_progress", "(", "match",...
Calculates the final progress value found by the regex
[ "Calculates", "the", "final", "progress", "value", "found", "by", "the", "regex" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/processor.py#L86-L93
train
Calculates the final progress value found by the regex match
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/components/sidebar.py
Sidebar.swapConfigPanels
def swapConfigPanels(self, event): """Hide/show configuration panels based on the currently selected option in the sidebar """ for id, panel in enumerate(self.configPanels): panel.Hide() self.activeSelection = event.Selection self.configPanels[event.Selection]....
python
def swapConfigPanels(self, event): """Hide/show configuration panels based on the currently selected option in the sidebar """ for id, panel in enumerate(self.configPanels): panel.Hide() self.activeSelection = event.Selection self.configPanels[event.Selection]....
[ "def", "swapConfigPanels", "(", "self", ",", "event", ")", ":", "for", "id", ",", "panel", "in", "enumerate", "(", "self", ".", "configPanels", ")", ":", "panel", ".", "Hide", "(", ")", "self", ".", "activeSelection", "=", "event", ".", "Selection", "s...
Hide/show configuration panels based on the currently selected option in the sidebar
[ "Hide", "/", "show", "configuration", "panels", "based", "on", "the", "currently", "selected", "option", "in", "the", "sidebar" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/sidebar.py#L36-L43
train
Hide and show configuration panels based on the currently selected option in the sidebar
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/components/footer.py
Footer.updateProgressBar
def updateProgressBar(self, *args, **kwargs): ''' value, disable_animation=False :param args: :param kwargs: :return: ''' value = kwargs.get('progress') pb = self.progress_bar if value is None: return if value < 0: ...
python
def updateProgressBar(self, *args, **kwargs): ''' value, disable_animation=False :param args: :param kwargs: :return: ''' value = kwargs.get('progress') pb = self.progress_bar if value is None: return if value < 0: ...
[ "def", "updateProgressBar", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "value", "=", "kwargs", ".", "get", "(", "'progress'", ")", "pb", "=", "self", ".", "progress_bar", "if", "value", "is", "None", ":", "return", "if", "value...
value, disable_animation=False :param args: :param kwargs: :return:
[ "value", "disable_animation", "=", "False", ":", "param", "args", ":", ":", "param", "kwargs", ":", ":", "return", ":" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/footer.py#L38-L63
train
Updates the progress bar with the new value.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/python_bindings/gooey_decorator.py
Gooey
def Gooey(f=None, advanced=True, language='english', auto_start=False, # TODO: add this to the docs. Used to be `show_config=True` target=None, program_name=None, program_description=None, default_size=(610, 530), use_legacy_titles...
python
def Gooey(f=None, advanced=True, language='english', auto_start=False, # TODO: add this to the docs. Used to be `show_config=True` target=None, program_name=None, program_description=None, default_size=(610, 530), use_legacy_titles...
[ "def", "Gooey", "(", "f", "=", "None", ",", "advanced", "=", "True", ",", "language", "=", "'english'", ",", "auto_start", "=", "False", ",", "# TODO: add this to the docs. Used to be `show_config=True`\r", "target", "=", "None", ",", "program_name", "=", "None", ...
Decorator for client code's main function. Serializes argparse data to JSON for use with the Gooey front end
[ "Decorator", "for", "client", "code", "s", "main", "function", ".", "Serializes", "argparse", "data", "to", "JSON", "for", "use", "with", "the", "Gooey", "front", "end" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/python_bindings/gooey_decorator.py#L22-L99
train
Decorator for client code s main function.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/seeder.py
fetchDynamicProperties
def fetchDynamicProperties(target, encoding): """ Sends a gooey-seed-ui request to the client program it retrieve dynamically generated defaults with which to seed the UI """ cmd = '{} {}'.format(target, 'gooey-seed-ui --ignore-gooey') proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, s...
python
def fetchDynamicProperties(target, encoding): """ Sends a gooey-seed-ui request to the client program it retrieve dynamically generated defaults with which to seed the UI """ cmd = '{} {}'.format(target, 'gooey-seed-ui --ignore-gooey') proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, s...
[ "def", "fetchDynamicProperties", "(", "target", ",", "encoding", ")", ":", "cmd", "=", "'{} {}'", ".", "format", "(", "target", ",", "'gooey-seed-ui --ignore-gooey'", ")", "proc", "=", "subprocess", ".", "Popen", "(", "cmd", ",", "stdout", "=", "subprocess", ...
Sends a gooey-seed-ui request to the client program it retrieve dynamically generated defaults with which to seed the UI
[ "Sends", "a", "gooey", "-", "seed", "-", "ui", "request", "to", "the", "client", "program", "it", "retrieve", "dynamically", "generated", "defaults", "with", "which", "to", "seed", "the", "UI" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/seeder.py#L9-L21
train
Sends a gooey - seed - ui request to the client program it retrieve dynamically generated defaults with which to seed the UI
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/components/config.py
ConfigPage.makeGroup
def makeGroup(self, parent, thissizer, group, *args): ''' Messily builds the (potentially) nested and grouped layout Note! Mutates `self.reifiedWidgets` in place with the widgets as they're instantiated! I cannot figure out how to split out the creation of the widgets from...
python
def makeGroup(self, parent, thissizer, group, *args): ''' Messily builds the (potentially) nested and grouped layout Note! Mutates `self.reifiedWidgets` in place with the widgets as they're instantiated! I cannot figure out how to split out the creation of the widgets from...
[ "def", "makeGroup", "(", "self", ",", "parent", ",", "thissizer", ",", "group", ",", "*", "args", ")", ":", "# determine the type of border , if any, the main sizer will use\r", "if", "getin", "(", "group", ",", "[", "'options'", ",", "'show_border'", "]", ",", ...
Messily builds the (potentially) nested and grouped layout Note! Mutates `self.reifiedWidgets` in place with the widgets as they're instantiated! I cannot figure out how to split out the creation of the widgets from their styling without WxPython violently exploding TODO: sort ou...
[ "Messily", "builds", "the", "(", "potentially", ")", "nested", "and", "grouped", "layout", "Note!", "Mutates", "self", ".", "reifiedWidgets", "in", "place", "with", "the", "widgets", "as", "they", "re", "instantiated!", "I", "cannot", "figure", "out", "how", ...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/config.py#L84-L134
train
Creates a group of items and returns a wx. BoxSizer instance that can be used to create the group of items.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/components/config.py
ConfigPage.chunkWidgets
def chunkWidgets(self, group): ''' chunk the widgets up into groups based on their sizing hints ''' ui_groups = [] subgroup = [] for index, item in enumerate(group['items']): if getin(item, ['options', 'full_width'], False): ui_groups.append(subgroup) ...
python
def chunkWidgets(self, group): ''' chunk the widgets up into groups based on their sizing hints ''' ui_groups = [] subgroup = [] for index, item in enumerate(group['items']): if getin(item, ['options', 'full_width'], False): ui_groups.append(subgroup) ...
[ "def", "chunkWidgets", "(", "self", ",", "group", ")", ":", "ui_groups", "=", "[", "]", "subgroup", "=", "[", "]", "for", "index", ",", "item", "in", "enumerate", "(", "group", "[", "'items'", "]", ")", ":", "if", "getin", "(", "item", ",", "[", ...
chunk the widgets up into groups based on their sizing hints
[ "chunk", "the", "widgets", "up", "into", "groups", "based", "on", "their", "sizing", "hints" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/config.py#L137-L152
train
chunk the widgets up into groups based on their sizing hints
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/components/config.py
ConfigPage.reifyWidget
def reifyWidget(self, parent, item): ''' Convert a JSON description of a widget into a WxObject ''' from gooey.gui.components import widgets widgetClass = getattr(widgets, item['type']) return widgetClass(parent, item)
python
def reifyWidget(self, parent, item): ''' Convert a JSON description of a widget into a WxObject ''' from gooey.gui.components import widgets widgetClass = getattr(widgets, item['type']) return widgetClass(parent, item)
[ "def", "reifyWidget", "(", "self", ",", "parent", ",", "item", ")", ":", "from", "gooey", ".", "gui", ".", "components", "import", "widgets", "widgetClass", "=", "getattr", "(", "widgets", ",", "item", "[", "'type'", "]", ")", "return", "widgetClass", "(...
Convert a JSON description of a widget into a WxObject
[ "Convert", "a", "JSON", "description", "of", "a", "widget", "into", "a", "WxObject" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/config.py#L155-L159
train
Convert a JSON description of a widget into a WxObject
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/python_bindings/argparse_to_json.py
extract_groups
def extract_groups(action_group): ''' Recursively extract argument groups and associated actions from ParserGroup objects ''' return { 'name': action_group.title, 'description': action_group.description, 'items': [action for action in action_group._group_actions ...
python
def extract_groups(action_group): ''' Recursively extract argument groups and associated actions from ParserGroup objects ''' return { 'name': action_group.title, 'description': action_group.description, 'items': [action for action in action_group._group_actions ...
[ "def", "extract_groups", "(", "action_group", ")", ":", "return", "{", "'name'", ":", "action_group", ".", "title", ",", "'description'", ":", "action_group", ".", "description", ",", "'items'", ":", "[", "action", "for", "action", "in", "action_group", ".", ...
Recursively extract argument groups and associated actions from ParserGroup objects
[ "Recursively", "extract", "argument", "groups", "and", "associated", "actions", "from", "ParserGroup", "objects" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/python_bindings/argparse_to_json.py#L114-L128
train
Recursively extract argument groups and associated actions from ParserGroup objects
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/python_bindings/argparse_to_json.py
is_required
def is_required(action): ''' _actions possessing the `required` flag and not implicitly optional through `nargs` being '*' or '?' ''' return not isinstance(action, _SubParsersAction) and ( action.required == True and action.nargs not in ['*', '?'])
python
def is_required(action): ''' _actions possessing the `required` flag and not implicitly optional through `nargs` being '*' or '?' ''' return not isinstance(action, _SubParsersAction) and ( action.required == True and action.nargs not in ['*', '?'])
[ "def", "is_required", "(", "action", ")", ":", "return", "not", "isinstance", "(", "action", ",", "_SubParsersAction", ")", "and", "(", "action", ".", "required", "==", "True", "and", "action", ".", "nargs", "not", "in", "[", "'*'", ",", "'?'", "]", ")...
_actions possessing the `required` flag and not implicitly optional through `nargs` being '*' or '?'
[ "_actions", "possessing", "the", "required", "flag", "and", "not", "implicitly", "optional", "through", "nargs", "being", "*", "or", "?" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/python_bindings/argparse_to_json.py#L217-L223
train
Returns true if the given action is required.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/python_bindings/argparse_to_json.py
is_standard
def is_standard(action): """ actions which are general "store" instructions. e.g. anything which has an argument style like: $ script.py -f myfilename.txt """ boolean_actions = ( _StoreConstAction, _StoreFalseAction, _StoreTrueAction ) return (not action.choices ...
python
def is_standard(action): """ actions which are general "store" instructions. e.g. anything which has an argument style like: $ script.py -f myfilename.txt """ boolean_actions = ( _StoreConstAction, _StoreFalseAction, _StoreTrueAction ) return (not action.choices ...
[ "def", "is_standard", "(", "action", ")", ":", "boolean_actions", "=", "(", "_StoreConstAction", ",", "_StoreFalseAction", ",", "_StoreTrueAction", ")", "return", "(", "not", "action", ".", "choices", "and", "not", "isinstance", "(", "action", ",", "_CountAction...
actions which are general "store" instructions. e.g. anything which has an argument style like: $ script.py -f myfilename.txt
[ "actions", "which", "are", "general", "store", "instructions", ".", "e", ".", "g", ".", "anything", "which", "has", "an", "argument", "style", "like", ":", "$", "script", ".", "py", "-", "f", "myfilename", ".", "txt" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/python_bindings/argparse_to_json.py#L259-L271
train
Returns True if the given action is standard.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/python_bindings/argparse_to_json.py
is_flag
def is_flag(action): """ _actions which are either storeconst, store_bool, etc.. """ action_types = [_StoreTrueAction, _StoreFalseAction, _StoreConstAction] return any(list(map(lambda Action: isinstance(action, Action), action_types)))
python
def is_flag(action): """ _actions which are either storeconst, store_bool, etc.. """ action_types = [_StoreTrueAction, _StoreFalseAction, _StoreConstAction] return any(list(map(lambda Action: isinstance(action, Action), action_types)))
[ "def", "is_flag", "(", "action", ")", ":", "action_types", "=", "[", "_StoreTrueAction", ",", "_StoreFalseAction", ",", "_StoreConstAction", "]", "return", "any", "(", "list", "(", "map", "(", "lambda", "Action", ":", "isinstance", "(", "action", ",", "Actio...
_actions which are either storeconst, store_bool, etc..
[ "_actions", "which", "are", "either", "storeconst", "store_bool", "etc", ".." ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/python_bindings/argparse_to_json.py#L274-L277
train
Check if the given action is a flag.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/formatters.py
counter
def counter(metatdata, value): ''' Returns str(option_string * DropDown Value) e.g. -vvvvv ''' if not str(value).isdigit(): return None arg = str(metatdata['commands'][0]).replace('-', '') repeated_args = arg * int(value) return '-' + repeated_args
python
def counter(metatdata, value): ''' Returns str(option_string * DropDown Value) e.g. -vvvvv ''' if not str(value).isdigit(): return None arg = str(metatdata['commands'][0]).replace('-', '') repeated_args = arg * int(value) return '-' + repeated_args
[ "def", "counter", "(", "metatdata", ",", "value", ")", ":", "if", "not", "str", "(", "value", ")", ".", "isdigit", "(", ")", ":", "return", "None", "arg", "=", "str", "(", "metatdata", "[", "'commands'", "]", "[", "0", "]", ")", ".", "replace", "...
Returns str(option_string * DropDown Value) e.g. -vvvvv
[ "Returns", "str", "(", "option_string", "*", "DropDown", "Value", ")", "e", ".", "g", ".", "-", "vvvvv" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/formatters.py#L39-L50
train
Returns the string that will be used to drop down the next value
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/gui/lang/i18n.py
load
def load(language_dir, filename, encoding): ''' Open and return the supplied json file ''' global _DICTIONARY try: json_file = filename + '.json' with io.open(os.path.join(language_dir, json_file), 'r', encoding=encoding) as f: _DICTIONARY = json.load(f) except IOError: raise IOError('...
python
def load(language_dir, filename, encoding): ''' Open and return the supplied json file ''' global _DICTIONARY try: json_file = filename + '.json' with io.open(os.path.join(language_dir, json_file), 'r', encoding=encoding) as f: _DICTIONARY = json.load(f) except IOError: raise IOError('...
[ "def", "load", "(", "language_dir", ",", "filename", ",", "encoding", ")", ":", "global", "_DICTIONARY", "try", ":", "json_file", "=", "filename", "+", "'.json'", "with", "io", ".", "open", "(", "os", ".", "path", ".", "join", "(", "language_dir", ",", ...
Open and return the supplied json file
[ "Open", "and", "return", "the", "supplied", "json", "file" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/lang/i18n.py#L18-L28
train
Open and return the supplied json file
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/util/functional.py
getin
def getin(m, path, default=None): """returns the value in a nested dict""" keynotfound = ':com.gooey-project/not-found' result = reduce(lambda acc, val: acc.get(val, {keynotfound: None}), path, m) # falsey values like 0 would incorrectly trigger the default to be returned # so the keynotfound v...
python
def getin(m, path, default=None): """returns the value in a nested dict""" keynotfound = ':com.gooey-project/not-found' result = reduce(lambda acc, val: acc.get(val, {keynotfound: None}), path, m) # falsey values like 0 would incorrectly trigger the default to be returned # so the keynotfound v...
[ "def", "getin", "(", "m", ",", "path", ",", "default", "=", "None", ")", ":", "keynotfound", "=", "':com.gooey-project/not-found'", "result", "=", "reduce", "(", "lambda", "acc", ",", "val", ":", "acc", ".", "get", "(", "val", ",", "{", "keynotfound", ...
returns the value in a nested dict
[ "returns", "the", "value", "in", "a", "nested", "dict" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/util/functional.py#L9-L17
train
returns the value in a nested dict
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/util/functional.py
assoc
def assoc(m, key, val): """Copy-on-write associates a value in a dict""" cpy = deepcopy(m) cpy[key] = val return cpy
python
def assoc(m, key, val): """Copy-on-write associates a value in a dict""" cpy = deepcopy(m) cpy[key] = val return cpy
[ "def", "assoc", "(", "m", ",", "key", ",", "val", ")", ":", "cpy", "=", "deepcopy", "(", "m", ")", "cpy", "[", "key", "]", "=", "val", "return", "cpy" ]
Copy-on-write associates a value in a dict
[ "Copy", "-", "on", "-", "write", "associates", "a", "value", "in", "a", "dict" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/util/functional.py#L20-L24
train
Copy - on - write associates a value in a dict
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/util/functional.py
associn
def associn(m, path, value): """ Copy-on-write associates a value in a nested dict """ def assoc_recursively(m, path, value): if not path: return value p = path[0] return assoc(m, p, assoc_recursively(m.get(p,{}), path[1:], value)) return assoc_recursively(m, path,...
python
def associn(m, path, value): """ Copy-on-write associates a value in a nested dict """ def assoc_recursively(m, path, value): if not path: return value p = path[0] return assoc(m, p, assoc_recursively(m.get(p,{}), path[1:], value)) return assoc_recursively(m, path,...
[ "def", "associn", "(", "m", ",", "path", ",", "value", ")", ":", "def", "assoc_recursively", "(", "m", ",", "path", ",", "value", ")", ":", "if", "not", "path", ":", "return", "value", "p", "=", "path", "[", "0", "]", "return", "assoc", "(", "m",...
Copy-on-write associates a value in a nested dict
[ "Copy", "-", "on", "-", "write", "associates", "a", "value", "in", "a", "nested", "dict" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/util/functional.py#L27-L34
train
Copy - on - write associates a value in a nested dict
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/util/functional.py
merge
def merge(*maps): """Merge all maps left to right""" copies = map(deepcopy, maps) return reduce(lambda acc, val: acc.update(val) or acc, copies)
python
def merge(*maps): """Merge all maps left to right""" copies = map(deepcopy, maps) return reduce(lambda acc, val: acc.update(val) or acc, copies)
[ "def", "merge", "(", "*", "maps", ")", ":", "copies", "=", "map", "(", "deepcopy", ",", "maps", ")", "return", "reduce", "(", "lambda", "acc", ",", "val", ":", "acc", ".", "update", "(", "val", ")", "or", "acc", ",", "copies", ")" ]
Merge all maps left to right
[ "Merge", "all", "maps", "left", "to", "right" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/util/functional.py#L37-L40
train
Merge all maps left to right
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
chriskiehl/Gooey
gooey/util/functional.py
findfirst
def findfirst(f, coll): """Return first occurrence matching f, otherwise None""" result = list(dropwhile(f, coll)) return result[0] if result else None
python
def findfirst(f, coll): """Return first occurrence matching f, otherwise None""" result = list(dropwhile(f, coll)) return result[0] if result else None
[ "def", "findfirst", "(", "f", ",", "coll", ")", ":", "result", "=", "list", "(", "dropwhile", "(", "f", ",", "coll", ")", ")", "return", "result", "[", "0", "]", "if", "result", "else", "None" ]
Return first occurrence matching f, otherwise None
[ "Return", "first", "occurrence", "matching", "f", "otherwise", "None" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/util/functional.py#L58-L61
train
Return first occurrence matching f otherwise None
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
raghakot/keras-vis
vis/visualization/activation_maximization.py
visualize_activation_with_losses
def visualize_activation_with_losses(input_tensor, losses, wrt_tensor=None, seed_input=None, input_range=(0, 255), **optimizer_params): """Generates the `input_tensor` that minimizes the weighted `losses`. This function is intended for advanc...
python
def visualize_activation_with_losses(input_tensor, losses, wrt_tensor=None, seed_input=None, input_range=(0, 255), **optimizer_params): """Generates the `input_tensor` that minimizes the weighted `losses`. This function is intended for advanc...
[ "def", "visualize_activation_with_losses", "(", "input_tensor", ",", "losses", ",", "wrt_tensor", "=", "None", ",", "seed_input", "=", "None", ",", "input_range", "=", "(", "0", ",", "255", ")", ",", "*", "*", "optimizer_params", ")", ":", "# Default optimizer...
Generates the `input_tensor` that minimizes the weighted `losses`. This function is intended for advanced use cases where a custom loss is desired. Args: input_tensor: An input tensor of shape: `(samples, channels, image_dims...)` if `image_data_format= channels_first` or `(samples, image_d...
[ "Generates", "the", "input_tensor", "that", "minimizes", "the", "weighted", "losses", ".", "This", "function", "is", "intended", "for", "advanced", "use", "cases", "where", "a", "custom", "loss", "is", "desired", "." ]
668b0e11dab93f3487f23c17e07f40554a8939e9
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/visualization/activation_maximization.py#L13-L51
train
Generates the input_tensor that minimizes the weighted losses.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
raghakot/keras-vis
vis/visualization/activation_maximization.py
visualize_activation
def visualize_activation(model, layer_idx, filter_indices=None, wrt_tensor=None, seed_input=None, input_range=(0, 255), backprop_modifier=None, grad_modifier=None, act_max_weight=1, lp_norm_weight=10, tv_weight=10, **opt...
python
def visualize_activation(model, layer_idx, filter_indices=None, wrt_tensor=None, seed_input=None, input_range=(0, 255), backprop_modifier=None, grad_modifier=None, act_max_weight=1, lp_norm_weight=10, tv_weight=10, **opt...
[ "def", "visualize_activation", "(", "model", ",", "layer_idx", ",", "filter_indices", "=", "None", ",", "wrt_tensor", "=", "None", ",", "seed_input", "=", "None", ",", "input_range", "=", "(", "0", ",", "255", ")", ",", "backprop_modifier", "=", "None", ",...
Generates the model input that maximizes the output of all `filter_indices` in the given `layer_idx`. Args: model: The `keras.models.Model` instance. The model input shape must be: `(samples, channels, image_dims...)` if `image_data_format=channels_first` or `(samples, image_dims..., channels)`...
[ "Generates", "the", "model", "input", "that", "maximizes", "the", "output", "of", "all", "filter_indices", "in", "the", "given", "layer_idx", "." ]
668b0e11dab93f3487f23c17e07f40554a8939e9
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/visualization/activation_maximization.py#L54-L112
train
Generates the model input that maximizes the output of all filter_indices in the given layer_idx.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
raghakot/keras-vis
vis/optimizer.py
Optimizer._rmsprop
def _rmsprop(self, grads, cache=None, decay_rate=0.95): """Uses RMSProp to compute step from gradients. Args: grads: numpy array of gradients. cache: numpy array of same shape as `grads` as RMSProp cache decay_rate: How fast to decay cache Returns: ...
python
def _rmsprop(self, grads, cache=None, decay_rate=0.95): """Uses RMSProp to compute step from gradients. Args: grads: numpy array of gradients. cache: numpy array of same shape as `grads` as RMSProp cache decay_rate: How fast to decay cache Returns: ...
[ "def", "_rmsprop", "(", "self", ",", "grads", ",", "cache", "=", "None", ",", "decay_rate", "=", "0.95", ")", ":", "if", "cache", "is", "None", ":", "cache", "=", "np", ".", "zeros_like", "(", "grads", ")", "cache", "=", "decay_rate", "*", "cache", ...
Uses RMSProp to compute step from gradients. Args: grads: numpy array of gradients. cache: numpy array of same shape as `grads` as RMSProp cache decay_rate: How fast to decay cache Returns: A tuple of step: numpy array of the same shape a...
[ "Uses", "RMSProp", "to", "compute", "step", "from", "gradients", "." ]
668b0e11dab93f3487f23c17e07f40554a8939e9
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/optimizer.py#L69-L87
train
Uses RMSProp to compute step from gradients.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
raghakot/keras-vis
vis/optimizer.py
Optimizer._get_seed_input
def _get_seed_input(self, seed_input): """Creates a random `seed_input` if None. Otherwise: - Ensures batch_size dim on provided `seed_input`. - Shuffle axis according to expected `image_data_format`. """ desired_shape = (1, ) + K.int_shape(self.input_tensor)[1:] ...
python
def _get_seed_input(self, seed_input): """Creates a random `seed_input` if None. Otherwise: - Ensures batch_size dim on provided `seed_input`. - Shuffle axis according to expected `image_data_format`. """ desired_shape = (1, ) + K.int_shape(self.input_tensor)[1:] ...
[ "def", "_get_seed_input", "(", "self", ",", "seed_input", ")", ":", "desired_shape", "=", "(", "1", ",", ")", "+", "K", ".", "int_shape", "(", "self", ".", "input_tensor", ")", "[", "1", ":", "]", "if", "seed_input", "is", "None", ":", "return", "uti...
Creates a random `seed_input` if None. Otherwise: - Ensures batch_size dim on provided `seed_input`. - Shuffle axis according to expected `image_data_format`.
[ "Creates", "a", "random", "seed_input", "if", "None", ".", "Otherwise", ":", "-", "Ensures", "batch_size", "dim", "on", "provided", "seed_input", ".", "-", "Shuffle", "axis", "according", "to", "expected", "image_data_format", "." ]
668b0e11dab93f3487f23c17e07f40554a8939e9
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/optimizer.py#L89-L107
train
Creates a random seed_input if None. Otherwise returns a random seed_input.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
raghakot/keras-vis
vis/optimizer.py
Optimizer.minimize
def minimize(self, seed_input=None, max_iter=200, input_modifiers=None, grad_modifier=None, callbacks=None, verbose=True): """Performs gradient descent on the input image with respect to defined losses. Args: seed_input: An N-dim numpy array of shape: `(sam...
python
def minimize(self, seed_input=None, max_iter=200, input_modifiers=None, grad_modifier=None, callbacks=None, verbose=True): """Performs gradient descent on the input image with respect to defined losses. Args: seed_input: An N-dim numpy array of shape: `(sam...
[ "def", "minimize", "(", "self", ",", "seed_input", "=", "None", ",", "max_iter", "=", "200", ",", "input_modifiers", "=", "None", ",", "grad_modifier", "=", "None", ",", "callbacks", "=", "None", ",", "verbose", "=", "True", ")", ":", "seed_input", "=", ...
Performs gradient descent on the input image with respect to defined losses. Args: seed_input: An N-dim numpy array of shape: `(samples, channels, image_dims...)` if `image_data_format= channels_first` or `(samples, image_dims..., channels)` if `image_data_format=channels_last`. ...
[ "Performs", "gradient", "descent", "on", "the", "input", "image", "with", "respect", "to", "defined", "losses", "." ]
668b0e11dab93f3487f23c17e07f40554a8939e9
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/optimizer.py#L109-L187
train
Performs gradient descent on the input image with respect to defined losses.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...