INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Static method called before creating a XrefDialog to check if there are xrefs to display method ( optional ): method of the class we are looking xref from | def get_xrefs_list(cls, class_item, method=None):
"""Static method called before creating a XrefDialog
to check if there are xrefs to display
method (optional): method of the class we are looking xref from
"""
log.debug("Getting XREF for %s" % class_item)
item = c... |
Helper for get_xrefs_list | def get_xrefs_list_from_element(cls, element):
"""Helper for get_xrefs_list
element is a ClassDefItem or MethodDefItem
At the end of the function, we lost if we worked on
a class or method but we do not care for now.
"""
xref_items = element.XREFfrom.items
... |
Plot the call graph using matplotlib For larger graphs this should not be used as it is very slow and probably you can not see anything on it. | def plot(cg):
"""
Plot the call graph using matplotlib
For larger graphs, this should not be used, as it is very slow
and probably you can not see anything on it.
:param cg: A networkx call graph to plot
"""
from androguard.core.analysis.analysis import ExternalMethod
import matplotlib.... |
Wrapper around nx. write_gml | def _write_gml(G, path):
"""
Wrapper around nx.write_gml
"""
import networkx as nx
return nx.write_gml(G, path, stringizer=str) |
Start an interactive shell | def androlyze_main(session, filename):
"""
Start an interactive shell
:param session: Session file to load
:param filename: File to analyze, can be APK or DEX (or ODEX)
"""
from androguard.core.androconf import ANDROGUARD_VERSION, CONF
from IPython.terminal.embed import InteractiveShellEmbe... |
Decode bytes as MUTF - 8 See https:// docs. oracle. com/ javase/ 6/ docs/ api/ java/ io/ DataInput. html#modified - utf - 8 for more information | def decode(b):
"""
Decode bytes as MUTF-8
See https://docs.oracle.com/javase/6/docs/api/java/io/DataInput.html#modified-utf-8
for more information
Surrogates will be returned as two 16 bit characters.
:param b: bytes to decode
:rtype: unicode (py2), str (py3) of 16bit chars
:raises: Un... |
Reorganize a String in such a way that surrogates are printable and lonely surrogates are escaped. | def patch_string(s):
"""
Reorganize a String in such a way that surrogates are printable
and lonely surrogates are escaped.
:param s: input string
:return: string with escaped lonely surrogates and 32bit surrogates
"""
res = ''
it = PeekIterator(s)
for c in it:
if (ord(c) >>... |
Convert a string to a escaped ASCII representation including quotation marks: param s: a string: return: ASCII escaped string | def string(s):
"""
Convert a string to a escaped ASCII representation including quotation marks
:param s: a string
:return: ASCII escaped string
"""
ret = ['"']
for c in s:
if ' ' <= c < '\x7f':
if c == "'" or c == '"' or c == '\\':
ret.append('\\')
... |
Highlight a block of text. | def highlightBlock(self, string):
""" Highlight a block of text.
"""
prev_data = self.currentBlock().previous().userData()
if prev_data is not None:
self._lexer._saved_state_stack = prev_data.syntax_stack
elif hasattr(self._lexer, '_saved_state_stack'):
de... |
Sets the style to the specified Pygments style. | def set_style(self, style):
""" Sets the style to the specified Pygments style.
"""
style = SolarizedStyle # get_style_by_name(style)
self._style = style
self._clear_caches() |
Sets a CSS stylesheet. The classes in the stylesheet should correspond to those generated by: pygmentize - S <style > - f html Note that set_style and set_style_sheet completely override each other i. e. they cannot be used in conjunction. | def set_style_sheet(self, stylesheet):
""" Sets a CSS stylesheet. The classes in the stylesheet should
correspond to those generated by:
pygmentize -S <style> -f html
Note that 'set_style' and 'set_style_sheet' completely override each
other, i.e. they cannot be used in conju... |
Returns a QTextCharFormat for token or None. | def _get_format(self, token):
""" Returns a QTextCharFormat for token or None.
"""
if token in self._formats:
return self._formats[token]
result = self._get_format_from_style(token, self._style)
self._formats[token] = result
return result |
Returns a brush for the color. | def _get_brush(self, color):
""" Returns a brush for the color.
"""
result = self._brushes.get(color)
if result is None:
qcolor = self._get_color(color)
result = QtGui.QBrush(qcolor)
self._brushes[color] = result
return result |
Returns a QColor built from a Pygments color string. | def _get_color(self, color):
""" Returns a QColor built from a Pygments color string.
"""
qcolor = QtGui.QColor()
qcolor.setRgb(int(color[:2], base=16),
int(color[2:4], base=16),
int(color[4:6], base=16))
return qcolor |
Reload completely the sources by asking Androguard to decompile it again. Useful when: - an element has been renamed to propagate the info - the current tab is changed because we do not know what user did since then so we need to propagate previous changes as well | def reload_java_sources(self):
"""Reload completely the sources by asking Androguard
to decompile it again. Useful when:
- an element has been renamed to propagate the info
- the current tab is changed because we do not know what user
did since then, so we need t... |
Used to detect when cursor change position and to auto select word underneath it | def cursor_position_changed(self):
"""Used to detect when cursor change position and to auto select word
underneath it"""
log.debug("cursor_position_changed")
cur = self.textCursor()
log.debug(cur.position())
log.debug(cur.selectedText())
if len(cur.selectedTe... |
Keyboard shortcuts | def keyPressEvent(self, event):
"""Keyboard shortcuts"""
key = event.key()
if key == QtCore.Qt.Key_X:
self.actionXref()
elif key == QtCore.Qt.Key_G:
self.actionGoto()
elif key == QtCore.Qt.Key_X:
self.actionXref()
elif key == QtCore.Qt.... |
Check if there is already a meth_name method in the current class It is useful before allowing to rename a method to check name does not already exist. | def method_name_exist(self, meth_name):
"""Check if there is already a meth_name method in the current class
It is useful before allowing to rename a method to check name does
not already exist.
"""
methods = self.current_class.get_methods()
for m in methods:
... |
Check if there is already a field_name field in the current class It is useful before allowing to rename a field to check name does not already exist. | def field_name_exist(self, field_name):
"""Check if there is already a field_name field in the current class
It is useful before allowing to rename a field to check name does
not already exist.
"""
fields = self.class_item.get_fields()
for f in fields:
... |
Called back after a user chose a new name for an element. | def renameElement(self, oldname, newname, info):
"""Called back after a user chose a new name for an element.
"""
log.debug("Renaming %s into %s in %s" %
(oldname, newname, self.current_filename))
start, end = info
try:
t = self.doc.binding[st... |
Format a value based on type and data. By default no strings are looked up and <string > is returned. You need to define lookup_string in order to actually lookup strings from the string table. | def format_value(_type, _data, lookup_string=lambda ix: "<string>"):
"""
Format a value based on type and data.
By default, no strings are looked up and "<string>" is returned.
You need to define `lookup_string` in order to actually lookup strings from
the string table.
:param _type: The numeri... |
Return a string containing all resources packages ordered by packagename locale and type. | def get_arsc_info(arscobj):
"""
Return a string containing all resources packages ordered by packagename, locale and type.
:param arscobj: :class:`~ARSCParser`
:return: a string
"""
buff = ""
for package in arscobj.get_packages_names():
buff += package + ":\n"
for locale in ... |
Return the string at the index in the string table | def getString(self, idx):
"""
Return the string at the index in the string table
:param idx: index in the string table
:return: str
"""
if idx in self._cache:
return self._cache[idx]
if idx < 0 or not self.m_stringOffsets or idx > self.stringCount:
... |
Generic decoding with length check. The string is decoded from bytes with the given encoding then the length of the string is checked. The string is decoded using the replace method. | def _decode_bytes(data, encoding, str_len):
"""
Generic decoding with length check.
The string is decoded from bytes with the given encoding, then the length
of the string is checked.
The string is decoded using the "replace" method.
:param data: bytes
:param enc... |
Print some information on stdout about the string table | def show(self):
"""
Print some information on stdout about the string table
"""
print("StringBlock(stringsCount=0x%x, "
"stringsOffset=0x%x, "
"stylesCount=0x%x, "
"stylesOffset=0x%x, "
"flags=0x%x"
")" % (self.stringC... |
Return the String assosciated with the tag name | def name(self):
"""
Return the String assosciated with the tag name
"""
if self.m_name == -1 or (self.m_event != START_TAG and self.m_event != END_TAG):
return ''
return self.sb[self.m_name] |
Returns the current namespace mapping as a dictionary | def nsmap(self):
"""
Returns the current namespace mapping as a dictionary
there are several problems with the map and we try to guess a few
things here:
1) a URI can be mapped by many prefixes, so it is to decide which one to take
2) a prefix might map to an empty stri... |
Return the String assosicated with the current text | def text(self):
"""
Return the String assosicated with the current text
"""
if self.m_name == -1 or self.m_event != TEXT:
return ''
return self.sb[self.m_name] |
Return the start inside the m_attributes array for a given attribute | def _get_attribute_offset(self, index):
"""
Return the start inside the m_attributes array for a given attribute
"""
if self.m_event != START_TAG:
log.warning("Current event is not START_TAG.")
offset = index * ATTRIBUTE_LENGHT
if offset >= len(self.m_attribu... |
Returns the numeric ID for the namespace URI of an attribute | def getAttributeUri(self, index):
"""
Returns the numeric ID for the namespace URI of an attribute
"""
offset = self._get_attribute_offset(index)
uri = self.m_attributes[offset + ATTRIBUTE_IX_NAMESPACE_URI]
return uri |
This function is only used to look up strings All other work is done by: func: ~androguard. core. bytecodes. axml. format_value # FIXME should unite those functions: param index: index of the attribute: return: | def getAttributeValue(self, index):
"""
This function is only used to look up strings
All other work is done by
:func:`~androguard.core.bytecodes.axml.format_value`
# FIXME should unite those functions
:param index: index of the attribute
:return:
"""
... |
Get the XML as an UTF - 8 string | def get_xml(self, pretty=True):
"""
Get the XML as an UTF-8 string
:returns: bytes encoded as UTF-8
"""
return etree.tostring(self.root, encoding="utf-8", pretty_print=pretty) |
Apply some fixes to element named and attribute names. Try to get conform to: > Like element names attribute names are case - sensitive and must start with a letter or underscore. > The rest of the name can contain letters digits hyphens underscores and periods. See: https:// msdn. microsoft. com/ en - us/ library/ ms2... | def _fix_name(self, prefix, name):
"""
Apply some fixes to element named and attribute names.
Try to get conform to:
> Like element names, attribute names are case-sensitive and must start with a letter or underscore.
> The rest of the name can contain letters, digits, hyphens, u... |
Return a cleaned version of a value according to the specification: > Char:: = #x9 | #xA | #xD | [ #x20 - #xD7FF ] | [ #xE000 - #xFFFD ] | [ #x10000 - #x10FFFF ] | def _fix_value(self, value):
"""
Return a cleaned version of a value
according to the specification:
> Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
See https://www.w3.org/TR/xml/#charsets
:param value: a value to clean
:r... |
Retrieve a list of all available locales in a given packagename. | def get_locales(self, package_name):
"""
Retrieve a list of all available locales in a given packagename.
:param package_name: the package name to get locales of
"""
self._analyse()
return list(self.values[package_name].keys()) |
Get the XML ( as string ) of all resources of type string. | def get_string_resources(self, package_name, locale='\x00\x00'):
"""
Get the XML (as string) of all resources of type 'string'.
Read more about string resources:
https://developer.android.com/guide/topics/resources/string-resource.html
:param package_name: the package name to g... |
Get the XML ( as string ) of all resources of type string. This is a combined variant which has all locales and all package names stored. | def get_strings_resources(self):
"""
Get the XML (as string) of all resources of type 'string'.
This is a combined variant, which has all locales and all package names
stored.
"""
self._analyse()
buff = '<?xml version="1.0" encoding="utf-8"?>\n'
buff += ... |
Get the XML ( as string ) of all resources of type id. | def get_id_resources(self, package_name, locale='\x00\x00'):
"""
Get the XML (as string) of all resources of type 'id'.
Read more about ID resources:
https://developer.android.com/guide/topics/resources/more-resources.html#Id
:param package_name: the package name to get the res... |
Get the XML ( as string ) of all resources of type bool. | def get_bool_resources(self, package_name, locale='\x00\x00'):
"""
Get the XML (as string) of all resources of type 'bool'.
Read more about bool resources:
https://developer.android.com/guide/topics/resources/more-resources.html#Bool
:param package_name: the package name to get... |
Return a list of resolved resource IDs with their corresponding configuration. It has a similar return type as: meth: get_res_configs but also handles complex entries and references. Also instead of returning: class: ARSCResTableEntry in the tuple the actual values are resolved. | def get_resolved_res_configs(self, rid, config=None):
"""
Return a list of resolved resource IDs with their corresponding configuration.
It has a similar return type as :meth:`get_res_configs` but also handles complex entries
and references.
Also instead of returning :class:`ARSC... |
Return the resources found with the ID rid and select the right one based on the configuration or return all if no configuration was set. | def get_res_configs(self, rid, config=None, fallback=True):
"""
Return the resources found with the ID `rid` and select
the right one based on the configuration, or return all if no configuration was set.
But we try to be generous here and at least try to resolve something:
This... |
Resolves an id from a binary XML file in the form @ [ package: ] DEADBEEF and returns a tuple of package name and resource id. If no package name was given i. e. the ID has the form @DEADBEEF the package name is set to None. | def parse_id(name):
"""
Resolves an id from a binary XML file in the form "@[package:]DEADBEEF"
and returns a tuple of package name and resource id.
If no package name was given, i.e. the ID has the form "@DEADBEEF",
the package name is set to None.
Raises a ValueError i... |
Returns the XML name for a resource including the package name if package is None. A full name might look like @com. example: string/ foobar Otherwise the name is only looked up in the specified package and is returned without the package name. The same example from about without the package name will read as @string/ ... | def get_resource_xml_name(self, r_id, package=None):
"""
Returns the XML name for a resource, including the package name if package is None.
A full name might look like `@com.example:string/foobar`
Otherwise the name is only looked up in the specified package and is returned without
... |
Returns the combined language + region string or \ x00 \ x00 for the default locale: return: | def get_language_and_region(self):
"""
Returns the combined language+region string or \x00\x00 for the default locale
:return:
"""
if self.locale != 0:
_language = self._unpack_language_or_region([self.locale & 0xff, (self.locale & 0xff00) >> 8, ], ord('a'))
... |
Return the formatted ( interpreted ) data according to data_type. | def format_value(self):
"""
Return the formatted (interpreted) data according to `data_type`.
"""
return format_value(
self.data_type,
self.data,
self.parent.stringpool_main.getString
) |
Manage GitlabHttpError exceptions. | def on_http_error(error):
"""Manage GitlabHttpError exceptions.
This decorator function can be used to catch GitlabHttpError exceptions
raise specialized exceptions instead.
Args:
error(Exception): The exception type to raise -- must inherit from
GitlabError
"""
def wrap(f)... |
Returns the id of the resource. | def get_id(self):
"""Returns the id of the resource."""
if self._id_attr is None or not hasattr(self, self._id_attr):
return None
return getattr(self, self._id_attr) |
Retrieve a list of objects. | def list(self, **kwargs):
"""Retrieve a list of objects.
Args:
all (bool): If True, return all the items, without pagination
per_page (int): Number of items to retrieve per request
page (int): ID of the page to return (starts with page 1)
as_list (bool): ... |
Block the user. | def block(self, **kwargs):
"""Block the user.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabBlockError: If the user could not be blocked
Returns:
... |
Update an object on the server. | def update(self, id=None, new_data={}, **kwargs):
"""Update an object on the server.
Args:
id: ID of the object to update (can be None if not required)
new_data: the update data for the object
**kwargs: Extra options to send to the server (e.g. sudo)
Returns... |
Create or update the object. | def set(self, name, value, feature_group=None, user=None, **kwargs):
"""Create or update the object.
Args:
name (str): The value to set for the object
value (bool/int): The value to set for the object
feature_group (str): A feature group name
user (str): ... |
Create a new object. | def create(self, data, **kwargs):
"""Create a new object.
Args:
data (dict): Parameters to send to the server to create the
resource
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If auth... |
List all the members included inherited ones. | def all(self, **kwargs):
"""List all the members, included inherited ones.
Args:
all (bool): If True, return all the items, without pagination
per_page (int): Number of items to retrieve per request
page (int): ID of the page to return (starts with page 1)
... |
List issues related to this milestone. | def issues(self, **kwargs):
"""List issues related to this milestone.
Args:
all (bool): If True, return all the items, without pagination
per_page (int): Number of items to retrieve per request
page (int): ID of the page to return (starts with page 1)
as_... |
List the merge requests related to this milestone. | def merge_requests(self, **kwargs):
"""List the merge requests related to this milestone.
Args:
all (bool): If True, return all the items, without pagination
per_page (int): Number of items to retrieve per request
page (int): ID of the page to return (starts with pag... |
Transfer a project to this group. | def transfer_project(self, to_project_id, **kwargs):
"""Transfer a project to this group.
Args:
to_project_id (int): ID of the project to transfer
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication ... |
Add an LDAP group link. | def add_ldap_group_link(self, cn, group_access, provider, **kwargs):
"""Add an LDAP group link.
Args:
cn (str): CN of the LDAP group
group_access (int): Minimum access level for members of the LDAP
group
provider (str): LDAP provider for the LDAP grou... |
Delete an LDAP group link. | def delete_ldap_group_link(self, cn, provider=None, **kwargs):
"""Delete an LDAP group link.
Args:
cn (str): CN of the LDAP group
provider (str): LDAP provider for the LDAP group
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
G... |
Sync LDAP groups. | def ldap_sync(self, **kwargs):
"""Sync LDAP groups.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabCreateError: If the server cannot perform the request
"""
... |
Retrieve a list of objects. | def list(self, **kwargs):
"""Retrieve a list of objects.
Args:
all (bool): If True, return all the items, without pagination
per_page (int): Number of items to retrieve per request
page (int): ID of the page to return (starts with page 1)
as_list (bool): ... |
Protect the branch. | def protect(self, developers_can_push=False, developers_can_merge=False,
**kwargs):
"""Protect the branch.
Args:
developers_can_push (bool): Set to True if developers are allowed
to push to the branch
developers_can_merge (... |
Unprotect the branch. | def unprotect(self, **kwargs):
"""Unprotect the branch.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabProtectError: If the branch could not be unprotected
"""... |
Cancel the job. | def cancel(self, **kwargs):
"""Cancel the job.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabJobCancelError: If the job could not be canceled
"""
path... |
Retry the job. | def retry(self, **kwargs):
"""Retry the job.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabJobRetryError: If the job could not be retried
"""
path = '... |
Trigger a job explicitly. | def play(self, **kwargs):
"""Trigger a job explicitly.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabJobPlayError: If the job could not be triggered
"""
... |
Erase the job ( remove job artifacts and trace ). | def erase(self, **kwargs):
"""Erase the job (remove job artifacts and trace).
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabJobEraseError: If the job could not be era... |
Prevent artifacts from being deleted when expiration is set. | def keep_artifacts(self, **kwargs):
"""Prevent artifacts from being deleted when expiration is set.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabCreateError: If the ... |
Create a new object. | def create(self, data, **kwargs):
"""Create a new object.
Args:
data (dict): Parameters to send to the server to create the
resource
**kwargs: Extra options to send to the server (e.g. sudo or
'ref_name', 'stage', 'name', 'all')
... |
Generate the commit diff. | def diff(self, **kwargs):
"""Generate the commit diff.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabGetError: If the diff could not be retrieved
Returns:
... |
Cherry - pick a commit into a branch. | def cherry_pick(self, branch, **kwargs):
"""Cherry-pick a commit into a branch.
Args:
branch (str): Name of target branch
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
... |
List the references the commit is pushed to. | def refs(self, type='all', **kwargs):
"""List the references the commit is pushed to.
Args:
type (str): The scope of references ('branch', 'tag' or 'all')
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authent... |
List the merge requests related to the commit. | def merge_requests(self, **kwargs):
"""List the merge requests related to the commit.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabGetError: If the references could ... |
Stop the environment. | def stop(self, **kwargs):
"""Stop the environment.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabStopError: If the operation failed
"""
path = '%s/%s/... |
Enable a deploy key for a project. | def enable(self, key_id, **kwargs):
"""Enable a deploy key for a project.
Args:
key_id (int): The ID of the key to enable
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
... |
Retrieve a list of objects. | def list(self, **kwargs):
"""Retrieve a list of objects.
Args:
all (bool): If True, return all the items, without pagination
per_page (int): Number of items to retrieve per request
page (int): ID of the page to return (starts with page 1)
as_list (bool): ... |
Create a new object. | def create(self, data, **kwargs):
"""Create a new object.
Args:
data (dict): parameters to send to the server to create the
resource
**kwargs: Extra options to send to the server (e.g. sudo)
Returns:
RESTObject, RESTObject: The sourc... |
Move the issue to another project. | def move(self, to_project_id, **kwargs):
"""Move the issue to another project.
Args:
to_project_id(int): ID of the target project
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
... |
List merge requests that will close the issue when merged. | def closed_by(self, **kwargs):
"""List merge requests that will close the issue when merged.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabGetErrot: If the merge requ... |
Set the release notes on the tag. | def set_release_description(self, description, **kwargs):
"""Set the release notes on the tag.
If the release doesn't exist yet, it will be created. If it already
exists, its description will be updated.
Args:
description (str): Description of the release.
**kwa... |
Change MR - level allowed approvers and approver groups. | def set_approvers(self, approver_ids=[], approver_group_ids=[], **kwargs):
"""Change MR-level allowed approvers and approver groups.
Args:
approver_ids (list): User IDs that can approve MRs
approver_group_ids (list): Group IDs whose members can approve MRs
Raises:
... |
Cancel merge when the pipeline succeeds. | def cancel_merge_when_pipeline_succeeds(self, **kwargs):
"""Cancel merge when the pipeline succeeds.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabMROnBuildSuccessErr... |
List the merge request commits. | def commits(self, **kwargs):
"""List the merge request commits.
Args:
all (bool): If True, return all the items, without pagination
per_page (int): Number of items to retrieve per request
page (int): ID of the page to return (starts with page 1)
as_list (... |
List the merge request changes. | def changes(self, **kwargs):
"""List the merge request changes.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabListError: If the list could not be retrieved
R... |
List the merge request pipelines. | def pipelines(self, **kwargs):
"""List the merge request pipelines.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabListError: If the list could not be retrieved
... |
Approve the merge request. | def approve(self, sha=None, **kwargs):
"""Approve the merge request.
Args:
sha (str): Head SHA of MR
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabMRApprovalErr... |
Unapprove the merge request. | def unapprove(self, **kwargs):
"""Unapprove the merge request.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabMRApprovalError: If the unapproval failed
"""
... |
Accept the merge request. | def merge(self, merge_commit_message=None,
should_remove_source_branch=False,
merge_when_pipeline_succeeds=False,
**kwargs):
"""Accept the merge request.
Args:
merge_commit_message (bool): Commit message
should_remove_source_branch (bool... |
List issues related to this milestone. | def issues(self, **kwargs):
"""List issues related to this milestone.
Args:
all (bool): If True, return all the items, without pagination
per_page (int): Number of items to retrieve per request
page (int): ID of the page to return (starts with page 1)
as_... |
List the merge requests related to this milestone. | def merge_requests(self, **kwargs):
"""List the merge requests related to this milestone.
Args:
all (bool): If True, return all the items, without pagination
per_page (int): Number of items to retrieve per request
page (int): ID of the page to return (starts with pag... |
Delete a Label on the server. | def delete(self, name, **kwargs):
"""Delete a Label on the server.
Args:
name: The name of the label
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabDeleteError: ... |
Save the changes made to the file to the server. | def save(self, branch, commit_message, **kwargs):
"""Save the changes made to the file to the server.
The object is updated to match what the server returns.
Args:
branch (str): Branch in which the file will be updated
commit_message (str): Message to send with the comm... |
Delete the file from the server. | def delete(self, branch, commit_message, **kwargs):
"""Delete the file from the server.
Args:
branch (str): Branch from which the file will be removed
commit_message (str): Commit message for the deletion
**kwargs: Extra options to send to the server (e.g. sudo)
... |
Retrieve a single file. | def get(self, file_path, ref, **kwargs):
"""Retrieve a single file.
Args:
file_path (str): Path of the file to retrieve
ref (str): Name of the branch, tag or commit
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthentic... |
Create a new object. | def create(self, data, **kwargs):
"""Create a new object.
Args:
data (dict): parameters to send to the server to create the
resource
**kwargs: Extra options to send to the server (e.g. sudo)
Returns:
RESTObject: a new instance of the... |
Update an object on the server. | def update(self, file_path, new_data={}, **kwargs):
"""Update an object on the server.
Args:
id: ID of the object to update (can be None if not required)
new_data: the update data for the object
**kwargs: Extra options to send to the server (e.g. sudo)
Retur... |
Delete a file on the server. | def delete(self, file_path, branch, commit_message, **kwargs):
"""Delete a file on the server.
Args:
file_path (str): Path of the file to remove
branch (str): Branch from which the file will be removed
commit_message (str): Commit message for the deletion
... |
Return the content of a file for a commit. | def raw(self, file_path, ref, streamed=False, action=None, chunk_size=1024,
**kwargs):
"""Return the content of a file for a commit.
Args:
ref (str): ID of the commit
filepath (str): Path of the file to return
streamed (bool): If True the data will be pro... |
Creates a new object. | def create(self, data, **kwargs):
"""Creates a new object.
Args:
data (dict): Parameters to send to the server to create the
resource
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If aut... |
Update the owner of a pipeline schedule. | def take_ownership(self, **kwargs):
"""Update the owner of a pipeline schedule.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabOwnershipError: If the request failed
... |
Retrieve a single object. | def get(self, id, **kwargs):
"""Retrieve a single object.
Args:
id (int or str): ID of the object to retrieve
lazy (bool): If True, don't request the server, but create a
shallow object giving access to the managers. This is
usef... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.