partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
BaseRegisterUser.add_registration
Add a registration request for the user. :rtype : RegisterUser
flask_appbuilder/security/registerviews.py
def add_registration(self, username, first_name, last_name, email, password=""): """ Add a registration request for the user. :rtype : RegisterUser """ register_user = self.appbuilder.sm.add_register_user( username, first_name, last_name, email, password ...
def add_registration(self, username, first_name, last_name, email, password=""): """ Add a registration request for the user. :rtype : RegisterUser """ register_user = self.appbuilder.sm.add_register_user( username, first_name, last_name, email, password ...
[ "Add", "a", "registration", "request", "for", "the", "user", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/registerviews.py#L104-L120
[ "def", "add_registration", "(", "self", ",", "username", ",", "first_name", ",", "last_name", ",", "email", ",", "password", "=", "\"\"", ")", ":", "register_user", "=", "self", ".", "appbuilder", ".", "sm", ".", "add_register_user", "(", "username", ",", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseRegisterUser.activation
Endpoint to expose an activation url, this url is sent to the user by email, when accessed the user is inserted and activated
flask_appbuilder/security/registerviews.py
def activation(self, activation_hash): """ Endpoint to expose an activation url, this url is sent to the user by email, when accessed the user is inserted and activated """ reg = self.appbuilder.sm.find_register_user(activation_hash) if not reg: ...
def activation(self, activation_hash): """ Endpoint to expose an activation url, this url is sent to the user by email, when accessed the user is inserted and activated """ reg = self.appbuilder.sm.find_register_user(activation_hash) if not reg: ...
[ "Endpoint", "to", "expose", "an", "activation", "url", "this", "url", "is", "sent", "to", "the", "user", "by", "email", "when", "accessed", "the", "user", "is", "inserted", "and", "activated" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/registerviews.py#L123-L154
[ "def", "activation", "(", "self", ",", "activation_hash", ")", ":", "reg", "=", "self", ".", "appbuilder", ".", "sm", ".", "find_register_user", "(", "activation_hash", ")", "if", "not", "reg", ":", "log", ".", "error", "(", "c", ".", "LOGMSG_ERR_SEC_NO_RE...
c293734c1b86e176a3ba57ee2deab6676d125576
train
RegisterUserOIDView.oid_login_handler
Hackish method to make use of oid.login_handler decorator.
flask_appbuilder/security/registerviews.py
def oid_login_handler(self, f, oid): """ Hackish method to make use of oid.login_handler decorator. """ if request.args.get("openid_complete") != u"yes": return f(False) consumer = Consumer(SessionWrapper(self), oid.store_factory()) openid_response = consu...
def oid_login_handler(self, f, oid): """ Hackish method to make use of oid.login_handler decorator. """ if request.args.get("openid_complete") != u"yes": return f(False) consumer = Consumer(SessionWrapper(self), oid.store_factory()) openid_response = consu...
[ "Hackish", "method", "to", "make", "use", "of", "oid", ".", "login_handler", "decorator", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/registerviews.py#L233-L249
[ "def", "oid_login_handler", "(", "self", ",", "f", ",", "oid", ")", ":", "if", "request", ".", "args", ".", "get", "(", "\"openid_complete\"", ")", "!=", "u\"yes\"", ":", "return", "f", "(", "False", ")", "consumer", "=", "Consumer", "(", "SessionWrapper...
c293734c1b86e176a3ba57ee2deab6676d125576
train
AJAXSelectField.process_data
Process the Python data applied to this field and store the result. This will be called during form construction by the form's `kwargs` or `obj` argument. Converting ORM object to primary key for client form. :param value: The python object containing the value to process.
flask_appbuilder/fields.py
def process_data(self, value): """ Process the Python data applied to this field and store the result. This will be called during form construction by the form's `kwargs` or `obj` argument. Converting ORM object to primary key for client form. :param value: The python o...
def process_data(self, value): """ Process the Python data applied to this field and store the result. This will be called during form construction by the form's `kwargs` or `obj` argument. Converting ORM object to primary key for client form. :param value: The python o...
[ "Process", "the", "Python", "data", "applied", "to", "this", "field", "and", "store", "the", "result", ".", "This", "will", "be", "called", "during", "form", "construction", "by", "the", "form", "s", "kwargs", "or", "obj", "argument", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/fields.py#L40-L58
[ "def", "process_data", "(", "self", ",", "value", ")", ":", "if", "value", ":", "if", "self", ".", "is_related", ":", "self", ".", "data", "=", "self", ".", "datamodel", ".", "get_related_interface", "(", "self", ".", "col_name", ")", ".", "get_pk_value"...
c293734c1b86e176a3ba57ee2deab6676d125576
train
AJAXSelectField.process_formdata
Process data received over the wire from a form. This will be called during form construction with data supplied through the `formdata` argument. Converting primary key to ORM for server processing. :param valuelist: A list of strings to process.
flask_appbuilder/fields.py
def process_formdata(self, valuelist): """ Process data received over the wire from a form. This will be called during form construction with data supplied through the `formdata` argument. Converting primary key to ORM for server processing. :param valuelist: A list of ...
def process_formdata(self, valuelist): """ Process data received over the wire from a form. This will be called during form construction with data supplied through the `formdata` argument. Converting primary key to ORM for server processing. :param valuelist: A list of ...
[ "Process", "data", "received", "over", "the", "wire", "from", "a", "form", ".", "This", "will", "be", "called", "during", "form", "construction", "with", "data", "supplied", "through", "the", "formdata", "argument", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/fields.py#L60-L76
[ "def", "process_formdata", "(", "self", ",", "valuelist", ")", ":", "if", "valuelist", ":", "if", "self", ".", "is_related", ":", "self", ".", "data", "=", "self", ".", "datamodel", ".", "get_related_interface", "(", "self", ".", "col_name", ")", ".", "g...
c293734c1b86e176a3ba57ee2deab6676d125576
train
GroupByChartView.get_group_by_class
intantiates the processing class (Direct or Grouped) and returns it.
flask_appbuilder/charts/views.py
def get_group_by_class(self, definition): """ intantiates the processing class (Direct or Grouped) and returns it. """ group_by = definition["group"] series = definition["series"] if "formatter" in definition: formatter = {group_by: definition["formatter"]...
def get_group_by_class(self, definition): """ intantiates the processing class (Direct or Grouped) and returns it. """ group_by = definition["group"] series = definition["series"] if "formatter" in definition: formatter = {group_by: definition["formatter"]...
[ "intantiates", "the", "processing", "class", "(", "Direct", "or", "Grouped", ")", "and", "returns", "it", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/charts/views.py#L140-L150
[ "def", "get_group_by_class", "(", "self", ",", "definition", ")", ":", "group_by", "=", "definition", "[", "\"group\"", "]", "series", "=", "definition", "[", "\"series\"", "]", "if", "\"formatter\"", "in", "definition", ":", "formatter", "=", "{", "group_by",...
c293734c1b86e176a3ba57ee2deab6676d125576
train
get_page_args
Get page arguments, returns a dictionary { <VIEW_NAME>: PAGE_NUMBER } Arguments are passed: page_<VIEW_NAME>=<PAGE_NUMBER>
flask_appbuilder/urltools.py
def get_page_args(): """ Get page arguments, returns a dictionary { <VIEW_NAME>: PAGE_NUMBER } Arguments are passed: page_<VIEW_NAME>=<PAGE_NUMBER> """ pages = {} for arg in request.args: re_match = re.findall("page_(.*)", arg) if re_match: pages[re_...
def get_page_args(): """ Get page arguments, returns a dictionary { <VIEW_NAME>: PAGE_NUMBER } Arguments are passed: page_<VIEW_NAME>=<PAGE_NUMBER> """ pages = {} for arg in request.args: re_match = re.findall("page_(.*)", arg) if re_match: pages[re_...
[ "Get", "page", "arguments", "returns", "a", "dictionary", "{", "<VIEW_NAME", ">", ":", "PAGE_NUMBER", "}" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/urltools.py#L44-L57
[ "def", "get_page_args", "(", ")", ":", "pages", "=", "{", "}", "for", "arg", "in", "request", ".", "args", ":", "re_match", "=", "re", ".", "findall", "(", "\"page_(.*)\"", ",", "arg", ")", "if", "re_match", ":", "pages", "[", "re_match", "[", "0", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
get_page_size_args
Get page size arguments, returns an int { <VIEW_NAME>: PAGE_NUMBER } Arguments are passed: psize_<VIEW_NAME>=<PAGE_SIZE>
flask_appbuilder/urltools.py
def get_page_size_args(): """ Get page size arguments, returns an int { <VIEW_NAME>: PAGE_NUMBER } Arguments are passed: psize_<VIEW_NAME>=<PAGE_SIZE> """ page_sizes = {} for arg in request.args: re_match = re.findall("psize_(.*)", arg) if re_match: ...
def get_page_size_args(): """ Get page size arguments, returns an int { <VIEW_NAME>: PAGE_NUMBER } Arguments are passed: psize_<VIEW_NAME>=<PAGE_SIZE> """ page_sizes = {} for arg in request.args: re_match = re.findall("psize_(.*)", arg) if re_match: ...
[ "Get", "page", "size", "arguments", "returns", "an", "int", "{", "<VIEW_NAME", ">", ":", "PAGE_NUMBER", "}" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/urltools.py#L60-L73
[ "def", "get_page_size_args", "(", ")", ":", "page_sizes", "=", "{", "}", "for", "arg", "in", "request", ".", "args", ":", "re_match", "=", "re", ".", "findall", "(", "\"psize_(.*)\"", ",", "arg", ")", "if", "re_match", ":", "page_sizes", "[", "re_match",...
c293734c1b86e176a3ba57ee2deab6676d125576
train
get_order_args
Get order arguments, return a dictionary { <VIEW_NAME>: (ORDER_COL, ORDER_DIRECTION) } Arguments are passed like: _oc_<VIEW_NAME>=<COL_NAME>&_od_<VIEW_NAME>='asc'|'desc'
flask_appbuilder/urltools.py
def get_order_args(): """ Get order arguments, return a dictionary { <VIEW_NAME>: (ORDER_COL, ORDER_DIRECTION) } Arguments are passed like: _oc_<VIEW_NAME>=<COL_NAME>&_od_<VIEW_NAME>='asc'|'desc' """ orders = {} for arg in request.args: re_match = re.findall("_oc_(.*)",...
def get_order_args(): """ Get order arguments, return a dictionary { <VIEW_NAME>: (ORDER_COL, ORDER_DIRECTION) } Arguments are passed like: _oc_<VIEW_NAME>=<COL_NAME>&_od_<VIEW_NAME>='asc'|'desc' """ orders = {} for arg in request.args: re_match = re.findall("_oc_(.*)",...
[ "Get", "order", "arguments", "return", "a", "dictionary", "{", "<VIEW_NAME", ">", ":", "(", "ORDER_COL", "ORDER_DIRECTION", ")", "}" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/urltools.py#L76-L91
[ "def", "get_order_args", "(", ")", ":", "orders", "=", "{", "}", "for", "arg", "in", "request", ".", "args", ":", "re_match", "=", "re", ".", "findall", "(", "\"_oc_(.*)\"", ",", "arg", ")", "if", "re_match", ":", "order_direction", "=", "request", "."...
c293734c1b86e176a3ba57ee2deab6676d125576
train
Model2SchemaConverter._meta_schema_factory
Creates ModelSchema marshmallow-sqlalchemy :param columns: a list of columns to mix :param model: Model :param class_mixin: a marshamallow Schema to mix :return: ModelSchema
flask_appbuilder/api/convert.py
def _meta_schema_factory(self, columns, model, class_mixin): """ Creates ModelSchema marshmallow-sqlalchemy :param columns: a list of columns to mix :param model: Model :param class_mixin: a marshamallow Schema to mix :return: ModelSchema """ _model =...
def _meta_schema_factory(self, columns, model, class_mixin): """ Creates ModelSchema marshmallow-sqlalchemy :param columns: a list of columns to mix :param model: Model :param class_mixin: a marshamallow Schema to mix :return: ModelSchema """ _model =...
[ "Creates", "ModelSchema", "marshmallow", "-", "sqlalchemy" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/api/convert.py#L87-L110
[ "def", "_meta_schema_factory", "(", "self", ",", "columns", ",", "model", ",", "class_mixin", ")", ":", "_model", "=", "model", "if", "columns", ":", "class", "MetaSchema", "(", "ModelSchema", ",", "class_mixin", ")", ":", "class", "Meta", ":", "model", "=...
c293734c1b86e176a3ba57ee2deab6676d125576
train
Model2SchemaConverter.convert
Creates a Marshmallow ModelSchema class :param columns: List with columns to include, if empty converts all on model :param model: Override Model to convert :param nested: Generate relation with nested schemas :return: ModelSchema object
flask_appbuilder/api/convert.py
def convert(self, columns, model=None, nested=True, enum_dump_by_name=False): """ Creates a Marshmallow ModelSchema class :param columns: List with columns to include, if empty converts all on model :param model: Override Model to convert :param nested: Generate relation wi...
def convert(self, columns, model=None, nested=True, enum_dump_by_name=False): """ Creates a Marshmallow ModelSchema class :param columns: List with columns to include, if empty converts all on model :param model: Override Model to convert :param nested: Generate relation wi...
[ "Creates", "a", "Marshmallow", "ModelSchema", "class" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/api/convert.py#L187-L224
[ "def", "convert", "(", "self", ",", "columns", ",", "model", "=", "None", ",", "nested", "=", "True", ",", "enum_dump_by_name", "=", "False", ")", ":", "super", "(", "Model2SchemaConverter", ",", "self", ")", ".", "convert", "(", "columns", ",", "model",...
c293734c1b86e176a3ba57ee2deab6676d125576
train
protect
Use this decorator to enable granular security permissions to your API methods (BaseApi and child classes). Permissions will be associated to a role, and roles are associated to users. allow_browser_login will accept signed cookies obtained from the normal MVC app:: class MyApi(Bas...
flask_appbuilder/security/decorators.py
def protect(allow_browser_login=False): """ Use this decorator to enable granular security permissions to your API methods (BaseApi and child classes). Permissions will be associated to a role, and roles are associated to users. allow_browser_login will accept signed cookies obtaine...
def protect(allow_browser_login=False): """ Use this decorator to enable granular security permissions to your API methods (BaseApi and child classes). Permissions will be associated to a role, and roles are associated to users. allow_browser_login will accept signed cookies obtaine...
[ "Use", "this", "decorator", "to", "enable", "granular", "security", "permissions", "to", "your", "API", "methods", "(", "BaseApi", "and", "child", "classes", ")", ".", "Permissions", "will", "be", "associated", "to", "a", "role", "and", "roles", "are", "asso...
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/decorators.py#L25-L85
[ "def", "protect", "(", "allow_browser_login", "=", "False", ")", ":", "def", "_protect", "(", "f", ")", ":", "if", "hasattr", "(", "f", ",", "'_permission_name'", ")", ":", "permission_str", "=", "f", ".", "_permission_name", "else", ":", "permission_str", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
has_access
Use this decorator to enable granular security permissions to your methods. Permissions will be associated to a role, and roles are associated to users. By default the permission's name is the methods name.
flask_appbuilder/security/decorators.py
def has_access(f): """ Use this decorator to enable granular security permissions to your methods. Permissions will be associated to a role, and roles are associated to users. By default the permission's name is the methods name. """ if hasattr(f, '_permission_name'): permis...
def has_access(f): """ Use this decorator to enable granular security permissions to your methods. Permissions will be associated to a role, and roles are associated to users. By default the permission's name is the methods name. """ if hasattr(f, '_permission_name'): permis...
[ "Use", "this", "decorator", "to", "enable", "granular", "security", "permissions", "to", "your", "methods", ".", "Permissions", "will", "be", "associated", "to", "a", "role", "and", "roles", "are", "associated", "to", "users", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/decorators.py#L88-L122
[ "def", "has_access", "(", "f", ")", ":", "if", "hasattr", "(", "f", ",", "'_permission_name'", ")", ":", "permission_str", "=", "f", ".", "_permission_name", "else", ":", "permission_str", "=", "f", ".", "__name__", "def", "wraps", "(", "self", ",", "*",...
c293734c1b86e176a3ba57ee2deab6676d125576
train
has_access_api
Use this decorator to enable granular security permissions to your API methods. Permissions will be associated to a role, and roles are associated to users. By default the permission's name is the methods name. this will return a message and HTTP 401 is case of unauthorized access.
flask_appbuilder/security/decorators.py
def has_access_api(f): """ Use this decorator to enable granular security permissions to your API methods. Permissions will be associated to a role, and roles are associated to users. By default the permission's name is the methods name. this will return a message and HTTP 401 is c...
def has_access_api(f): """ Use this decorator to enable granular security permissions to your API methods. Permissions will be associated to a role, and roles are associated to users. By default the permission's name is the methods name. this will return a message and HTTP 401 is c...
[ "Use", "this", "decorator", "to", "enable", "granular", "security", "permissions", "to", "your", "API", "methods", ".", "Permissions", "will", "be", "associated", "to", "a", "role", "and", "roles", "are", "associated", "to", "users", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/decorators.py#L125-L165
[ "def", "has_access_api", "(", "f", ")", ":", "if", "hasattr", "(", "f", ",", "'_permission_name'", ")", ":", "permission_str", "=", "f", ".", "_permission_name", "else", ":", "permission_str", "=", "f", ".", "__name__", "def", "wraps", "(", "self", ",", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
action
Use this decorator to expose actions :param name: Action name :param text: Action text. :param confirmation: Confirmation text. If not provided, action will be executed unconditionally. :param icon: Font Awesome icon name ...
flask_appbuilder/actions.py
def action(name, text, confirmation=None, icon=None, multiple=True, single=True): """ Use this decorator to expose actions :param name: Action name :param text: Action text. :param confirmation: Confirmation text. If not provided, action will be e...
def action(name, text, confirmation=None, icon=None, multiple=True, single=True): """ Use this decorator to expose actions :param name: Action name :param text: Action text. :param confirmation: Confirmation text. If not provided, action will be e...
[ "Use", "this", "decorator", "to", "expose", "actions" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/actions.py#L27-L50
[ "def", "action", "(", "name", ",", "text", ",", "confirmation", "=", "None", ",", "icon", "=", "None", ",", "multiple", "=", "True", ",", "single", "=", "True", ")", ":", "def", "wrap", "(", "f", ")", ":", "f", ".", "_action", "=", "(", "name", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
_oauth_tokengetter
Default function to return the current user oauth token from session cookie.
flask_appbuilder/security/manager.py
def _oauth_tokengetter(token=None): """ Default function to return the current user oauth token from session cookie. """ token = session.get("oauth") log.debug("Token Get: {0}".format(token)) return token
def _oauth_tokengetter(token=None): """ Default function to return the current user oauth token from session cookie. """ token = session.get("oauth") log.debug("Token Get: {0}".format(token)) return token
[ "Default", "function", "to", "return", "the", "current", "user", "oauth", "token", "from", "session", "cookie", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L113-L120
[ "def", "_oauth_tokengetter", "(", "token", "=", "None", ")", ":", "token", "=", "session", ".", "get", "(", "\"oauth\"", ")", "log", ".", "debug", "(", "\"Token Get: {0}\"", ".", "format", "(", "token", ")", ")", "return", "token" ]
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.create_login_manager
Override to implement your custom login manager instance :param app: Flask app
flask_appbuilder/security/manager.py
def create_login_manager(self, app) -> LoginManager: """ Override to implement your custom login manager instance :param app: Flask app """ lm = LoginManager(app) lm.login_view = "login" lm.user_loader(self.load_user) return lm
def create_login_manager(self, app) -> LoginManager: """ Override to implement your custom login manager instance :param app: Flask app """ lm = LoginManager(app) lm.login_view = "login" lm.user_loader(self.load_user) return lm
[ "Override", "to", "implement", "your", "custom", "login", "manager", "instance" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L271-L280
[ "def", "create_login_manager", "(", "self", ",", "app", ")", "->", "LoginManager", ":", "lm", "=", "LoginManager", "(", "app", ")", "lm", ".", "login_view", "=", "\"login\"", "lm", ".", "user_loader", "(", "self", ".", "load_user", ")", "return", "lm" ]
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.create_jwt_manager
Override to implement your custom JWT manager instance :param app: Flask app
flask_appbuilder/security/manager.py
def create_jwt_manager(self, app) -> JWTManager: """ Override to implement your custom JWT manager instance :param app: Flask app """ jwt_manager = JWTManager() jwt_manager.init_app(app) jwt_manager.user_loader_callback_loader(self.load_user) retu...
def create_jwt_manager(self, app) -> JWTManager: """ Override to implement your custom JWT manager instance :param app: Flask app """ jwt_manager = JWTManager() jwt_manager.init_app(app) jwt_manager.user_loader_callback_loader(self.load_user) retu...
[ "Override", "to", "implement", "your", "custom", "JWT", "manager", "instance" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L282-L291
[ "def", "create_jwt_manager", "(", "self", ",", "app", ")", "->", "JWTManager", ":", "jwt_manager", "=", "JWTManager", "(", ")", "jwt_manager", ".", "init_app", "(", "app", ")", "jwt_manager", ".", "user_loader_callback_loader", "(", "self", ".", "load_user", "...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.oauth_user_info_getter
Decorator function to be the OAuth user info getter for all the providers, receives provider and response return a dict with the information returned from the provider. The returned user info dict should have it's keys with the same name as the User Model. Us...
flask_appbuilder/security/manager.py
def oauth_user_info_getter(self, f): """ Decorator function to be the OAuth user info getter for all the providers, receives provider and response return a dict with the information returned from the provider. The returned user info dict should have it's keys with...
def oauth_user_info_getter(self, f): """ Decorator function to be the OAuth user info getter for all the providers, receives provider and response return a dict with the information returned from the provider. The returned user info dict should have it's keys with...
[ "Decorator", "function", "to", "be", "the", "OAuth", "user", "info", "getter", "for", "all", "the", "providers", "receives", "provider", "and", "response", "return", "a", "dict", "with", "the", "information", "returned", "from", "the", "provider", ".", "The", ...
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L412-L445
[ "def", "oauth_user_info_getter", "(", "self", ",", "f", ")", ":", "def", "wraps", "(", "provider", ",", "response", "=", "None", ")", ":", "ret", "=", "f", "(", "self", ",", "provider", ",", "response", "=", "response", ")", "# Checks if decorator is well ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.get_oauth_token_key_name
Returns the token_key name for the oauth provider if none is configured defaults to oauth_token this is configured using OAUTH_PROVIDERS and token_key key.
flask_appbuilder/security/manager.py
def get_oauth_token_key_name(self, provider): """ Returns the token_key name for the oauth provider if none is configured defaults to oauth_token this is configured using OAUTH_PROVIDERS and token_key key. """ for _provider in self.oauth_providers: ...
def get_oauth_token_key_name(self, provider): """ Returns the token_key name for the oauth provider if none is configured defaults to oauth_token this is configured using OAUTH_PROVIDERS and token_key key. """ for _provider in self.oauth_providers: ...
[ "Returns", "the", "token_key", "name", "for", "the", "oauth", "provider", "if", "none", "is", "configured", "defaults", "to", "oauth_token", "this", "is", "configured", "using", "OAUTH_PROVIDERS", "and", "token_key", "key", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L447-L455
[ "def", "get_oauth_token_key_name", "(", "self", ",", "provider", ")", ":", "for", "_provider", "in", "self", ".", "oauth_providers", ":", "if", "_provider", "[", "\"name\"", "]", "==", "provider", ":", "return", "_provider", ".", "get", "(", "\"token_key\"", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.get_oauth_token_secret_name
Returns the token_secret name for the oauth provider if none is configured defaults to oauth_secret this is configured using OAUTH_PROVIDERS and token_secret
flask_appbuilder/security/manager.py
def get_oauth_token_secret_name(self, provider): """ Returns the token_secret name for the oauth provider if none is configured defaults to oauth_secret this is configured using OAUTH_PROVIDERS and token_secret """ for _provider in self.oauth_providers: ...
def get_oauth_token_secret_name(self, provider): """ Returns the token_secret name for the oauth provider if none is configured defaults to oauth_secret this is configured using OAUTH_PROVIDERS and token_secret """ for _provider in self.oauth_providers: ...
[ "Returns", "the", "token_secret", "name", "for", "the", "oauth", "provider", "if", "none", "is", "configured", "defaults", "to", "oauth_secret", "this", "is", "configured", "using", "OAUTH_PROVIDERS", "and", "token_secret" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L457-L465
[ "def", "get_oauth_token_secret_name", "(", "self", ",", "provider", ")", ":", "for", "_provider", "in", "self", ".", "oauth_providers", ":", "if", "_provider", "[", "\"name\"", "]", "==", "provider", ":", "return", "_provider", ".", "get", "(", "\"token_secret...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.set_oauth_session
Set the current session with OAuth user secrets
flask_appbuilder/security/manager.py
def set_oauth_session(self, provider, oauth_response): """ Set the current session with OAuth user secrets """ # Get this provider key names for token_key and token_secret token_key = self.appbuilder.sm.get_oauth_token_key_name(provider) token_secret = self.appbuilder...
def set_oauth_session(self, provider, oauth_response): """ Set the current session with OAuth user secrets """ # Get this provider key names for token_key and token_secret token_key = self.appbuilder.sm.get_oauth_token_key_name(provider) token_secret = self.appbuilder...
[ "Set", "the", "current", "session", "with", "OAuth", "user", "secrets" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L467-L479
[ "def", "set_oauth_session", "(", "self", ",", "provider", ",", "oauth_response", ")", ":", "# Get this provider key names for token_key and token_secret", "token_key", "=", "self", ".", "appbuilder", ".", "sm", ".", "get_oauth_token_key_name", "(", "provider", ")", "tok...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.get_oauth_user_info
Since there are different OAuth API's with different ways to retrieve user info
flask_appbuilder/security/manager.py
def get_oauth_user_info(self, provider, resp): """ Since there are different OAuth API's with different ways to retrieve user info """ # for GITHUB if provider == "github" or provider == "githublocal": me = self.appbuilder.sm.oauth_remotes[provider].ge...
def get_oauth_user_info(self, provider, resp): """ Since there are different OAuth API's with different ways to retrieve user info """ # for GITHUB if provider == "github" or provider == "githublocal": me = self.appbuilder.sm.oauth_remotes[provider].ge...
[ "Since", "there", "are", "different", "OAuth", "API", "s", "with", "different", "ways", "to", "retrieve", "user", "info" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L481-L538
[ "def", "get_oauth_user_info", "(", "self", ",", "provider", ",", "resp", ")", ":", "# for GITHUB", "if", "provider", "==", "\"github\"", "or", "provider", "==", "\"githublocal\"", ":", "me", "=", "self", ".", "appbuilder", ".", "sm", ".", "oauth_remotes", "[...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.create_db
Setups the DB, creates admin and public roles if they don't exist.
flask_appbuilder/security/manager.py
def create_db(self): """ Setups the DB, creates admin and public roles if they don't exist. """ self.add_role(self.auth_role_admin) self.add_role(self.auth_role_public) if self.count_users() == 0: log.warning(LOGMSG_WAR_SEC_NO_USER)
def create_db(self): """ Setups the DB, creates admin and public roles if they don't exist. """ self.add_role(self.auth_role_admin) self.add_role(self.auth_role_public) if self.count_users() == 0: log.warning(LOGMSG_WAR_SEC_NO_USER)
[ "Setups", "the", "DB", "creates", "admin", "and", "public", "roles", "if", "they", "don", "t", "exist", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L671-L678
[ "def", "create_db", "(", "self", ")", ":", "self", ".", "add_role", "(", "self", ".", "auth_role_admin", ")", "self", ".", "add_role", "(", "self", ".", "auth_role_public", ")", "if", "self", ".", "count_users", "(", ")", "==", "0", ":", "log", ".", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.reset_password
Change/Reset a user's password for authdb. Password will be hashed and saved. :param userid: the user.id to reset the password :param password: The clear text password to reset and save hashed on the db
flask_appbuilder/security/manager.py
def reset_password(self, userid, password): """ Change/Reset a user's password for authdb. Password will be hashed and saved. :param userid: the user.id to reset the password :param password: The clear text password to reset and sa...
def reset_password(self, userid, password): """ Change/Reset a user's password for authdb. Password will be hashed and saved. :param userid: the user.id to reset the password :param password: The clear text password to reset and sa...
[ "Change", "/", "Reset", "a", "user", "s", "password", "for", "authdb", ".", "Password", "will", "be", "hashed", "and", "saved", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L680-L692
[ "def", "reset_password", "(", "self", ",", "userid", ",", "password", ")", ":", "user", "=", "self", ".", "get_user_by_id", "(", "userid", ")", "user", ".", "password", "=", "generate_password_hash", "(", "password", ")", "self", ".", "update_user", "(", "...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.update_user_auth_stat
Update authentication successful to user. :param user: The authenticated user model :param success: Default to true, if false increments fail_login_count on user model
flask_appbuilder/security/manager.py
def update_user_auth_stat(self, user, success=True): """ Update authentication successful to user. :param user: The authenticated user model :param success: Default to true, if false increments fail_login_count on user model """ ...
def update_user_auth_stat(self, user, success=True): """ Update authentication successful to user. :param user: The authenticated user model :param success: Default to true, if false increments fail_login_count on user model """ ...
[ "Update", "authentication", "successful", "to", "user", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L694-L713
[ "def", "update_user_auth_stat", "(", "self", ",", "user", ",", "success", "=", "True", ")", ":", "if", "not", "user", ".", "login_count", ":", "user", ".", "login_count", "=", "0", "if", "not", "user", ".", "fail_login_count", ":", "user", ".", "fail_log...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.auth_user_db
Method for authenticating user, auth db style :param username: The username or registered email address :param password: The password, will be tested against hashed password on db
flask_appbuilder/security/manager.py
def auth_user_db(self, username, password): """ Method for authenticating user, auth db style :param username: The username or registered email address :param password: The password, will be tested against hashed password on db """ ...
def auth_user_db(self, username, password): """ Method for authenticating user, auth db style :param username: The username or registered email address :param password: The password, will be tested against hashed password on db """ ...
[ "Method", "for", "authenticating", "user", "auth", "db", "style" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L715-L738
[ "def", "auth_user_db", "(", "self", ",", "username", ",", "password", ")", ":", "if", "username", "is", "None", "or", "username", "==", "\"\"", ":", "return", "None", "user", "=", "self", ".", "find_user", "(", "username", "=", "username", ")", "if", "...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager._search_ldap
Searches LDAP for user, assumes ldap_search is set. :param ldap: The ldap module reference :param con: The ldap connection :param username: username to match with auth_ldap_uid_field :return: ldap object array
flask_appbuilder/security/manager.py
def _search_ldap(self, ldap, con, username): """ Searches LDAP for user, assumes ldap_search is set. :param ldap: The ldap module reference :param con: The ldap connection :param username: username to match with auth_ldap_uid_field :return: ldap objec...
def _search_ldap(self, ldap, con, username): """ Searches LDAP for user, assumes ldap_search is set. :param ldap: The ldap module reference :param con: The ldap connection :param username: username to match with auth_ldap_uid_field :return: ldap objec...
[ "Searches", "LDAP", "for", "user", "assumes", "ldap_search", "is", "set", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L740-L772
[ "def", "_search_ldap", "(", "self", ",", "ldap", ",", "con", ",", "username", ")", ":", "if", "self", ".", "auth_ldap_append_domain", ":", "username", "=", "username", "+", "\"@\"", "+", "self", ".", "auth_ldap_append_domain", "if", "self", ".", "auth_ldap_s...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager._bind_indirect_user
If using AUTH_LDAP_BIND_USER bind this user before performing search :param ldap: The ldap module reference :param con: The ldap connection
flask_appbuilder/security/manager.py
def _bind_indirect_user(self, ldap, con): """ If using AUTH_LDAP_BIND_USER bind this user before performing search :param ldap: The ldap module reference :param con: The ldap connection """ indirect_user = self.auth_ldap_bind_user if indirect_user: ...
def _bind_indirect_user(self, ldap, con): """ If using AUTH_LDAP_BIND_USER bind this user before performing search :param ldap: The ldap module reference :param con: The ldap connection """ indirect_user = self.auth_ldap_bind_user if indirect_user: ...
[ "If", "using", "AUTH_LDAP_BIND_USER", "bind", "this", "user", "before", "performing", "search", ":", "param", "ldap", ":", "The", "ldap", "module", "reference", ":", "param", "con", ":", "The", "ldap", "connection" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L774-L785
[ "def", "_bind_indirect_user", "(", "self", ",", "ldap", ",", "con", ")", ":", "indirect_user", "=", "self", ".", "auth_ldap_bind_user", "if", "indirect_user", ":", "indirect_password", "=", "self", ".", "auth_ldap_bind_password", "log", ".", "debug", "(", "\"LDA...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager._bind_ldap
Private to bind/Authenticate a user. If AUTH_LDAP_BIND_USER exists then it will bind first with it, next will search the LDAP server using the username with UID and try to bind to it (OpenLDAP). If AUTH_LDAP_BIND_USER does not exit, will bind with username/password
flask_appbuilder/security/manager.py
def _bind_ldap(self, ldap, con, username, password): """ Private to bind/Authenticate a user. If AUTH_LDAP_BIND_USER exists then it will bind first with it, next will search the LDAP server using the username with UID and try to bind to it (OpenLDAP). ...
def _bind_ldap(self, ldap, con, username, password): """ Private to bind/Authenticate a user. If AUTH_LDAP_BIND_USER exists then it will bind first with it, next will search the LDAP server using the username with UID and try to bind to it (OpenLDAP). ...
[ "Private", "to", "bind", "/", "Authenticate", "a", "user", ".", "If", "AUTH_LDAP_BIND_USER", "exists", "then", "it", "will", "bind", "first", "with", "it", "next", "will", "search", "the", "LDAP", "server", "using", "the", "username", "with", "UID", "and", ...
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L787-L814
[ "def", "_bind_ldap", "(", "self", ",", "ldap", ",", "con", ",", "username", ",", "password", ")", ":", "try", ":", "if", "self", ".", "auth_ldap_bind_user", ":", "self", ".", "_bind_indirect_user", "(", "ldap", ",", "con", ")", "user", "=", "self", "."...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.auth_user_ldap
Method for authenticating user, auth LDAP style. depends on ldap module that is not mandatory requirement for F.A.B. :param username: The username :param password: The password
flask_appbuilder/security/manager.py
def auth_user_ldap(self, username, password): """ Method for authenticating user, auth LDAP style. depends on ldap module that is not mandatory requirement for F.A.B. :param username: The username :param password: The p...
def auth_user_ldap(self, username, password): """ Method for authenticating user, auth LDAP style. depends on ldap module that is not mandatory requirement for F.A.B. :param username: The username :param password: The p...
[ "Method", "for", "authenticating", "user", "auth", "LDAP", "style", ".", "depends", "on", "ldap", "module", "that", "is", "not", "mandatory", "requirement", "for", "F", ".", "A", ".", "B", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L822-L916
[ "def", "auth_user_ldap", "(", "self", ",", "username", ",", "password", ")", ":", "if", "username", "is", "None", "or", "username", "==", "\"\"", ":", "return", "None", "user", "=", "self", ".", "find_user", "(", "username", "=", "username", ")", "if", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.auth_user_oid
OpenID user Authentication :param email: user's email to authenticate :type self: User model
flask_appbuilder/security/manager.py
def auth_user_oid(self, email): """ OpenID user Authentication :param email: user's email to authenticate :type self: User model """ user = self.find_user(email=email) if user is None or (not user.is_active): log.info(LOGMSG_WAR_SEC_LOGIN_...
def auth_user_oid(self, email): """ OpenID user Authentication :param email: user's email to authenticate :type self: User model """ user = self.find_user(email=email) if user is None or (not user.is_active): log.info(LOGMSG_WAR_SEC_LOGIN_...
[ "OpenID", "user", "Authentication" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L918-L931
[ "def", "auth_user_oid", "(", "self", ",", "email", ")", ":", "user", "=", "self", ".", "find_user", "(", "email", "=", "email", ")", "if", "user", "is", "None", "or", "(", "not", "user", ".", "is_active", ")", ":", "log", ".", "info", "(", "LOGMSG_...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.auth_user_remote_user
REMOTE_USER user Authentication :param username: user's username for remote auth :type self: User model
flask_appbuilder/security/manager.py
def auth_user_remote_user(self, username): """ REMOTE_USER user Authentication :param username: user's username for remote auth :type self: User model """ user = self.find_user(username=username) # User does not exist, create one if auto user registr...
def auth_user_remote_user(self, username): """ REMOTE_USER user Authentication :param username: user's username for remote auth :type self: User model """ user = self.find_user(username=username) # User does not exist, create one if auto user registr...
[ "REMOTE_USER", "user", "Authentication" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L933-L961
[ "def", "auth_user_remote_user", "(", "self", ",", "username", ")", ":", "user", "=", "self", ".", "find_user", "(", "username", "=", "username", ")", "# User does not exist, create one if auto user registration.", "if", "user", "is", "None", "and", "self", ".", "a...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.auth_user_oauth
OAuth user Authentication :userinfo: dict with user information the keys have the same name as User model columns.
flask_appbuilder/security/manager.py
def auth_user_oauth(self, userinfo): """ OAuth user Authentication :userinfo: dict with user information the keys have the same name as User model columns. """ if "username" in userinfo: user = self.find_user(username=userinfo["username"]) ...
def auth_user_oauth(self, userinfo): """ OAuth user Authentication :userinfo: dict with user information the keys have the same name as User model columns. """ if "username" in userinfo: user = self.find_user(username=userinfo["username"]) ...
[ "OAuth", "user", "Authentication" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L963-L997
[ "def", "auth_user_oauth", "(", "self", ",", "userinfo", ")", ":", "if", "\"username\"", "in", "userinfo", ":", "user", "=", "self", ".", "find_user", "(", "username", "=", "userinfo", "[", "\"username\"", "]", ")", "elif", "\"email\"", "in", "userinfo", ":...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.is_item_public
Check if view has public permissions :param permission_name: the permission: can_show, can_edit... :param view_name: the name of the class view (child of BaseView)
flask_appbuilder/security/manager.py
def is_item_public(self, permission_name, view_name): """ Check if view has public permissions :param permission_name: the permission: can_show, can_edit... :param view_name: the name of the class view (child of BaseView) """ p...
def is_item_public(self, permission_name, view_name): """ Check if view has public permissions :param permission_name: the permission: can_show, can_edit... :param view_name: the name of the class view (child of BaseView) """ p...
[ "Check", "if", "view", "has", "public", "permissions" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L1005-L1023
[ "def", "is_item_public", "(", "self", ",", "permission_name", ",", "view_name", ")", ":", "permissions", "=", "self", ".", "get_public_permissions", "(", ")", "if", "permissions", ":", "for", "i", "in", "permissions", ":", "if", "(", "view_name", "==", "i", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.has_access
Check if current user or public has access to view or menu
flask_appbuilder/security/manager.py
def has_access(self, permission_name, view_name): """ Check if current user or public has access to view or menu """ if current_user.is_authenticated: return self._has_view_access(g.user, permission_name, view_name) elif current_user_jwt: return self._...
def has_access(self, permission_name, view_name): """ Check if current user or public has access to view or menu """ if current_user.is_authenticated: return self._has_view_access(g.user, permission_name, view_name) elif current_user_jwt: return self._...
[ "Check", "if", "current", "user", "or", "public", "has", "access", "to", "view", "or", "menu" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L1037-L1046
[ "def", "has_access", "(", "self", ",", "permission_name", ",", "view_name", ")", ":", "if", "current_user", ".", "is_authenticated", ":", "return", "self", ".", "_has_view_access", "(", "g", ".", "user", ",", "permission_name", ",", "view_name", ")", "elif", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.get_user_permissions_on_view
Returns all current user permissions on a certain view/resource :param view_name: The name of the view/resource/menu :return: (list) with permissions
flask_appbuilder/security/manager.py
def get_user_permissions_on_view(view_name): """ Returns all current user permissions on a certain view/resource :param view_name: The name of the view/resource/menu :return: (list) with permissions """ _ret = list() if current_user.is_authenticat...
def get_user_permissions_on_view(view_name): """ Returns all current user permissions on a certain view/resource :param view_name: The name of the view/resource/menu :return: (list) with permissions """ _ret = list() if current_user.is_authenticat...
[ "Returns", "all", "current", "user", "permissions", "on", "a", "certain", "view", "/", "resource", ":", "param", "view_name", ":", "The", "name", "of", "the", "view", "/", "resource", "/", "menu", ":", "return", ":", "(", "list", ")", "with", "permission...
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L1049-L1068
[ "def", "get_user_permissions_on_view", "(", "view_name", ")", ":", "_ret", "=", "list", "(", ")", "if", "current_user", ".", "is_authenticated", ":", "_current_user", "=", "current_user", "elif", "current_user_jwt", ":", "_current_user", "=", "current_user_jwt", "el...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.add_permissions_view
Adds a permission on a view menu to the backend :param base_permissions: list of permissions from view (all exposed methods): 'can_add','can_edit' etc... :param view_menu: name of the view or menu to add
flask_appbuilder/security/manager.py
def add_permissions_view(self, base_permissions, view_menu): """ Adds a permission on a view menu to the backend :param base_permissions: list of permissions from view (all exposed methods): 'can_add','can_edit' etc... :param view_menu: ...
def add_permissions_view(self, base_permissions, view_menu): """ Adds a permission on a view menu to the backend :param base_permissions: list of permissions from view (all exposed methods): 'can_add','can_edit' etc... :param view_menu: ...
[ "Adds", "a", "permission", "on", "a", "view", "menu", "to", "the", "backend" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L1070-L1108
[ "def", "add_permissions_view", "(", "self", ",", "base_permissions", ",", "view_menu", ")", ":", "view_menu_db", "=", "self", ".", "add_view_menu", "(", "view_menu", ")", "perm_views", "=", "self", ".", "find_permissions_view_menu", "(", "view_menu_db", ")", "if",...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.add_permissions_menu
Adds menu_access to menu on permission_view_menu :param view_menu_name: The menu name
flask_appbuilder/security/manager.py
def add_permissions_menu(self, view_menu_name): """ Adds menu_access to menu on permission_view_menu :param view_menu_name: The menu name """ self.add_view_menu(view_menu_name) pv = self.find_permission_view_menu("menu_access", view_menu_name) ...
def add_permissions_menu(self, view_menu_name): """ Adds menu_access to menu on permission_view_menu :param view_menu_name: The menu name """ self.add_view_menu(view_menu_name) pv = self.find_permission_view_menu("menu_access", view_menu_name) ...
[ "Adds", "menu_access", "to", "menu", "on", "permission_view_menu" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L1110-L1122
[ "def", "add_permissions_menu", "(", "self", ",", "view_menu_name", ")", ":", "self", ".", "add_view_menu", "(", "view_menu_name", ")", "pv", "=", "self", ".", "find_permission_view_menu", "(", "\"menu_access\"", ",", "view_menu_name", ")", "if", "not", "pv", ":"...
c293734c1b86e176a3ba57ee2deab6676d125576
train
BaseSecurityManager.security_cleanup
Will cleanup all unused permissions from the database :param baseviews: A list of BaseViews class :param menus: Menu class
flask_appbuilder/security/manager.py
def security_cleanup(self, baseviews, menus): """ Will cleanup all unused permissions from the database :param baseviews: A list of BaseViews class :param menus: Menu class """ viewsmenus = self.get_all_view_menu() roles = self.get_all_roles() ...
def security_cleanup(self, baseviews, menus): """ Will cleanup all unused permissions from the database :param baseviews: A list of BaseViews class :param menus: Menu class """ viewsmenus = self.get_all_view_menu() roles = self.get_all_roles() ...
[ "Will", "cleanup", "all", "unused", "permissions", "from", "the", "database" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/manager.py#L1124-L1149
[ "def", "security_cleanup", "(", "self", ",", "baseviews", ",", "menus", ")", ":", "viewsmenus", "=", "self", ".", "get_all_view_menu", "(", ")", "roles", "=", "self", ".", "get_all_roles", "(", ")", "for", "viewmenu", "in", "viewsmenus", ":", "found", "=",...
c293734c1b86e176a3ba57ee2deab6676d125576
train
ExampleApi.greeting2
Send a greeting --- get: responses: 200: description: Greet the user content: application/json: schema: type: object properties: message: ...
examples/base_api/app/api.py
def greeting2(self): """Send a greeting --- get: responses: 200: description: Greet the user content: application/json: schema: type: object properties: ...
def greeting2(self): """Send a greeting --- get: responses: 200: description: Greet the user content: application/json: schema: type: object properties: ...
[ "Send", "a", "greeting", "---", "get", ":", "responses", ":", "200", ":", "description", ":", "Greet", "the", "user", "content", ":", "application", "/", "json", ":", "schema", ":", "type", ":", "object", "properties", ":", "message", ":", "type", ":", ...
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/examples/base_api/app/api.py#L34-L62
[ "def", "greeting2", "(", "self", ")", ":", "if", "request", ".", "method", "==", "\"GET\"", ":", "return", "self", ".", "response", "(", "200", ",", "message", "=", "\"Hello (GET)\"", ")", "return", "self", ".", "response", "(", "201", ",", "message", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
Filters.rest_add_filters
Adds list of dicts :param data: list of dicts :return:
flask_appbuilder/models/filters.py
def rest_add_filters(self, data): """ Adds list of dicts :param data: list of dicts :return: """ for _filter in data: filter_class = map_args_filter.get(_filter["opr"], None) if filter_class: self.add_filter(_filter["col"], fil...
def rest_add_filters(self, data): """ Adds list of dicts :param data: list of dicts :return: """ for _filter in data: filter_class = map_args_filter.get(_filter["opr"], None) if filter_class: self.add_filter(_filter["col"], fil...
[ "Adds", "list", "of", "dicts" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/models/filters.py#L158-L168
[ "def", "rest_add_filters", "(", "self", ",", "data", ")", ":", "for", "_filter", "in", "data", ":", "filter_class", "=", "map_args_filter", ".", "get", "(", "_filter", "[", "\"opr\"", "]", ",", "None", ")", "if", "filter_class", ":", "self", ".", "add_fi...
c293734c1b86e176a3ba57ee2deab6676d125576
train
Filters.get_joined_filters
Creates a new filters class with active filters joined
flask_appbuilder/models/filters.py
def get_joined_filters(self, filters): """ Creates a new filters class with active filters joined """ retfilters = Filters(self.filter_converter, self.datamodel) retfilters.filters = self.filters + filters.filters retfilters.values = self.values + filters.values ...
def get_joined_filters(self, filters): """ Creates a new filters class with active filters joined """ retfilters = Filters(self.filter_converter, self.datamodel) retfilters.filters = self.filters + filters.filters retfilters.values = self.values + filters.values ...
[ "Creates", "a", "new", "filters", "class", "with", "active", "filters", "joined" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/models/filters.py#L184-L191
[ "def", "get_joined_filters", "(", "self", ",", "filters", ")", ":", "retfilters", "=", "Filters", "(", "self", ".", "filter_converter", ",", "self", ".", "datamodel", ")", "retfilters", ".", "filters", "=", "self", ".", "filters", "+", "filters", ".", "fil...
c293734c1b86e176a3ba57ee2deab6676d125576
train
Filters.copy
Returns a copy of this object :return: A copy of self
flask_appbuilder/models/filters.py
def copy(self): """ Returns a copy of this object :return: A copy of self """ retfilters = Filters(self.filter_converter, self.datamodel) retfilters.filters = copy.copy(self.filters) retfilters.values = copy.copy(self.values) return retfilters
def copy(self): """ Returns a copy of this object :return: A copy of self """ retfilters = Filters(self.filter_converter, self.datamodel) retfilters.filters = copy.copy(self.filters) retfilters.values = copy.copy(self.values) return retfilters
[ "Returns", "a", "copy", "of", "this", "object" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/models/filters.py#L193-L202
[ "def", "copy", "(", "self", ")", ":", "retfilters", "=", "Filters", "(", "self", ".", "filter_converter", ",", "self", ".", "datamodel", ")", "retfilters", ".", "filters", "=", "copy", ".", "copy", "(", "self", ".", "filters", ")", "retfilters", ".", "...
c293734c1b86e176a3ba57ee2deab6676d125576
train
Filters.get_relation_cols
Returns the filter active FilterRelation cols
flask_appbuilder/models/filters.py
def get_relation_cols(self): """ Returns the filter active FilterRelation cols """ retlst = [] for flt, value in zip(self.filters, self.values): if isinstance(flt, FilterRelation) and value: retlst.append(flt.column_name) return retlst
def get_relation_cols(self): """ Returns the filter active FilterRelation cols """ retlst = [] for flt, value in zip(self.filters, self.values): if isinstance(flt, FilterRelation) and value: retlst.append(flt.column_name) return retlst
[ "Returns", "the", "filter", "active", "FilterRelation", "cols" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/models/filters.py#L204-L212
[ "def", "get_relation_cols", "(", "self", ")", ":", "retlst", "=", "[", "]", "for", "flt", ",", "value", "in", "zip", "(", "self", ".", "filters", ",", "self", ".", "values", ")", ":", "if", "isinstance", "(", "flt", ",", "FilterRelation", ")", "and",...
c293734c1b86e176a3ba57ee2deab6676d125576
train
Filters.get_filters_values
Returns a list of tuples [(FILTER, value),(...,...),....]
flask_appbuilder/models/filters.py
def get_filters_values(self): """ Returns a list of tuples [(FILTER, value),(...,...),....] """ return [(flt, value) for flt, value in zip(self.filters, self.values)]
def get_filters_values(self): """ Returns a list of tuples [(FILTER, value),(...,...),....] """ return [(flt, value) for flt, value in zip(self.filters, self.values)]
[ "Returns", "a", "list", "of", "tuples", "[", "(", "FILTER", "value", ")", "(", "...", "...", ")", "....", "]" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/models/filters.py#L214-L218
[ "def", "get_filters_values", "(", "self", ")", ":", "return", "[", "(", "flt", ",", "value", ")", "for", "flt", ",", "value", "in", "zip", "(", "self", ".", "filters", ",", "self", ".", "values", ")", "]" ]
c293734c1b86e176a3ba57ee2deab6676d125576
train
Filters.get_filter_value
Returns the filtered value for a certain column :param column_name: The name of the column that we want the value from :return: the filter value of the column
flask_appbuilder/models/filters.py
def get_filter_value(self, column_name): """ Returns the filtered value for a certain column :param column_name: The name of the column that we want the value from :return: the filter value of the column """ for flt, value in zip(self.filters, self.values): ...
def get_filter_value(self, column_name): """ Returns the filtered value for a certain column :param column_name: The name of the column that we want the value from :return: the filter value of the column """ for flt, value in zip(self.filters, self.values): ...
[ "Returns", "the", "filtered", "value", "for", "a", "certain", "column" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/models/filters.py#L220-L229
[ "def", "get_filter_value", "(", "self", ",", "column_name", ")", ":", "for", "flt", ",", "value", "in", "zip", "(", "self", ".", "filters", ",", "self", ".", "values", ")", ":", "if", "flt", ".", "column_name", "==", "column_name", ":", "return", "valu...
c293734c1b86e176a3ba57ee2deab6676d125576
train
Menu.find
Finds a menu item by name and returns it. :param name: The menu item name.
flask_appbuilder/menu.py
def find(self, name, menu=None): """ Finds a menu item by name and returns it. :param name: The menu item name. """ menu = menu or self.menu for i in menu: if i.name == name: return i else: i...
def find(self, name, menu=None): """ Finds a menu item by name and returns it. :param name: The menu item name. """ menu = menu or self.menu for i in menu: if i.name == name: return i else: i...
[ "Finds", "a", "menu", "item", "by", "name", "and", "returns", "it", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/menu.py#L57-L72
[ "def", "find", "(", "self", ",", "name", ",", "menu", "=", "None", ")", ":", "menu", "=", "menu", "or", "self", ".", "menu", "for", "i", "in", "menu", ":", "if", "i", ".", "name", "==", "name", ":", "return", "i", "else", ":", "if", "i", ".",...
c293734c1b86e176a3ba57ee2deab6676d125576
train
create_db
Create all your database objects (SQLAlchemy specific).
flask_appbuilder/cli.py
def create_db(): """ Create all your database objects (SQLAlchemy specific). """ from flask_appbuilder.models.sqla import Model engine = current_app.appbuilder.get_session.get_bind(mapper=None, clause=None) Model.metadata.create_all(engine) click.echo(click.style("DB objects created", f...
def create_db(): """ Create all your database objects (SQLAlchemy specific). """ from flask_appbuilder.models.sqla import Model engine = current_app.appbuilder.get_session.get_bind(mapper=None, clause=None) Model.metadata.create_all(engine) click.echo(click.style("DB objects created", f...
[ "Create", "all", "your", "database", "objects", "(", "SQLAlchemy", "specific", ")", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/cli.py#L100-L108
[ "def", "create_db", "(", ")", ":", "from", "flask_appbuilder", ".", "models", ".", "sqla", "import", "Model", "engine", "=", "current_app", ".", "appbuilder", ".", "get_session", ".", "get_bind", "(", "mapper", "=", "None", ",", "clause", "=", "None", ")",...
c293734c1b86e176a3ba57ee2deab6676d125576
train
version
Flask-AppBuilder package version
flask_appbuilder/cli.py
def version(): """ Flask-AppBuilder package version """ click.echo( click.style( "F.A.B Version: {0}.".format(current_app.appbuilder.version), bg="blue", fg="white" ) )
def version(): """ Flask-AppBuilder package version """ click.echo( click.style( "F.A.B Version: {0}.".format(current_app.appbuilder.version), bg="blue", fg="white" ) )
[ "Flask", "-", "AppBuilder", "package", "version" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/cli.py#L113-L123
[ "def", "version", "(", ")", ":", "click", ".", "echo", "(", "click", ".", "style", "(", "\"F.A.B Version: {0}.\"", ".", "format", "(", "current_app", ".", "appbuilder", ".", "version", ")", ",", "bg", "=", "\"blue\"", ",", "fg", "=", "\"white\"", ")", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
create_permissions
Creates all permissions and add them to the ADMIN Role.
flask_appbuilder/cli.py
def create_permissions(): """ Creates all permissions and add them to the ADMIN Role. """ current_app.appbuilder.add_permissions(update_perms=True) click.echo(click.style("Created all permissions", fg="green"))
def create_permissions(): """ Creates all permissions and add them to the ADMIN Role. """ current_app.appbuilder.add_permissions(update_perms=True) click.echo(click.style("Created all permissions", fg="green"))
[ "Creates", "all", "permissions", "and", "add", "them", "to", "the", "ADMIN", "Role", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/cli.py#L138-L143
[ "def", "create_permissions", "(", ")", ":", "current_app", ".", "appbuilder", ".", "add_permissions", "(", "update_perms", "=", "True", ")", "click", ".", "echo", "(", "click", ".", "style", "(", "\"Created all permissions\"", ",", "fg", "=", "\"green\"", ")",...
c293734c1b86e176a3ba57ee2deab6676d125576
train
list_views
List all registered views
flask_appbuilder/cli.py
def list_views(): """ List all registered views """ echo_header("List of registered views") for view in current_app.appbuilder.baseviews: click.echo( "View:{0} | Route:{1} | Perms:{2}".format( view.__class__.__name__, view.route_base, view.base_permissions ...
def list_views(): """ List all registered views """ echo_header("List of registered views") for view in current_app.appbuilder.baseviews: click.echo( "View:{0} | Route:{1} | Perms:{2}".format( view.__class__.__name__, view.route_base, view.base_permissions ...
[ "List", "all", "registered", "views" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/cli.py#L148-L158
[ "def", "list_views", "(", ")", ":", "echo_header", "(", "\"List of registered views\"", ")", "for", "view", "in", "current_app", ".", "appbuilder", ".", "baseviews", ":", "click", ".", "echo", "(", "\"View:{0} | Route:{1} | Perms:{2}\"", ".", "format", "(", "view"...
c293734c1b86e176a3ba57ee2deab6676d125576
train
list_users
List all users on the database
flask_appbuilder/cli.py
def list_users(): """ List all users on the database """ echo_header("List of users") for user in current_app.appbuilder.sm.get_all_users(): click.echo( "username:{0} | email:{1} | role:{2}".format( user.username, user.email, user.roles ) )
def list_users(): """ List all users on the database """ echo_header("List of users") for user in current_app.appbuilder.sm.get_all_users(): click.echo( "username:{0} | email:{1} | role:{2}".format( user.username, user.email, user.roles ) )
[ "List", "all", "users", "on", "the", "database" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/cli.py#L163-L173
[ "def", "list_users", "(", ")", ":", "echo_header", "(", "\"List of users\"", ")", "for", "user", "in", "current_app", ".", "appbuilder", ".", "sm", ".", "get_all_users", "(", ")", ":", "click", ".", "echo", "(", "\"username:{0} | email:{1} | role:{2}\"", ".", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
create_app
Create a Skeleton application (needs internet connection to github)
flask_appbuilder/cli.py
def create_app(name, engine): """ Create a Skeleton application (needs internet connection to github) """ try: if engine.lower() == "sqlalchemy": url = urlopen(SQLA_REPO_URL) dirname = "Flask-AppBuilder-Skeleton-master" elif engine.lower() == "mongoengine": ...
def create_app(name, engine): """ Create a Skeleton application (needs internet connection to github) """ try: if engine.lower() == "sqlalchemy": url = urlopen(SQLA_REPO_URL) dirname = "Flask-AppBuilder-Skeleton-master" elif engine.lower() == "mongoengine": ...
[ "Create", "a", "Skeleton", "application", "(", "needs", "internet", "connection", "to", "github", ")" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/cli.py#L189-L219
[ "def", "create_app", "(", "name", ",", "engine", ")", ":", "try", ":", "if", "engine", ".", "lower", "(", ")", "==", "\"sqlalchemy\"", ":", "url", "=", "urlopen", "(", "SQLA_REPO_URL", ")", "dirname", "=", "\"Flask-AppBuilder-Skeleton-master\"", "elif", "eng...
c293734c1b86e176a3ba57ee2deab6676d125576
train
create_addon
Create a Skeleton AddOn (needs internet connection to github)
flask_appbuilder/cli.py
def create_addon(name): """ Create a Skeleton AddOn (needs internet connection to github) """ try: full_name = "fab_addon_" + name dirname = "Flask-AppBuilder-Skeleton-AddOn-master" url = urlopen(ADDON_REPO_URL) zipfile = ZipFile(BytesIO(url.read())) zipfile.e...
def create_addon(name): """ Create a Skeleton AddOn (needs internet connection to github) """ try: full_name = "fab_addon_" + name dirname = "Flask-AppBuilder-Skeleton-AddOn-master" url = urlopen(ADDON_REPO_URL) zipfile = ZipFile(BytesIO(url.read())) zipfile.e...
[ "Create", "a", "Skeleton", "AddOn", "(", "needs", "internet", "connection", "to", "github", ")" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/cli.py#L228-L251
[ "def", "create_addon", "(", "name", ")", ":", "try", ":", "full_name", "=", "\"fab_addon_\"", "+", "name", "dirname", "=", "\"Flask-AppBuilder-Skeleton-AddOn-master\"", "url", "=", "urlopen", "(", "ADDON_REPO_URL", ")", "zipfile", "=", "ZipFile", "(", "BytesIO", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
babel_extract
Babel, Extracts and updates all messages marked for translation
flask_appbuilder/cli.py
def babel_extract(config, input, output, target, keywords): """ Babel, Extracts and updates all messages marked for translation """ click.echo( click.style( "Starting Extractions config:{0} input:{1} output:{2} keywords:{3}".format( config, input, output, keywords...
def babel_extract(config, input, output, target, keywords): """ Babel, Extracts and updates all messages marked for translation """ click.echo( click.style( "Starting Extractions config:{0} input:{1} output:{2} keywords:{3}".format( config, input, output, keywords...
[ "Babel", "Extracts", "and", "updates", "all", "messages", "marked", "for", "translation" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/cli.py#L295-L315
[ "def", "babel_extract", "(", "config", ",", "input", ",", "output", ",", "target", ",", "keywords", ")", ":", "click", ".", "echo", "(", "click", ".", "style", "(", "\"Starting Extractions config:{0} input:{1} output:{2} keywords:{3}\"", ".", "format", "(", "confi...
c293734c1b86e176a3ba57ee2deab6676d125576
train
babel_compile
Babel, Compiles all translations
flask_appbuilder/cli.py
def babel_compile(target): """ Babel, Compiles all translations """ click.echo(click.style("Starting Compile target:{0}".format(target), fg="green")) os.popen("pybabel compile -f -d {0}".format(target))
def babel_compile(target): """ Babel, Compiles all translations """ click.echo(click.style("Starting Compile target:{0}".format(target), fg="green")) os.popen("pybabel compile -f -d {0}".format(target))
[ "Babel", "Compiles", "all", "translations" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/cli.py#L324-L329
[ "def", "babel_compile", "(", "target", ")", ":", "click", ".", "echo", "(", "click", ".", "style", "(", "\"Starting Compile target:{0}\"", ".", "format", "(", "target", ")", ",", "fg", "=", "\"green\"", ")", ")", "os", ".", "popen", "(", "\"pybabel compile...
c293734c1b86e176a3ba57ee2deab6676d125576
train
dynamic_class_import
Will dynamically import a class from a string path :param class_path: string with class path :return: class
flask_appbuilder/base.py
def dynamic_class_import(class_path): """ Will dynamically import a class from a string path :param class_path: string with class path :return: class """ # Split first occurrence of path try: tmp = class_path.split(".") module_path = ".".join(tmp[0:-1]) pa...
def dynamic_class_import(class_path): """ Will dynamically import a class from a string path :param class_path: string with class path :return: class """ # Split first occurrence of path try: tmp = class_path.split(".") module_path = ".".join(tmp[0:-1]) pa...
[ "Will", "dynamically", "import", "a", "class", "from", "a", "string", "path", ":", "param", "class_path", ":", "string", "with", "class", "path", ":", "return", ":", "class" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/base.py#L25-L39
[ "def", "dynamic_class_import", "(", "class_path", ")", ":", "# Split first occurrence of path", "try", ":", "tmp", "=", "class_path", ".", "split", "(", "\".\"", ")", "module_path", "=", "\".\"", ".", "join", "(", "tmp", "[", "0", ":", "-", "1", "]", ")", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
AppBuilder.init_app
Will initialize the Flask app, supporting the app factory pattern. :param app: :param session: The SQLAlchemy session
flask_appbuilder/base.py
def init_app(self, app, session): """ Will initialize the Flask app, supporting the app factory pattern. :param app: :param session: The SQLAlchemy session """ app.config.setdefault("APP_NAME", "F.A.B.") app.config.setdefault("APP_THEME", "") ...
def init_app(self, app, session): """ Will initialize the Flask app, supporting the app factory pattern. :param app: :param session: The SQLAlchemy session """ app.config.setdefault("APP_NAME", "F.A.B.") app.config.setdefault("APP_THEME", "") ...
[ "Will", "initialize", "the", "Flask", "app", "supporting", "the", "app", "factory", "pattern", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/base.py#L149-L189
[ "def", "init_app", "(", "self", ",", "app", ",", "session", ")", ":", "app", ".", "config", ".", "setdefault", "(", "\"APP_NAME\"", ",", "\"F.A.B.\"", ")", "app", ".", "config", ".", "setdefault", "(", "\"APP_THEME\"", ",", "\"\"", ")", "app", ".", "co...
c293734c1b86e176a3ba57ee2deab6676d125576
train
AppBuilder._add_admin_views
Registers indexview, utilview (back function), babel views and Security views.
flask_appbuilder/base.py
def _add_admin_views(self): """ Registers indexview, utilview (back function), babel views and Security views. """ self.indexview = self._check_and_init(self.indexview) self.add_view_no_menu(self.indexview) self.add_view_no_menu(UtilView()) self.bm.register_vi...
def _add_admin_views(self): """ Registers indexview, utilview (back function), babel views and Security views. """ self.indexview = self._check_and_init(self.indexview) self.add_view_no_menu(self.indexview) self.add_view_no_menu(UtilView()) self.bm.register_vi...
[ "Registers", "indexview", "utilview", "(", "back", "function", ")", "babel", "views", "and", "Security", "views", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/base.py#L282-L293
[ "def", "_add_admin_views", "(", "self", ")", ":", "self", ".", "indexview", "=", "self", ".", "_check_and_init", "(", "self", ".", "indexview", ")", "self", ".", "add_view_no_menu", "(", "self", ".", "indexview", ")", "self", ".", "add_view_no_menu", "(", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
AppBuilder._add_addon_views
Registers declared addon's
flask_appbuilder/base.py
def _add_addon_views(self): """ Registers declared addon's """ for addon in self._addon_managers: addon_class = dynamic_class_import(addon) if addon_class: # Instantiate manager with appbuilder (self) addon_class = addon_class(s...
def _add_addon_views(self): """ Registers declared addon's """ for addon in self._addon_managers: addon_class = dynamic_class_import(addon) if addon_class: # Instantiate manager with appbuilder (self) addon_class = addon_class(s...
[ "Registers", "declared", "addon", "s" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/base.py#L295-L312
[ "def", "_add_addon_views", "(", "self", ")", ":", "for", "addon", "in", "self", ".", "_addon_managers", ":", "addon_class", "=", "dynamic_class_import", "(", "addon", ")", "if", "addon_class", ":", "# Instantiate manager with appbuilder (self)", "addon_class", "=", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
AppBuilder.add_view
Add your views associated with menus using this method. :param baseview: A BaseView type class instantiated or not. This method will instantiate the class for you if needed. :param name: The string name that identifies the menu. :param href: Overr...
flask_appbuilder/base.py
def add_view( self, baseview, name, href="", icon="", label="", category="", category_icon="", category_label="", ): """ Add your views associated with menus using this method. :param baseview: A BaseView ty...
def add_view( self, baseview, name, href="", icon="", label="", category="", category_icon="", category_label="", ): """ Add your views associated with menus using this method. :param baseview: A BaseView ty...
[ "Add", "your", "views", "associated", "with", "menus", "using", "this", "method", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/base.py#L324-L408
[ "def", "add_view", "(", "self", ",", "baseview", ",", "name", ",", "href", "=", "\"\"", ",", "icon", "=", "\"\"", ",", "label", "=", "\"\"", ",", "category", "=", "\"\"", ",", "category_icon", "=", "\"\"", ",", "category_label", "=", "\"\"", ",", ")"...
c293734c1b86e176a3ba57ee2deab6676d125576
train
AppBuilder.add_link
Add your own links to menu using this method :param name: The string name that identifies the menu. :param href: Override the generated href for the menu. You can use an url string or an endpoint name :param icon: Font-...
flask_appbuilder/base.py
def add_link( self, name, href, icon="", label="", category="", category_icon="", category_label="", baseview=None, ): """ Add your own links to menu using this method :param name: The string nam...
def add_link( self, name, href, icon="", label="", category="", category_icon="", category_label="", baseview=None, ): """ Add your own links to menu using this method :param name: The string nam...
[ "Add", "your", "own", "links", "to", "menu", "using", "this", "method" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/base.py#L410-L457
[ "def", "add_link", "(", "self", ",", "name", ",", "href", ",", "icon", "=", "\"\"", ",", "label", "=", "\"\"", ",", "category", "=", "\"\"", ",", "category_icon", "=", "\"\"", ",", "category_label", "=", "\"\"", ",", "baseview", "=", "None", ",", ")"...
c293734c1b86e176a3ba57ee2deab6676d125576
train
AppBuilder.add_view_no_menu
Add your views without creating a menu. :param baseview: A BaseView type class instantiated.
flask_appbuilder/base.py
def add_view_no_menu(self, baseview, endpoint=None, static_folder=None): """ Add your views without creating a menu. :param baseview: A BaseView type class instantiated. """ baseview = self._check_and_init(baseview) log.info(LOGMSG_INF_FAB_ADD_VIEW.forma...
def add_view_no_menu(self, baseview, endpoint=None, static_folder=None): """ Add your views without creating a menu. :param baseview: A BaseView type class instantiated. """ baseview = self._check_and_init(baseview) log.info(LOGMSG_INF_FAB_ADD_VIEW.forma...
[ "Add", "your", "views", "without", "creating", "a", "menu", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/base.py#L468-L490
[ "def", "add_view_no_menu", "(", "self", ",", "baseview", ",", "endpoint", "=", "None", ",", "static_folder", "=", "None", ")", ":", "baseview", "=", "self", ".", "_check_and_init", "(", "baseview", ")", "log", ".", "info", "(", "LOGMSG_INF_FAB_ADD_VIEW", "."...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityApi.login
Login endpoint for the API returns a JWT and optionally a refresh token --- post: requestBody: required: true content: application/json: schema: type: object properties: username: ...
flask_appbuilder/security/api.py
def login(self): """Login endpoint for the API returns a JWT and optionally a refresh token --- post: requestBody: required: true content: application/json: schema: type: object properties: ...
def login(self): """Login endpoint for the API returns a JWT and optionally a refresh token --- post: requestBody: required: true content: application/json: schema: type: object properties: ...
[ "Login", "endpoint", "for", "the", "API", "returns", "a", "JWT", "and", "optionally", "a", "refresh", "token", "---", "post", ":", "requestBody", ":", "required", ":", "true", "content", ":", "application", "/", "json", ":", "schema", ":", "type", ":", "...
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/api.py#L36-L106
[ "def", "login", "(", "self", ")", ":", "if", "not", "request", ".", "is_json", ":", "return", "self", ".", "response_400", "(", "message", "=", "\"Request payload is not JSON\"", ")", "username", "=", "request", ".", "json", ".", "get", "(", "API_SECURITY_US...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityApi.refresh
Security endpoint for the refresh token, so we can obtain a new token without forcing the user to login again --- post: responses: 200: description: Refresh Successful content: application/json: schema: ...
flask_appbuilder/security/api.py
def refresh(self): """ Security endpoint for the refresh token, so we can obtain a new token without forcing the user to login again --- post: responses: 200: description: Refresh Successful content: applic...
def refresh(self): """ Security endpoint for the refresh token, so we can obtain a new token without forcing the user to login again --- post: responses: 200: description: Refresh Successful content: applic...
[ "Security", "endpoint", "for", "the", "refresh", "token", "so", "we", "can", "obtain", "a", "new", "token", "without", "forcing", "the", "user", "to", "login", "again", "---", "post", ":", "responses", ":", "200", ":", "description", ":", "Refresh", "Succe...
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/api.py#L111-L137
[ "def", "refresh", "(", "self", ")", ":", "resp", "=", "{", "API_SECURITY_REFRESH_TOKEN_KEY", ":", "create_access_token", "(", "identity", "=", "get_jwt_identity", "(", ")", ",", "fresh", "=", "False", ")", "}", "return", "self", ".", "response", "(", "200", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityManager.add_register_user
Add a registration request for the user. :rtype : RegisterUser
flask_appbuilder/security/sqla/manager.py
def add_register_user( self, username, first_name, last_name, email, password="", hashed_password="" ): """ Add a registration request for the user. :rtype : RegisterUser """ register_user = self.registeruser_model() register_user.username = username ...
def add_register_user( self, username, first_name, last_name, email, password="", hashed_password="" ): """ Add a registration request for the user. :rtype : RegisterUser """ register_user = self.registeruser_model() register_user.username = username ...
[ "Add", "a", "registration", "request", "for", "the", "user", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/sqla/manager.py#L95-L120
[ "def", "add_register_user", "(", "self", ",", "username", ",", "first_name", ",", "last_name", ",", "email", ",", "password", "=", "\"\"", ",", "hashed_password", "=", "\"\"", ")", ":", "register_user", "=", "self", ".", "registeruser_model", "(", ")", "regi...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityManager.del_register_user
Deletes registration object from database :param register_user: RegisterUser object to delete
flask_appbuilder/security/sqla/manager.py
def del_register_user(self, register_user): """ Deletes registration object from database :param register_user: RegisterUser object to delete """ try: self.get_session.delete(register_user) self.get_session.commit() return True ...
def del_register_user(self, register_user): """ Deletes registration object from database :param register_user: RegisterUser object to delete """ try: self.get_session.delete(register_user) self.get_session.commit() return True ...
[ "Deletes", "registration", "object", "from", "database" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/sqla/manager.py#L122-L135
[ "def", "del_register_user", "(", "self", ",", "register_user", ")", ":", "try", ":", "self", ".", "get_session", ".", "delete", "(", "register_user", ")", "self", ".", "get_session", ".", "commit", "(", ")", "return", "True", "except", "Exception", "as", "...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityManager.find_user
Finds user by username or email
flask_appbuilder/security/sqla/manager.py
def find_user(self, username=None, email=None): """ Finds user by username or email """ if username: return ( self.get_session.query(self.user_model) .filter(func.lower(self.user_model.username) == func.lower(username)) .fir...
def find_user(self, username=None, email=None): """ Finds user by username or email """ if username: return ( self.get_session.query(self.user_model) .filter(func.lower(self.user_model.username) == func.lower(username)) .fir...
[ "Finds", "user", "by", "username", "or", "email" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/sqla/manager.py#L137-L150
[ "def", "find_user", "(", "self", ",", "username", "=", "None", ",", "email", "=", "None", ")", ":", "if", "username", ":", "return", "(", "self", ".", "get_session", ".", "query", "(", "self", ".", "user_model", ")", ".", "filter", "(", "func", ".", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityManager.add_user
Generic function to create user
flask_appbuilder/security/sqla/manager.py
def add_user( self, username, first_name, last_name, email, role, password="", hashed_password="", ): """ Generic function to create user """ try: user = self.user_model() user.first_name = fi...
def add_user( self, username, first_name, last_name, email, role, password="", hashed_password="", ): """ Generic function to create user """ try: user = self.user_model() user.first_name = fi...
[ "Generic", "function", "to", "create", "user" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/sqla/manager.py#L155-L187
[ "def", "add_user", "(", "self", ",", "username", ",", "first_name", ",", "last_name", ",", "email", ",", "role", ",", "password", "=", "\"\"", ",", "hashed_password", "=", "\"\"", ",", ")", ":", "try", ":", "user", "=", "self", ".", "user_model", "(", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityManager.find_permission
Finds and returns a Permission by name
flask_appbuilder/security/sqla/manager.py
def find_permission(self, name): """ Finds and returns a Permission by name """ return ( self.get_session.query(self.permission_model).filter_by(name=name).first() )
def find_permission(self, name): """ Finds and returns a Permission by name """ return ( self.get_session.query(self.permission_model).filter_by(name=name).first() )
[ "Finds", "and", "returns", "a", "Permission", "by", "name" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/sqla/manager.py#L244-L250
[ "def", "find_permission", "(", "self", ",", "name", ")", ":", "return", "(", "self", ".", "get_session", ".", "query", "(", "self", ".", "permission_model", ")", ".", "filter_by", "(", "name", "=", "name", ")", ".", "first", "(", ")", ")" ]
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityManager.add_permission
Adds a permission to the backend, model permission :param name: name of the permission: 'can_add','can_edit' etc...
flask_appbuilder/security/sqla/manager.py
def add_permission(self, name): """ Adds a permission to the backend, model permission :param name: name of the permission: 'can_add','can_edit' etc... """ perm = self.find_permission(name) if perm is None: try: perm = ...
def add_permission(self, name): """ Adds a permission to the backend, model permission :param name: name of the permission: 'can_add','can_edit' etc... """ perm = self.find_permission(name) if perm is None: try: perm = ...
[ "Adds", "a", "permission", "to", "the", "backend", "model", "permission" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/sqla/manager.py#L252-L270
[ "def", "add_permission", "(", "self", ",", "name", ")", ":", "perm", "=", "self", ".", "find_permission", "(", "name", ")", "if", "perm", "is", "None", ":", "try", ":", "perm", "=", "self", ".", "permission_model", "(", ")", "perm", ".", "name", "=",...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityManager.del_permission
Deletes a permission from the backend, model permission :param name: name of the permission: 'can_add','can_edit' etc...
flask_appbuilder/security/sqla/manager.py
def del_permission(self, name): """ Deletes a permission from the backend, model permission :param name: name of the permission: 'can_add','can_edit' etc... """ perm = self.find_permission(name) if perm: try: self.get_s...
def del_permission(self, name): """ Deletes a permission from the backend, model permission :param name: name of the permission: 'can_add','can_edit' etc... """ perm = self.find_permission(name) if perm: try: self.get_s...
[ "Deletes", "a", "permission", "from", "the", "backend", "model", "permission" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/sqla/manager.py#L272-L286
[ "def", "del_permission", "(", "self", ",", "name", ")", ":", "perm", "=", "self", ".", "find_permission", "(", "name", ")", "if", "perm", ":", "try", ":", "self", ".", "get_session", ".", "delete", "(", "perm", ")", "self", ".", "get_session", ".", "...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityManager.find_view_menu
Finds and returns a ViewMenu by name
flask_appbuilder/security/sqla/manager.py
def find_view_menu(self, name): """ Finds and returns a ViewMenu by name """ return self.get_session.query(self.viewmenu_model).filter_by(name=name).first()
def find_view_menu(self, name): """ Finds and returns a ViewMenu by name """ return self.get_session.query(self.viewmenu_model).filter_by(name=name).first()
[ "Finds", "and", "returns", "a", "ViewMenu", "by", "name" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/sqla/manager.py#L294-L298
[ "def", "find_view_menu", "(", "self", ",", "name", ")", ":", "return", "self", ".", "get_session", ".", "query", "(", "self", ".", "viewmenu_model", ")", ".", "filter_by", "(", "name", "=", "name", ")", ".", "first", "(", ")" ]
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityManager.add_view_menu
Adds a view or menu to the backend, model view_menu param name: name of the view menu to add
flask_appbuilder/security/sqla/manager.py
def add_view_menu(self, name): """ Adds a view or menu to the backend, model view_menu param name: name of the view menu to add """ view_menu = self.find_view_menu(name) if view_menu is None: try: view_menu = self.viewme...
def add_view_menu(self, name): """ Adds a view or menu to the backend, model view_menu param name: name of the view menu to add """ view_menu = self.find_view_menu(name) if view_menu is None: try: view_menu = self.viewme...
[ "Adds", "a", "view", "or", "menu", "to", "the", "backend", "model", "view_menu", "param", "name", ":", "name", "of", "the", "view", "menu", "to", "add" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/sqla/manager.py#L303-L320
[ "def", "add_view_menu", "(", "self", ",", "name", ")", ":", "view_menu", "=", "self", ".", "find_view_menu", "(", "name", ")", "if", "view_menu", "is", "None", ":", "try", ":", "view_menu", "=", "self", ".", "viewmenu_model", "(", ")", "view_menu", ".", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityManager.find_permission_view_menu
Finds and returns a PermissionView by names
flask_appbuilder/security/sqla/manager.py
def find_permission_view_menu(self, permission_name, view_menu_name): """ Finds and returns a PermissionView by names """ permission = self.find_permission(permission_name) view_menu = self.find_view_menu(view_menu_name) if permission and view_menu: return...
def find_permission_view_menu(self, permission_name, view_menu_name): """ Finds and returns a PermissionView by names """ permission = self.find_permission(permission_name) view_menu = self.find_view_menu(view_menu_name) if permission and view_menu: return...
[ "Finds", "and", "returns", "a", "PermissionView", "by", "names" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/sqla/manager.py#L344-L355
[ "def", "find_permission_view_menu", "(", "self", ",", "permission_name", ",", "view_menu_name", ")", ":", "permission", "=", "self", ".", "find_permission", "(", "permission_name", ")", "view_menu", "=", "self", ".", "find_view_menu", "(", "view_menu_name", ")", "...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityManager.find_permissions_view_menu
Finds all permissions from ViewMenu, returns list of PermissionView :param view_menu: ViewMenu object :return: list of PermissionView objects
flask_appbuilder/security/sqla/manager.py
def find_permissions_view_menu(self, view_menu): """ Finds all permissions from ViewMenu, returns list of PermissionView :param view_menu: ViewMenu object :return: list of PermissionView objects """ return ( self.get_session.query(self.permissionv...
def find_permissions_view_menu(self, view_menu): """ Finds all permissions from ViewMenu, returns list of PermissionView :param view_menu: ViewMenu object :return: list of PermissionView objects """ return ( self.get_session.query(self.permissionv...
[ "Finds", "all", "permissions", "from", "ViewMenu", "returns", "list", "of", "PermissionView" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/sqla/manager.py#L357-L368
[ "def", "find_permissions_view_menu", "(", "self", ",", "view_menu", ")", ":", "return", "(", "self", ".", "get_session", ".", "query", "(", "self", ".", "permissionview_model", ")", ".", "filter_by", "(", "view_menu_id", "=", "view_menu", ".", "id", ")", "."...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityManager.add_permission_view_menu
Adds a permission on a view or menu to the backend :param permission_name: name of the permission to add: 'can_add','can_edit' etc... :param view_menu_name: name of the view menu to add
flask_appbuilder/security/sqla/manager.py
def add_permission_view_menu(self, permission_name, view_menu_name): """ Adds a permission on a view or menu to the backend :param permission_name: name of the permission to add: 'can_add','can_edit' etc... :param view_menu_name: name of the v...
def add_permission_view_menu(self, permission_name, view_menu_name): """ Adds a permission on a view or menu to the backend :param permission_name: name of the permission to add: 'can_add','can_edit' etc... :param view_menu_name: name of the v...
[ "Adds", "a", "permission", "on", "a", "view", "or", "menu", "to", "the", "backend" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/sqla/manager.py#L370-L398
[ "def", "add_permission_view_menu", "(", "self", ",", "permission_name", ",", "view_menu_name", ")", ":", "if", "not", "(", "permission_name", "and", "view_menu_name", ")", ":", "return", "None", "pv", "=", "self", ".", "find_permission_view_menu", "(", "permission...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityManager.add_permission_role
Add permission-ViewMenu object to Role :param role: The role object :param perm_view: The PermissionViewMenu object
flask_appbuilder/security/sqla/manager.py
def add_permission_role(self, role, perm_view): """ Add permission-ViewMenu object to Role :param role: The role object :param perm_view: The PermissionViewMenu object """ if perm_view not in role.permissions: try: ...
def add_permission_role(self, role, perm_view): """ Add permission-ViewMenu object to Role :param role: The role object :param perm_view: The PermissionViewMenu object """ if perm_view not in role.permissions: try: ...
[ "Add", "permission", "-", "ViewMenu", "object", "to", "Role" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/sqla/manager.py#L432-L451
[ "def", "add_permission_role", "(", "self", ",", "role", ",", "perm_view", ")", ":", "if", "perm_view", "not", "in", "role", ".", "permissions", ":", "try", ":", "role", ".", "permissions", ".", "append", "(", "perm_view", ")", "self", ".", "get_session", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SecurityManager.del_permission_role
Remove permission-ViewMenu object to Role :param role: The role object :param perm_view: The PermissionViewMenu object
flask_appbuilder/security/sqla/manager.py
def del_permission_role(self, role, perm_view): """ Remove permission-ViewMenu object to Role :param role: The role object :param perm_view: The PermissionViewMenu object """ if perm_view in role.permissions: try: ...
def del_permission_role(self, role, perm_view): """ Remove permission-ViewMenu object to Role :param role: The role object :param perm_view: The PermissionViewMenu object """ if perm_view in role.permissions: try: ...
[ "Remove", "permission", "-", "ViewMenu", "object", "to", "Role" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/security/sqla/manager.py#L453-L472
[ "def", "del_permission_role", "(", "self", ",", "role", ",", "perm_view", ")", ":", "if", "perm_view", "in", "role", ".", "permissions", ":", "try", ":", "role", ".", "permissions", ".", "remove", "(", "perm_view", ")", "self", ".", "get_session", ".", "...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SQLA.get_tables_for_bind
Returns a list of all tables relevant for a bind.
flask_appbuilder/models/sqla/__init__.py
def get_tables_for_bind(self, bind=None): """Returns a list of all tables relevant for a bind.""" result = [] tables = Model.metadata.tables for key in tables: if tables[key].info.get("bind_key") == bind: result.append(tables[key]) return result
def get_tables_for_bind(self, bind=None): """Returns a list of all tables relevant for a bind.""" result = [] tables = Model.metadata.tables for key in tables: if tables[key].info.get("bind_key") == bind: result.append(tables[key]) return result
[ "Returns", "a", "list", "of", "all", "tables", "relevant", "for", "a", "bind", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/models/sqla/__init__.py#L40-L47
[ "def", "get_tables_for_bind", "(", "self", ",", "bind", "=", "None", ")", ":", "result", "=", "[", "]", "tables", "=", "Model", ".", "metadata", ".", "tables", "for", "key", "in", "tables", ":", "if", "tables", "[", "key", "]", ".", "info", ".", "g...
c293734c1b86e176a3ba57ee2deab6676d125576
train
RestCRUDView._get_api_urls
Completes a dict with the CRUD urls of the API. :param api_urls: A dict with the urls {'<FUNCTION>':'<URL>',...} :return: A dict with the CRUD urls of the base API.
flask_appbuilder/views.py
def _get_api_urls(self, api_urls=None): """ Completes a dict with the CRUD urls of the API. :param api_urls: A dict with the urls {'<FUNCTION>':'<URL>',...} :return: A dict with the CRUD urls of the base API. """ view_name = self.__class__.__name__ api_urls =...
def _get_api_urls(self, api_urls=None): """ Completes a dict with the CRUD urls of the API. :param api_urls: A dict with the urls {'<FUNCTION>':'<URL>',...} :return: A dict with the CRUD urls of the base API. """ view_name = self.__class__.__name__ api_urls =...
[ "Completes", "a", "dict", "with", "the", "CRUD", "urls", "of", "the", "API", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/views.py#L160-L173
[ "def", "_get_api_urls", "(", "self", ",", "api_urls", "=", "None", ")", ":", "view_name", "=", "self", ".", "__class__", ".", "__name__", "api_urls", "=", "api_urls", "or", "{", "}", "api_urls", "[", "\"read\"", "]", "=", "url_for", "(", "view_name", "+"...
c293734c1b86e176a3ba57ee2deab6676d125576
train
RestCRUDView.show_item_dict
Returns a json-able dict for show
flask_appbuilder/views.py
def show_item_dict(self, item): """Returns a json-able dict for show""" d = {} for col in self.show_columns: v = getattr(item, col) if not isinstance(v, (int, float, string_types)): v = str(v) d[col] = v return d
def show_item_dict(self, item): """Returns a json-able dict for show""" d = {} for col in self.show_columns: v = getattr(item, col) if not isinstance(v, (int, float, string_types)): v = str(v) d[col] = v return d
[ "Returns", "a", "json", "-", "able", "dict", "for", "show" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/views.py#L268-L276
[ "def", "show_item_dict", "(", "self", ",", "item", ")", ":", "d", "=", "{", "}", "for", "col", "in", "self", ".", "show_columns", ":", "v", "=", "getattr", "(", "item", ",", "col", ")", "if", "not", "isinstance", "(", "v", ",", "(", "int", ",", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
RestCRUDView.api_column_add
Returns list of (pk, object) nice to use on select2. Use only for related columns. Always filters with add_form_query_rel_fields, and accepts extra filters on endpoint arguments. :param col_name: The related column name :return: JSON response
flask_appbuilder/views.py
def api_column_add(self, col_name): """ Returns list of (pk, object) nice to use on select2. Use only for related columns. Always filters with add_form_query_rel_fields, and accepts extra filters on endpoint arguments. :param col_name: The related column n...
def api_column_add(self, col_name): """ Returns list of (pk, object) nice to use on select2. Use only for related columns. Always filters with add_form_query_rel_fields, and accepts extra filters on endpoint arguments. :param col_name: The related column n...
[ "Returns", "list", "of", "(", "pk", "object", ")", "nice", "to", "use", "on", "select2", ".", "Use", "only", "for", "related", "columns", ".", "Always", "filters", "with", "add_form_query_rel_fields", "and", "accepts", "extra", "filters", "on", "endpoint", "...
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/views.py#L420-L436
[ "def", "api_column_add", "(", "self", ",", "col_name", ")", ":", "log", ".", "warning", "(", "\"This API is deprecated and will be removed on 1.15.X\"", ")", "filter_rel_fields", "=", "None", "if", "self", ".", "add_form_query_rel_fields", ":", "filter_rel_fields", "=",...
c293734c1b86e176a3ba57ee2deab6676d125576
train
RestCRUDView.api_column_edit
Returns list of (pk, object) nice to use on select2. Use only for related columns. Always filters with edit_form_query_rel_fields, and accepts extra filters on endpoint arguments. :param col_name: The related column name :return: JSON response
flask_appbuilder/views.py
def api_column_edit(self, col_name): """ Returns list of (pk, object) nice to use on select2. Use only for related columns. Always filters with edit_form_query_rel_fields, and accepts extra filters on endpoint arguments. :param col_name: The related column...
def api_column_edit(self, col_name): """ Returns list of (pk, object) nice to use on select2. Use only for related columns. Always filters with edit_form_query_rel_fields, and accepts extra filters on endpoint arguments. :param col_name: The related column...
[ "Returns", "list", "of", "(", "pk", "object", ")", "nice", "to", "use", "on", "select2", ".", "Use", "only", "for", "related", "columns", ".", "Always", "filters", "with", "edit_form_query_rel_fields", "and", "accepts", "extra", "filters", "on", "endpoint", ...
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/views.py#L441-L457
[ "def", "api_column_edit", "(", "self", ",", "col_name", ")", ":", "log", ".", "warning", "(", "\"This API is deprecated and will be removed on 1.15.X\"", ")", "filter_rel_fields", "=", "None", "if", "self", ".", "edit_form_query_rel_fields", ":", "filter_rel_fields", "=...
c293734c1b86e176a3ba57ee2deab6676d125576
train
ModelView.action
Action method to handle actions from a show view
flask_appbuilder/views.py
def action(self, name, pk): """ Action method to handle actions from a show view """ pk = self._deserialize_pk_if_composite(pk) if self.appbuilder.sm.has_access(name, self.__class__.__name__): action = self.actions.get(name) return action.func(self.dat...
def action(self, name, pk): """ Action method to handle actions from a show view """ pk = self._deserialize_pk_if_composite(pk) if self.appbuilder.sm.has_access(name, self.__class__.__name__): action = self.actions.get(name) return action.func(self.dat...
[ "Action", "method", "to", "handle", "actions", "from", "a", "show", "view" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/views.py#L614-L624
[ "def", "action", "(", "self", ",", "name", ",", "pk", ")", ":", "pk", "=", "self", ".", "_deserialize_pk_if_composite", "(", "pk", ")", "if", "self", ".", "appbuilder", ".", "sm", ".", "has_access", "(", "name", ",", "self", ".", "__class__", ".", "_...
c293734c1b86e176a3ba57ee2deab6676d125576
train
ModelView.action_post
Action method to handle multiple records selected from a list view
flask_appbuilder/views.py
def action_post(self): """ Action method to handle multiple records selected from a list view """ name = request.form["action"] pks = request.form.getlist("rowid") if self.appbuilder.sm.has_access(name, self.__class__.__name__): action = self.actions.get(n...
def action_post(self): """ Action method to handle multiple records selected from a list view """ name = request.form["action"] pks = request.form.getlist("rowid") if self.appbuilder.sm.has_access(name, self.__class__.__name__): action = self.actions.get(n...
[ "Action", "method", "to", "handle", "multiple", "records", "selected", "from", "a", "list", "view" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/views.py#L627-L641
[ "def", "action_post", "(", "self", ")", ":", "name", "=", "request", ".", "form", "[", "\"action\"", "]", "pks", "=", "request", ".", "form", ".", "getlist", "(", "\"rowid\"", ")", "if", "self", ".", "appbuilder", ".", "sm", ".", "has_access", "(", "...
c293734c1b86e176a3ba57ee2deab6676d125576
train
CompactCRUDMixin.set_key
Allows attaching stateless information to the class using the flask session dict
flask_appbuilder/views.py
def set_key(cls, k, v): """Allows attaching stateless information to the class using the flask session dict """ k = cls.__name__ + "__" + k session[k] = v
def set_key(cls, k, v): """Allows attaching stateless information to the class using the flask session dict """ k = cls.__name__ + "__" + k session[k] = v
[ "Allows", "attaching", "stateless", "information", "to", "the", "class", "using", "the", "flask", "session", "dict" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/views.py#L760-L765
[ "def", "set_key", "(", "cls", ",", "k", ",", "v", ")", ":", "k", "=", "cls", ".", "__name__", "+", "\"__\"", "+", "k", "session", "[", "k", "]", "=", "v" ]
c293734c1b86e176a3ba57ee2deab6676d125576
train
CompactCRUDMixin.get_key
Matching get method for ``set_key``
flask_appbuilder/views.py
def get_key(cls, k, default=None): """Matching get method for ``set_key`` """ k = cls.__name__ + "__" + k if k in session: return session[k] else: return default
def get_key(cls, k, default=None): """Matching get method for ``set_key`` """ k = cls.__name__ + "__" + k if k in session: return session[k] else: return default
[ "Matching", "get", "method", "for", "set_key" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/views.py#L768-L775
[ "def", "get_key", "(", "cls", ",", "k", ",", "default", "=", "None", ")", ":", "k", "=", "cls", ".", "__name__", "+", "\"__\"", "+", "k", "if", "k", "in", "session", ":", "return", "session", "[", "k", "]", "else", ":", "return", "default" ]
c293734c1b86e176a3ba57ee2deab6676d125576
train
CompactCRUDMixin.del_key
Matching get method for ``set_key``
flask_appbuilder/views.py
def del_key(cls, k): """Matching get method for ``set_key`` """ k = cls.__name__ + "__" + k session.pop(k)
def del_key(cls, k): """Matching get method for ``set_key`` """ k = cls.__name__ + "__" + k session.pop(k)
[ "Matching", "get", "method", "for", "set_key" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/views.py#L778-L782
[ "def", "del_key", "(", "cls", ",", "k", ")", ":", "k", "=", "cls", ".", "__name__", "+", "\"__\"", "+", "k", "session", ".", "pop", "(", "k", ")" ]
c293734c1b86e176a3ba57ee2deab6676d125576
train
CompactCRUDMixin._get_list_widget
get joined base filter and current active filter for query
flask_appbuilder/views.py
def _get_list_widget(self, **args): """ get joined base filter and current active filter for query """ widgets = super(CompactCRUDMixin, self)._get_list_widget(**args) session_form_widget = self.get_key("session_form_widget", None) form_widget = None if session_form_widget == "a...
def _get_list_widget(self, **args): """ get joined base filter and current active filter for query """ widgets = super(CompactCRUDMixin, self)._get_list_widget(**args) session_form_widget = self.get_key("session_form_widget", None) form_widget = None if session_form_widget == "a...
[ "get", "joined", "base", "filter", "and", "current", "active", "filter", "for", "query" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/views.py#L784-L803
[ "def", "_get_list_widget", "(", "self", ",", "*", "*", "args", ")", ":", "widgets", "=", "super", "(", "CompactCRUDMixin", ",", "self", ")", ".", "_get_list_widget", "(", "*", "*", "args", ")", "session_form_widget", "=", "self", ".", "get_key", "(", "\"...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SQLAInterface._query_select_options
Add select load options to query. The goal is to only SQL select what is requested :param query: SQLAlchemy Query obj :param select_columns: (list) of columns :return: SQLAlchemy Query obj
flask_appbuilder/models/sqla/interface.py
def _query_select_options(self, query, select_columns=None): """ Add select load options to query. The goal is to only SQL select what is requested :param query: SQLAlchemy Query obj :param select_columns: (list) of columns :return: SQLAlchemy Query obj "...
def _query_select_options(self, query, select_columns=None): """ Add select load options to query. The goal is to only SQL select what is requested :param query: SQLAlchemy Query obj :param select_columns: (list) of columns :return: SQLAlchemy Query obj "...
[ "Add", "select", "load", "options", "to", "query", ".", "The", "goal", "is", "to", "only", "SQL", "select", "what", "is", "requested" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/models/sqla/interface.py#L97-L124
[ "def", "_query_select_options", "(", "self", ",", "query", ",", "select_columns", "=", "None", ")", ":", "if", "select_columns", ":", "_load_options", "=", "list", "(", ")", "for", "column", "in", "select_columns", ":", "if", "\".\"", "in", "column", ":", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SQLAInterface.query
QUERY :param filters: dict with filters {<col_name>:<value,...} :param order_column: name of the column to order :param order_direction: the direction to order <'asc'|'desc'> :param page: the current page ...
flask_appbuilder/models/sqla/interface.py
def query( self, filters=None, order_column="", order_direction="", page=None, page_size=None, select_columns=None, ): """ QUERY :param filters: dict with filters {<col_name>:<value,...} :param order_...
def query( self, filters=None, order_column="", order_direction="", page=None, page_size=None, select_columns=None, ): """ QUERY :param filters: dict with filters {<col_name>:<value,...} :param order_...
[ "QUERY", ":", "param", "filters", ":", "dict", "with", "filters", "{", "<col_name", ">", ":", "<value", "...", "}", ":", "param", "order_column", ":", "name", "of", "the", "column", "to", "order", ":", "param", "order_direction", ":", "the", "direction", ...
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/models/sqla/interface.py#L126-L173
[ "def", "query", "(", "self", ",", "filters", "=", "None", ",", "order_column", "=", "\"\"", ",", "order_direction", "=", "\"\"", ",", "page", "=", "None", ",", "page_size", "=", "None", ",", "select_columns", "=", "None", ",", ")", ":", "query", "=", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
SQLAInterface.get_user_columns_list
Returns all model's columns except pk or fk
flask_appbuilder/models/sqla/interface.py
def get_user_columns_list(self): """ Returns all model's columns except pk or fk """ ret_lst = list() for col_name in self.get_columns_list(): if (not self.is_pk(col_name)) and (not self.is_fk(col_name)): ret_lst.append(col_name) return ret...
def get_user_columns_list(self): """ Returns all model's columns except pk or fk """ ret_lst = list() for col_name in self.get_columns_list(): if (not self.is_pk(col_name)) and (not self.is_fk(col_name)): ret_lst.append(col_name) return ret...
[ "Returns", "all", "model", "s", "columns", "except", "pk", "or", "fk" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/models/sqla/interface.py#L544-L552
[ "def", "get_user_columns_list", "(", "self", ")", ":", "ret_lst", "=", "list", "(", ")", "for", "col_name", "in", "self", ".", "get_columns_list", "(", ")", ":", "if", "(", "not", "self", ".", "is_pk", "(", "col_name", ")", ")", "and", "(", "not", "s...
c293734c1b86e176a3ba57ee2deab6676d125576
train
ImageManager.save_file
Saves an image File :param data: FileStorage from Flask form upload field :param filename: Filename with full path
flask_appbuilder/filemanager.py
def save_file(self, data, filename, size=None, thumbnail_size=None): """ Saves an image File :param data: FileStorage from Flask form upload field :param filename: Filename with full path """ max_size = size or self.max_size thumbnail_size = thumbnai...
def save_file(self, data, filename, size=None, thumbnail_size=None): """ Saves an image File :param data: FileStorage from Flask form upload field :param filename: Filename with full path """ max_size = size or self.max_size thumbnail_size = thumbnai...
[ "Saves", "an", "image", "File" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/filemanager.py#L160-L194
[ "def", "save_file", "(", "self", ",", "data", ",", "filename", ",", "size", "=", "None", ",", "thumbnail_size", "=", "None", ")", ":", "max_size", "=", "size", "or", "self", ".", "max_size", "thumbnail_size", "=", "thumbnail_size", "or", "self", ".", "th...
c293734c1b86e176a3ba57ee2deab6676d125576
train
ImageManager.resize
Resizes the image :param image: The image object :param size: size is PIL tuple (width, heigth, force) ex: (200,100,True)
flask_appbuilder/filemanager.py
def resize(self, image, size): """ Resizes the image :param image: The image object :param size: size is PIL tuple (width, heigth, force) ex: (200,100,True) """ (width, height, force) = size if image.size[0] > width or image.size[1] > height: ...
def resize(self, image, size): """ Resizes the image :param image: The image object :param size: size is PIL tuple (width, heigth, force) ex: (200,100,True) """ (width, height, force) = size if image.size[0] > width or image.size[1] > height: ...
[ "Resizes", "the", "image" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/filemanager.py#L203-L220
[ "def", "resize", "(", "self", ",", "image", ",", "size", ")", ":", "(", "width", ",", "height", ",", "force", ")", "=", "size", "if", "image", ".", "size", "[", "0", "]", ">", "width", "or", "image", ".", "size", "[", "1", "]", ">", "height", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
safe
A decorator that catches uncaught exceptions and return the response in JSON format (inspired on Superset code)
flask_appbuilder/api/__init__.py
def safe(f): """ A decorator that catches uncaught exceptions and return the response in JSON format (inspired on Superset code) """ def wraps(self, *args, **kwargs): try: return f(self, *args, **kwargs) except BadRequest as e: return self.response_400(messag...
def safe(f): """ A decorator that catches uncaught exceptions and return the response in JSON format (inspired on Superset code) """ def wraps(self, *args, **kwargs): try: return f(self, *args, **kwargs) except BadRequest as e: return self.response_400(messag...
[ "A", "decorator", "that", "catches", "uncaught", "exceptions", "and", "return", "the", "response", "in", "JSON", "format", "(", "inspired", "on", "Superset", "code", ")" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/api/__init__.py#L70-L85
[ "def", "safe", "(", "f", ")", ":", "def", "wraps", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "f", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "except", "BadRequest", "as", "e", ":...
c293734c1b86e176a3ba57ee2deab6676d125576
train
rison
Use this decorator to parse URI *Rison* arguments to a python data structure, your method gets the data structure on kwargs['rison']. Response is HTTP 400 if *Rison* is not correct:: class ExampleApi(BaseApi): @expose('/risonjson') @rison() ...
flask_appbuilder/api/__init__.py
def rison(schema=None): """ Use this decorator to parse URI *Rison* arguments to a python data structure, your method gets the data structure on kwargs['rison']. Response is HTTP 400 if *Rison* is not correct:: class ExampleApi(BaseApi): @expose('/ris...
def rison(schema=None): """ Use this decorator to parse URI *Rison* arguments to a python data structure, your method gets the data structure on kwargs['rison']. Response is HTTP 400 if *Rison* is not correct:: class ExampleApi(BaseApi): @expose('/ris...
[ "Use", "this", "decorator", "to", "parse", "URI", "*", "Rison", "*", "arguments", "to", "a", "python", "data", "structure", "your", "method", "gets", "the", "data", "structure", "on", "kwargs", "[", "rison", "]", ".", "Response", "is", "HTTP", "400", "if...
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/api/__init__.py#L88-L141
[ "def", "rison", "(", "schema", "=", "None", ")", ":", "def", "_rison", "(", "f", ")", ":", "def", "wraps", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "value", "=", "request", ".", "args", ".", "get", "(", "API_URI_RIS_KEY",...
c293734c1b86e176a3ba57ee2deab6676d125576
train
expose
Use this decorator to expose API endpoints on your API classes. :param url: Relative URL for the endpoint :param methods: Allowed HTTP methods. By default only GET is allowed.
flask_appbuilder/api/__init__.py
def expose(url="/", methods=("GET",)): """ Use this decorator to expose API endpoints on your API classes. :param url: Relative URL for the endpoint :param methods: Allowed HTTP methods. By default only GET is allowed. """ def wrap(f): if not hasattr...
def expose(url="/", methods=("GET",)): """ Use this decorator to expose API endpoints on your API classes. :param url: Relative URL for the endpoint :param methods: Allowed HTTP methods. By default only GET is allowed. """ def wrap(f): if not hasattr...
[ "Use", "this", "decorator", "to", "expose", "API", "endpoints", "on", "your", "API", "classes", "." ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/api/__init__.py#L144-L160
[ "def", "expose", "(", "url", "=", "\"/\"", ",", "methods", "=", "(", "\"GET\"", ",", ")", ")", ":", "def", "wrap", "(", "f", ")", ":", "if", "not", "hasattr", "(", "f", ",", "\"_urls\"", ")", ":", "f", ".", "_urls", "=", "[", "]", "f", ".", ...
c293734c1b86e176a3ba57ee2deab6676d125576
train
merge_response_func
Use this decorator to set a new merging response function to HTTP endpoints candidate function must have the following signature and be childs of BaseApi: ``` def merge_some_function(self, response, rison_args): ``` :param func: Name of the merge function where ...
flask_appbuilder/api/__init__.py
def merge_response_func(func, key): """ Use this decorator to set a new merging response function to HTTP endpoints candidate function must have the following signature and be childs of BaseApi: ``` def merge_some_function(self, response, rison_args): ```...
def merge_response_func(func, key): """ Use this decorator to set a new merging response function to HTTP endpoints candidate function must have the following signature and be childs of BaseApi: ``` def merge_some_function(self, response, rison_args): ```...
[ "Use", "this", "decorator", "to", "set", "a", "new", "merging", "response", "function", "to", "HTTP", "endpoints" ]
dpgaspar/Flask-AppBuilder
python
https://github.com/dpgaspar/Flask-AppBuilder/blob/c293734c1b86e176a3ba57ee2deab6676d125576/flask_appbuilder/api/__init__.py#L163-L185
[ "def", "merge_response_func", "(", "func", ",", "key", ")", ":", "def", "wrap", "(", "f", ")", ":", "if", "not", "hasattr", "(", "f", ",", "\"_response_key_func_mappings\"", ")", ":", "f", ".", "_response_key_func_mappings", "=", "dict", "(", ")", "f", "...
c293734c1b86e176a3ba57ee2deab6676d125576