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
Main._execute_migrations
passed a version: this version don't exists in the database and is younger than the last version -> do migrations up until this version this version don't exists in the database and is older than the last version -> do nothing, is a unpredictable behavior this version exists in the d...
simple_db_migrate/main.py
def _execute_migrations(self, current_version, destination_version): """ passed a version: this version don't exists in the database and is younger than the last version -> do migrations up until this version this version don't exists in the database and is older than the last ve...
def _execute_migrations(self, current_version, destination_version): """ passed a version: this version don't exists in the database and is younger than the last version -> do migrations up until this version this version don't exists in the database and is older than the last ve...
[ "passed", "a", "version", ":", "this", "version", "don", "t", "exists", "in", "the", "database", "and", "is", "younger", "than", "the", "last", "version", "-", ">", "do", "migrations", "up", "until", "this", "version", "this", "version", "don", "t", "exi...
guilhermechapiewski/simple-db-migrate
python
https://github.com/guilhermechapiewski/simple-db-migrate/blob/7ea6ffd0c58f70079cc344eae348430c7bdaaab3/simple_db_migrate/main.py#L174-L250
[ "def", "_execute_migrations", "(", "self", ",", "current_version", ",", "destination_version", ")", ":", "is_migration_up", "=", "True", "# check if a version was passed to the program", "if", "self", ".", "config", ".", "get", "(", "\"schema_version\"", ")", ":", "# ...
7ea6ffd0c58f70079cc344eae348430c7bdaaab3
train
csrf_token
Generate a token string from bytes arrays. The token in the session is user specific.
examples/chat.py
def csrf_token(): """ Generate a token string from bytes arrays. The token in the session is user specific. """ if "_csrf_token" not in session: session["_csrf_token"] = os.urandom(128) return hmac.new(app.secret_key, session["_csrf_token"], digestmod=sha1).hexdigest()
def csrf_token(): """ Generate a token string from bytes arrays. The token in the session is user specific. """ if "_csrf_token" not in session: session["_csrf_token"] = os.urandom(128) return hmac.new(app.secret_key, session["_csrf_token"], digestmod=sha1).hexdigest()
[ "Generate", "a", "token", "string", "from", "bytes", "arrays", ".", "The", "token", "in", "the", "session", "is", "user", "specific", "." ]
spantaleev/flask-sijax
python
https://github.com/spantaleev/flask-sijax/blob/df9f6d9b8385b3375c119a51aa100491d5445e17/examples/chat.py#L17-L25
[ "def", "csrf_token", "(", ")", ":", "if", "\"_csrf_token\"", "not", "in", "session", ":", "session", "[", "\"_csrf_token\"", "]", "=", "os", ".", "urandom", "(", "128", ")", "return", "hmac", ".", "new", "(", "app", ".", "secret_key", ",", "session", "...
df9f6d9b8385b3375c119a51aa100491d5445e17
train
check_csrf_token
Checks that token is correct, aborting if not
examples/chat.py
def check_csrf_token(): """Checks that token is correct, aborting if not""" if request.method in ("GET",): # not exhaustive list return token = request.form.get("csrf_token") if token is None: app.logger.warning("Expected CSRF Token: not present") abort(400) if not safe_str_c...
def check_csrf_token(): """Checks that token is correct, aborting if not""" if request.method in ("GET",): # not exhaustive list return token = request.form.get("csrf_token") if token is None: app.logger.warning("Expected CSRF Token: not present") abort(400) if not safe_str_c...
[ "Checks", "that", "token", "is", "correct", "aborting", "if", "not" ]
spantaleev/flask-sijax
python
https://github.com/spantaleev/flask-sijax/blob/df9f6d9b8385b3375c119a51aa100491d5445e17/examples/chat.py#L28-L38
[ "def", "check_csrf_token", "(", ")", ":", "if", "request", ".", "method", "in", "(", "\"GET\"", ",", ")", ":", "# not exhaustive list", "return", "token", "=", "request", ".", "form", ".", "get", "(", "\"csrf_token\"", ")", "if", "token", "is", "None", "...
df9f6d9b8385b3375c119a51aa100491d5445e17
train
NexusModule.get_request
Get the HTTPRequest object from thread storage or from a callee by searching each frame in the call stack.
nexus/modules.py
def get_request(cls): """ Get the HTTPRequest object from thread storage or from a callee by searching each frame in the call stack. """ request = cls.get_global('request') if request: return request try: stack = inspect.stack() exc...
def get_request(cls): """ Get the HTTPRequest object from thread storage or from a callee by searching each frame in the call stack. """ request = cls.get_global('request') if request: return request try: stack = inspect.stack() exc...
[ "Get", "the", "HTTPRequest", "object", "from", "thread", "storage", "or", "from", "a", "callee", "by", "searching", "each", "frame", "in", "the", "call", "stack", "." ]
disqus/nexus
python
https://github.com/disqus/nexus/blob/d761ac7f24d92237ca9ea2eb8b66476832f66486/nexus/modules.py#L61-L80
[ "def", "get_request", "(", "cls", ")", ":", "request", "=", "cls", ".", "get_global", "(", "'request'", ")", "if", "request", ":", "return", "request", "try", ":", "stack", "=", "inspect", ".", "stack", "(", ")", "except", "IndexError", ":", "# in some c...
d761ac7f24d92237ca9ea2eb8b66476832f66486
train
route
An alternative to :meth:`flask.Flask.route` or :meth:`flask.Blueprint.route` that always adds the ``POST`` method to the allowed endpoint request methods. You should use this for all your view functions that would need to use Sijax. We're doing this because Sijax uses ``POST`` for data passing, which ...
flask_sijax.py
def route(app_or_blueprint, rule, **options): """An alternative to :meth:`flask.Flask.route` or :meth:`flask.Blueprint.route` that always adds the ``POST`` method to the allowed endpoint request methods. You should use this for all your view functions that would need to use Sijax. We're doing this bec...
def route(app_or_blueprint, rule, **options): """An alternative to :meth:`flask.Flask.route` or :meth:`flask.Blueprint.route` that always adds the ``POST`` method to the allowed endpoint request methods. You should use this for all your view functions that would need to use Sijax. We're doing this bec...
[ "An", "alternative", "to", ":", "meth", ":", "flask", ".", "Flask", ".", "route", "or", ":", "meth", ":", "flask", ".", "Blueprint", ".", "route", "that", "always", "adds", "the", "POST", "method", "to", "the", "allowed", "endpoint", "request", "methods"...
spantaleev/flask-sijax
python
https://github.com/spantaleev/flask-sijax/blob/df9f6d9b8385b3375c119a51aa100491d5445e17/flask_sijax.py#L177-L207
[ "def", "route", "(", "app_or_blueprint", ",", "rule", ",", "*", "*", "options", ")", ":", "def", "decorator", "(", "f", ")", ":", "methods", "=", "options", ".", "pop", "(", "'methods'", ",", "(", "'GET'", ",", "'POST'", ")", ")", "if", "'POST'", "...
df9f6d9b8385b3375c119a51aa100491d5445e17
train
_make_response
Takes a Sijax response object and returns a valid Flask response object.
flask_sijax.py
def _make_response(sijax_response): """Takes a Sijax response object and returns a valid Flask response object.""" from types import GeneratorType if isinstance(sijax_response, GeneratorType): # Streaming response using a generator (non-JSON response). # Upon returning a response, Flask...
def _make_response(sijax_response): """Takes a Sijax response object and returns a valid Flask response object.""" from types import GeneratorType if isinstance(sijax_response, GeneratorType): # Streaming response using a generator (non-JSON response). # Upon returning a response, Flask...
[ "Takes", "a", "Sijax", "response", "object", "and", "returns", "a", "valid", "Flask", "response", "object", "." ]
spantaleev/flask-sijax
python
https://github.com/spantaleev/flask-sijax/blob/df9f6d9b8385b3375c119a51aa100491d5445e17/flask_sijax.py#L210-L238
[ "def", "_make_response", "(", "sijax_response", ")", ":", "from", "types", "import", "GeneratorType", "if", "isinstance", "(", "sijax_response", ",", "GeneratorType", ")", ":", "# Streaming response using a generator (non-JSON response).", "# Upon returning a response, Flask wo...
df9f6d9b8385b3375c119a51aa100491d5445e17
train
Sijax.register_comet_callback
Registers a single Comet callback function (see :ref:`comet-plugin`). Refer to :func:`sijax.plugin.comet.register_comet_callback` for more details - its signature differs slightly. This method's signature is the same, except that the first argument that :func:`sijax.plugin.come...
flask_sijax.py
def register_comet_callback(self, *args, **kwargs): """Registers a single Comet callback function (see :ref:`comet-plugin`). Refer to :func:`sijax.plugin.comet.register_comet_callback` for more details - its signature differs slightly. This method's signature is the same, excep...
def register_comet_callback(self, *args, **kwargs): """Registers a single Comet callback function (see :ref:`comet-plugin`). Refer to :func:`sijax.plugin.comet.register_comet_callback` for more details - its signature differs slightly. This method's signature is the same, excep...
[ "Registers", "a", "single", "Comet", "callback", "function", "(", "see", ":", "ref", ":", "comet", "-", "plugin", ")", "." ]
spantaleev/flask-sijax
python
https://github.com/spantaleev/flask-sijax/blob/df9f6d9b8385b3375c119a51aa100491d5445e17/flask_sijax.py#L85-L97
[ "def", "register_comet_callback", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "sijax", ".", "plugin", ".", "comet", ".", "register_comet_callback", "(", "self", ".", "_sijax", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
df9f6d9b8385b3375c119a51aa100491d5445e17
train
Sijax.register_comet_object
Registers all functions from the object as Comet functions (see :ref:`comet-plugin`). This makes mass registration of functions a lot easier. Refer to :func:`sijax.plugin.comet.register_comet_object` for more details -ts signature differs slightly. This method's signature is t...
flask_sijax.py
def register_comet_object(self, *args, **kwargs): """Registers all functions from the object as Comet functions (see :ref:`comet-plugin`). This makes mass registration of functions a lot easier. Refer to :func:`sijax.plugin.comet.register_comet_object` for more details -ts sign...
def register_comet_object(self, *args, **kwargs): """Registers all functions from the object as Comet functions (see :ref:`comet-plugin`). This makes mass registration of functions a lot easier. Refer to :func:`sijax.plugin.comet.register_comet_object` for more details -ts sign...
[ "Registers", "all", "functions", "from", "the", "object", "as", "Comet", "functions", "(", "see", ":", "ref", ":", "comet", "-", "plugin", ")", "." ]
spantaleev/flask-sijax
python
https://github.com/spantaleev/flask-sijax/blob/df9f6d9b8385b3375c119a51aa100491d5445e17/flask_sijax.py#L99-L113
[ "def", "register_comet_object", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "sijax", ".", "plugin", ".", "comet", ".", "register_comet_object", "(", "self", ".", "_sijax", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
df9f6d9b8385b3375c119a51aa100491d5445e17
train
Sijax.register_upload_callback
Registers an Upload function (see :ref:`upload-plugin`) to handle a certain form. Refer to :func:`sijax.plugin.upload.register_upload_callback` for more details. This method passes some additional arguments to your handler functions - the ``flask.request.files`` object. ...
flask_sijax.py
def register_upload_callback(self, *args, **kwargs): """Registers an Upload function (see :ref:`upload-plugin`) to handle a certain form. Refer to :func:`sijax.plugin.upload.register_upload_callback` for more details. This method passes some additional arguments to your handler...
def register_upload_callback(self, *args, **kwargs): """Registers an Upload function (see :ref:`upload-plugin`) to handle a certain form. Refer to :func:`sijax.plugin.upload.register_upload_callback` for more details. This method passes some additional arguments to your handler...
[ "Registers", "an", "Upload", "function", "(", "see", ":", "ref", ":", "upload", "-", "plugin", ")", "to", "handle", "a", "certain", "form", "." ]
spantaleev/flask-sijax
python
https://github.com/spantaleev/flask-sijax/blob/df9f6d9b8385b3375c119a51aa100491d5445e17/flask_sijax.py#L115-L133
[ "def", "register_upload_callback", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'args_extra'", "not", "in", "kwargs", ":", "kwargs", "[", "'args_extra'", "]", "=", "[", "request", ".", "files", "]", "return", "sijax", ".", "...
df9f6d9b8385b3375c119a51aa100491d5445e17
train
Sijax.execute_callback
Executes a callback and returns the proper response. Refer to :meth:`sijax.Sijax.execute_callback` for more details.
flask_sijax.py
def execute_callback(self, *args, **kwargs): """Executes a callback and returns the proper response. Refer to :meth:`sijax.Sijax.execute_callback` for more details. """ response = self._sijax.execute_callback(*args, **kwargs) return _make_response(response)
def execute_callback(self, *args, **kwargs): """Executes a callback and returns the proper response. Refer to :meth:`sijax.Sijax.execute_callback` for more details. """ response = self._sijax.execute_callback(*args, **kwargs) return _make_response(response)
[ "Executes", "a", "callback", "and", "returns", "the", "proper", "response", "." ]
spantaleev/flask-sijax
python
https://github.com/spantaleev/flask-sijax/blob/df9f6d9b8385b3375c119a51aa100491d5445e17/flask_sijax.py#L160-L166
[ "def", "execute_callback", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "self", ".", "_sijax", ".", "execute_callback", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "_make_response", "(", "response", "...
df9f6d9b8385b3375c119a51aa100491d5445e17
train
NexusSite.has_permission
Returns True if the given HttpRequest has permission to view *at least one* page in the admin site.
nexus/sites.py
def has_permission(self, request, extra_permission=None): """ Returns True if the given HttpRequest has permission to view *at least one* page in the admin site. """ permission = request.user.is_active and request.user.is_staff if extra_permission: permission ...
def has_permission(self, request, extra_permission=None): """ Returns True if the given HttpRequest has permission to view *at least one* page in the admin site. """ permission = request.user.is_active and request.user.is_staff if extra_permission: permission ...
[ "Returns", "True", "if", "the", "given", "HttpRequest", "has", "permission", "to", "view", "*", "at", "least", "one", "*", "page", "in", "the", "admin", "site", "." ]
disqus/nexus
python
https://github.com/disqus/nexus/blob/d761ac7f24d92237ca9ea2eb8b66476832f66486/nexus/sites.py#L116-L124
[ "def", "has_permission", "(", "self", ",", "request", ",", "extra_permission", "=", "None", ")", ":", "permission", "=", "request", ".", "user", ".", "is_active", "and", "request", ".", "user", ".", "is_staff", "if", "extra_permission", ":", "permission", "=...
d761ac7f24d92237ca9ea2eb8b66476832f66486
train
NexusSite.as_view
Wraps a view in authentication/caching logic extra_permission can be used to require an extra permission for this view, such as a module permission
nexus/sites.py
def as_view(self, view, cacheable=False, extra_permission=None): """ Wraps a view in authentication/caching logic extra_permission can be used to require an extra permission for this view, such as a module permission """ def inner(request, *args, **kwargs): if not se...
def as_view(self, view, cacheable=False, extra_permission=None): """ Wraps a view in authentication/caching logic extra_permission can be used to require an extra permission for this view, such as a module permission """ def inner(request, *args, **kwargs): if not se...
[ "Wraps", "a", "view", "in", "authentication", "/", "caching", "logic" ]
disqus/nexus
python
https://github.com/disqus/nexus/blob/d761ac7f24d92237ca9ea2eb8b66476832f66486/nexus/sites.py#L126-L149
[ "def", "as_view", "(", "self", ",", "view", ",", "cacheable", "=", "False", ",", "extra_permission", "=", "None", ")", ":", "def", "inner", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "has_permission...
d761ac7f24d92237ca9ea2eb8b66476832f66486
train
NexusSite.media
Serve static files below a given point in the directory structure.
nexus/sites.py
def media(self, request, module, path): """ Serve static files below a given point in the directory structure. """ if module == 'nexus': document_root = os.path.join(NEXUS_ROOT, 'media') else: document_root = self.get_module(module).media_root pat...
def media(self, request, module, path): """ Serve static files below a given point in the directory structure. """ if module == 'nexus': document_root = os.path.join(NEXUS_ROOT, 'media') else: document_root = self.get_module(module).media_root pat...
[ "Serve", "static", "files", "below", "a", "given", "point", "in", "the", "directory", "structure", "." ]
disqus/nexus
python
https://github.com/disqus/nexus/blob/d761ac7f24d92237ca9ea2eb8b66476832f66486/nexus/sites.py#L211-L250
[ "def", "media", "(", "self", ",", "request", ",", "module", ",", "path", ")", ":", "if", "module", "==", "'nexus'", ":", "document_root", "=", "os", ".", "path", ".", "join", "(", "NEXUS_ROOT", ",", "'media'", ")", "else", ":", "document_root", "=", ...
d761ac7f24d92237ca9ea2eb8b66476832f66486
train
NexusSite.login
Login form
nexus/sites.py
def login(self, request, form_class=None): "Login form" from django.contrib.auth import login as login_ from django.contrib.auth.forms import AuthenticationForm if form_class is None: form_class = AuthenticationForm if request.POST: form = form_class(req...
def login(self, request, form_class=None): "Login form" from django.contrib.auth import login as login_ from django.contrib.auth.forms import AuthenticationForm if form_class is None: form_class = AuthenticationForm if request.POST: form = form_class(req...
[ "Login", "form" ]
disqus/nexus
python
https://github.com/disqus/nexus/blob/d761ac7f24d92237ca9ea2eb8b66476832f66486/nexus/sites.py#L252-L274
[ "def", "login", "(", "self", ",", "request", ",", "form_class", "=", "None", ")", ":", "from", "django", ".", "contrib", ".", "auth", "import", "login", "as", "login_", "from", "django", ".", "contrib", ".", "auth", ".", "forms", "import", "Authenticatio...
d761ac7f24d92237ca9ea2eb8b66476832f66486
train
NexusSite.logout
Logs out user and redirects them to Nexus home
nexus/sites.py
def logout(self, request): "Logs out user and redirects them to Nexus home" from django.contrib.auth import logout logout(request) return HttpResponseRedirect(reverse('nexus:index', current_app=self.name))
def logout(self, request): "Logs out user and redirects them to Nexus home" from django.contrib.auth import logout logout(request) return HttpResponseRedirect(reverse('nexus:index', current_app=self.name))
[ "Logs", "out", "user", "and", "redirects", "them", "to", "Nexus", "home" ]
disqus/nexus
python
https://github.com/disqus/nexus/blob/d761ac7f24d92237ca9ea2eb8b66476832f66486/nexus/sites.py#L277-L283
[ "def", "logout", "(", "self", ",", "request", ")", ":", "from", "django", ".", "contrib", ".", "auth", "import", "logout", "logout", "(", "request", ")", "return", "HttpResponseRedirect", "(", "reverse", "(", "'nexus:index'", ",", "current_app", "=", "self",...
d761ac7f24d92237ca9ea2eb8b66476832f66486
train
NexusSite.dashboard
Basic dashboard panel
nexus/sites.py
def dashboard(self, request): "Basic dashboard panel" # TODO: these should be ajax module_set = [] for namespace, module in self.get_modules(): home_url = module.get_home_url(request) if hasattr(module, 'render_on_dashboard'): # Show by default, u...
def dashboard(self, request): "Basic dashboard panel" # TODO: these should be ajax module_set = [] for namespace, module in self.get_modules(): home_url = module.get_home_url(request) if hasattr(module, 'render_on_dashboard'): # Show by default, u...
[ "Basic", "dashboard", "panel" ]
disqus/nexus
python
https://github.com/disqus/nexus/blob/d761ac7f24d92237ca9ea2eb8b66476832f66486/nexus/sites.py#L285-L299
[ "def", "dashboard", "(", "self", ",", "request", ")", ":", "# TODO: these should be ajax", "module_set", "=", "[", "]", "for", "namespace", ",", "module", "in", "self", ".", "get_modules", "(", ")", ":", "home_url", "=", "module", ".", "get_home_url", "(", ...
d761ac7f24d92237ca9ea2eb8b66476832f66486
train
submit_row
Displays the row of buttons for delete and save.
nexus/templatetags/nexus_admin.py
def submit_row(context): """ Displays the row of buttons for delete and save. """ opts = context['opts'] change = context['change'] is_popup = context['is_popup'] save_as = context['save_as'] return { 'onclick_attrib': (opts.get_ordered_objects() and change ...
def submit_row(context): """ Displays the row of buttons for delete and save. """ opts = context['opts'] change = context['change'] is_popup = context['is_popup'] save_as = context['save_as'] return { 'onclick_attrib': (opts.get_ordered_objects() and change ...
[ "Displays", "the", "row", "of", "buttons", "for", "delete", "and", "save", "." ]
disqus/nexus
python
https://github.com/disqus/nexus/blob/d761ac7f24d92237ca9ea2eb8b66476832f66486/nexus/templatetags/nexus_admin.py#L5-L24
[ "def", "submit_row", "(", "context", ")", ":", "opts", "=", "context", "[", "'opts'", "]", "change", "=", "context", "[", "'change'", "]", "is_popup", "=", "context", "[", "'is_popup'", "]", "save_as", "=", "context", "[", "'save_as'", "]", "return", "{"...
d761ac7f24d92237ca9ea2eb8b66476832f66486
train
autodiscover
Auto-discover INSTALLED_APPS nexus.py modules and fail silently when not present. This forces an import on them to register any api bits they may want. Specifying ``site`` will register all auto discovered modules with the new site.
nexus/__init__.py
def autodiscover(site=None): """ Auto-discover INSTALLED_APPS nexus.py modules and fail silently when not present. This forces an import on them to register any api bits they may want. Specifying ``site`` will register all auto discovered modules with the new site. """ # Bail out if autodis...
def autodiscover(site=None): """ Auto-discover INSTALLED_APPS nexus.py modules and fail silently when not present. This forces an import on them to register any api bits they may want. Specifying ``site`` will register all auto discovered modules with the new site. """ # Bail out if autodis...
[ "Auto", "-", "discover", "INSTALLED_APPS", "nexus", ".", "py", "modules", "and", "fail", "silently", "when", "not", "present", ".", "This", "forces", "an", "import", "on", "them", "to", "register", "any", "api", "bits", "they", "may", "want", "." ]
disqus/nexus
python
https://github.com/disqus/nexus/blob/d761ac7f24d92237ca9ea2eb8b66476832f66486/nexus/__init__.py#L23-L83
[ "def", "autodiscover", "(", "site", "=", "None", ")", ":", "# Bail out if autodiscover didn't finish loading from a previous call so", "# that we avoid running autodiscover again when the URLconf is loaded by", "# the exception handler to resolve the handler500 view. This prevents an", "# adm...
d761ac7f24d92237ca9ea2eb8b66476832f66486
train
AdvancedHTMLParser.handle_starttag
Internal for parsing
AdvancedHTMLParser/Parser.py
def handle_starttag(self, tagName, attributeList, isSelfClosing=False): ''' Internal for parsing ''' tagName = tagName.lower() inTag = self._inTag if isSelfClosing is False and tagName in IMPLICIT_SELF_CLOSING_TAGS: isSelfClosing = True newTag = ...
def handle_starttag(self, tagName, attributeList, isSelfClosing=False): ''' Internal for parsing ''' tagName = tagName.lower() inTag = self._inTag if isSelfClosing is False and tagName in IMPLICIT_SELF_CLOSING_TAGS: isSelfClosing = True newTag = ...
[ "Internal", "for", "parsing" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L124-L145
[ "def", "handle_starttag", "(", "self", ",", "tagName", ",", "attributeList", ",", "isSelfClosing", "=", "False", ")", ":", "tagName", "=", "tagName", ".", "lower", "(", ")", "inTag", "=", "self", ".", "_inTag", "if", "isSelfClosing", "is", "False", "and", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.handle_endtag
Internal for parsing
AdvancedHTMLParser/Parser.py
def handle_endtag(self, tagName): ''' Internal for parsing ''' try: foundIt = False inTag = self._inTag for i in range(len(inTag)): if inTag[i].tagName == tagName: foundIt = True break ...
def handle_endtag(self, tagName): ''' Internal for parsing ''' try: foundIt = False inTag = self._inTag for i in range(len(inTag)): if inTag[i].tagName == tagName: foundIt = True break ...
[ "Internal", "for", "parsing" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L153-L173
[ "def", "handle_endtag", "(", "self", ",", "tagName", ")", ":", "try", ":", "foundIt", "=", "False", "inTag", "=", "self", ".", "_inTag", "for", "i", "in", "range", "(", "len", "(", "inTag", ")", ")", ":", "if", "inTag", "[", "i", "]", ".", "tagNa...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.handle_data
Internal for parsing
AdvancedHTMLParser/Parser.py
def handle_data(self, data): ''' Internal for parsing ''' if data: inTag = self._inTag if len(inTag) > 0: inTag[-1].appendText(data) elif data.strip(): #and not self.getRoot(): # Must be text prior to or after root n...
def handle_data(self, data): ''' Internal for parsing ''' if data: inTag = self._inTag if len(inTag) > 0: inTag[-1].appendText(data) elif data.strip(): #and not self.getRoot(): # Must be text prior to or after root n...
[ "Internal", "for", "parsing" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L176-L186
[ "def", "handle_data", "(", "self", ",", "data", ")", ":", "if", "data", ":", "inTag", "=", "self", ".", "_inTag", "if", "len", "(", "inTag", ")", ">", "0", ":", "inTag", "[", "-", "1", "]", ".", "appendText", "(", "data", ")", "elif", "data", "...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.handle_entityref
Internal for parsing
AdvancedHTMLParser/Parser.py
def handle_entityref(self, entity): ''' Internal for parsing ''' inTag = self._inTag if len(inTag) > 0: inTag[-1].appendText('&%s;' %(entity,)) else: raise MultipleRootNodeException()
def handle_entityref(self, entity): ''' Internal for parsing ''' inTag = self._inTag if len(inTag) > 0: inTag[-1].appendText('&%s;' %(entity,)) else: raise MultipleRootNodeException()
[ "Internal", "for", "parsing" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L188-L196
[ "def", "handle_entityref", "(", "self", ",", "entity", ")", ":", "inTag", "=", "self", ".", "_inTag", "if", "len", "(", "inTag", ")", ">", "0", ":", "inTag", "[", "-", "1", "]", ".", "appendText", "(", "'&%s;'", "%", "(", "entity", ",", ")", ")",...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.handle_charref
Internal for parsing
AdvancedHTMLParser/Parser.py
def handle_charref(self, charRef): ''' Internal for parsing ''' inTag = self._inTag if len(inTag) > 0: inTag[-1].appendText('&#%s;' %(charRef,)) else: raise MultipleRootNodeException()
def handle_charref(self, charRef): ''' Internal for parsing ''' inTag = self._inTag if len(inTag) > 0: inTag[-1].appendText('&#%s;' %(charRef,)) else: raise MultipleRootNodeException()
[ "Internal", "for", "parsing" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L198-L206
[ "def", "handle_charref", "(", "self", ",", "charRef", ")", ":", "inTag", "=", "self", ".", "_inTag", "if", "len", "(", "inTag", ")", ">", "0", ":", "inTag", "[", "-", "1", "]", ".", "appendText", "(", "'&#%s;'", "%", "(", "charRef", ",", ")", ")"...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.handle_comment
Internal for parsing
AdvancedHTMLParser/Parser.py
def handle_comment(self, comment): ''' Internal for parsing ''' inTag = self._inTag if len(inTag) > 0: inTag[-1].appendText('<!-- %s -->' %(comment,)) else: raise MultipleRootNodeException()
def handle_comment(self, comment): ''' Internal for parsing ''' inTag = self._inTag if len(inTag) > 0: inTag[-1].appendText('<!-- %s -->' %(comment,)) else: raise MultipleRootNodeException()
[ "Internal", "for", "parsing" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L208-L216
[ "def", "handle_comment", "(", "self", ",", "comment", ")", ":", "inTag", "=", "self", ".", "_inTag", "if", "len", "(", "inTag", ")", ">", "0", ":", "inTag", "[", "-", "1", "]", ".", "appendText", "(", "'<!-- %s -->'", "%", "(", "comment", ",", ")",...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.getRootNodes
getRootNodes - Gets all objects at the "root" (first level; no parent). Use this if you may have multiple roots (not children of <html>) Use this method to get objects, for example, in an AJAX request where <html> may not be your root. Note: If there are multiple root nodes (i.e. no <ht...
AdvancedHTMLParser/Parser.py
def getRootNodes(self): ''' getRootNodes - Gets all objects at the "root" (first level; no parent). Use this if you may have multiple roots (not children of <html>) Use this method to get objects, for example, in an AJAX request where <html> may not be your root. Not...
def getRootNodes(self): ''' getRootNodes - Gets all objects at the "root" (first level; no parent). Use this if you may have multiple roots (not children of <html>) Use this method to get objects, for example, in an AJAX request where <html> may not be your root. Not...
[ "getRootNodes", "-", "Gets", "all", "objects", "at", "the", "root", "(", "first", "level", ";", "no", "parent", ")", ".", "Use", "this", "if", "you", "may", "have", "multiple", "roots", "(", "not", "children", "of", "<html", ">", ")", "Use", "this", ...
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L247-L262
[ "def", "getRootNodes", "(", "self", ")", ":", "root", "=", "self", ".", "root", "if", "not", "root", ":", "return", "[", "]", "if", "root", ".", "tagName", "==", "INVISIBLE_ROOT_TAG", ":", "return", "list", "(", "root", ".", "children", ")", "return", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.getAllNodes
getAllNodes - Get every element @return TagCollection<AdvancedTag>
AdvancedHTMLParser/Parser.py
def getAllNodes(self): ''' getAllNodes - Get every element @return TagCollection<AdvancedTag> ''' ret = TagCollection() for rootNode in self.getRootNodes(): ret.append(rootNode) ret += rootNode.getAllChildNodes() return ret
def getAllNodes(self): ''' getAllNodes - Get every element @return TagCollection<AdvancedTag> ''' ret = TagCollection() for rootNode in self.getRootNodes(): ret.append(rootNode) ret += rootNode.getAllChildNodes() return ret
[ "getAllNodes", "-", "Get", "every", "element" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L264-L278
[ "def", "getAllNodes", "(", "self", ")", ":", "ret", "=", "TagCollection", "(", ")", "for", "rootNode", "in", "self", ".", "getRootNodes", "(", ")", ":", "ret", ".", "append", "(", "rootNode", ")", "ret", "+=", "rootNode", ".", "getAllChildNodes", "(", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.getElementsByTagName
getElementsByTagName - Searches and returns all elements with a specific tag name. @param tagName <lowercase str> - A lowercase string of the tag name. @param root <AdvancedTag/'root'> - Search starting at a specific node, if provided. if string 'root', the root of the p...
AdvancedHTMLParser/Parser.py
def getElementsByTagName(self, tagName, root='root'): ''' getElementsByTagName - Searches and returns all elements with a specific tag name. @param tagName <lowercase str> - A lowercase string of the tag name. @param root <AdvancedTag/'root'> - Search...
def getElementsByTagName(self, tagName, root='root'): ''' getElementsByTagName - Searches and returns all elements with a specific tag name. @param tagName <lowercase str> - A lowercase string of the tag name. @param root <AdvancedTag/'root'> - Search...
[ "getElementsByTagName", "-", "Searches", "and", "returns", "all", "elements", "with", "a", "specific", "tag", "name", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L286-L308
[ "def", "getElementsByTagName", "(", "self", ",", "tagName", ",", "root", "=", "'root'", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "elements", "=", "[", "]", "if", "isFromRoot", "is", "True", "a...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.getElementsByName
getElementsByName - Searches and returns all elements with a specific name. @param name <str> - A string of the name attribute @param root <AdvancedTag/'root'> - Search starting at a specific node, if provided. if string 'root' [default], the root of the parsed tree will ...
AdvancedHTMLParser/Parser.py
def getElementsByName(self, name, root='root'): ''' getElementsByName - Searches and returns all elements with a specific name. @param name <str> - A string of the name attribute @param root <AdvancedTag/'root'> - Search starting at a specific node, if...
def getElementsByName(self, name, root='root'): ''' getElementsByName - Searches and returns all elements with a specific name. @param name <str> - A string of the name attribute @param root <AdvancedTag/'root'> - Search starting at a specific node, if...
[ "getElementsByName", "-", "Searches", "and", "returns", "all", "elements", "with", "a", "specific", "name", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L310-L332
[ "def", "getElementsByName", "(", "self", ",", "name", ",", "root", "=", "'root'", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "elements", "=", "[", "]", "if", "isFromRoot", "is", "True", "and", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.getElementById
getElementById - Searches and returns the first (should only be one) element with the given ID. @param id <str> - A string of the id attribute. @param root <AdvancedTag/'root'> - Search starting at a specific node, if provided. if string 'root' [default], the root of the ...
AdvancedHTMLParser/Parser.py
def getElementById(self, _id, root='root'): ''' getElementById - Searches and returns the first (should only be one) element with the given ID. @param id <str> - A string of the id attribute. @param root <AdvancedTag/'root'> - Search starting at a spec...
def getElementById(self, _id, root='root'): ''' getElementById - Searches and returns the first (should only be one) element with the given ID. @param id <str> - A string of the id attribute. @param root <AdvancedTag/'root'> - Search starting at a spec...
[ "getElementById", "-", "Searches", "and", "returns", "the", "first", "(", "should", "only", "be", "one", ")", "element", "with", "the", "given", "ID", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L334-L356
[ "def", "getElementById", "(", "self", ",", "_id", ",", "root", "=", "'root'", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "if", "isFromRoot", "is", "True", "and", "root", ".", "id", "==", "_id"...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.getElementsByClassName
getElementsByClassName - Searches and returns all elements containing a given class name. @param className <str> - A one-word class name @param root <AdvancedTag/'root'> - Search starting at a specific node, if provided. if string 'root' [default], the root of the parsed ...
AdvancedHTMLParser/Parser.py
def getElementsByClassName(self, className, root='root'): ''' getElementsByClassName - Searches and returns all elements containing a given class name. @param className <str> - A one-word class name @param root <AdvancedTag/'root'> - Search starting at...
def getElementsByClassName(self, className, root='root'): ''' getElementsByClassName - Searches and returns all elements containing a given class name. @param className <str> - A one-word class name @param root <AdvancedTag/'root'> - Search starting at...
[ "getElementsByClassName", "-", "Searches", "and", "returns", "all", "elements", "containing", "a", "given", "class", "name", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L358-L380
[ "def", "getElementsByClassName", "(", "self", ",", "className", ",", "root", "=", "'root'", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "elements", "=", "[", "]", "if", "isFromRoot", "is", "True", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.getElementsByAttr
getElementsByAttr - Searches the full tree for elements with a given attribute name and value combination. This is always a full scan. @param attrName <lowercase str> - A lowercase attribute name @param attrValue <str> - Expected value of attribute @param ...
AdvancedHTMLParser/Parser.py
def getElementsByAttr(self, attrName, attrValue, root='root'): ''' getElementsByAttr - Searches the full tree for elements with a given attribute name and value combination. This is always a full scan. @param attrName <lowercase str> - A lowercase attribute name ...
def getElementsByAttr(self, attrName, attrValue, root='root'): ''' getElementsByAttr - Searches the full tree for elements with a given attribute name and value combination. This is always a full scan. @param attrName <lowercase str> - A lowercase attribute name ...
[ "getElementsByAttr", "-", "Searches", "the", "full", "tree", "for", "elements", "with", "a", "given", "attribute", "name", "and", "value", "combination", ".", "This", "is", "always", "a", "full", "scan", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L382-L405
[ "def", "getElementsByAttr", "(", "self", ",", "attrName", ",", "attrValue", ",", "root", "=", "'root'", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "elements", "=", "[", "]", "if", "isFromRoot", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.getElementsWithAttrValues
getElementsWithAttrValues - Returns elements with an attribute, named by #attrName contains one of the values in the list, #values @param attrName <lowercase str> - A lowercase attribute name @param attrValues set<str> - A set of all valid values. @return - TagCollection of all m...
AdvancedHTMLParser/Parser.py
def getElementsWithAttrValues(self, attrName, attrValues, root='root'): ''' getElementsWithAttrValues - Returns elements with an attribute, named by #attrName contains one of the values in the list, #values @param attrName <lowercase str> - A lowercase attribute name @param ...
def getElementsWithAttrValues(self, attrName, attrValues, root='root'): ''' getElementsWithAttrValues - Returns elements with an attribute, named by #attrName contains one of the values in the list, #values @param attrName <lowercase str> - A lowercase attribute name @param ...
[ "getElementsWithAttrValues", "-", "Returns", "elements", "with", "an", "attribute", "named", "by", "#attrName", "contains", "one", "of", "the", "values", "in", "the", "list", "#values" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L407-L423
[ "def", "getElementsWithAttrValues", "(", "self", ",", "attrName", ",", "attrValues", ",", "root", "=", "'root'", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "if", "type", "(", "attrValues", ")", "!...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.getElementsCustomFilter
getElementsCustomFilter - Scan elements using a provided function @param filterFunc <function>(node) - A function that takes an AdvancedTag as an argument, and returns True if some arbitrary criteria is met @return - TagCollection of all matching elements
AdvancedHTMLParser/Parser.py
def getElementsCustomFilter(self, filterFunc, root='root'): ''' getElementsCustomFilter - Scan elements using a provided function @param filterFunc <function>(node) - A function that takes an AdvancedTag as an argument, and returns True if some arbitrary criteria is met @re...
def getElementsCustomFilter(self, filterFunc, root='root'): ''' getElementsCustomFilter - Scan elements using a provided function @param filterFunc <function>(node) - A function that takes an AdvancedTag as an argument, and returns True if some arbitrary criteria is met @re...
[ "getElementsCustomFilter", "-", "Scan", "elements", "using", "a", "provided", "function" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L426-L449
[ "def", "getElementsCustomFilter", "(", "self", ",", "filterFunc", ",", "root", "=", "'root'", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "elements", "=", "[", "]", "if", "isFromRoot", "is", "True"...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.getFirstElementCustomFilter
getFirstElementCustomFilter - Scan elements using a provided function, stop and return the first match. @see getElementsCustomFilter to match multiple elements @param filterFunc <function>(node) - A function that takes an AdvancedTag as an argument, and returns True if some arbitrary crite...
AdvancedHTMLParser/Parser.py
def getFirstElementCustomFilter(self, filterFunc, root='root'): ''' getFirstElementCustomFilter - Scan elements using a provided function, stop and return the first match. @see getElementsCustomFilter to match multiple elements @param filterFunc <function>(node) - A fun...
def getFirstElementCustomFilter(self, filterFunc, root='root'): ''' getFirstElementCustomFilter - Scan elements using a provided function, stop and return the first match. @see getElementsCustomFilter to match multiple elements @param filterFunc <function>(node) - A fun...
[ "getFirstElementCustomFilter", "-", "Scan", "elements", "using", "a", "provided", "function", "stop", "and", "return", "the", "first", "match", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L452-L481
[ "def", "getFirstElementCustomFilter", "(", "self", ",", "filterFunc", ",", "root", "=", "'root'", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "elements", "=", "[", "]", "if", "isFromRoot", "is", "T...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.contains
Checks if #em is found anywhere within this element tree @param em <AdvancedTag> - Tag of interest @return <bool> - If element #em is within this tree
AdvancedHTMLParser/Parser.py
def contains(self, em): ''' Checks if #em is found anywhere within this element tree @param em <AdvancedTag> - Tag of interest @return <bool> - If element #em is within this tree ''' for rootNode in self.getRootNodes(): if rootNode.contains(em): ...
def contains(self, em): ''' Checks if #em is found anywhere within this element tree @param em <AdvancedTag> - Tag of interest @return <bool> - If element #em is within this tree ''' for rootNode in self.getRootNodes(): if rootNode.contains(em): ...
[ "Checks", "if", "#em", "is", "found", "anywhere", "within", "this", "element", "tree" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L511-L523
[ "def", "contains", "(", "self", ",", "em", ")", ":", "for", "rootNode", "in", "self", ".", "getRootNodes", "(", ")", ":", "if", "rootNode", ".", "contains", "(", "em", ")", ":", "return", "True", "return", "False" ]
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.containsUid
Check if #uid is found anywhere within this element tree @param uid <uuid.UUID> - Uid @return <bool> - If #uid is found within this tree
AdvancedHTMLParser/Parser.py
def containsUid(self, uid): ''' Check if #uid is found anywhere within this element tree @param uid <uuid.UUID> - Uid @return <bool> - If #uid is found within this tree ''' for rootNode in self.getRootNodes(): if rootNode.containsUid(uid): ...
def containsUid(self, uid): ''' Check if #uid is found anywhere within this element tree @param uid <uuid.UUID> - Uid @return <bool> - If #uid is found within this tree ''' for rootNode in self.getRootNodes(): if rootNode.containsUid(uid): ...
[ "Check", "if", "#uid", "is", "found", "anywhere", "within", "this", "element", "tree" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L527-L539
[ "def", "containsUid", "(", "self", ",", "uid", ")", ":", "for", "rootNode", "in", "self", ".", "getRootNodes", "(", ")", ":", "if", "rootNode", ".", "containsUid", "(", "uid", ")", ":", "return", "True", "return", "False" ]
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.find
find - Perform a search of elements using attributes as keys and potential values as values (i.e. parser.find(name='blah', tagname='span') will return all elements in this document with the name "blah" of the tag type "span" ) Arguments are key = value, or key...
AdvancedHTMLParser/Parser.py
def find(self, **kwargs): ''' find - Perform a search of elements using attributes as keys and potential values as values (i.e. parser.find(name='blah', tagname='span') will return all elements in this document with the name "blah" of the tag type "span...
def find(self, **kwargs): ''' find - Perform a search of elements using attributes as keys and potential values as values (i.e. parser.find(name='blah', tagname='span') will return all elements in this document with the name "blah" of the tag type "span...
[ "find", "-", "Perform", "a", "search", "of", "elements", "using", "attributes", "as", "keys", "and", "potential", "values", "as", "values", "(", "i", ".", "e", ".", "parser", ".", "find", "(", "name", "=", "blah", "tagname", "=", "span", ")", "will", ...
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L604-L765
[ "def", "find", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "not", "kwargs", ":", "return", "TagCollection", "(", ")", "# Because of how closures work in python, need a function to generate these lambdas", "# because the closure basically references \"current key in i...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.getHTML
getHTML - Get the full HTML as contained within this tree. If parsed from a document, this will contain the original whitespacing. @returns - <str> of html @see getFormattedHTML @see getMiniHTML
AdvancedHTMLParser/Parser.py
def getHTML(self): ''' getHTML - Get the full HTML as contained within this tree. If parsed from a document, this will contain the original whitespacing. @returns - <str> of html @see getFormattedHTML @see getMiniHTML ...
def getHTML(self): ''' getHTML - Get the full HTML as contained within this tree. If parsed from a document, this will contain the original whitespacing. @returns - <str> of html @see getFormattedHTML @see getMiniHTML ...
[ "getHTML", "-", "Get", "the", "full", "HTML", "as", "contained", "within", "this", "tree", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L768-L796
[ "def", "getHTML", "(", "self", ")", ":", "root", "=", "self", ".", "getRoot", "(", ")", "if", "root", "is", "None", ":", "raise", "ValueError", "(", "'Did not parse anything. Use parseFile or parseStr'", ")", "if", "self", ".", "doctype", ":", "doctypeStr", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.getFormattedHTML
getFormattedHTML - Get formatted and xhtml of this document, replacing the original whitespace with a pretty-printed version @param indent - space/tab/newline of each level of indent, or integer for how many spaces per level @return - <str> Formatted html @...
AdvancedHTMLParser/Parser.py
def getFormattedHTML(self, indent=' '): ''' getFormattedHTML - Get formatted and xhtml of this document, replacing the original whitespace with a pretty-printed version @param indent - space/tab/newline of each level of indent, or integer for how many spaces per level ...
def getFormattedHTML(self, indent=' '): ''' getFormattedHTML - Get formatted and xhtml of this document, replacing the original whitespace with a pretty-printed version @param indent - space/tab/newline of each level of indent, or integer for how many spaces per level ...
[ "getFormattedHTML", "-", "Get", "formatted", "and", "xhtml", "of", "this", "document", "replacing", "the", "original", "whitespace", "with", "a", "pretty", "-", "printed", "version" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L807-L824
[ "def", "getFormattedHTML", "(", "self", ",", "indent", "=", "' '", ")", ":", "from", ".", "Formatter", "import", "AdvancedHTMLFormatter", "html", "=", "self", ".", "getHTML", "(", ")", "formatter", "=", "AdvancedHTMLFormatter", "(", "indent", ",", "None", "...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.getMiniHTML
getMiniHTML - Gets the HTML representation of this document without any pretty formatting and disregarding original whitespace beyond the functional. @return <str> - HTML with only functional whitespace present
AdvancedHTMLParser/Parser.py
def getMiniHTML(self): ''' getMiniHTML - Gets the HTML representation of this document without any pretty formatting and disregarding original whitespace beyond the functional. @return <str> - HTML with only functional whitespace present ''' from .For...
def getMiniHTML(self): ''' getMiniHTML - Gets the HTML representation of this document without any pretty formatting and disregarding original whitespace beyond the functional. @return <str> - HTML with only functional whitespace present ''' from .For...
[ "getMiniHTML", "-", "Gets", "the", "HTML", "representation", "of", "this", "document", "without", "any", "pretty", "formatting", "and", "disregarding", "original", "whitespace", "beyond", "the", "functional", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L826-L837
[ "def", "getMiniHTML", "(", "self", ")", ":", "from", ".", "Formatter", "import", "AdvancedHTMLMiniFormatter", "html", "=", "self", ".", "getHTML", "(", ")", "formatter", "=", "AdvancedHTMLMiniFormatter", "(", "None", ")", "# Do not double-encode", "formatter", "."...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser._reset
_reset - reset this object. Assigned to .reset after __init__ call.
AdvancedHTMLParser/Parser.py
def _reset(self): ''' _reset - reset this object. Assigned to .reset after __init__ call. ''' HTMLParser.reset(self) self.root = None self.doctype = None self._inTag = []
def _reset(self): ''' _reset - reset this object. Assigned to .reset after __init__ call. ''' HTMLParser.reset(self) self.root = None self.doctype = None self._inTag = []
[ "_reset", "-", "reset", "this", "object", ".", "Assigned", "to", ".", "reset", "after", "__init__", "call", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L839-L847
[ "def", "_reset", "(", "self", ")", ":", "HTMLParser", ".", "reset", "(", "self", ")", "self", ".", "root", "=", "None", "self", ".", "doctype", "=", "None", "self", ".", "_inTag", "=", "[", "]" ]
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.feed
feed - Feed contents. Use parseStr or parseFile instead. @param contents - Contents
AdvancedHTMLParser/Parser.py
def feed(self, contents): ''' feed - Feed contents. Use parseStr or parseFile instead. @param contents - Contents ''' contents = stripIEConditionals(contents) try: HTMLParser.feed(self, contents) except MultipleRootNodeException: ...
def feed(self, contents): ''' feed - Feed contents. Use parseStr or parseFile instead. @param contents - Contents ''' contents = stripIEConditionals(contents) try: HTMLParser.feed(self, contents) except MultipleRootNodeException: ...
[ "feed", "-", "Feed", "contents", ".", "Use", "parseStr", "or", "parseFile", "instead", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L849-L860
[ "def", "feed", "(", "self", ",", "contents", ")", ":", "contents", "=", "stripIEConditionals", "(", "contents", ")", "try", ":", "HTMLParser", ".", "feed", "(", "self", ",", "contents", ")", "except", "MultipleRootNodeException", ":", "self", ".", "reset", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.parseFile
parseFile - Parses a file and creates the DOM tree and indexes @param filename <str/file> - A string to a filename or a file object. If file object, it will not be closed, you must close.
AdvancedHTMLParser/Parser.py
def parseFile(self, filename): ''' parseFile - Parses a file and creates the DOM tree and indexes @param filename <str/file> - A string to a filename or a file object. If file object, it will not be closed, you must close. ''' self.reset() if isinstance(...
def parseFile(self, filename): ''' parseFile - Parses a file and creates the DOM tree and indexes @param filename <str/file> - A string to a filename or a file object. If file object, it will not be closed, you must close. ''' self.reset() if isinstance(...
[ "parseFile", "-", "Parses", "a", "file", "and", "creates", "the", "DOM", "tree", "and", "indexes" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L862-L876
[ "def", "parseFile", "(", "self", ",", "filename", ")", ":", "self", ".", "reset", "(", ")", "if", "isinstance", "(", "filename", ",", "file", ")", ":", "contents", "=", "filename", ".", "read", "(", ")", "else", ":", "with", "codecs", ".", "open", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.parseStr
parseStr - Parses a string and creates the DOM tree and indexes. @param html <str> - valid HTML
AdvancedHTMLParser/Parser.py
def parseStr(self, html): ''' parseStr - Parses a string and creates the DOM tree and indexes. @param html <str> - valid HTML ''' self.reset() if isinstance(html, bytes): self.feed(html.decode(self.encoding)) else: self.feed(h...
def parseStr(self, html): ''' parseStr - Parses a string and creates the DOM tree and indexes. @param html <str> - valid HTML ''' self.reset() if isinstance(html, bytes): self.feed(html.decode(self.encoding)) else: self.feed(h...
[ "parseStr", "-", "Parses", "a", "string", "and", "creates", "the", "DOM", "tree", "and", "indexes", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L878-L889
[ "def", "parseStr", "(", "self", ",", "html", ")", ":", "self", ".", "reset", "(", ")", "if", "isinstance", "(", "html", ",", "bytes", ")", ":", "self", ".", "feed", "(", "html", ".", "decode", "(", "self", ".", "encoding", ")", ")", "else", ":", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.createElementFromHTML
createElementFromHTML - Creates an element from a string of HTML. If this could create multiple root-level elements (children are okay), you must use #createElementsFromHTML which returns a list of elements created. @param html <str> - Some html data @param e...
AdvancedHTMLParser/Parser.py
def createElementFromHTML(cls, html, encoding='utf-8'): ''' createElementFromHTML - Creates an element from a string of HTML. If this could create multiple root-level elements (children are okay), you must use #createElementsFromHTML which returns a list of element...
def createElementFromHTML(cls, html, encoding='utf-8'): ''' createElementFromHTML - Creates an element from a string of HTML. If this could create multiple root-level elements (children are okay), you must use #createElementsFromHTML which returns a list of element...
[ "createElementFromHTML", "-", "Creates", "an", "element", "from", "a", "string", "of", "HTML", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L904-L936
[ "def", "createElementFromHTML", "(", "cls", ",", "html", ",", "encoding", "=", "'utf-8'", ")", ":", "parser", "=", "cls", "(", "encoding", "=", "encoding", ")", "html", "=", "stripIEConditionals", "(", "html", ")", "try", ":", "HTMLParser", ".", "feed", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.createElementsFromHTML
createElementsFromHTML - Creates elements from provided html, and returns a list of the root-level elements children of these root-level nodes are accessable via the usual means. @param html <str> - Some html data @param encoding <str> - Encoding to use for document ...
AdvancedHTMLParser/Parser.py
def createElementsFromHTML(cls, html, encoding='utf-8'): ''' createElementsFromHTML - Creates elements from provided html, and returns a list of the root-level elements children of these root-level nodes are accessable via the usual means. @param html <str> - Some html d...
def createElementsFromHTML(cls, html, encoding='utf-8'): ''' createElementsFromHTML - Creates elements from provided html, and returns a list of the root-level elements children of these root-level nodes are accessable via the usual means. @param html <str> - Some html d...
[ "createElementsFromHTML", "-", "Creates", "elements", "from", "provided", "html", "and", "returns", "a", "list", "of", "the", "root", "-", "level", "elements", "children", "of", "these", "root", "-", "level", "nodes", "are", "accessable", "via", "the", "usual"...
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L940-L969
[ "def", "createElementsFromHTML", "(", "cls", ",", "html", ",", "encoding", "=", "'utf-8'", ")", ":", "# TODO: If text is present outside a tag, it will be lost.", "parser", "=", "cls", "(", "encoding", "=", "encoding", ")", "parser", ".", "parseStr", "(", "html", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedHTMLParser.createBlocksFromHTML
createBlocksFromHTML - Returns the root level node (unless multiple nodes), and a list of "blocks" added (text and nodes). @return list< str/AdvancedTag > - List of blocks created. May be strings (text nodes) or AdvancedTag (tags) NOTE: Results may be checked b...
AdvancedHTMLParser/Parser.py
def createBlocksFromHTML(cls, html, encoding='utf-8'): ''' createBlocksFromHTML - Returns the root level node (unless multiple nodes), and a list of "blocks" added (text and nodes). @return list< str/AdvancedTag > - List of blocks created. May be strings (text nodes) or...
def createBlocksFromHTML(cls, html, encoding='utf-8'): ''' createBlocksFromHTML - Returns the root level node (unless multiple nodes), and a list of "blocks" added (text and nodes). @return list< str/AdvancedTag > - List of blocks created. May be strings (text nodes) or...
[ "createBlocksFromHTML", "-", "Returns", "the", "root", "level", "node", "(", "unless", "multiple", "nodes", ")", "and", "a", "list", "of", "blocks", "added", "(", "text", "and", "nodes", ")", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L972-L995
[ "def", "createBlocksFromHTML", "(", "cls", ",", "html", ",", "encoding", "=", "'utf-8'", ")", ":", "parser", "=", "cls", "(", "encoding", "=", "encoding", ")", "parser", ".", "parseStr", "(", "html", ")", "rootNode", "=", "parser", ".", "getRoot", "(", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
IndexedAdvancedHTMLParser.handle_starttag
internal for parsing
AdvancedHTMLParser/Parser.py
def handle_starttag(self, tagName, attributeList, isSelfClosing=False): ''' internal for parsing ''' newTag = AdvancedHTMLParser.handle_starttag(self, tagName, attributeList, isSelfClosing) self._indexTag(newTag) return newTag
def handle_starttag(self, tagName, attributeList, isSelfClosing=False): ''' internal for parsing ''' newTag = AdvancedHTMLParser.handle_starttag(self, tagName, attributeList, isSelfClosing) self._indexTag(newTag) return newTag
[ "internal", "for", "parsing" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1097-L1104
[ "def", "handle_starttag", "(", "self", ",", "tagName", ",", "attributeList", ",", "isSelfClosing", "=", "False", ")", ":", "newTag", "=", "AdvancedHTMLParser", ".", "handle_starttag", "(", "self", ",", "tagName", ",", "attributeList", ",", "isSelfClosing", ")", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
IndexedAdvancedHTMLParser.reindex
reindex - reindex the tree. Optionally, change what fields are indexed. @param newIndexIDs <bool/None> - None to leave same, otherwise new value to index IDs @parma newIndexNames <bool/None> - None to leave same, otherwise new value to index names @param newI...
AdvancedHTMLParser/Parser.py
def reindex(self, newIndexIDs=None, newIndexNames=None, newIndexClassNames=None, newIndexTagNames=None): ''' reindex - reindex the tree. Optionally, change what fields are indexed. @param newIndexIDs <bool/None> - None to leave same, otherwise new value to index IDs ...
def reindex(self, newIndexIDs=None, newIndexNames=None, newIndexClassNames=None, newIndexTagNames=None): ''' reindex - reindex the tree. Optionally, change what fields are indexed. @param newIndexIDs <bool/None> - None to leave same, otherwise new value to index IDs ...
[ "reindex", "-", "reindex", "the", "tree", ".", "Optionally", "change", "what", "fields", "are", "indexed", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1120-L1139
[ "def", "reindex", "(", "self", ",", "newIndexIDs", "=", "None", ",", "newIndexNames", "=", "None", ",", "newIndexClassNames", "=", "None", ",", "newIndexTagNames", "=", "None", ")", ":", "if", "newIndexIDs", "is", "not", "None", ":", "self", ".", "indexIDs...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
IndexedAdvancedHTMLParser.disableIndexing
disableIndexing - Disables indexing. Consider using plain AdvancedHTMLParser class. Maybe useful in some scenarios where you want to parse, add a ton of elements, then index and do a bunch of searching.
AdvancedHTMLParser/Parser.py
def disableIndexing(self): ''' disableIndexing - Disables indexing. Consider using plain AdvancedHTMLParser class. Maybe useful in some scenarios where you want to parse, add a ton of elements, then index and do a bunch of searching. ''' self.indexIDs = se...
def disableIndexing(self): ''' disableIndexing - Disables indexing. Consider using plain AdvancedHTMLParser class. Maybe useful in some scenarios where you want to parse, add a ton of elements, then index and do a bunch of searching. ''' self.indexIDs = se...
[ "disableIndexing", "-", "Disables", "indexing", ".", "Consider", "using", "plain", "AdvancedHTMLParser", "class", ".", "Maybe", "useful", "in", "some", "scenarios", "where", "you", "want", "to", "parse", "add", "a", "ton", "of", "elements", "then", "index", "a...
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1141-L1148
[ "def", "disableIndexing", "(", "self", ")", ":", "self", ".", "indexIDs", "=", "self", ".", "indexNames", "=", "self", ".", "indexClassNames", "=", "self", ".", "indexTagNames", "=", "False", "self", ".", "_resetIndexInternal", "(", ")" ]
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
IndexedAdvancedHTMLParser.addIndexOnAttribute
addIndexOnAttribute - Add an index for an arbitrary attribute. This will be used by the getElementsByAttr function. You should do this prior to parsing, or call reindex. Otherwise it will be blank. "name" and "id" will have no effect. @param attributeName <lowercase str> - An attrib...
AdvancedHTMLParser/Parser.py
def addIndexOnAttribute(self, attributeName): ''' addIndexOnAttribute - Add an index for an arbitrary attribute. This will be used by the getElementsByAttr function. You should do this prior to parsing, or call reindex. Otherwise it will be blank. "name" and "id" will have no effect....
def addIndexOnAttribute(self, attributeName): ''' addIndexOnAttribute - Add an index for an arbitrary attribute. This will be used by the getElementsByAttr function. You should do this prior to parsing, or call reindex. Otherwise it will be blank. "name" and "id" will have no effect....
[ "addIndexOnAttribute", "-", "Add", "an", "index", "for", "an", "arbitrary", "attribute", ".", "This", "will", "be", "used", "by", "the", "getElementsByAttr", "function", ".", "You", "should", "do", "this", "prior", "to", "parsing", "or", "call", "reindex", "...
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1150-L1168
[ "def", "addIndexOnAttribute", "(", "self", ",", "attributeName", ")", ":", "attributeName", "=", "attributeName", ".", "lower", "(", ")", "self", ".", "_otherAttributeIndexes", "[", "attributeName", "]", "=", "{", "}", "def", "_otherIndexFunction", "(", "self", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
IndexedAdvancedHTMLParser.removeIndexOnAttribute
removeIndexOnAttribute - Remove an attribute from indexing (for getElementsByAttr function) and remove indexed data. @param attributeName <lowercase str> - An attribute name. Will be lowercased. "name" and "id" will have no effect.
AdvancedHTMLParser/Parser.py
def removeIndexOnAttribute(self, attributeName): ''' removeIndexOnAttribute - Remove an attribute from indexing (for getElementsByAttr function) and remove indexed data. @param attributeName <lowercase str> - An attribute name. Will be lowercased. "name" and "id" will have no effect. ...
def removeIndexOnAttribute(self, attributeName): ''' removeIndexOnAttribute - Remove an attribute from indexing (for getElementsByAttr function) and remove indexed data. @param attributeName <lowercase str> - An attribute name. Will be lowercased. "name" and "id" will have no effect. ...
[ "removeIndexOnAttribute", "-", "Remove", "an", "attribute", "from", "indexing", "(", "for", "getElementsByAttr", "function", ")", "and", "remove", "indexed", "data", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1170-L1180
[ "def", "removeIndexOnAttribute", "(", "self", ",", "attributeName", ")", ":", "attributeName", "=", "attributeName", ".", "lower", "(", ")", "if", "attributeName", "in", "self", ".", "otherAttributeIndexFunctions", ":", "del", "self", ".", "otherAttributeIndexFuncti...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
IndexedAdvancedHTMLParser.getElementsByTagName
getElementsByTagName - Searches and returns all elements with a specific tag name. @param tagName <lowercase str> - A lowercase string of the tag name. @param root <AdvancedTag/'root'> - Search starting at a specific node, if provided. if string 'root', the root of the p...
AdvancedHTMLParser/Parser.py
def getElementsByTagName(self, tagName, root='root', useIndex=True): ''' getElementsByTagName - Searches and returns all elements with a specific tag name. @param tagName <lowercase str> - A lowercase string of the tag name. @param root <AdvancedTag/'...
def getElementsByTagName(self, tagName, root='root', useIndex=True): ''' getElementsByTagName - Searches and returns all elements with a specific tag name. @param tagName <lowercase str> - A lowercase string of the tag name. @param root <AdvancedTag/'...
[ "getElementsByTagName", "-", "Searches", "and", "returns", "all", "elements", "with", "a", "specific", "tag", "name", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1183-L1202
[ "def", "getElementsByTagName", "(", "self", ",", "tagName", ",", "root", "=", "'root'", ",", "useIndex", "=", "True", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "if", "useIndex", "is", "True", "...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
IndexedAdvancedHTMLParser.getElementsByName
getElementsByName - Searches and returns all elements with a specific name. @param name <str> - A string of the name attribute @param root <AdvancedTag/'root'> - Search starting at a specific node, if provided. if string 'root', the root of the parsed tree will be used. ...
AdvancedHTMLParser/Parser.py
def getElementsByName(self, name, root='root', useIndex=True): ''' getElementsByName - Searches and returns all elements with a specific name. @param name <str> - A string of the name attribute @param root <AdvancedTag/'root'> - Search starting at a sp...
def getElementsByName(self, name, root='root', useIndex=True): ''' getElementsByName - Searches and returns all elements with a specific name. @param name <str> - A string of the name attribute @param root <AdvancedTag/'root'> - Search starting at a sp...
[ "getElementsByName", "-", "Searches", "and", "returns", "all", "elements", "with", "a", "specific", "name", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1205-L1226
[ "def", "getElementsByName", "(", "self", ",", "name", ",", "root", "=", "'root'", ",", "useIndex", "=", "True", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "elements", "=", "[", "]", "if", "use...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
IndexedAdvancedHTMLParser.getElementById
getElementById - Searches and returns the first (should only be one) element with the given ID. @param id <str> - A string of the id attribute. @param root <AdvancedTag/'root'> - Search starting at a specific node, if provided. if string 'root', the root of the parsed tre...
AdvancedHTMLParser/Parser.py
def getElementById(self, _id, root='root', useIndex=True): ''' getElementById - Searches and returns the first (should only be one) element with the given ID. @param id <str> - A string of the id attribute. @param root <AdvancedTag/'root'> - Search sta...
def getElementById(self, _id, root='root', useIndex=True): ''' getElementById - Searches and returns the first (should only be one) element with the given ID. @param id <str> - A string of the id attribute. @param root <AdvancedTag/'root'> - Search sta...
[ "getElementById", "-", "Searches", "and", "returns", "the", "first", "(", "should", "only", "be", "one", ")", "element", "with", "the", "given", "ID", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1229-L1251
[ "def", "getElementById", "(", "self", ",", "_id", ",", "root", "=", "'root'", ",", "useIndex", "=", "True", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "if", "self", ".", "useIndex", "is", "Tru...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
IndexedAdvancedHTMLParser.getElementsByClassName
getElementsByClassName - Searches and returns all elements containing a given class name. @param className <str> - A one-word class name @param root <AdvancedTag/'root'> - Search starting at a specific node, if provided. if string 'root', the root of the parsed tree will ...
AdvancedHTMLParser/Parser.py
def getElementsByClassName(self, className, root='root', useIndex=True): ''' getElementsByClassName - Searches and returns all elements containing a given class name. @param className <str> - A one-word class name @param root <AdvancedTag/'root'> - Sea...
def getElementsByClassName(self, className, root='root', useIndex=True): ''' getElementsByClassName - Searches and returns all elements containing a given class name. @param className <str> - A one-word class name @param root <AdvancedTag/'root'> - Sea...
[ "getElementsByClassName", "-", "Searches", "and", "returns", "all", "elements", "containing", "a", "given", "class", "name", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1254-L1274
[ "def", "getElementsByClassName", "(", "self", ",", "className", ",", "root", "=", "'root'", ",", "useIndex", "=", "True", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "if", "useIndex", "is", "True",...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
IndexedAdvancedHTMLParser.getElementsByAttr
getElementsByAttr - Searches the full tree for elements with a given attribute name and value combination. If you want multiple potential values, see getElementsWithAttrValues If you want an index on a random attribute, use the addIndexOnAttribute function. @param attrName...
AdvancedHTMLParser/Parser.py
def getElementsByAttr(self, attrName, attrValue, root='root', useIndex=True): ''' getElementsByAttr - Searches the full tree for elements with a given attribute name and value combination. If you want multiple potential values, see getElementsWithAttrValues If you want an index on a r...
def getElementsByAttr(self, attrName, attrValue, root='root', useIndex=True): ''' getElementsByAttr - Searches the full tree for elements with a given attribute name and value combination. If you want multiple potential values, see getElementsWithAttrValues If you want an index on a r...
[ "getElementsByAttr", "-", "Searches", "the", "full", "tree", "for", "elements", "with", "a", "given", "attribute", "name", "and", "value", "combination", ".", "If", "you", "want", "multiple", "potential", "values", "see", "getElementsWithAttrValues", "If", "you", ...
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1277-L1299
[ "def", "getElementsByAttr", "(", "self", ",", "attrName", ",", "attrValue", ",", "root", "=", "'root'", ",", "useIndex", "=", "True", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "if", "useIndex", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
IndexedAdvancedHTMLParser.getElementsWithAttrValues
getElementsWithAttrValues - Returns elements with an attribute matching one of several values. For a single name/value combination, see getElementsByAttr @param attrName <lowercase str> - A lowercase attribute name @param attrValues set<str> - List of expected values of attribute ...
AdvancedHTMLParser/Parser.py
def getElementsWithAttrValues(self, attrName, values, root='root', useIndex=True): ''' getElementsWithAttrValues - Returns elements with an attribute matching one of several values. For a single name/value combination, see getElementsByAttr @param attrName <lowercase str> - A lowerc...
def getElementsWithAttrValues(self, attrName, values, root='root', useIndex=True): ''' getElementsWithAttrValues - Returns elements with an attribute matching one of several values. For a single name/value combination, see getElementsByAttr @param attrName <lowercase str> - A lowerc...
[ "getElementsWithAttrValues", "-", "Returns", "elements", "with", "an", "attribute", "matching", "one", "of", "several", "values", ".", "For", "a", "single", "name", "/", "value", "combination", "see", "getElementsByAttr" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Parser.py#L1302-L1323
[ "def", "getElementsWithAttrValues", "(", "self", ",", "attrName", ",", "values", ",", "root", "=", "'root'", ",", "useIndex", "=", "True", ")", ":", "(", "root", ",", "isFromRoot", ")", "=", "self", ".", "_handleRootArg", "(", "root", ")", "_otherAttribute...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
uniqueTags
uniqueTags - Returns the unique tags in tagList. @param tagList list<AdvancedTag> : A list of tag objects.
AdvancedHTMLParser/Tags.py
def uniqueTags(tagList): ''' uniqueTags - Returns the unique tags in tagList. @param tagList list<AdvancedTag> : A list of tag objects. ''' ret = [] alreadyAdded = set() for tag in tagList: myUid = tag.getUid() if myUid in alreadyAdded: contin...
def uniqueTags(tagList): ''' uniqueTags - Returns the unique tags in tagList. @param tagList list<AdvancedTag> : A list of tag objects. ''' ret = [] alreadyAdded = set() for tag in tagList: myUid = tag.getUid() if myUid in alreadyAdded: contin...
[ "uniqueTags", "-", "Returns", "the", "unique", "tags", "in", "tagList", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L47-L60
[ "def", "uniqueTags", "(", "tagList", ")", ":", "ret", "=", "[", "]", "alreadyAdded", "=", "set", "(", ")", "for", "tag", "in", "tagList", ":", "myUid", "=", "tag", ".", "getUid", "(", ")", "if", "myUid", "in", "alreadyAdded", ":", "continue", "ret", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
toggleAttributesDOM
toggleAttributesDOM - Toggle if the old DOM tag.attributes NamedNodeMap model should be used for the .attributes method, versus a more sane direct dict implementation. The DOM version is always accessable as AdvancedTag.attributesDOM The dict version is always accessable as Advanced...
AdvancedHTMLParser/Tags.py
def toggleAttributesDOM(isEnabled): ''' toggleAttributesDOM - Toggle if the old DOM tag.attributes NamedNodeMap model should be used for the .attributes method, versus a more sane direct dict implementation. The DOM version is always accessable as AdvancedTag.attributesDOM ...
def toggleAttributesDOM(isEnabled): ''' toggleAttributesDOM - Toggle if the old DOM tag.attributes NamedNodeMap model should be used for the .attributes method, versus a more sane direct dict implementation. The DOM version is always accessable as AdvancedTag.attributesDOM ...
[ "toggleAttributesDOM", "-", "Toggle", "if", "the", "old", "DOM", "tag", ".", "attributes", "NamedNodeMap", "model", "should", "be", "used", "for", "the", ".", "attributes", "method", "versus" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L62-L79
[ "def", "toggleAttributesDOM", "(", "isEnabled", ")", ":", "if", "isEnabled", ":", "AdvancedTag", ".", "attributes", "=", "AdvancedTag", ".", "attributesDOM", "else", ":", "AdvancedTag", ".", "attributes", "=", "AdvancedTag", ".", "attributesDict" ]
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.cloneNode
cloneNode - Clone this node (tag name and attributes). Does not clone children. Tags will be equal according to isTagEqual method, but will contain a different internal unique id such tag origTag != origTag.cloneNode() , as is the case in JS DOM.
AdvancedHTMLParser/Tags.py
def cloneNode(self): ''' cloneNode - Clone this node (tag name and attributes). Does not clone children. Tags will be equal according to isTagEqual method, but will contain a different internal unique id such tag origTag != origTag.cloneNode() , as is the case in JS DOM. ...
def cloneNode(self): ''' cloneNode - Clone this node (tag name and attributes). Does not clone children. Tags will be equal according to isTagEqual method, but will contain a different internal unique id such tag origTag != origTag.cloneNode() , as is the case in JS DOM. ...
[ "cloneNode", "-", "Clone", "this", "node", "(", "tag", "name", "and", "attributes", ")", ".", "Does", "not", "clone", "children", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L341-L348
[ "def", "cloneNode", "(", "self", ")", ":", "return", "self", ".", "__class__", "(", "self", ".", "tagName", ",", "self", ".", "getAttributesList", "(", ")", ",", "self", ".", "isSelfClosing", ")" ]
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.appendText
appendText - append some inner text
AdvancedHTMLParser/Tags.py
def appendText(self, text): ''' appendText - append some inner text ''' # self.text is just raw string of the text self.text += text self.isSelfClosing = False # inner text means it can't self close anymo # self.blocks is either text or tags, in order of appea...
def appendText(self, text): ''' appendText - append some inner text ''' # self.text is just raw string of the text self.text += text self.isSelfClosing = False # inner text means it can't self close anymo # self.blocks is either text or tags, in order of appea...
[ "appendText", "-", "append", "some", "inner", "text" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L408-L416
[ "def", "appendText", "(", "self", ",", "text", ")", ":", "# self.text is just raw string of the text", "self", ".", "text", "+=", "text", "self", ".", "isSelfClosing", "=", "False", "# inner text means it can't self close anymo", "# self.blocks is either text or tags, in orde...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.removeText
removeText - Removes the first occurace of given text in a text node (i.e. not part of a tag) @param text <str> - text to remove @return text <str/None> - The text in that block (text node) after remove, or None if not found NOTE: To remove a node, @see removeChild NOT...
AdvancedHTMLParser/Tags.py
def removeText(self, text): ''' removeText - Removes the first occurace of given text in a text node (i.e. not part of a tag) @param text <str> - text to remove @return text <str/None> - The text in that block (text node) after remove, or None if not found NOTE...
def removeText(self, text): ''' removeText - Removes the first occurace of given text in a text node (i.e. not part of a tag) @param text <str> - text to remove @return text <str/None> - The text in that block (text node) after remove, or None if not found NOTE...
[ "removeText", "-", "Removes", "the", "first", "occurace", "of", "given", "text", "in", "a", "text", "node", "(", "i", ".", "e", ".", "not", "part", "of", "a", "tag", ")" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L419-L456
[ "def", "removeText", "(", "self", ",", "text", ")", ":", "# TODO: This would be a good candidate for the refactor of text blocks", "removedBlock", "=", "None", "# Scan all text blocks for \"text\"", "blocks", "=", "self", ".", "blocks", "for", "i", "in", "range", "(", "...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.removeTextAll
removeTextAll - Removes ALL occuraces of given text in a text node (i.e. not part of a tag) @param text <str> - text to remove @return list <str> - All text node containing #text BEFORE the text was removed. Empty list if no text removed NOTE: To remove a node, @se...
AdvancedHTMLParser/Tags.py
def removeTextAll(self, text): ''' removeTextAll - Removes ALL occuraces of given text in a text node (i.e. not part of a tag) @param text <str> - text to remove @return list <str> - All text node containing #text BEFORE the text was removed. Empty list if n...
def removeTextAll(self, text): ''' removeTextAll - Removes ALL occuraces of given text in a text node (i.e. not part of a tag) @param text <str> - text to remove @return list <str> - All text node containing #text BEFORE the text was removed. Empty list if n...
[ "removeTextAll", "-", "Removes", "ALL", "occuraces", "of", "given", "text", "in", "a", "text", "node", "(", "i", ".", "e", ".", "not", "part", "of", "a", "tag", ")" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L459-L495
[ "def", "removeTextAll", "(", "self", ",", "text", ")", ":", "# TODO: This would be a good candidate for the refactor of text blocks", "removedBlocks", "=", "[", "]", "blocks", "=", "self", ".", "blocks", "for", "i", "in", "range", "(", "len", "(", "blocks", ")", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.remove
remove - Will remove this node from its parent, if it has a parent (thus taking it out of the HTML tree) NOTE: If you are using an IndexedAdvancedHTMLParser, calling this will NOT update the index. You MUST call reindex method manually. @return <bool> - While JS DOM defin...
AdvancedHTMLParser/Tags.py
def remove(self): ''' remove - Will remove this node from its parent, if it has a parent (thus taking it out of the HTML tree) NOTE: If you are using an IndexedAdvancedHTMLParser, calling this will NOT update the index. You MUST call reindex method manually. ...
def remove(self): ''' remove - Will remove this node from its parent, if it has a parent (thus taking it out of the HTML tree) NOTE: If you are using an IndexedAdvancedHTMLParser, calling this will NOT update the index. You MUST call reindex method manually. ...
[ "remove", "-", "Will", "remove", "this", "node", "from", "its", "parent", "if", "it", "has", "a", "parent", "(", "thus", "taking", "it", "out", "of", "the", "HTML", "tree", ")" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L498-L512
[ "def", "remove", "(", "self", ")", ":", "if", "self", ".", "parentNode", ":", "self", ".", "parentNode", ".", "removeChild", "(", "self", ")", "# self.parentNode will now be None by 'removeChild' method", "return", "True", "return", "False" ]
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.removeBlocks
removeBlock - Removes a list of blocks (the first occurance of each) from the direct children of this node. @param blocks list<str/AdvancedTag> - List of AdvancedTags for tag nodes, else strings for text nodes @return The removed blocks in each slot, or None if None removed. @see...
AdvancedHTMLParser/Tags.py
def removeBlocks(self, blocks): ''' removeBlock - Removes a list of blocks (the first occurance of each) from the direct children of this node. @param blocks list<str/AdvancedTag> - List of AdvancedTags for tag nodes, else strings for text nodes @return The removed blocks ...
def removeBlocks(self, blocks): ''' removeBlock - Removes a list of blocks (the first occurance of each) from the direct children of this node. @param blocks list<str/AdvancedTag> - List of AdvancedTags for tag nodes, else strings for text nodes @return The removed blocks ...
[ "removeBlock", "-", "Removes", "a", "list", "of", "blocks", "(", "the", "first", "occurance", "of", "each", ")", "from", "the", "direct", "children", "of", "this", "node", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L515-L536
[ "def", "removeBlocks", "(", "self", ",", "blocks", ")", ":", "ret", "=", "[", "]", "for", "block", "in", "blocks", ":", "if", "issubclass", "(", "block", ".", "__class__", ",", "AdvancedTag", ")", ":", "ret", ".", "append", "(", "self", ".", "removeC...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.appendChild
appendChild - Append a child to this element. @param child <AdvancedTag> - Append a child element to this element
AdvancedHTMLParser/Tags.py
def appendChild(self, child): ''' appendChild - Append a child to this element. @param child <AdvancedTag> - Append a child element to this element ''' # Associate parentNode of #child to this tag child.parentNode = self # Associate owner document to ch...
def appendChild(self, child): ''' appendChild - Append a child to this element. @param child <AdvancedTag> - Append a child element to this element ''' # Associate parentNode of #child to this tag child.parentNode = self # Associate owner document to ch...
[ "appendChild", "-", "Append", "a", "child", "to", "this", "element", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L538-L561
[ "def", "appendChild", "(", "self", ",", "child", ")", ":", "# Associate parentNode of #child to this tag", "child", ".", "parentNode", "=", "self", "# Associate owner document to child and all children recursive", "ownerDocument", "=", "self", ".", "ownerDocument", "child", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.appendBlock
append / appendBlock - Append a block to this element. A block can be a string (text node), or an AdvancedTag (tag node) @param <str/AdvancedTag> - block to add @return - #block NOTE: To add multiple blocks, @see appendBlocks If you know the type, use either @see...
AdvancedHTMLParser/Tags.py
def appendBlock(self, block): ''' append / appendBlock - Append a block to this element. A block can be a string (text node), or an AdvancedTag (tag node) @param <str/AdvancedTag> - block to add @return - #block NOTE: To add multiple blocks, @see appendBlocks ...
def appendBlock(self, block): ''' append / appendBlock - Append a block to this element. A block can be a string (text node), or an AdvancedTag (tag node) @param <str/AdvancedTag> - block to add @return - #block NOTE: To add multiple blocks, @see appendBlocks ...
[ "append", "/", "appendBlock", "-", "Append", "a", "block", "to", "this", "element", ".", "A", "block", "can", "be", "a", "string", "(", "text", "node", ")", "or", "an", "AdvancedTag", "(", "tag", "node", ")" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L567-L584
[ "def", "appendBlock", "(", "self", ",", "block", ")", ":", "# Determine block type and call appropriate method", "if", "isinstance", "(", "block", ",", "AdvancedTag", ")", ":", "self", ".", "appendNode", "(", "block", ")", "else", ":", "self", ".", "appendText",...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.appendBlocks
appendBlocks - Append blocks to this element. A block can be a string (text node), or an AdvancedTag (tag node) @param blocks list<str/AdvancedTag> - A list, in order to append, of blocks to add. @return - #blocks NOTE: To add a single block, @see appendBlock If ...
AdvancedHTMLParser/Tags.py
def appendBlocks(self, blocks): ''' appendBlocks - Append blocks to this element. A block can be a string (text node), or an AdvancedTag (tag node) @param blocks list<str/AdvancedTag> - A list, in order to append, of blocks to add. @return - #blocks NOTE: To ad...
def appendBlocks(self, blocks): ''' appendBlocks - Append blocks to this element. A block can be a string (text node), or an AdvancedTag (tag node) @param blocks list<str/AdvancedTag> - A list, in order to append, of blocks to add. @return - #blocks NOTE: To ad...
[ "appendBlocks", "-", "Append", "blocks", "to", "this", "element", ".", "A", "block", "can", "be", "a", "string", "(", "text", "node", ")", "or", "an", "AdvancedTag", "(", "tag", "node", ")" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L590-L607
[ "def", "appendBlocks", "(", "self", ",", "blocks", ")", ":", "for", "block", "in", "blocks", ":", "if", "isinstance", "(", "block", ",", "AdvancedTag", ")", ":", "self", ".", "appendNode", "(", "block", ")", "else", ":", "self", ".", "appendText", "(",...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.appendInnerHTML
appendInnerHTML - Appends nodes from arbitrary HTML as if doing element.innerHTML += 'someHTML' in javascript. @param html <str> - Some HTML NOTE: If associated with a document ( AdvancedHTMLParser ), the html will use the encoding associated with that document. ...
AdvancedHTMLParser/Tags.py
def appendInnerHTML(self, html): ''' appendInnerHTML - Appends nodes from arbitrary HTML as if doing element.innerHTML += 'someHTML' in javascript. @param html <str> - Some HTML NOTE: If associated with a document ( AdvancedHTMLParser ), the html will use the encoding assoc...
def appendInnerHTML(self, html): ''' appendInnerHTML - Appends nodes from arbitrary HTML as if doing element.innerHTML += 'someHTML' in javascript. @param html <str> - Some HTML NOTE: If associated with a document ( AdvancedHTMLParser ), the html will use the encoding assoc...
[ "appendInnerHTML", "-", "Appends", "nodes", "from", "arbitrary", "HTML", "as", "if", "doing", "element", ".", "innerHTML", "+", "=", "someHTML", "in", "javascript", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L610-L635
[ "def", "appendInnerHTML", "(", "self", ",", "html", ")", ":", "# Late-binding to prevent circular import", "from", ".", "Parser", "import", "AdvancedHTMLParser", "# Inherit encoding from the associated document, if any.", "encoding", "=", "None", "if", "self", ".", "ownerDo...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.removeChild
removeChild - Remove a child tag, if present. @param child <AdvancedTag> - The child to remove @return - The child [with parentNode cleared] if removed, otherwise None. NOTE: This removes a tag. If removing a text block, use #removeText function. If y...
AdvancedHTMLParser/Tags.py
def removeChild(self, child): ''' removeChild - Remove a child tag, if present. @param child <AdvancedTag> - The child to remove @return - The child [with parentNode cleared] if removed, otherwise None. NOTE: This removes a tag. If removing a text b...
def removeChild(self, child): ''' removeChild - Remove a child tag, if present. @param child <AdvancedTag> - The child to remove @return - The child [with parentNode cleared] if removed, otherwise None. NOTE: This removes a tag. If removing a text b...
[ "removeChild", "-", "Remove", "a", "child", "tag", "if", "present", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L638-L668
[ "def", "removeChild", "(", "self", ",", "child", ")", ":", "try", ":", "# Remove from children and blocks", "self", ".", "children", ".", "remove", "(", "child", ")", "self", ".", "blocks", ".", "remove", "(", "child", ")", "# Clear parent node association on ch...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.removeChildren
removeChildren - Remove multiple child AdvancedTags. @see removeChild @return list<AdvancedTag/None> - A list of all tags removed in same order as passed. Item is "None" if it was not attached to this node, and thus was not removed.
AdvancedHTMLParser/Tags.py
def removeChildren(self, children): ''' removeChildren - Remove multiple child AdvancedTags. @see removeChild @return list<AdvancedTag/None> - A list of all tags removed in same order as passed. Item is "None" if it was not attached to this node, and thus wa...
def removeChildren(self, children): ''' removeChildren - Remove multiple child AdvancedTags. @see removeChild @return list<AdvancedTag/None> - A list of all tags removed in same order as passed. Item is "None" if it was not attached to this node, and thus wa...
[ "removeChildren", "-", "Remove", "multiple", "child", "AdvancedTags", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L673-L687
[ "def", "removeChildren", "(", "self", ",", "children", ")", ":", "ret", "=", "[", "]", "for", "child", "in", "children", ":", "ret", ".", "append", "(", "self", ".", "removeChild", "(", "child", ")", ")", "return", "ret" ]
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.removeBlock
removeBlock - Removes a single block (text node or AdvancedTag) which is a child of this object. @param block <str/AdvancedTag> - The block (text node or AdvancedTag) to remove. @return Returns the removed block if one was removed, or None if requested block is not a child of this ...
AdvancedHTMLParser/Tags.py
def removeBlock(self, block): ''' removeBlock - Removes a single block (text node or AdvancedTag) which is a child of this object. @param block <str/AdvancedTag> - The block (text node or AdvancedTag) to remove. @return Returns the removed block if one was remov...
def removeBlock(self, block): ''' removeBlock - Removes a single block (text node or AdvancedTag) which is a child of this object. @param block <str/AdvancedTag> - The block (text node or AdvancedTag) to remove. @return Returns the removed block if one was remov...
[ "removeBlock", "-", "Removes", "a", "single", "block", "(", "text", "node", "or", "AdvancedTag", ")", "which", "is", "a", "child", "of", "this", "object", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L690-L706
[ "def", "removeBlock", "(", "self", ",", "block", ")", ":", "if", "issubclass", "(", "block", ".", "__class__", ",", "AdvancedTag", ")", ":", "return", "self", ".", "removeChild", "(", "block", ")", "else", ":", "return", "self", ".", "removeText", "(", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.insertBefore
insertBefore - Inserts a child before #beforeChild @param child <AdvancedTag/str> - Child block to insert @param beforeChild <AdvancedTag/str> - Child block to insert before. if None, will be appended @return - The added child. Note, if it is a text block (str), the retu...
AdvancedHTMLParser/Tags.py
def insertBefore(self, child, beforeChild): ''' insertBefore - Inserts a child before #beforeChild @param child <AdvancedTag/str> - Child block to insert @param beforeChild <AdvancedTag/str> - Child block to insert before. if None, will be appended @r...
def insertBefore(self, child, beforeChild): ''' insertBefore - Inserts a child before #beforeChild @param child <AdvancedTag/str> - Child block to insert @param beforeChild <AdvancedTag/str> - Child block to insert before. if None, will be appended @r...
[ "insertBefore", "-", "Inserts", "a", "child", "before", "#beforeChild" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L710-L749
[ "def", "insertBefore", "(", "self", ",", "child", ",", "beforeChild", ")", ":", "# When the second arg is null/None, the node is appended. The argument is required per JS API, but null is acceptable..", "if", "beforeChild", "is", "None", ":", "return", "self", ".", "appendBlock...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.insertAfter
insertAfter - Inserts a child after #afterChild @param child <AdvancedTag/str> - Child block to insert @param afterChild <AdvancedTag/str> - Child block to insert after. if None, will be appended @return - The added child. Note, if it is a text block (str), the return is...
AdvancedHTMLParser/Tags.py
def insertAfter(self, child, afterChild): ''' insertAfter - Inserts a child after #afterChild @param child <AdvancedTag/str> - Child block to insert @param afterChild <AdvancedTag/str> - Child block to insert after. if None, will be appended @return -...
def insertAfter(self, child, afterChild): ''' insertAfter - Inserts a child after #afterChild @param child <AdvancedTag/str> - Child block to insert @param afterChild <AdvancedTag/str> - Child block to insert after. if None, will be appended @return -...
[ "insertAfter", "-", "Inserts", "a", "child", "after", "#afterChild" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L751-L785
[ "def", "insertAfter", "(", "self", ",", "child", ",", "afterChild", ")", ":", "# If after child is null/None, just append", "if", "afterChild", "is", "None", ":", "return", "self", ".", "appendBlock", "(", "child", ")", "isChildTag", "=", "isTagNode", "(", "chil...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.firstChild
firstChild - property, Get the first child block, text or tag. @return <str/AdvancedTag/None> - The first child block, or None if no child blocks
AdvancedHTMLParser/Tags.py
def firstChild(self): ''' firstChild - property, Get the first child block, text or tag. @return <str/AdvancedTag/None> - The first child block, or None if no child blocks ''' blocks = object.__getattribute__(self, 'blocks') # First block is empty string for ...
def firstChild(self): ''' firstChild - property, Get the first child block, text or tag. @return <str/AdvancedTag/None> - The first child block, or None if no child blocks ''' blocks = object.__getattribute__(self, 'blocks') # First block is empty string for ...
[ "firstChild", "-", "property", "Get", "the", "first", "child", "block", "text", "or", "tag", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L860-L877
[ "def", "firstChild", "(", "self", ")", ":", "blocks", "=", "object", ".", "__getattribute__", "(", "self", ",", "'blocks'", ")", "# First block is empty string for indent, but don't hardcode incase that changes", "if", "blocks", "[", "0", "]", "==", "''", ":", "firs...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.lastChild
lastChild - property, Get the last child block, text or tag @return <str/AdvancedTag/None> - The last child block, or None if no child blocks
AdvancedHTMLParser/Tags.py
def lastChild(self): ''' lastChild - property, Get the last child block, text or tag @return <str/AdvancedTag/None> - The last child block, or None if no child blocks ''' blocks = object.__getattribute__(self, 'blocks') # First block is empty string for inden...
def lastChild(self): ''' lastChild - property, Get the last child block, text or tag @return <str/AdvancedTag/None> - The last child block, or None if no child blocks ''' blocks = object.__getattribute__(self, 'blocks') # First block is empty string for inden...
[ "lastChild", "-", "property", "Get", "the", "last", "child", "block", "text", "or", "tag" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L895-L911
[ "def", "lastChild", "(", "self", ")", ":", "blocks", "=", "object", ".", "__getattribute__", "(", "self", ",", "'blocks'", ")", "# First block is empty string for indent, but don't hardcode incase that changes", "if", "blocks", "[", "0", "]", "==", "''", ":", "first...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.nextSibling
nextSibling - Returns the next sibling. This is the child following this node in the parent's list of children. This could be text or an element. use nextSiblingElement to ensure element @return <None/str/AdvancedTag> - None if there are no nodes (text or tag) in the parent after t...
AdvancedHTMLParser/Tags.py
def nextSibling(self): ''' nextSibling - Returns the next sibling. This is the child following this node in the parent's list of children. This could be text or an element. use nextSiblingElement to ensure element @return <None/str/AdvancedTag> - None if there a...
def nextSibling(self): ''' nextSibling - Returns the next sibling. This is the child following this node in the parent's list of children. This could be text or an element. use nextSiblingElement to ensure element @return <None/str/AdvancedTag> - None if there a...
[ "nextSibling", "-", "Returns", "the", "next", "sibling", ".", "This", "is", "the", "child", "following", "this", "node", "in", "the", "parent", "s", "list", "of", "children", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L929-L952
[ "def", "nextSibling", "(", "self", ")", ":", "parentNode", "=", "self", ".", "parentNode", "# If no parent, no siblings.", "if", "not", "parentNode", ":", "return", "None", "# Determine index in blocks", "myBlockIdx", "=", "parentNode", ".", "blocks", ".", "index", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.nextElementSibling
nextElementSibling - Returns the next sibling that is an element. This is the tag node following this node in the parent's list of children @return <None/AdvancedTag> - None if there are no children (tag) in the parent after this node, ...
AdvancedHTMLParser/Tags.py
def nextElementSibling(self): ''' nextElementSibling - Returns the next sibling that is an element. This is the tag node following this node in the parent's list of children @return <None/AdvancedTag> - None if there are no children (tag) in the parent after this nod...
def nextElementSibling(self): ''' nextElementSibling - Returns the next sibling that is an element. This is the tag node following this node in the parent's list of children @return <None/AdvancedTag> - None if there are no children (tag) in the parent after this nod...
[ "nextElementSibling", "-", "Returns", "the", "next", "sibling", "that", "is", "an", "element", ".", "This", "is", "the", "tag", "node", "following", "this", "node", "in", "the", "parent", "s", "list", "of", "children" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L955-L977
[ "def", "nextElementSibling", "(", "self", ")", ":", "parentNode", "=", "self", ".", "parentNode", "# If no parent, no siblings", "if", "not", "parentNode", ":", "return", "None", "# Determine the index in children", "myElementIdx", "=", "parentNode", ".", "children", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.previousSibling
previousSibling - Returns the previous sibling. This would be the previous node (text or tag) in the parent's list This could be text or an element. use previousSiblingElement to ensure element @return <None/str/AdvancedTag> - None if there are no nodes (text or tag) in th...
AdvancedHTMLParser/Tags.py
def previousSibling(self): ''' previousSibling - Returns the previous sibling. This would be the previous node (text or tag) in the parent's list This could be text or an element. use previousSiblingElement to ensure element @return <None/str/AdvancedTa...
def previousSibling(self): ''' previousSibling - Returns the previous sibling. This would be the previous node (text or tag) in the parent's list This could be text or an element. use previousSiblingElement to ensure element @return <None/str/AdvancedTa...
[ "previousSibling", "-", "Returns", "the", "previous", "sibling", ".", "This", "would", "be", "the", "previous", "node", "(", "text", "or", "tag", ")", "in", "the", "parent", "s", "list", "This", "could", "be", "text", "or", "an", "element", ".", "use", ...
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L982-L1006
[ "def", "previousSibling", "(", "self", ")", ":", "parentNode", "=", "self", ".", "parentNode", "# If no parent, no previous sibling", "if", "not", "parentNode", ":", "return", "None", "# Determine block index on parent of this node", "myBlockIdx", "=", "parentNode", ".", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.previousElementSibling
previousElementSibling - Returns the previous sibling that is an element. This is the previous tag node in the parent's list of children @return <None/AdvancedTag> - None if there are no children (tag) in the parent before this node, ...
AdvancedHTMLParser/Tags.py
def previousElementSibling(self): ''' previousElementSibling - Returns the previous sibling that is an element. This is the previous tag node in the parent's list of children @return <None/AdvancedTag> - None if there are no children (tag...
def previousElementSibling(self): ''' previousElementSibling - Returns the previous sibling that is an element. This is the previous tag node in the parent's list of children @return <None/AdvancedTag> - None if there are no children (tag...
[ "previousElementSibling", "-", "Returns", "the", "previous", "sibling", "that", "is", "an", "element", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1009-L1034
[ "def", "previousElementSibling", "(", "self", ")", ":", "parentNode", "=", "self", ".", "parentNode", "# If no parent, no siblings", "if", "not", "parentNode", ":", "return", "None", "# Determine this node's index in the children of parent", "myElementIdx", "=", "parentNode...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.tagBlocks
tagBlocks - Property. Returns all the blocks which are direct children of this node, where that block is a tag (not text) NOTE: This is similar to .children , and you should probably use .children instead except within this class itself @return list<AdvancedTag...
AdvancedHTMLParser/Tags.py
def tagBlocks(self): ''' tagBlocks - Property. Returns all the blocks which are direct children of this node, where that block is a tag (not text) NOTE: This is similar to .children , and you should probably use .children instead except within this class its...
def tagBlocks(self): ''' tagBlocks - Property. Returns all the blocks which are direct children of this node, where that block is a tag (not text) NOTE: This is similar to .children , and you should probably use .children instead except within this class its...
[ "tagBlocks", "-", "Property", ".", "Returns", "all", "the", "blocks", "which", "are", "direct", "children", "of", "this", "node", "where", "that", "block", "is", "a", "tag", "(", "not", "text", ")" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1040-L1051
[ "def", "tagBlocks", "(", "self", ")", ":", "myBlocks", "=", "self", ".", "blocks", "return", "[", "block", "for", "block", "in", "myBlocks", "if", "issubclass", "(", "block", ".", "__class__", ",", "AdvancedTag", ")", "]" ]
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.getBlocksTags
getBlocksTags - Returns a list of tuples referencing the blocks which are direct children of this node, and the block is an AdvancedTag. The tuples are ( block, blockIdx ) where "blockIdx" is the index of self.blocks wherein the tag resides. @return list< tuple(block, blockIdx) > - A l...
AdvancedHTMLParser/Tags.py
def getBlocksTags(self): ''' getBlocksTags - Returns a list of tuples referencing the blocks which are direct children of this node, and the block is an AdvancedTag. The tuples are ( block, blockIdx ) where "blockIdx" is the index of self.blocks wherein the tag resides. ...
def getBlocksTags(self): ''' getBlocksTags - Returns a list of tuples referencing the blocks which are direct children of this node, and the block is an AdvancedTag. The tuples are ( block, blockIdx ) where "blockIdx" is the index of self.blocks wherein the tag resides. ...
[ "getBlocksTags", "-", "Returns", "a", "list", "of", "tuples", "referencing", "the", "blocks", "which", "are", "direct", "children", "of", "this", "node", "and", "the", "block", "is", "an", "AdvancedTag", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1054-L1064
[ "def", "getBlocksTags", "(", "self", ")", ":", "myBlocks", "=", "self", ".", "blocks", "return", "[", "(", "myBlocks", "[", "i", "]", ",", "i", ")", "for", "i", "in", "range", "(", "len", "(", "myBlocks", ")", ")", "if", "issubclass", "(", "myBlock...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.textBlocks
textBlocks - Property. Returns all the blocks which are direct children of this node, where that block is a text (not a tag) @return list<AdvancedTag> - A list of direct children which are text.
AdvancedHTMLParser/Tags.py
def textBlocks(self): ''' textBlocks - Property. Returns all the blocks which are direct children of this node, where that block is a text (not a tag) @return list<AdvancedTag> - A list of direct children which are text. ''' myBlocks = self.b...
def textBlocks(self): ''' textBlocks - Property. Returns all the blocks which are direct children of this node, where that block is a text (not a tag) @return list<AdvancedTag> - A list of direct children which are text. ''' myBlocks = self.b...
[ "textBlocks", "-", "Property", ".", "Returns", "all", "the", "blocks", "which", "are", "direct", "children", "of", "this", "node", "where", "that", "block", "is", "a", "text", "(", "not", "a", "tag", ")" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1068-L1077
[ "def", "textBlocks", "(", "self", ")", ":", "myBlocks", "=", "self", ".", "blocks", "return", "[", "block", "for", "block", "in", "myBlocks", "if", "not", "issubclass", "(", "block", ".", "__class__", ",", "AdvancedTag", ")", "]" ]
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.textContent
textContent - property, gets the text of this node and all inner nodes. Use .innerText for just this node's text @return <str> - The text of all nodes at this level or lower
AdvancedHTMLParser/Tags.py
def textContent(self): ''' textContent - property, gets the text of this node and all inner nodes. Use .innerText for just this node's text @return <str> - The text of all nodes at this level or lower ''' def _collateText(curNode): ''' ...
def textContent(self): ''' textContent - property, gets the text of this node and all inner nodes. Use .innerText for just this node's text @return <str> - The text of all nodes at this level or lower ''' def _collateText(curNode): ''' ...
[ "textContent", "-", "property", "gets", "the", "text", "of", "this", "node", "and", "all", "inner", "nodes", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1092-L1124
[ "def", "textContent", "(", "self", ")", ":", "def", "_collateText", "(", "curNode", ")", ":", "'''\n _collateText - Recursive function to gather the \"text\" of all blocks\n\n in the order that they appear\n\n @param curNode <...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.containsUid
containsUid - Check if the uid (unique internal ID) appears anywhere as a direct child to this node, or the node itself. @param uid <uuid.UUID> - uuid to check @return <bool> - True if #uid is this node's uid, or is the uid of any children at any level down
AdvancedHTMLParser/Tags.py
def containsUid(self, uid): ''' containsUid - Check if the uid (unique internal ID) appears anywhere as a direct child to this node, or the node itself. @param uid <uuid.UUID> - uuid to check @return <bool> - True if #uid is this node's uid, or is the uid of any childre...
def containsUid(self, uid): ''' containsUid - Check if the uid (unique internal ID) appears anywhere as a direct child to this node, or the node itself. @param uid <uuid.UUID> - uuid to check @return <bool> - True if #uid is this node's uid, or is the uid of any childre...
[ "containsUid", "-", "Check", "if", "the", "uid", "(", "unique", "internal", "ID", ")", "appears", "anywhere", "as", "a", "direct", "child", "to", "this", "node", "or", "the", "node", "itself", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1181-L1198
[ "def", "containsUid", "(", "self", ",", "uid", ")", ":", "# Check if this node is the match", "if", "self", ".", "uid", "==", "uid", ":", "return", "True", "# Scan all children", "for", "child", "in", "self", ".", "children", ":", "if", "child", ".", "contai...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.getAllChildNodes
getAllChildNodes - Gets all the children, and their children, and their children, and so on, all the way to the end as a TagCollection. Use .childNodes for a regular list @return TagCollection<AdvancedTag> - A TagCollection of all children (and their children ...
AdvancedHTMLParser/Tags.py
def getAllChildNodes(self): ''' getAllChildNodes - Gets all the children, and their children, and their children, and so on, all the way to the end as a TagCollection. Use .childNodes for a regular list @return TagCollection<AdvancedTag> - ...
def getAllChildNodes(self): ''' getAllChildNodes - Gets all the children, and their children, and their children, and so on, all the way to the end as a TagCollection. Use .childNodes for a regular list @return TagCollection<AdvancedTag> - ...
[ "getAllChildNodes", "-", "Gets", "all", "the", "children", "and", "their", "children", "and", "their", "children", "and", "so", "on", "all", "the", "way", "to", "the", "end", "as", "a", "TagCollection", ".", "Use", ".", "childNodes", "for", "a", "regular",...
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1200-L1220
[ "def", "getAllChildNodes", "(", "self", ")", ":", "ret", "=", "TagCollection", "(", ")", "# Scan all the children of this node", "for", "child", "in", "self", ".", "children", ":", "# Append each child", "ret", ".", "append", "(", "child", ")", "# Append children'...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.getAllChildNodeUids
getAllChildNodeUids - Returns all the unique internal IDs for all children, and there children, so on and so forth until the end. For performing "contains node" kind of logic, this is more efficent than copying the entire nodeset @return set<uuid.UUID> A set of uuid objects
AdvancedHTMLParser/Tags.py
def getAllChildNodeUids(self): ''' getAllChildNodeUids - Returns all the unique internal IDs for all children, and there children, so on and so forth until the end. For performing "contains node" kind of logic, this is more efficent than copying the entire nodeset ...
def getAllChildNodeUids(self): ''' getAllChildNodeUids - Returns all the unique internal IDs for all children, and there children, so on and so forth until the end. For performing "contains node" kind of logic, this is more efficent than copying the entire nodeset ...
[ "getAllChildNodeUids", "-", "Returns", "all", "the", "unique", "internal", "IDs", "for", "all", "children", "and", "there", "children", "so", "on", "and", "so", "forth", "until", "the", "end", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1238-L1256
[ "def", "getAllChildNodeUids", "(", "self", ")", ":", "ret", "=", "set", "(", ")", "# Iterate through all children", "for", "child", "in", "self", ".", "children", ":", "# Add child's uid", "ret", ".", "add", "(", "child", ".", "uid", ")", "# Add child's childr...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.getAllNodeUids
getAllNodeUids - Returns all the unique internal IDs from getAllChildNodeUids, but also includes this tag's uid @return set<uuid.UUID> A set of uuid objects
AdvancedHTMLParser/Tags.py
def getAllNodeUids(self): ''' getAllNodeUids - Returns all the unique internal IDs from getAllChildNodeUids, but also includes this tag's uid @return set<uuid.UUID> A set of uuid objects ''' # Start with a set including this tag's uuid ret = { self.uid } ...
def getAllNodeUids(self): ''' getAllNodeUids - Returns all the unique internal IDs from getAllChildNodeUids, but also includes this tag's uid @return set<uuid.UUID> A set of uuid objects ''' # Start with a set including this tag's uuid ret = { self.uid } ...
[ "getAllNodeUids", "-", "Returns", "all", "the", "unique", "internal", "IDs", "from", "getAllChildNodeUids", "but", "also", "includes", "this", "tag", "s", "uid" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1258-L1269
[ "def", "getAllNodeUids", "(", "self", ")", ":", "# Start with a set including this tag's uuid", "ret", "=", "{", "self", ".", "uid", "}", "ret", ".", "update", "(", "self", ".", "getAllChildNodeUids", "(", ")", ")", "return", "ret" ]
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.getPeers
getPeers - Get elements who share a parent with this element @return - TagCollection of elements
AdvancedHTMLParser/Tags.py
def getPeers(self): ''' getPeers - Get elements who share a parent with this element @return - TagCollection of elements ''' parentNode = self.parentNode # If no parent, no peers if not parentNode: return None peers = parentNode.child...
def getPeers(self): ''' getPeers - Get elements who share a parent with this element @return - TagCollection of elements ''' parentNode = self.parentNode # If no parent, no peers if not parentNode: return None peers = parentNode.child...
[ "getPeers", "-", "Get", "elements", "who", "share", "a", "parent", "with", "this", "element" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1272-L1286
[ "def", "getPeers", "(", "self", ")", ":", "parentNode", "=", "self", ".", "parentNode", "# If no parent, no peers", "if", "not", "parentNode", ":", "return", "None", "peers", "=", "parentNode", ".", "children", "# Otherwise, get all children of parent excluding this nod...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.getStartTag
getStartTag - Returns the start tag represented as HTML @return - String of start tag with attributes
AdvancedHTMLParser/Tags.py
def getStartTag(self): ''' getStartTag - Returns the start tag represented as HTML @return - String of start tag with attributes ''' attributeStrings = [] # Get all attributes as a tuple (name<str>, value<str>) for name, val in self._attributes.items(): ...
def getStartTag(self): ''' getStartTag - Returns the start tag represented as HTML @return - String of start tag with attributes ''' attributeStrings = [] # Get all attributes as a tuple (name<str>, value<str>) for name, val in self._attributes.items(): ...
[ "getStartTag", "-", "Returns", "the", "start", "tag", "represented", "as", "HTML" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1395-L1430
[ "def", "getStartTag", "(", "self", ")", ":", "attributeStrings", "=", "[", "]", "# Get all attributes as a tuple (name<str>, value<str>)", "for", "name", ",", "val", "in", "self", ".", "_attributes", ".", "items", "(", ")", ":", "# Get all attributes", "if", "val"...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.getEndTag
getEndTag - returns the end tag representation as HTML string @return - String of end tag
AdvancedHTMLParser/Tags.py
def getEndTag(self): ''' getEndTag - returns the end tag representation as HTML string @return - String of end tag ''' # If this is a self-closing tag, we have no end tag (opens and closes in the start) if self.isSelfClosing is True: return '' ...
def getEndTag(self): ''' getEndTag - returns the end tag representation as HTML string @return - String of end tag ''' # If this is a self-closing tag, we have no end tag (opens and closes in the start) if self.isSelfClosing is True: return '' ...
[ "getEndTag", "-", "returns", "the", "end", "tag", "representation", "as", "HTML", "string" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1432-L1449
[ "def", "getEndTag", "(", "self", ")", ":", "# If this is a self-closing tag, we have no end tag (opens and closes in the start)", "if", "self", ".", "isSelfClosing", "is", "True", ":", "return", "''", "tagName", "=", "self", ".", "tagName", "# Do not add any indentation to ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.innerHTML
innerHTML - Returns an HTML string of the inner contents of this tag, including children. @return - String of inner contents HTML
AdvancedHTMLParser/Tags.py
def innerHTML(self): ''' innerHTML - Returns an HTML string of the inner contents of this tag, including children. @return - String of inner contents HTML ''' # If a self-closing tag, there are no contents if self.isSelfClosing is True: return '' ...
def innerHTML(self): ''' innerHTML - Returns an HTML string of the inner contents of this tag, including children. @return - String of inner contents HTML ''' # If a self-closing tag, there are no contents if self.isSelfClosing is True: return '' ...
[ "innerHTML", "-", "Returns", "an", "HTML", "string", "of", "the", "inner", "contents", "of", "this", "tag", "including", "children", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1452-L1477
[ "def", "innerHTML", "(", "self", ")", ":", "# If a self-closing tag, there are no contents", "if", "self", ".", "isSelfClosing", "is", "True", ":", "return", "''", "# Assemble all the blocks.", "ret", "=", "[", "]", "# Iterate through blocks", "for", "block", "in", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.getAttribute
getAttribute - Gets an attribute on this tag. Be wary using this for classname, maybe use addClass/removeClass. Attribute names are all lowercase. @return - The attribute value, or None if none exists.
AdvancedHTMLParser/Tags.py
def getAttribute(self, attrName, defaultValue=None): ''' getAttribute - Gets an attribute on this tag. Be wary using this for classname, maybe use addClass/removeClass. Attribute names are all lowercase. @return - The attribute value, or None if none exists. ''' if a...
def getAttribute(self, attrName, defaultValue=None): ''' getAttribute - Gets an attribute on this tag. Be wary using this for classname, maybe use addClass/removeClass. Attribute names are all lowercase. @return - The attribute value, or None if none exists. ''' if a...
[ "getAttribute", "-", "Gets", "an", "attribute", "on", "this", "tag", ".", "Be", "wary", "using", "this", "for", "classname", "maybe", "use", "addClass", "/", "removeClass", ".", "Attribute", "names", "are", "all", "lowercase", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1489-L1505
[ "def", "getAttribute", "(", "self", ",", "attrName", ",", "defaultValue", "=", "None", ")", ":", "if", "attrName", "in", "TAG_ITEM_BINARY_ATTRIBUTES", ":", "if", "attrName", "in", "self", ".", "_attributes", ":", "attrVal", "=", "self", ".", "_attributes", "...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.getAttributesList
getAttributesList - Get a copy of all attributes as a list of tuples (name, value) ALL values are converted to string and copied, so modifications will not affect the original attributes. If you want types like "style" to work as before, you'll need to recreate those elements (like StyleA...
AdvancedHTMLParser/Tags.py
def getAttributesList(self): ''' getAttributesList - Get a copy of all attributes as a list of tuples (name, value) ALL values are converted to string and copied, so modifications will not affect the original attributes. If you want types like "style" to work as before...
def getAttributesList(self): ''' getAttributesList - Get a copy of all attributes as a list of tuples (name, value) ALL values are converted to string and copied, so modifications will not affect the original attributes. If you want types like "style" to work as before...
[ "getAttributesList", "-", "Get", "a", "copy", "of", "all", "attributes", "as", "a", "list", "of", "tuples", "(", "name", "value", ")" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1508-L1519
[ "def", "getAttributesList", "(", "self", ")", ":", "return", "[", "(", "tostr", "(", "name", ")", "[", ":", "]", ",", "tostr", "(", "value", ")", "[", ":", "]", ")", "for", "name", ",", "value", "in", "self", ".", "_attributes", ".", "items", "("...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.getAttributesDict
getAttributesDict - Get a copy of all attributes as a dict map of name -> value ALL values are converted to string and copied, so modifications will not affect the original attributes. If you want types like "style" to work as before, you'll need to recreate those elements (like StyleAttr...
AdvancedHTMLParser/Tags.py
def getAttributesDict(self): ''' getAttributesDict - Get a copy of all attributes as a dict map of name -> value ALL values are converted to string and copied, so modifications will not affect the original attributes. If you want types like "style" to work as before, y...
def getAttributesDict(self): ''' getAttributesDict - Get a copy of all attributes as a dict map of name -> value ALL values are converted to string and copied, so modifications will not affect the original attributes. If you want types like "style" to work as before, y...
[ "getAttributesDict", "-", "Get", "a", "copy", "of", "all", "attributes", "as", "a", "dict", "map", "of", "name", "-", ">", "value" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1522-L1532
[ "def", "getAttributesDict", "(", "self", ")", ":", "return", "{", "tostr", "(", "name", ")", "[", ":", "]", ":", "tostr", "(", "value", ")", "[", ":", "]", "for", "name", ",", "value", "in", "self", ".", "_attributes", ".", "items", "(", ")", "}"...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.hasAttribute
hasAttribute - Checks for the existance of an attribute. Attribute names are all lowercase. @param attrName <str> - The attribute name @return <bool> - True or False if attribute exists by that name
AdvancedHTMLParser/Tags.py
def hasAttribute(self, attrName): ''' hasAttribute - Checks for the existance of an attribute. Attribute names are all lowercase. @param attrName <str> - The attribute name @return <bool> - True or False if attribute exists by that name ''...
def hasAttribute(self, attrName): ''' hasAttribute - Checks for the existance of an attribute. Attribute names are all lowercase. @param attrName <str> - The attribute name @return <bool> - True or False if attribute exists by that name ''...
[ "hasAttribute", "-", "Checks", "for", "the", "existance", "of", "an", "attribute", ".", "Attribute", "names", "are", "all", "lowercase", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1554-L1565
[ "def", "hasAttribute", "(", "self", ",", "attrName", ")", ":", "attrName", "=", "attrName", ".", "lower", "(", ")", "# Check if requested attribute is present on this node", "return", "bool", "(", "attrName", "in", "self", ".", "_attributes", ")" ]
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.removeAttribute
removeAttribute - Removes an attribute, by name. @param attrName <str> - The attribute name
AdvancedHTMLParser/Tags.py
def removeAttribute(self, attrName): ''' removeAttribute - Removes an attribute, by name. @param attrName <str> - The attribute name ''' attrName = attrName.lower() # Delete provided attribute name ( #attrName ) from attributes map try: ...
def removeAttribute(self, attrName): ''' removeAttribute - Removes an attribute, by name. @param attrName <str> - The attribute name ''' attrName = attrName.lower() # Delete provided attribute name ( #attrName ) from attributes map try: ...
[ "removeAttribute", "-", "Removes", "an", "attribute", "by", "name", ".", "@param", "attrName", "<str", ">", "-", "The", "attribute", "name" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1567-L1580
[ "def", "removeAttribute", "(", "self", ",", "attrName", ")", ":", "attrName", "=", "attrName", ".", "lower", "(", ")", "# Delete provided attribute name ( #attrName ) from attributes map", "try", ":", "del", "self", ".", "_attributes", "[", "attrName", "]", "except"...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.addClass
addClass - append a class name to the end of the "class" attribute, if not present @param className <str> - The name of the class to add
AdvancedHTMLParser/Tags.py
def addClass(self, className): ''' addClass - append a class name to the end of the "class" attribute, if not present @param className <str> - The name of the class to add ''' className = stripWordsOnly(className) if not className: return None ...
def addClass(self, className): ''' addClass - append a class name to the end of the "class" attribute, if not present @param className <str> - The name of the class to add ''' className = stripWordsOnly(className) if not className: return None ...
[ "addClass", "-", "append", "a", "class", "name", "to", "the", "end", "of", "the", "class", "attribute", "if", "not", "present" ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1593-L1620
[ "def", "addClass", "(", "self", ",", "className", ")", ":", "className", "=", "stripWordsOnly", "(", "className", ")", "if", "not", "className", ":", "return", "None", "if", "' '", "in", "className", ":", "# Multiple class names passed, do one at a time", "for", ...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d
train
AdvancedTag.removeClass
removeClass - remove a class name if present. Returns the class name if removed, otherwise None. @param className <str> - The name of the class to remove @return <str> - The class name removed if one was removed, otherwise None if #className wasn't present
AdvancedHTMLParser/Tags.py
def removeClass(self, className): ''' removeClass - remove a class name if present. Returns the class name if removed, otherwise None. @param className <str> - The name of the class to remove @return <str> - The class name removed if one was removed, otherwise None...
def removeClass(self, className): ''' removeClass - remove a class name if present. Returns the class name if removed, otherwise None. @param className <str> - The name of the class to remove @return <str> - The class name removed if one was removed, otherwise None...
[ "removeClass", "-", "remove", "a", "class", "name", "if", "present", ".", "Returns", "the", "class", "name", "if", "removed", "otherwise", "None", "." ]
kata198/AdvancedHTMLParser
python
https://github.com/kata198/AdvancedHTMLParser/blob/06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d/AdvancedHTMLParser/Tags.py#L1623-L1651
[ "def", "removeClass", "(", "self", ",", "className", ")", ":", "className", "=", "stripWordsOnly", "(", "className", ")", "if", "not", "className", ":", "return", "None", "if", "' '", "in", "className", ":", "# Multiple class names passed, do one at a time", "for"...
06aeea5d8e2ea86e155aae0fc237623d3e9b7f9d