repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
buildbot/buildbot | master/buildbot/db/enginestrategy.py | SqlLiteStrategy.set_up | def set_up(self, u, engine):
"""Special setup for sqlite engines"""
def connect_listener_enable_fk(connection, record):
# fk must be enabled for all connections
if not getattr(engine, "fk_disabled", False):
return # http://trac.buildbot.net/ticket/3490#ticket
... | python | def set_up(self, u, engine):
"""Special setup for sqlite engines"""
def connect_listener_enable_fk(connection, record):
# fk must be enabled for all connections
if not getattr(engine, "fk_disabled", False):
return # http://trac.buildbot.net/ticket/3490#ticket
... | [
"def",
"set_up",
"(",
"self",
",",
"u",
",",
"engine",
")",
":",
"def",
"connect_listener_enable_fk",
"(",
"connection",
",",
"record",
")",
":",
"# fk must be enabled for all connections",
"if",
"not",
"getattr",
"(",
"engine",
",",
"\"fk_disabled\"",
",",
"Fal... | Special setup for sqlite engines | [
"Special",
"setup",
"for",
"sqlite",
"engines"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/enginestrategy.py#L64-L84 | train |
buildbot/buildbot | master/buildbot/db/enginestrategy.py | MySQLStrategy.set_up | def set_up(self, u, engine):
"""Special setup for mysql engines"""
# add the reconnecting PoolListener that will detect a
# disconnected connection and automatically start a new
# one. This provides a measure of additional safety over
# the pool_recycle parameter, and is useful ... | python | def set_up(self, u, engine):
"""Special setup for mysql engines"""
# add the reconnecting PoolListener that will detect a
# disconnected connection and automatically start a new
# one. This provides a measure of additional safety over
# the pool_recycle parameter, and is useful ... | [
"def",
"set_up",
"(",
"self",
",",
"u",
",",
"engine",
")",
":",
"# add the reconnecting PoolListener that will detect a",
"# disconnected connection and automatically start a new",
"# one. This provides a measure of additional safety over",
"# the pool_recycle parameter, and is useful wh... | Special setup for mysql engines | [
"Special",
"setup",
"for",
"mysql",
"engines"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/enginestrategy.py#L102-L130 | train |
buildbot/buildbot | master/buildbot/db/enginestrategy.py | BuildbotEngineStrategy.special_case_sqlite | def special_case_sqlite(self, u, kwargs):
"""For sqlite, percent-substitute %(basedir)s and use a full
path to the basedir. If using a memory database, force the
pool size to be 1."""
max_conns = 1
# when given a database path, stick the basedir in there
if u.database:
... | python | def special_case_sqlite(self, u, kwargs):
"""For sqlite, percent-substitute %(basedir)s and use a full
path to the basedir. If using a memory database, force the
pool size to be 1."""
max_conns = 1
# when given a database path, stick the basedir in there
if u.database:
... | [
"def",
"special_case_sqlite",
"(",
"self",
",",
"u",
",",
"kwargs",
")",
":",
"max_conns",
"=",
"1",
"# when given a database path, stick the basedir in there",
"if",
"u",
".",
"database",
":",
"# Use NullPool instead of the sqlalchemy-0.6.8-default",
"# SingletonThreadPool f... | For sqlite, percent-substitute %(basedir)s and use a full
path to the basedir. If using a memory database, force the
pool size to be 1. | [
"For",
"sqlite",
"percent",
"-",
"substitute",
"%",
"(",
"basedir",
")",
"s",
"and",
"use",
"a",
"full",
"path",
"to",
"the",
"basedir",
".",
"If",
"using",
"a",
"memory",
"database",
"force",
"the",
"pool",
"size",
"to",
"be",
"1",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/enginestrategy.py#L164-L198 | train |
buildbot/buildbot | master/buildbot/db/enginestrategy.py | BuildbotEngineStrategy.special_case_mysql | def special_case_mysql(self, u, kwargs):
"""For mysql, take max_idle out of the query arguments, and
use its value for pool_recycle. Also, force use_unicode and
charset to be True and 'utf8', failing if they were set to
anything else."""
kwargs['pool_recycle'] = int(u.query.pop... | python | def special_case_mysql(self, u, kwargs):
"""For mysql, take max_idle out of the query arguments, and
use its value for pool_recycle. Also, force use_unicode and
charset to be True and 'utf8', failing if they were set to
anything else."""
kwargs['pool_recycle'] = int(u.query.pop... | [
"def",
"special_case_mysql",
"(",
"self",
",",
"u",
",",
"kwargs",
")",
":",
"kwargs",
"[",
"'pool_recycle'",
"]",
"=",
"int",
"(",
"u",
".",
"query",
".",
"pop",
"(",
"'max_idle'",
",",
"3600",
")",
")",
"# default to the MyISAM storage engine",
"storage_en... | For mysql, take max_idle out of the query arguments, and
use its value for pool_recycle. Also, force use_unicode and
charset to be True and 'utf8', failing if they were set to
anything else. | [
"For",
"mysql",
"take",
"max_idle",
"out",
"of",
"the",
"query",
"arguments",
"and",
"use",
"its",
"value",
"for",
"pool_recycle",
".",
"Also",
"force",
"use_unicode",
"and",
"charset",
"to",
"be",
"True",
"and",
"utf8",
"failing",
"if",
"they",
"were",
"s... | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/enginestrategy.py#L200-L228 | train |
buildbot/buildbot | master/buildbot/worker/openstack.py | OpenStackLatentWorker._constructClient | def _constructClient(client_version, username, user_domain, password, project_name, project_domain,
auth_url):
"""Return a novaclient from the given args."""
loader = loading.get_plugin_loader('password')
# These only work with v3
if user_domain is not None or p... | python | def _constructClient(client_version, username, user_domain, password, project_name, project_domain,
auth_url):
"""Return a novaclient from the given args."""
loader = loading.get_plugin_loader('password')
# These only work with v3
if user_domain is not None or p... | [
"def",
"_constructClient",
"(",
"client_version",
",",
"username",
",",
"user_domain",
",",
"password",
",",
"project_name",
",",
"project_domain",
",",
"auth_url",
")",
":",
"loader",
"=",
"loading",
".",
"get_plugin_loader",
"(",
"'password'",
")",
"# These only... | Return a novaclient from the given args. | [
"Return",
"a",
"novaclient",
"from",
"the",
"given",
"args",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/openstack.py#L106-L120 | train |
buildbot/buildbot | master/buildbot/worker/openstack.py | OpenStackLatentWorker._parseBlockDevice | def _parseBlockDevice(self, block_device):
"""
Parse a higher-level view of the block device mapping into something
novaclient wants. This should be similar to how Horizon presents it.
Required keys:
device_name: The name of the device; e.g. vda or xda.
source_typ... | python | def _parseBlockDevice(self, block_device):
"""
Parse a higher-level view of the block device mapping into something
novaclient wants. This should be similar to how Horizon presents it.
Required keys:
device_name: The name of the device; e.g. vda or xda.
source_typ... | [
"def",
"_parseBlockDevice",
"(",
"self",
",",
"block_device",
")",
":",
"client_block_device",
"=",
"{",
"}",
"client_block_device",
"[",
"'device_name'",
"]",
"=",
"block_device",
".",
"get",
"(",
"'device_name'",
",",
"'vda'",
")",
"client_block_device",
"[",
... | Parse a higher-level view of the block device mapping into something
novaclient wants. This should be similar to how Horizon presents it.
Required keys:
device_name: The name of the device; e.g. vda or xda.
source_type: image, snapshot, volume, or blank/None.
destinat... | [
"Parse",
"a",
"higher",
"-",
"level",
"view",
"of",
"the",
"block",
"device",
"mapping",
"into",
"something",
"novaclient",
"wants",
".",
"This",
"should",
"be",
"similar",
"to",
"how",
"Horizon",
"presents",
"it",
".",
"Required",
"keys",
":",
"device_name"... | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/openstack.py#L122-L149 | train |
buildbot/buildbot | master/buildbot/worker/openstack.py | OpenStackLatentWorker._renderBlockDevice | def _renderBlockDevice(self, block_device, build):
"""Render all of the block device's values."""
rendered_block_device = yield build.render(block_device)
if rendered_block_device['volume_size'] is None:
source_type = rendered_block_device['source_type']
source_uuid = ren... | python | def _renderBlockDevice(self, block_device, build):
"""Render all of the block device's values."""
rendered_block_device = yield build.render(block_device)
if rendered_block_device['volume_size'] is None:
source_type = rendered_block_device['source_type']
source_uuid = ren... | [
"def",
"_renderBlockDevice",
"(",
"self",
",",
"block_device",
",",
"build",
")",
":",
"rendered_block_device",
"=",
"yield",
"build",
".",
"render",
"(",
"block_device",
")",
"if",
"rendered_block_device",
"[",
"'volume_size'",
"]",
"is",
"None",
":",
"source_t... | Render all of the block device's values. | [
"Render",
"all",
"of",
"the",
"block",
"device",
"s",
"values",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/openstack.py#L152-L160 | train |
buildbot/buildbot | master/buildbot/worker/openstack.py | OpenStackLatentWorker._determineVolumeSize | def _determineVolumeSize(self, source_type, source_uuid):
"""
Determine the minimum size the volume needs to be for the source.
Returns the size in GiB.
"""
nova = self.novaclient
if source_type == 'image':
# The size returned for an image is in bytes. Round u... | python | def _determineVolumeSize(self, source_type, source_uuid):
"""
Determine the minimum size the volume needs to be for the source.
Returns the size in GiB.
"""
nova = self.novaclient
if source_type == 'image':
# The size returned for an image is in bytes. Round u... | [
"def",
"_determineVolumeSize",
"(",
"self",
",",
"source_type",
",",
"source_uuid",
")",
":",
"nova",
"=",
"self",
".",
"novaclient",
"if",
"source_type",
"==",
"'image'",
":",
"# The size returned for an image is in bytes. Round up to the next",
"# integer GiB.",
"image"... | Determine the minimum size the volume needs to be for the source.
Returns the size in GiB. | [
"Determine",
"the",
"minimum",
"size",
"the",
"volume",
"needs",
"to",
"be",
"for",
"the",
"source",
".",
"Returns",
"the",
"size",
"in",
"GiB",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/openstack.py#L162-L186 | train |
buildbot/buildbot | master/buildbot/steps/mtrlogobserver.py | MTR.runInteractionWithRetry | def runInteractionWithRetry(self, actionFn, *args, **kw):
"""
Run a database transaction with dbpool.runInteraction, but retry the
transaction in case of a temporary error (like connection lost).
This is needed to be robust against things like database connection
idle timeouts.
... | python | def runInteractionWithRetry(self, actionFn, *args, **kw):
"""
Run a database transaction with dbpool.runInteraction, but retry the
transaction in case of a temporary error (like connection lost).
This is needed to be robust against things like database connection
idle timeouts.
... | [
"def",
"runInteractionWithRetry",
"(",
"self",
",",
"actionFn",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"def",
"runWithRetry",
"(",
"txn",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"retryCount",
"=",
"0",
"while",
"(",
"True",
")",
... | Run a database transaction with dbpool.runInteraction, but retry the
transaction in case of a temporary error (like connection lost).
This is needed to be robust against things like database connection
idle timeouts.
The passed callable that implements the transaction must be retryable... | [
"Run",
"a",
"database",
"transaction",
"with",
"dbpool",
".",
"runInteraction",
"but",
"retry",
"the",
"transaction",
"in",
"case",
"of",
"a",
"temporary",
"error",
"(",
"like",
"connection",
"lost",
")",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/mtrlogobserver.py#L339-L368 | train |
buildbot/buildbot | master/buildbot/steps/mtrlogobserver.py | MTR.runQueryWithRetry | def runQueryWithRetry(self, *args, **kw):
"""
Run a database query, like with dbpool.runQuery, but retry the query in
case of a temporary error (like connection lost).
This is needed to be robust against things like database connection
idle timeouts."""
def runQuery(txn... | python | def runQueryWithRetry(self, *args, **kw):
"""
Run a database query, like with dbpool.runQuery, but retry the query in
case of a temporary error (like connection lost).
This is needed to be robust against things like database connection
idle timeouts."""
def runQuery(txn... | [
"def",
"runQueryWithRetry",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"def",
"runQuery",
"(",
"txn",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"txn",
".",
"execute",
"(",
"*",
"args",
",",
"*",
"*",
"kw",
")",
"retu... | Run a database query, like with dbpool.runQuery, but retry the query in
case of a temporary error (like connection lost).
This is needed to be robust against things like database connection
idle timeouts. | [
"Run",
"a",
"database",
"query",
"like",
"with",
"dbpool",
".",
"runQuery",
"but",
"retry",
"the",
"query",
"in",
"case",
"of",
"a",
"temporary",
"error",
"(",
"like",
"connection",
"lost",
")",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/mtrlogobserver.py#L370-L382 | train |
buildbot/buildbot | master/buildbot/db/pool.py | timed_do_fn | def timed_do_fn(f):
"""Decorate a do function to log before, after, and elapsed time,
with the name of the calling function. This is not speedy!"""
def wrap(callable, *args, **kwargs):
global _debug_id
# get a description of the function that called us
st = traceback.extract_stack(... | python | def timed_do_fn(f):
"""Decorate a do function to log before, after, and elapsed time,
with the name of the calling function. This is not speedy!"""
def wrap(callable, *args, **kwargs):
global _debug_id
# get a description of the function that called us
st = traceback.extract_stack(... | [
"def",
"timed_do_fn",
"(",
"f",
")",
":",
"def",
"wrap",
"(",
"callable",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"global",
"_debug_id",
"# get a description of the function that called us",
"st",
"=",
"traceback",
".",
"extract_stack",
"(",
"limi... | Decorate a do function to log before, after, and elapsed time,
with the name of the calling function. This is not speedy! | [
"Decorate",
"a",
"do",
"function",
"to",
"log",
"before",
"after",
"and",
"elapsed",
"time",
"with",
"the",
"name",
"of",
"the",
"calling",
"function",
".",
"This",
"is",
"not",
"speedy!"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/pool.py#L42-L87 | train |
buildbot/buildbot | master/buildbot/db/pool.py | DBThreadPool.shutdown | def shutdown(self):
"""Manually stop the pool. This is only necessary from tests, as the
pool will stop itself when the reactor stops under normal
circumstances."""
if not self._stop_evt:
return # pool is already stopped
self.reactor.removeSystemEventTrigger(self._s... | python | def shutdown(self):
"""Manually stop the pool. This is only necessary from tests, as the
pool will stop itself when the reactor stops under normal
circumstances."""
if not self._stop_evt:
return # pool is already stopped
self.reactor.removeSystemEventTrigger(self._s... | [
"def",
"shutdown",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_stop_evt",
":",
"return",
"# pool is already stopped",
"self",
".",
"reactor",
".",
"removeSystemEventTrigger",
"(",
"self",
".",
"_stop_evt",
")",
"self",
".",
"_stop",
"(",
")"
] | Manually stop the pool. This is only necessary from tests, as the
pool will stop itself when the reactor stops under normal
circumstances. | [
"Manually",
"stop",
"the",
"pool",
".",
"This",
"is",
"only",
"necessary",
"from",
"tests",
"as",
"the",
"pool",
"will",
"stop",
"itself",
"when",
"the",
"reactor",
"stops",
"under",
"normal",
"circumstances",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/pool.py#L152-L159 | train |
buildbot/buildbot | master/buildbot/manhole.py | show | def show(x):
"""Display the data attributes of an object in a readable format"""
print("data attributes of %r" % (x,))
names = dir(x)
maxlen = max([0] + [len(n) for n in names])
for k in names:
v = getattr(x, k)
if isinstance(v, types.MethodType):
continue
if k[:2... | python | def show(x):
"""Display the data attributes of an object in a readable format"""
print("data attributes of %r" % (x,))
names = dir(x)
maxlen = max([0] + [len(n) for n in names])
for k in names:
v = getattr(x, k)
if isinstance(v, types.MethodType):
continue
if k[:2... | [
"def",
"show",
"(",
"x",
")",
":",
"print",
"(",
"\"data attributes of %r\"",
"%",
"(",
"x",
",",
")",
")",
"names",
"=",
"dir",
"(",
"x",
")",
"maxlen",
"=",
"max",
"(",
"[",
"0",
"]",
"+",
"[",
"len",
"(",
"n",
")",
"for",
"n",
"in",
"names... | Display the data attributes of an object in a readable format | [
"Display",
"the",
"data",
"attributes",
"of",
"an",
"object",
"in",
"a",
"readable",
"format"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/manhole.py#L340-L361 | train |
buildbot/buildbot | master/buildbot/worker/libvirt.py | Connection.lookupByName | def lookupByName(self, name):
""" I lookup an existing predefined domain """
res = yield queue.executeInThread(self.connection.lookupByName, name)
return self.DomainClass(self, res) | python | def lookupByName(self, name):
""" I lookup an existing predefined domain """
res = yield queue.executeInThread(self.connection.lookupByName, name)
return self.DomainClass(self, res) | [
"def",
"lookupByName",
"(",
"self",
",",
"name",
")",
":",
"res",
"=",
"yield",
"queue",
".",
"executeInThread",
"(",
"self",
".",
"connection",
".",
"lookupByName",
",",
"name",
")",
"return",
"self",
".",
"DomainClass",
"(",
"self",
",",
"res",
")"
] | I lookup an existing predefined domain | [
"I",
"lookup",
"an",
"existing",
"predefined",
"domain"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/libvirt.py#L133-L136 | train |
buildbot/buildbot | master/buildbot/worker/libvirt.py | Connection.create | def create(self, xml):
""" I take libvirt XML and start a new VM """
res = yield queue.executeInThread(self.connection.createXML, xml, 0)
return self.DomainClass(self, res) | python | def create(self, xml):
""" I take libvirt XML and start a new VM """
res = yield queue.executeInThread(self.connection.createXML, xml, 0)
return self.DomainClass(self, res) | [
"def",
"create",
"(",
"self",
",",
"xml",
")",
":",
"res",
"=",
"yield",
"queue",
".",
"executeInThread",
"(",
"self",
".",
"connection",
".",
"createXML",
",",
"xml",
",",
"0",
")",
"return",
"self",
".",
"DomainClass",
"(",
"self",
",",
"res",
")"
... | I take libvirt XML and start a new VM | [
"I",
"take",
"libvirt",
"XML",
"and",
"start",
"a",
"new",
"VM"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/libvirt.py#L139-L142 | train |
buildbot/buildbot | master/buildbot/worker/libvirt.py | LibVirtWorker._find_existing_instance | def _find_existing_instance(self):
"""
I find existing VMs that are already running that might be orphaned instances of this worker.
"""
if not self.connection:
return None
domains = yield self.connection.all()
for d in domains:
name = yield d.nam... | python | def _find_existing_instance(self):
"""
I find existing VMs that are already running that might be orphaned instances of this worker.
"""
if not self.connection:
return None
domains = yield self.connection.all()
for d in domains:
name = yield d.nam... | [
"def",
"_find_existing_instance",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"connection",
":",
"return",
"None",
"domains",
"=",
"yield",
"self",
".",
"connection",
".",
"all",
"(",
")",
"for",
"d",
"in",
"domains",
":",
"name",
"=",
"yield",
"d... | I find existing VMs that are already running that might be orphaned instances of this worker. | [
"I",
"find",
"existing",
"VMs",
"that",
"are",
"already",
"running",
"that",
"might",
"be",
"orphaned",
"instances",
"of",
"this",
"worker",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/libvirt.py#L179-L193 | train |
buildbot/buildbot | master/buildbot/worker/libvirt.py | LibVirtWorker._prepare_base_image | def _prepare_base_image(self):
"""
I am a private method for creating (possibly cheap) copies of a
base_image for start_instance to boot.
"""
if not self.base_image:
return defer.succeed(True)
if self.cheap_copy:
clone_cmd = "qemu-img"
... | python | def _prepare_base_image(self):
"""
I am a private method for creating (possibly cheap) copies of a
base_image for start_instance to boot.
"""
if not self.base_image:
return defer.succeed(True)
if self.cheap_copy:
clone_cmd = "qemu-img"
... | [
"def",
"_prepare_base_image",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"base_image",
":",
"return",
"defer",
".",
"succeed",
"(",
"True",
")",
"if",
"self",
".",
"cheap_copy",
":",
"clone_cmd",
"=",
"\"qemu-img\"",
"clone_args",
"=",
"\"create -b %(b... | I am a private method for creating (possibly cheap) copies of a
base_image for start_instance to boot. | [
"I",
"am",
"a",
"private",
"method",
"for",
"creating",
"(",
"possibly",
"cheap",
")",
"copies",
"of",
"a",
"base_image",
"for",
"start_instance",
"to",
"boot",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/libvirt.py#L207-L241 | train |
buildbot/buildbot | master/buildbot/worker/libvirt.py | LibVirtWorker.start_instance | def start_instance(self, build):
"""
I start a new instance of a VM.
If a base_image is specified, I will make a clone of that otherwise i will
use image directly.
If i'm not given libvirt domain definition XML, I will look for my name
in the list of defined virtual mac... | python | def start_instance(self, build):
"""
I start a new instance of a VM.
If a base_image is specified, I will make a clone of that otherwise i will
use image directly.
If i'm not given libvirt domain definition XML, I will look for my name
in the list of defined virtual mac... | [
"def",
"start_instance",
"(",
"self",
",",
"build",
")",
":",
"if",
"self",
".",
"domain",
"is",
"not",
"None",
":",
"log",
".",
"msg",
"(",
"\"Cannot start_instance '%s' as already active\"",
"%",
"self",
".",
"workername",
")",
"return",
"False",
"yield",
... | I start a new instance of a VM.
If a base_image is specified, I will make a clone of that otherwise i will
use image directly.
If i'm not given libvirt domain definition XML, I will look for my name
in the list of defined virtual machines and start that. | [
"I",
"start",
"a",
"new",
"instance",
"of",
"a",
"VM",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/libvirt.py#L244-L274 | train |
buildbot/buildbot | master/buildbot/worker/libvirt.py | LibVirtWorker.stop_instance | def stop_instance(self, fast=False):
"""
I attempt to stop a running VM.
I make sure any connection to the worker is removed.
If the VM was using a cloned image, I remove the clone
When everything is tidied up, I ask that bbot looks for work to do
"""
log.msg("Att... | python | def stop_instance(self, fast=False):
"""
I attempt to stop a running VM.
I make sure any connection to the worker is removed.
If the VM was using a cloned image, I remove the clone
When everything is tidied up, I ask that bbot looks for work to do
"""
log.msg("Att... | [
"def",
"stop_instance",
"(",
"self",
",",
"fast",
"=",
"False",
")",
":",
"log",
".",
"msg",
"(",
"\"Attempting to stop '%s'\"",
"%",
"self",
".",
"workername",
")",
"if",
"self",
".",
"domain",
"is",
"None",
":",
"log",
".",
"msg",
"(",
"\"I don't think... | I attempt to stop a running VM.
I make sure any connection to the worker is removed.
If the VM was using a cloned image, I remove the clone
When everything is tidied up, I ask that bbot looks for work to do | [
"I",
"attempt",
"to",
"stop",
"a",
"running",
"VM",
".",
"I",
"make",
"sure",
"any",
"connection",
"to",
"the",
"worker",
"is",
"removed",
".",
"If",
"the",
"VM",
"was",
"using",
"a",
"cloned",
"image",
"I",
"remove",
"the",
"clone",
"When",
"everythin... | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/libvirt.py#L276-L312 | train |
buildbot/buildbot | master/buildbot/changes/p4poller.py | get_simple_split | def get_simple_split(branchfile):
"""Splits the branchfile argument and assuming branch is
the first path component in branchfile, will return
branch and file else None."""
index = branchfile.find('/')
if index == -1:
return None, None
branch, file = branchfile.split('/', 1)
r... | python | def get_simple_split(branchfile):
"""Splits the branchfile argument and assuming branch is
the first path component in branchfile, will return
branch and file else None."""
index = branchfile.find('/')
if index == -1:
return None, None
branch, file = branchfile.split('/', 1)
r... | [
"def",
"get_simple_split",
"(",
"branchfile",
")",
":",
"index",
"=",
"branchfile",
".",
"find",
"(",
"'/'",
")",
"if",
"index",
"==",
"-",
"1",
":",
"return",
"None",
",",
"None",
"branch",
",",
"file",
"=",
"branchfile",
".",
"split",
"(",
"'/'",
"... | Splits the branchfile argument and assuming branch is
the first path component in branchfile, will return
branch and file else None. | [
"Splits",
"the",
"branchfile",
"argument",
"and",
"assuming",
"branch",
"is",
"the",
"first",
"path",
"component",
"in",
"branchfile",
"will",
"return",
"branch",
"and",
"file",
"else",
"None",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/p4poller.py#L83-L92 | train |
buildbot/buildbot | master/buildbot/schedulers/trysched.py | TryBase.filterBuilderList | def filterBuilderList(self, builderNames):
"""
Make sure that C{builderNames} is a subset of the configured
C{self.builderNames}, returning an empty list if not. If
C{builderNames} is empty, use C{self.builderNames}.
@returns: list of builder names to build on
"""
... | python | def filterBuilderList(self, builderNames):
"""
Make sure that C{builderNames} is a subset of the configured
C{self.builderNames}, returning an empty list if not. If
C{builderNames} is empty, use C{self.builderNames}.
@returns: list of builder names to build on
"""
... | [
"def",
"filterBuilderList",
"(",
"self",
",",
"builderNames",
")",
":",
"# self.builderNames is the configured list of builders",
"# available for try. If the user supplies a list of builders,",
"# it must be restricted to the configured list. If not, build",
"# on all of the configured buil... | Make sure that C{builderNames} is a subset of the configured
C{self.builderNames}, returning an empty list if not. If
C{builderNames} is empty, use C{self.builderNames}.
@returns: list of builder names to build on | [
"Make",
"sure",
"that",
"C",
"{",
"builderNames",
"}",
"is",
"a",
"subset",
"of",
"the",
"configured",
"C",
"{",
"self",
".",
"builderNames",
"}",
"returning",
"an",
"empty",
"list",
"if",
"not",
".",
"If",
"C",
"{",
"builderNames",
"}",
"is",
"empty",... | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/schedulers/trysched.py#L34-L56 | train |
buildbot/buildbot | master/buildbot/util/lru.py | LRUCache._ref_key | def _ref_key(self, key):
"""Record a reference to the argument key."""
queue = self.queue
refcount = self.refcount
queue.append(key)
refcount[key] = refcount[key] + 1
# periodically compact the queue by eliminating duplicate keys
# while preserving order of most... | python | def _ref_key(self, key):
"""Record a reference to the argument key."""
queue = self.queue
refcount = self.refcount
queue.append(key)
refcount[key] = refcount[key] + 1
# periodically compact the queue by eliminating duplicate keys
# while preserving order of most... | [
"def",
"_ref_key",
"(",
"self",
",",
"key",
")",
":",
"queue",
"=",
"self",
".",
"queue",
"refcount",
"=",
"self",
".",
"refcount",
"queue",
".",
"append",
"(",
"key",
")",
"refcount",
"[",
"key",
"]",
"=",
"refcount",
"[",
"key",
"]",
"+",
"1",
... | Record a reference to the argument key. | [
"Record",
"a",
"reference",
"to",
"the",
"argument",
"key",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/util/lru.py#L108-L127 | train |
buildbot/buildbot | master/buildbot/util/lru.py | LRUCache._get_hit | def _get_hit(self, key):
"""Try to do a value lookup from the existing cache entries."""
try:
result = self.cache[key]
self.hits += 1
self._ref_key(key)
return result
except KeyError:
pass
result = self.weakrefs[key]
se... | python | def _get_hit(self, key):
"""Try to do a value lookup from the existing cache entries."""
try:
result = self.cache[key]
self.hits += 1
self._ref_key(key)
return result
except KeyError:
pass
result = self.weakrefs[key]
se... | [
"def",
"_get_hit",
"(",
"self",
",",
"key",
")",
":",
"try",
":",
"result",
"=",
"self",
".",
"cache",
"[",
"key",
"]",
"self",
".",
"hits",
"+=",
"1",
"self",
".",
"_ref_key",
"(",
"key",
")",
"return",
"result",
"except",
"KeyError",
":",
"pass",... | Try to do a value lookup from the existing cache entries. | [
"Try",
"to",
"do",
"a",
"value",
"lookup",
"from",
"the",
"existing",
"cache",
"entries",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/util/lru.py#L129-L143 | train |
buildbot/buildbot | master/buildbot/util/lru.py | LRUCache._purge | def _purge(self):
"""
Trim the cache down to max_size by evicting the
least-recently-used entries.
"""
if len(self.cache) <= self.max_size:
return
cache = self.cache
refcount = self.refcount
queue = self.queue
max_size = self.max_size
... | python | def _purge(self):
"""
Trim the cache down to max_size by evicting the
least-recently-used entries.
"""
if len(self.cache) <= self.max_size:
return
cache = self.cache
refcount = self.refcount
queue = self.queue
max_size = self.max_size
... | [
"def",
"_purge",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"cache",
")",
"<=",
"self",
".",
"max_size",
":",
"return",
"cache",
"=",
"self",
".",
"cache",
"refcount",
"=",
"self",
".",
"refcount",
"queue",
"=",
"self",
".",
"queue",
"ma... | Trim the cache down to max_size by evicting the
least-recently-used entries. | [
"Trim",
"the",
"cache",
"down",
"to",
"max_size",
"by",
"evicting",
"the",
"least",
"-",
"recently",
"-",
"used",
"entries",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/util/lru.py#L145-L166 | train |
buildbot/buildbot | worker/buildbot_worker/scripts/start.py | startWorker | def startWorker(basedir, quiet, nodaemon):
"""
Start worker process.
Fork and start twisted application described in basedir buildbot.tac file.
Print it's log messages to stdout for a while and try to figure out if
start was successful.
If quiet or nodaemon parameters are True, or we are runni... | python | def startWorker(basedir, quiet, nodaemon):
"""
Start worker process.
Fork and start twisted application described in basedir buildbot.tac file.
Print it's log messages to stdout for a while and try to figure out if
start was successful.
If quiet or nodaemon parameters are True, or we are runni... | [
"def",
"startWorker",
"(",
"basedir",
",",
"quiet",
",",
"nodaemon",
")",
":",
"os",
".",
"chdir",
"(",
"basedir",
")",
"if",
"quiet",
"or",
"nodaemon",
":",
"return",
"launch",
"(",
"nodaemon",
")",
"# we probably can't do this os.fork under windows",
"from",
... | Start worker process.
Fork and start twisted application described in basedir buildbot.tac file.
Print it's log messages to stdout for a while and try to figure out if
start was successful.
If quiet or nodaemon parameters are True, or we are running on a win32
system, will not fork and log will no... | [
"Start",
"worker",
"process",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/scripts/start.py#L83-L119 | train |
buildbot/buildbot | www/badges/buildbot_badges/__init__.py | Api.textwidth | def textwidth(self, text, config):
"""Calculates the width of the specified text.
"""
surface = cairo.SVGSurface(None, 1280, 200)
ctx = cairo.Context(surface)
ctx.select_font_face(config['font_face'],
cairo.FONT_SLANT_NORMAL,
... | python | def textwidth(self, text, config):
"""Calculates the width of the specified text.
"""
surface = cairo.SVGSurface(None, 1280, 200)
ctx = cairo.Context(surface)
ctx.select_font_face(config['font_face'],
cairo.FONT_SLANT_NORMAL,
... | [
"def",
"textwidth",
"(",
"self",
",",
"text",
",",
"config",
")",
":",
"surface",
"=",
"cairo",
".",
"SVGSurface",
"(",
"None",
",",
"1280",
",",
"200",
")",
"ctx",
"=",
"cairo",
".",
"Context",
"(",
"surface",
")",
"ctx",
".",
"select_font_face",
"(... | Calculates the width of the specified text. | [
"Calculates",
"the",
"width",
"of",
"the",
"specified",
"text",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/www/badges/buildbot_badges/__init__.py#L109-L118 | train |
buildbot/buildbot | www/badges/buildbot_badges/__init__.py | Api.makesvg | def makesvg(self, right_text, status=None, left_text=None,
left_color=None, config=None):
"""Renders an SVG from the template, using the specified data
"""
right_color = config['color_scheme'].get(status, "#9f9f9f") # Grey
left_text = left_text or config['left_text']
... | python | def makesvg(self, right_text, status=None, left_text=None,
left_color=None, config=None):
"""Renders an SVG from the template, using the specified data
"""
right_color = config['color_scheme'].get(status, "#9f9f9f") # Grey
left_text = left_text or config['left_text']
... | [
"def",
"makesvg",
"(",
"self",
",",
"right_text",
",",
"status",
"=",
"None",
",",
"left_text",
"=",
"None",
",",
"left_color",
"=",
"None",
",",
"config",
"=",
"None",
")",
":",
"right_color",
"=",
"config",
"[",
"'color_scheme'",
"]",
".",
"get",
"("... | Renders an SVG from the template, using the specified data | [
"Renders",
"an",
"SVG",
"from",
"the",
"template",
"using",
"the",
"specified",
"data"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/www/badges/buildbot_badges/__init__.py#L120-L141 | train |
buildbot/buildbot | master/buildbot/process/users/manual.py | CommandlineUserManagerPerspective.formatResults | def formatResults(self, op, results):
"""
This formats the results of the database operations for printing
back to the caller
@param op: operation to perform (add, remove, update, get)
@type op: string
@param results: results from db queries in perspective_commandline
... | python | def formatResults(self, op, results):
"""
This formats the results of the database operations for printing
back to the caller
@param op: operation to perform (add, remove, update, get)
@type op: string
@param results: results from db queries in perspective_commandline
... | [
"def",
"formatResults",
"(",
"self",
",",
"op",
",",
"results",
")",
":",
"formatted_results",
"=",
"\"\"",
"if",
"op",
"==",
"'add'",
":",
"# list, alternating ident, uid",
"formatted_results",
"+=",
"\"user(s) added:\\n\"",
"for",
"user",
"in",
"results",
":",
... | This formats the results of the database operations for printing
back to the caller
@param op: operation to perform (add, remove, update, get)
@type op: string
@param results: results from db queries in perspective_commandline
@type results: list
@returns: string conta... | [
"This",
"formats",
"the",
"results",
"of",
"the",
"database",
"operations",
"for",
"printing",
"back",
"to",
"the",
"caller"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/users/manual.py#L37-L83 | train |
buildbot/buildbot | master/buildbot/process/users/manual.py | CommandlineUserManagerPerspective.perspective_commandline | def perspective_commandline(self, op, bb_username, bb_password, ids, info):
"""
This performs the requested operations from the `buildbot user`
call by calling the proper buildbot.db.users methods based on
the operation. It yields a deferred instance with the results
from the dat... | python | def perspective_commandline(self, op, bb_username, bb_password, ids, info):
"""
This performs the requested operations from the `buildbot user`
call by calling the proper buildbot.db.users methods based on
the operation. It yields a deferred instance with the results
from the dat... | [
"def",
"perspective_commandline",
"(",
"self",
",",
"op",
",",
"bb_username",
",",
"bb_password",
",",
"ids",
",",
"info",
")",
":",
"log",
".",
"msg",
"(",
"\"perspective_commandline called\"",
")",
"results",
"=",
"[",
"]",
"# pylint: disable=too-many-nested-blo... | This performs the requested operations from the `buildbot user`
call by calling the proper buildbot.db.users methods based on
the operation. It yields a deferred instance with the results
from the database methods.
@param op: operation to perform (add, remove, update, get)
@type... | [
"This",
"performs",
"the",
"requested",
"operations",
"from",
"the",
"buildbot",
"user",
"call",
"by",
"calling",
"the",
"proper",
"buildbot",
".",
"db",
".",
"users",
"methods",
"based",
"on",
"the",
"operation",
".",
"It",
"yields",
"a",
"deferred",
"insta... | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/users/manual.py#L86-L187 | train |
buildbot/buildbot | master/buildbot/statistics/stats_service.py | StatsService.yieldMetricsValue | def yieldMetricsValue(self, data_name, post_data, buildid):
"""
A method to allow posting data that is not generated and stored as build-data in
the database. This method generates the `stats-yield-data` event to the mq layer
which is then consumed in self.postData.
@params
... | python | def yieldMetricsValue(self, data_name, post_data, buildid):
"""
A method to allow posting data that is not generated and stored as build-data in
the database. This method generates the `stats-yield-data` event to the mq layer
which is then consumed in self.postData.
@params
... | [
"def",
"yieldMetricsValue",
"(",
"self",
",",
"data_name",
",",
"post_data",
",",
"buildid",
")",
":",
"build_data",
"=",
"yield",
"self",
".",
"master",
".",
"data",
".",
"get",
"(",
"(",
"'builds'",
",",
"buildid",
")",
")",
"routingKey",
"=",
"(",
"... | A method to allow posting data that is not generated and stored as build-data in
the database. This method generates the `stats-yield-data` event to the mq layer
which is then consumed in self.postData.
@params
data_name: (str) The unique name for identifying this data.
post_dat... | [
"A",
"method",
"to",
"allow",
"posting",
"data",
"that",
"is",
"not",
"generated",
"and",
"stored",
"as",
"build",
"-",
"data",
"in",
"the",
"database",
".",
"This",
"method",
"generates",
"the",
"stats",
"-",
"yield",
"-",
"data",
"event",
"to",
"the",
... | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/statistics/stats_service.py#L73-L93 | train |
buildbot/buildbot | master/buildbot/plugins/db.py | get_plugins | def get_plugins(namespace, interface=None, check_extras=True, load_now=False):
"""
helper to get a direct interface to _Plugins
"""
return _DB.add_namespace(namespace, interface, check_extras, load_now) | python | def get_plugins(namespace, interface=None, check_extras=True, load_now=False):
"""
helper to get a direct interface to _Plugins
"""
return _DB.add_namespace(namespace, interface, check_extras, load_now) | [
"def",
"get_plugins",
"(",
"namespace",
",",
"interface",
"=",
"None",
",",
"check_extras",
"=",
"True",
",",
"load_now",
"=",
"False",
")",
":",
"return",
"_DB",
".",
"add_namespace",
"(",
"namespace",
",",
"interface",
",",
"check_extras",
",",
"load_now",... | helper to get a direct interface to _Plugins | [
"helper",
"to",
"get",
"a",
"direct",
"interface",
"to",
"_Plugins"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/plugins/db.py#L347-L351 | train |
buildbot/buildbot | master/buildbot/plugins/db.py | _PluginDB.add_namespace | def add_namespace(self, namespace, interface=None, check_extras=True,
load_now=False):
"""
register given namespace in global database of plugins
in case it's already registered, return the registration
"""
tempo = self._namespaces.get(namespace)
i... | python | def add_namespace(self, namespace, interface=None, check_extras=True,
load_now=False):
"""
register given namespace in global database of plugins
in case it's already registered, return the registration
"""
tempo = self._namespaces.get(namespace)
i... | [
"def",
"add_namespace",
"(",
"self",
",",
"namespace",
",",
"interface",
"=",
"None",
",",
"check_extras",
"=",
"True",
",",
"load_now",
"=",
"False",
")",
":",
"tempo",
"=",
"self",
".",
"_namespaces",
".",
"get",
"(",
"namespace",
")",
"if",
"tempo",
... | register given namespace in global database of plugins
in case it's already registered, return the registration | [
"register",
"given",
"namespace",
"in",
"global",
"database",
"of",
"plugins"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/plugins/db.py#L287-L303 | train |
buildbot/buildbot | master/buildbot/plugins/db.py | _PluginDB.info | def info(self):
"""
get information about all plugins in registered namespaces
"""
result = dict()
for name, namespace in self._namespaces.items():
result[name] = namespace.info_all()
return result | python | def info(self):
"""
get information about all plugins in registered namespaces
"""
result = dict()
for name, namespace in self._namespaces.items():
result[name] = namespace.info_all()
return result | [
"def",
"info",
"(",
"self",
")",
":",
"result",
"=",
"dict",
"(",
")",
"for",
"name",
",",
"namespace",
"in",
"self",
".",
"_namespaces",
".",
"items",
"(",
")",
":",
"result",
"[",
"name",
"]",
"=",
"namespace",
".",
"info_all",
"(",
")",
"return"... | get information about all plugins in registered namespaces | [
"get",
"information",
"about",
"all",
"plugins",
"in",
"registered",
"namespaces"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/plugins/db.py#L312-L319 | train |
buildbot/buildbot | master/buildbot/pbmanager.py | PBManager.register | def register(self, portstr, username, password, pfactory):
"""
Register a perspective factory PFACTORY to be executed when a PB
connection arrives on PORTSTR with USERNAME/PASSWORD. Returns a
Registration object which can be used to unregister later.
"""
# do some basic ... | python | def register(self, portstr, username, password, pfactory):
"""
Register a perspective factory PFACTORY to be executed when a PB
connection arrives on PORTSTR with USERNAME/PASSWORD. Returns a
Registration object which can be used to unregister later.
"""
# do some basic ... | [
"def",
"register",
"(",
"self",
",",
"portstr",
",",
"username",
",",
"password",
",",
"pfactory",
")",
":",
"# do some basic normalization of portstrs",
"if",
"isinstance",
"(",
"portstr",
",",
"type",
"(",
"0",
")",
")",
"or",
"':'",
"not",
"in",
"portstr"... | Register a perspective factory PFACTORY to be executed when a PB
connection arrives on PORTSTR with USERNAME/PASSWORD. Returns a
Registration object which can be used to unregister later. | [
"Register",
"a",
"perspective",
"factory",
"PFACTORY",
"to",
"be",
"executed",
"when",
"a",
"PB",
"connection",
"arrives",
"on",
"PORTSTR",
"with",
"USERNAME",
"/",
"PASSWORD",
".",
"Returns",
"a",
"Registration",
"object",
"which",
"can",
"be",
"used",
"to",
... | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/pbmanager.py#L50-L70 | train |
buildbot/buildbot | master/buildbot/pbmanager.py | Registration.getPort | def getPort(self):
"""
Helper method for testing; returns the TCP port used for this
registration, even if it was specified as 0 and thus allocated by the
OS.
"""
disp = self.pbmanager.dispatchers[self.portstr]
return disp.port.getHost().port | python | def getPort(self):
"""
Helper method for testing; returns the TCP port used for this
registration, even if it was specified as 0 and thus allocated by the
OS.
"""
disp = self.pbmanager.dispatchers[self.portstr]
return disp.port.getHost().port | [
"def",
"getPort",
"(",
"self",
")",
":",
"disp",
"=",
"self",
".",
"pbmanager",
".",
"dispatchers",
"[",
"self",
".",
"portstr",
"]",
"return",
"disp",
".",
"port",
".",
"getHost",
"(",
")",
".",
"port"
] | Helper method for testing; returns the TCP port used for this
registration, even if it was specified as 0 and thus allocated by the
OS. | [
"Helper",
"method",
"for",
"testing",
";",
"returns",
"the",
"TCP",
"port",
"used",
"for",
"this",
"registration",
"even",
"if",
"it",
"was",
"specified",
"as",
"0",
"and",
"thus",
"allocated",
"by",
"the",
"OS",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/pbmanager.py#L104-L111 | train |
buildbot/buildbot | worker/buildbot_worker/pb.py | Worker.gracefulShutdown | def gracefulShutdown(self):
"""Start shutting down"""
if not self.bf.perspective:
log.msg("No active connection, shutting down NOW")
reactor.stop()
return
log.msg(
"Telling the master we want to shutdown after any running builds are finished")
... | python | def gracefulShutdown(self):
"""Start shutting down"""
if not self.bf.perspective:
log.msg("No active connection, shutting down NOW")
reactor.stop()
return
log.msg(
"Telling the master we want to shutdown after any running builds are finished")
... | [
"def",
"gracefulShutdown",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"bf",
".",
"perspective",
":",
"log",
".",
"msg",
"(",
"\"No active connection, shutting down NOW\"",
")",
"reactor",
".",
"stop",
"(",
")",
"return",
"log",
".",
"msg",
"(",
"\"Te... | Start shutting down | [
"Start",
"shutting",
"down"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/pb.py#L229-L249 | train |
buildbot/buildbot | worker/buildbot_worker/util/_hangcheck.py | HangCheckProtocol._startHungConnectionTimer | def _startHungConnectionTimer(self):
"""
Start a timer to detect if the connection is hung.
"""
def hungConnection():
self._hung_callback()
self._hungConnectionTimer = None
self.transport.loseConnection()
self._hungConnectionTimer = self._react... | python | def _startHungConnectionTimer(self):
"""
Start a timer to detect if the connection is hung.
"""
def hungConnection():
self._hung_callback()
self._hungConnectionTimer = None
self.transport.loseConnection()
self._hungConnectionTimer = self._react... | [
"def",
"_startHungConnectionTimer",
"(",
"self",
")",
":",
"def",
"hungConnection",
"(",
")",
":",
"self",
".",
"_hung_callback",
"(",
")",
"self",
".",
"_hungConnectionTimer",
"=",
"None",
"self",
".",
"transport",
".",
"loseConnection",
"(",
")",
"self",
"... | Start a timer to detect if the connection is hung. | [
"Start",
"a",
"timer",
"to",
"detect",
"if",
"the",
"connection",
"is",
"hung",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/util/_hangcheck.py#L66-L75 | train |
buildbot/buildbot | master/buildbot/locks.py | BaseLock.isAvailable | def isAvailable(self, requester, access):
""" Return a boolean whether the lock is available for claiming """
debuglog("%s isAvailable(%s, %s): self.owners=%r"
% (self, requester, access, self.owners))
num_excl, num_counting = self._claimed_excl, self._claimed_counting
... | python | def isAvailable(self, requester, access):
""" Return a boolean whether the lock is available for claiming """
debuglog("%s isAvailable(%s, %s): self.owners=%r"
% (self, requester, access, self.owners))
num_excl, num_counting = self._claimed_excl, self._claimed_counting
... | [
"def",
"isAvailable",
"(",
"self",
",",
"requester",
",",
"access",
")",
":",
"debuglog",
"(",
"\"%s isAvailable(%s, %s): self.owners=%r\"",
"%",
"(",
"self",
",",
"requester",
",",
"access",
",",
"self",
".",
"owners",
")",
")",
"num_excl",
",",
"num_counting... | Return a boolean whether the lock is available for claiming | [
"Return",
"a",
"boolean",
"whether",
"the",
"lock",
"is",
"available",
"for",
"claiming"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/locks.py#L76-L96 | train |
buildbot/buildbot | master/buildbot/locks.py | BaseLock.claim | def claim(self, owner, access):
""" Claim the lock (lock must be available) """
debuglog("%s claim(%s, %s)" % (self, owner, access.mode))
assert owner is not None
assert self.isAvailable(owner, access), "ask for isAvailable() first"
assert isinstance(access, LockAccess)
... | python | def claim(self, owner, access):
""" Claim the lock (lock must be available) """
debuglog("%s claim(%s, %s)" % (self, owner, access.mode))
assert owner is not None
assert self.isAvailable(owner, access), "ask for isAvailable() first"
assert isinstance(access, LockAccess)
... | [
"def",
"claim",
"(",
"self",
",",
"owner",
",",
"access",
")",
":",
"debuglog",
"(",
"\"%s claim(%s, %s)\"",
"%",
"(",
"self",
",",
"owner",
",",
"access",
".",
"mode",
")",
")",
"assert",
"owner",
"is",
"not",
"None",
"assert",
"self",
".",
"isAvailab... | Claim the lock (lock must be available) | [
"Claim",
"the",
"lock",
"(",
"lock",
"must",
"be",
"available",
")"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/locks.py#L122-L133 | train |
buildbot/buildbot | master/buildbot/locks.py | BaseLock.release | def release(self, owner, access):
""" Release the lock """
assert isinstance(access, LockAccess)
debuglog("%s release(%s, %s)" % (self, owner, access.mode))
if not self._removeOwner(owner, access):
debuglog("%s already released" % self)
return
self._tryW... | python | def release(self, owner, access):
""" Release the lock """
assert isinstance(access, LockAccess)
debuglog("%s release(%s, %s)" % (self, owner, access.mode))
if not self._removeOwner(owner, access):
debuglog("%s already released" % self)
return
self._tryW... | [
"def",
"release",
"(",
"self",
",",
"owner",
",",
"access",
")",
":",
"assert",
"isinstance",
"(",
"access",
",",
"LockAccess",
")",
"debuglog",
"(",
"\"%s release(%s, %s)\"",
"%",
"(",
"self",
",",
"owner",
",",
"access",
".",
"mode",
")",
")",
"if",
... | Release the lock | [
"Release",
"the",
"lock"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/locks.py#L140-L152 | train |
buildbot/buildbot | master/buildbot/locks.py | BaseLock.waitUntilMaybeAvailable | def waitUntilMaybeAvailable(self, owner, access):
"""Fire when the lock *might* be available. The caller will need to
check with isAvailable() when the deferred fires. This loose form is
used to avoid deadlocks. If we were interested in a stronger form,
this would be named 'waitUntilAvai... | python | def waitUntilMaybeAvailable(self, owner, access):
"""Fire when the lock *might* be available. The caller will need to
check with isAvailable() when the deferred fires. This loose form is
used to avoid deadlocks. If we were interested in a stronger form,
this would be named 'waitUntilAvai... | [
"def",
"waitUntilMaybeAvailable",
"(",
"self",
",",
"owner",
",",
"access",
")",
":",
"debuglog",
"(",
"\"%s waitUntilAvailable(%s)\"",
"%",
"(",
"self",
",",
"owner",
")",
")",
"assert",
"isinstance",
"(",
"access",
",",
"LockAccess",
")",
"if",
"self",
"."... | Fire when the lock *might* be available. The caller will need to
check with isAvailable() when the deferred fires. This loose form is
used to avoid deadlocks. If we were interested in a stronger form,
this would be named 'waitUntilAvailable', and the deferred would fire
after the lock ha... | [
"Fire",
"when",
"the",
"lock",
"*",
"might",
"*",
"be",
"available",
".",
"The",
"caller",
"will",
"need",
"to",
"check",
"with",
"isAvailable",
"()",
"when",
"the",
"deferred",
"fires",
".",
"This",
"loose",
"form",
"is",
"used",
"to",
"avoid",
"deadloc... | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/locks.py#L178-L197 | train |
buildbot/buildbot | master/buildbot/process/cache.py | CacheManager.get_cache | def get_cache(self, cache_name, miss_fn):
"""
Get an L{AsyncLRUCache} object with the given name. If such an object
does not exist, it will be created. Since the cache is permanent, this
method can be called only once, e.g., in C{startService}, and it value
stored indefinitely.... | python | def get_cache(self, cache_name, miss_fn):
"""
Get an L{AsyncLRUCache} object with the given name. If such an object
does not exist, it will be created. Since the cache is permanent, this
method can be called only once, e.g., in C{startService}, and it value
stored indefinitely.... | [
"def",
"get_cache",
"(",
"self",
",",
"cache_name",
",",
"miss_fn",
")",
":",
"try",
":",
"return",
"self",
".",
"_caches",
"[",
"cache_name",
"]",
"except",
"KeyError",
":",
"max_size",
"=",
"self",
".",
"config",
".",
"get",
"(",
"cache_name",
",",
"... | Get an L{AsyncLRUCache} object with the given name. If such an object
does not exist, it will be created. Since the cache is permanent, this
method can be called only once, e.g., in C{startService}, and it value
stored indefinitely.
@param cache_name: name of the cache (usually the na... | [
"Get",
"an",
"L",
"{",
"AsyncLRUCache",
"}",
"object",
"with",
"the",
"given",
"name",
".",
"If",
"such",
"an",
"object",
"does",
"not",
"exist",
"it",
"will",
"be",
"created",
".",
"Since",
"the",
"cache",
"is",
"permanent",
"this",
"method",
"can",
"... | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/cache.py#L40-L59 | train |
buildbot/buildbot | master/buildbot/www/change_hook.py | ChangeHookResource.render_POST | def render_POST(self, request):
"""
Responds to events and starts the build process
different implementations can decide on what methods they will accept
:arguments:
request
the http request object
"""
try:
d = self.getAndSubmitC... | python | def render_POST(self, request):
"""
Responds to events and starts the build process
different implementations can decide on what methods they will accept
:arguments:
request
the http request object
"""
try:
d = self.getAndSubmitC... | [
"def",
"render_POST",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"d",
"=",
"self",
".",
"getAndSubmitChanges",
"(",
"request",
")",
"except",
"Exception",
":",
"d",
"=",
"defer",
".",
"fail",
"(",
")",
"def",
"ok",
"(",
"_",
")",
":",
"requ... | Responds to events and starts the build process
different implementations can decide on what methods they will accept
:arguments:
request
the http request object | [
"Responds",
"to",
"events",
"and",
"starts",
"the",
"build",
"process",
"different",
"implementations",
"can",
"decide",
"on",
"what",
"methods",
"they",
"will",
"accept"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/www/change_hook.py#L70-L102 | train |
buildbot/buildbot | master/buildbot/www/change_hook.py | ChangeHookResource.makeHandler | def makeHandler(self, dialect):
"""create and cache the handler object for this dialect"""
if dialect not in self.dialects:
m = "The dialect specified, '{}', wasn't whitelisted in change_hook".format(dialect)
log.msg(m)
log.msg(
"Note: if dialect is 'b... | python | def makeHandler(self, dialect):
"""create and cache the handler object for this dialect"""
if dialect not in self.dialects:
m = "The dialect specified, '{}', wasn't whitelisted in change_hook".format(dialect)
log.msg(m)
log.msg(
"Note: if dialect is 'b... | [
"def",
"makeHandler",
"(",
"self",
",",
"dialect",
")",
":",
"if",
"dialect",
"not",
"in",
"self",
".",
"dialects",
":",
"m",
"=",
"\"The dialect specified, '{}', wasn't whitelisted in change_hook\"",
".",
"format",
"(",
"dialect",
")",
"log",
".",
"msg",
"(",
... | create and cache the handler object for this dialect | [
"create",
"and",
"cache",
"the",
"handler",
"object",
"for",
"this",
"dialect"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/www/change_hook.py#L113-L134 | train |
buildbot/buildbot | master/buildbot/www/change_hook.py | ChangeHookResource.getChanges | def getChanges(self, request):
"""
Take the logic from the change hook, and then delegate it
to the proper handler
We use the buildbot plugin mechanisms to find out about dialects
and call getChanges()
the return value is a list of changes
if DIALECT is unspec... | python | def getChanges(self, request):
"""
Take the logic from the change hook, and then delegate it
to the proper handler
We use the buildbot plugin mechanisms to find out about dialects
and call getChanges()
the return value is a list of changes
if DIALECT is unspec... | [
"def",
"getChanges",
"(",
"self",
",",
"request",
")",
":",
"uriRE",
"=",
"re",
".",
"search",
"(",
"r'^/change_hook/?([a-zA-Z0-9_]*)'",
",",
"bytes2unicode",
"(",
"request",
".",
"uri",
")",
")",
"if",
"not",
"uriRE",
":",
"log",
".",
"msg",
"(",
"\"URI... | Take the logic from the change hook, and then delegate it
to the proper handler
We use the buildbot plugin mechanisms to find out about dialects
and call getChanges()
the return value is a list of changes
if DIALECT is unspecified, a sample implementation is provided | [
"Take",
"the",
"logic",
"from",
"the",
"change",
"hook",
"and",
"then",
"delegate",
"it",
"to",
"the",
"proper",
"handler"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/www/change_hook.py#L137-L168 | train |
buildbot/buildbot | master/buildbot/pbutil.py | decode | def decode(data, encoding='utf-8', errors='strict'):
"""We need to convert a dictionary where keys and values
are bytes, to unicode strings. This happens when a
Python 2 worker sends a dictionary back to a Python 3 master.
"""
data_type = type(data)
if data_type == bytes:
return bytes2... | python | def decode(data, encoding='utf-8', errors='strict'):
"""We need to convert a dictionary where keys and values
are bytes, to unicode strings. This happens when a
Python 2 worker sends a dictionary back to a Python 3 master.
"""
data_type = type(data)
if data_type == bytes:
return bytes2... | [
"def",
"decode",
"(",
"data",
",",
"encoding",
"=",
"'utf-8'",
",",
"errors",
"=",
"'strict'",
")",
":",
"data_type",
"=",
"type",
"(",
"data",
")",
"if",
"data_type",
"==",
"bytes",
":",
"return",
"bytes2unicode",
"(",
"data",
",",
"encoding",
",",
"e... | We need to convert a dictionary where keys and values
are bytes, to unicode strings. This happens when a
Python 2 worker sends a dictionary back to a Python 3 master. | [
"We",
"need",
"to",
"convert",
"a",
"dictionary",
"where",
"keys",
"and",
"values",
"are",
"bytes",
"to",
"unicode",
"strings",
".",
"This",
"happens",
"when",
"a",
"Python",
"2",
"worker",
"sends",
"a",
"dictionary",
"back",
"to",
"a",
"Python",
"3",
"m... | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/pbutil.py#L157-L170 | train |
buildbot/buildbot | master/buildbot/pbutil.py | ReconnectingPBClientFactory.failedToGetPerspective | def failedToGetPerspective(self, why):
"""The login process failed, most likely because of an authorization
failure (bad password), but it is also possible that we lost the new
connection before we managed to send our credentials.
"""
log.msg("ReconnectingPBClientFactory.failedTo... | python | def failedToGetPerspective(self, why):
"""The login process failed, most likely because of an authorization
failure (bad password), but it is also possible that we lost the new
connection before we managed to send our credentials.
"""
log.msg("ReconnectingPBClientFactory.failedTo... | [
"def",
"failedToGetPerspective",
"(",
"self",
",",
"why",
")",
":",
"log",
".",
"msg",
"(",
"\"ReconnectingPBClientFactory.failedToGetPerspective\"",
")",
"if",
"why",
".",
"check",
"(",
"pb",
".",
"PBConnectionLost",
")",
":",
"log",
".",
"msg",
"(",
"\"we lo... | The login process failed, most likely because of an authorization
failure (bad password), but it is also possible that we lost the new
connection before we managed to send our credentials. | [
"The",
"login",
"process",
"failed",
"most",
"likely",
"because",
"of",
"an",
"authorization",
"failure",
"(",
"bad",
"password",
")",
"but",
"it",
"is",
"also",
"possible",
"that",
"we",
"lost",
"the",
"new",
"connection",
"before",
"we",
"managed",
"to",
... | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/pbutil.py#L142-L154 | train |
buildbot/buildbot | worker/buildbot_worker/scripts/runner.py | CreateWorkerOptions.validateMasterArgument | def validateMasterArgument(self, master_arg):
"""
Parse the <master> argument.
@param master_arg: the <master> argument to parse
@return: tuple of master's host and port
@raise UsageError: on errors parsing the argument
"""
if master_arg[:5] == "http:":
... | python | def validateMasterArgument(self, master_arg):
"""
Parse the <master> argument.
@param master_arg: the <master> argument to parse
@return: tuple of master's host and port
@raise UsageError: on errors parsing the argument
"""
if master_arg[:5] == "http:":
... | [
"def",
"validateMasterArgument",
"(",
"self",
",",
"master_arg",
")",
":",
"if",
"master_arg",
"[",
":",
"5",
"]",
"==",
"\"http:\"",
":",
"raise",
"usage",
".",
"UsageError",
"(",
"\"<master> is not a URL - do not use URL\"",
")",
"if",
"\":\"",
"not",
"in",
... | Parse the <master> argument.
@param master_arg: the <master> argument to parse
@return: tuple of master's host and port
@raise UsageError: on errors parsing the argument | [
"Parse",
"the",
"<master",
">",
"argument",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/scripts/runner.py#L145-L172 | train |
buildbot/buildbot | master/buildbot/db/builds.py | BuildsConnectorComponent.setBuildProperty | def setBuildProperty(self, bid, name, value, source):
""" A kind of create_or_update, that's between one or two queries per
call """
def thd(conn):
bp_tbl = self.db.model.build_properties
self.checkLength(bp_tbl.c.name, name)
self.checkLength(bp_tbl.c.source, ... | python | def setBuildProperty(self, bid, name, value, source):
""" A kind of create_or_update, that's between one or two queries per
call """
def thd(conn):
bp_tbl = self.db.model.build_properties
self.checkLength(bp_tbl.c.name, name)
self.checkLength(bp_tbl.c.source, ... | [
"def",
"setBuildProperty",
"(",
"self",
",",
"bid",
",",
"name",
",",
"value",
",",
"source",
")",
":",
"def",
"thd",
"(",
"conn",
")",
":",
"bp_tbl",
"=",
"self",
".",
"db",
".",
"model",
".",
"build_properties",
"self",
".",
"checkLength",
"(",
"bp... | A kind of create_or_update, that's between one or two queries per
call | [
"A",
"kind",
"of",
"create_or_update",
"that",
"s",
"between",
"one",
"or",
"two",
"queries",
"per",
"call"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/builds.py#L192-L213 | train |
buildbot/buildbot | master/buildbot/process/log.py | Log._decoderFromString | def _decoderFromString(cfg):
"""
Return a decoder function.
If cfg is a string such as 'latin-1' or u'latin-1',
then we return a new lambda, s.decode().
If cfg is already a lambda or function, then we return that.
"""
if isinstance(cfg, (bytes, str)):
... | python | def _decoderFromString(cfg):
"""
Return a decoder function.
If cfg is a string such as 'latin-1' or u'latin-1',
then we return a new lambda, s.decode().
If cfg is already a lambda or function, then we return that.
"""
if isinstance(cfg, (bytes, str)):
... | [
"def",
"_decoderFromString",
"(",
"cfg",
")",
":",
"if",
"isinstance",
"(",
"cfg",
",",
"(",
"bytes",
",",
"str",
")",
")",
":",
"return",
"lambda",
"s",
":",
"s",
".",
"decode",
"(",
"cfg",
",",
"'replace'",
")",
"return",
"cfg"
] | Return a decoder function.
If cfg is a string such as 'latin-1' or u'latin-1',
then we return a new lambda, s.decode().
If cfg is already a lambda or function, then we return that. | [
"Return",
"a",
"decoder",
"function",
".",
"If",
"cfg",
"is",
"a",
"string",
"such",
"as",
"latin",
"-",
"1",
"or",
"u",
"latin",
"-",
"1",
"then",
"we",
"return",
"a",
"new",
"lambda",
"s",
".",
"decode",
"()",
".",
"If",
"cfg",
"is",
"already",
... | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/log.py#L42-L51 | train |
buildbot/buildbot | master/buildbot/changes/hgpoller.py | HgPoller._getRevDetails | def _getRevDetails(self, rev):
"""Return a deferred for (date, author, files, comments) of given rev.
Deferred will be in error if rev is unknown.
"""
args = ['log', '-r', rev, os.linesep.join((
'--template={date|hgdate}',
'{author}',
"{files % '{file... | python | def _getRevDetails(self, rev):
"""Return a deferred for (date, author, files, comments) of given rev.
Deferred will be in error if rev is unknown.
"""
args = ['log', '-r', rev, os.linesep.join((
'--template={date|hgdate}',
'{author}',
"{files % '{file... | [
"def",
"_getRevDetails",
"(",
"self",
",",
"rev",
")",
":",
"args",
"=",
"[",
"'log'",
",",
"'-r'",
",",
"rev",
",",
"os",
".",
"linesep",
".",
"join",
"(",
"(",
"'--template={date|hgdate}'",
",",
"'{author}'",
",",
"\"{files % '{file}\"",
"+",
"os",
"."... | Return a deferred for (date, author, files, comments) of given rev.
Deferred will be in error if rev is unknown. | [
"Return",
"a",
"deferred",
"for",
"(",
"date",
"author",
"files",
"comments",
")",
"of",
"given",
"rev",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/hgpoller.py#L111-L142 | train |
buildbot/buildbot | master/buildbot/changes/hgpoller.py | HgPoller._isRepositoryReady | def _isRepositoryReady(self):
"""Easy to patch in tests."""
return os.path.exists(os.path.join(self._absWorkdir(), '.hg')) | python | def _isRepositoryReady(self):
"""Easy to patch in tests."""
return os.path.exists(os.path.join(self._absWorkdir(), '.hg')) | [
"def",
"_isRepositoryReady",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_absWorkdir",
"(",
")",
",",
"'.hg'",
")",
")"
] | Easy to patch in tests. | [
"Easy",
"to",
"patch",
"in",
"tests",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/hgpoller.py#L144-L146 | train |
buildbot/buildbot | master/buildbot/changes/hgpoller.py | HgPoller._initRepository | def _initRepository(self):
"""Have mercurial init the workdir as a repository (hg init) if needed.
hg init will also create all needed intermediate directories.
"""
if self._isRepositoryReady():
return defer.succeed(None)
log.msg('hgpoller: initializing working dir f... | python | def _initRepository(self):
"""Have mercurial init the workdir as a repository (hg init) if needed.
hg init will also create all needed intermediate directories.
"""
if self._isRepositoryReady():
return defer.succeed(None)
log.msg('hgpoller: initializing working dir f... | [
"def",
"_initRepository",
"(",
"self",
")",
":",
"if",
"self",
".",
"_isRepositoryReady",
"(",
")",
":",
"return",
"defer",
".",
"succeed",
"(",
"None",
")",
"log",
".",
"msg",
"(",
"'hgpoller: initializing working dir from %s'",
"%",
"self",
".",
"repourl",
... | Have mercurial init the workdir as a repository (hg init) if needed.
hg init will also create all needed intermediate directories. | [
"Have",
"mercurial",
"init",
"the",
"workdir",
"as",
"a",
"repository",
"(",
"hg",
"init",
")",
"if",
"needed",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/hgpoller.py#L148-L163 | train |
buildbot/buildbot | master/buildbot/changes/hgpoller.py | HgPoller._setCurrentRev | def _setCurrentRev(self, rev, branch='default'):
"""Return a deferred to set current revision in persistent state."""
self.lastRev[branch] = str(rev)
return self.setState('lastRev', self.lastRev) | python | def _setCurrentRev(self, rev, branch='default'):
"""Return a deferred to set current revision in persistent state."""
self.lastRev[branch] = str(rev)
return self.setState('lastRev', self.lastRev) | [
"def",
"_setCurrentRev",
"(",
"self",
",",
"rev",
",",
"branch",
"=",
"'default'",
")",
":",
"self",
".",
"lastRev",
"[",
"branch",
"]",
"=",
"str",
"(",
"rev",
")",
"return",
"self",
".",
"setState",
"(",
"'lastRev'",
",",
"self",
".",
"lastRev",
")... | Return a deferred to set current revision in persistent state. | [
"Return",
"a",
"deferred",
"to",
"set",
"current",
"revision",
"in",
"persistent",
"state",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/hgpoller.py#L198-L201 | train |
buildbot/buildbot | master/buildbot/changes/hgpoller.py | HgPoller._getHead | def _getHead(self, branch):
"""Return a deferred for branch head revision or None.
We'll get an error if there is no head for this branch, which is
probably a good thing, since it's probably a misspelling
(if really buildbotting a branch that does not have any changeset
yet, one... | python | def _getHead(self, branch):
"""Return a deferred for branch head revision or None.
We'll get an error if there is no head for this branch, which is
probably a good thing, since it's probably a misspelling
(if really buildbotting a branch that does not have any changeset
yet, one... | [
"def",
"_getHead",
"(",
"self",
",",
"branch",
")",
":",
"d",
"=",
"utils",
".",
"getProcessOutput",
"(",
"self",
".",
"hgbin",
",",
"[",
"'heads'",
",",
"'-r'",
",",
"branch",
",",
"'--template={rev}'",
"+",
"os",
".",
"linesep",
"]",
",",
"path",
"... | Return a deferred for branch head revision or None.
We'll get an error if there is no head for this branch, which is
probably a good thing, since it's probably a misspelling
(if really buildbotting a branch that does not have any changeset
yet, one shouldn't be surprised to get errors) | [
"Return",
"a",
"deferred",
"for",
"branch",
"head",
"revision",
"or",
"None",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/hgpoller.py#L203-L237 | train |
buildbot/buildbot | master/buildbot/changes/hgpoller.py | HgPoller._processChanges | def _processChanges(self, unused_output):
"""Send info about pulled changes to the master and record current.
HgPoller does the recording by moving the working dir to the head
of the branch.
We don't update the tree (unnecessary treatment and waste of space)
instead, we simply s... | python | def _processChanges(self, unused_output):
"""Send info about pulled changes to the master and record current.
HgPoller does the recording by moving the working dir to the head
of the branch.
We don't update the tree (unnecessary treatment and waste of space)
instead, we simply s... | [
"def",
"_processChanges",
"(",
"self",
",",
"unused_output",
")",
":",
"for",
"branch",
"in",
"self",
".",
"branches",
"+",
"self",
".",
"bookmarks",
":",
"rev",
"=",
"yield",
"self",
".",
"_getHead",
"(",
"branch",
")",
"if",
"rev",
"is",
"None",
":",... | Send info about pulled changes to the master and record current.
HgPoller does the recording by moving the working dir to the head
of the branch.
We don't update the tree (unnecessary treatment and waste of space)
instead, we simply store the current rev number in a file.
Recall... | [
"Send",
"info",
"about",
"pulled",
"changes",
"to",
"the",
"master",
"and",
"record",
"current",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/hgpoller.py#L240-L254 | train |
buildbot/buildbot | master/buildbot/changes/hgpoller.py | HgPoller._convertNonZeroToFailure | def _convertNonZeroToFailure(self, res):
"utility method to handle the result of getProcessOutputAndValue"
(stdout, stderr, code) = res
if code != 0:
raise EnvironmentError(
'command failed with exit code %d: %s' % (code, stderr))
return (stdout, stderr, code) | python | def _convertNonZeroToFailure(self, res):
"utility method to handle the result of getProcessOutputAndValue"
(stdout, stderr, code) = res
if code != 0:
raise EnvironmentError(
'command failed with exit code %d: %s' % (code, stderr))
return (stdout, stderr, code) | [
"def",
"_convertNonZeroToFailure",
"(",
"self",
",",
"res",
")",
":",
"(",
"stdout",
",",
"stderr",
",",
"code",
")",
"=",
"res",
"if",
"code",
"!=",
"0",
":",
"raise",
"EnvironmentError",
"(",
"'command failed with exit code %d: %s'",
"%",
"(",
"code",
",",... | utility method to handle the result of getProcessOutputAndValue | [
"utility",
"method",
"to",
"handle",
"the",
"result",
"of",
"getProcessOutputAndValue"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/hgpoller.py#L305-L311 | train |
buildbot/buildbot | master/buildbot/changes/hgpoller.py | HgPoller._stopOnFailure | def _stopOnFailure(self, f):
"utility method to stop the service when a failure occurs"
if self.running:
d = defer.maybeDeferred(self.stopService)
d.addErrback(log.err, 'while stopping broken HgPoller service')
return f | python | def _stopOnFailure(self, f):
"utility method to stop the service when a failure occurs"
if self.running:
d = defer.maybeDeferred(self.stopService)
d.addErrback(log.err, 'while stopping broken HgPoller service')
return f | [
"def",
"_stopOnFailure",
"(",
"self",
",",
"f",
")",
":",
"if",
"self",
".",
"running",
":",
"d",
"=",
"defer",
".",
"maybeDeferred",
"(",
"self",
".",
"stopService",
")",
"d",
".",
"addErrback",
"(",
"log",
".",
"err",
",",
"'while stopping broken HgPol... | utility method to stop the service when a failure occurs | [
"utility",
"method",
"to",
"stop",
"the",
"service",
"when",
"a",
"failure",
"occurs"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/hgpoller.py#L313-L318 | train |
buildbot/buildbot | master/buildbot/steps/source/svn.py | SVN.purge | def purge(self, ignore_ignores):
"""Delete everything that shown up on status."""
command = ['status', '--xml']
if ignore_ignores:
command.append('--no-ignore')
d = self._dovccmd(command, collectStdout=True)
@d.addCallback
def parseAndRemove(stdout):
... | python | def purge(self, ignore_ignores):
"""Delete everything that shown up on status."""
command = ['status', '--xml']
if ignore_ignores:
command.append('--no-ignore')
d = self._dovccmd(command, collectStdout=True)
@d.addCallback
def parseAndRemove(stdout):
... | [
"def",
"purge",
"(",
"self",
",",
"ignore_ignores",
")",
":",
"command",
"=",
"[",
"'status'",
",",
"'--xml'",
"]",
"if",
"ignore_ignores",
":",
"command",
".",
"append",
"(",
"'--no-ignore'",
")",
"d",
"=",
"self",
".",
"_dovccmd",
"(",
"command",
",",
... | Delete everything that shown up on status. | [
"Delete",
"everything",
"that",
"shown",
"up",
"on",
"status",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/source/svn.py#L338-L366 | train |
buildbot/buildbot | master/buildbot/scripts/windows_service.py | DetermineRunner | def DetermineRunner(bbdir):
'''Checks if the given directory is a worker or a master and returns the
appropriate run function.'''
tacfile = os.path.join(bbdir, 'buildbot.tac')
if not os.path.exists(tacfile):
# No tac-file - use master runner by default.
import buildbot.scripts.runner
... | python | def DetermineRunner(bbdir):
'''Checks if the given directory is a worker or a master and returns the
appropriate run function.'''
tacfile = os.path.join(bbdir, 'buildbot.tac')
if not os.path.exists(tacfile):
# No tac-file - use master runner by default.
import buildbot.scripts.runner
... | [
"def",
"DetermineRunner",
"(",
"bbdir",
")",
":",
"tacfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"bbdir",
",",
"'buildbot.tac'",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"tacfile",
")",
":",
"# No tac-file - use master runner by default... | Checks if the given directory is a worker or a master and returns the
appropriate run function. | [
"Checks",
"if",
"the",
"given",
"directory",
"is",
"a",
"worker",
"or",
"a",
"master",
"and",
"returns",
"the",
"appropriate",
"run",
"function",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/scripts/windows_service.py#L522-L554 | train |
buildbot/buildbot | master/buildbot/steps/source/p4.py | P4.purge | def purge(self, ignore_ignores):
"""Delete everything that shown up on status."""
command = ['sync', '#none']
if ignore_ignores:
command.append('--no-ignore')
d = self._dovccmd(command, collectStdout=True)
# add deferred to rm tree
# then add defer to sync t... | python | def purge(self, ignore_ignores):
"""Delete everything that shown up on status."""
command = ['sync', '#none']
if ignore_ignores:
command.append('--no-ignore')
d = self._dovccmd(command, collectStdout=True)
# add deferred to rm tree
# then add defer to sync t... | [
"def",
"purge",
"(",
"self",
",",
"ignore_ignores",
")",
":",
"command",
"=",
"[",
"'sync'",
",",
"'#none'",
"]",
"if",
"ignore_ignores",
":",
"command",
".",
"append",
"(",
"'--no-ignore'",
")",
"d",
"=",
"self",
".",
"_dovccmd",
"(",
"command",
",",
... | Delete everything that shown up on status. | [
"Delete",
"everything",
"that",
"shown",
"up",
"on",
"status",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/source/p4.py#L394-L404 | train |
buildbot/buildbot | master/buildbot/steps/source/repo.py | Repo.filterManifestPatches | def filterManifestPatches(self):
"""
Patches to manifest projects are a bit special.
repo does not support a way to download them automatically,
so we need to implement the boilerplate manually.
This code separates the manifest patches from the other patches,
and generate... | python | def filterManifestPatches(self):
"""
Patches to manifest projects are a bit special.
repo does not support a way to download them automatically,
so we need to implement the boilerplate manually.
This code separates the manifest patches from the other patches,
and generate... | [
"def",
"filterManifestPatches",
"(",
"self",
")",
":",
"manifest_unrelated_downloads",
"=",
"[",
"]",
"manifest_related_downloads",
"=",
"[",
"]",
"for",
"download",
"in",
"self",
".",
"repoDownloads",
":",
"project",
",",
"ch_ps",
"=",
"download",
".",
"split",... | Patches to manifest projects are a bit special.
repo does not support a way to download them automatically,
so we need to implement the boilerplate manually.
This code separates the manifest patches from the other patches,
and generates commands to import those manifest patches. | [
"Patches",
"to",
"manifest",
"projects",
"are",
"a",
"bit",
"special",
".",
"repo",
"does",
"not",
"support",
"a",
"way",
"to",
"download",
"them",
"automatically",
"so",
"we",
"need",
"to",
"implement",
"the",
"boilerplate",
"manually",
".",
"This",
"code",... | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/source/repo.py#L181-L204 | train |
buildbot/buildbot | master/buildbot/steps/source/repo.py | Repo._getCleanupCommand | def _getCleanupCommand(self):
"""also used by tests for expectations"""
return textwrap.dedent("""\
set -v
if [ -d .repo/manifests ]
then
# repo just refuse to run if manifest is messed up
# so ensure we are in a known state
... | python | def _getCleanupCommand(self):
"""also used by tests for expectations"""
return textwrap.dedent("""\
set -v
if [ -d .repo/manifests ]
then
# repo just refuse to run if manifest is messed up
# so ensure we are in a known state
... | [
"def",
"_getCleanupCommand",
"(",
"self",
")",
":",
"return",
"textwrap",
".",
"dedent",
"(",
"\"\"\"\\\n set -v\n if [ -d .repo/manifests ]\n then\n # repo just refuse to run if manifest is messed up\n # so ensure we are in a know... | also used by tests for expectations | [
"also",
"used",
"by",
"tests",
"for",
"expectations"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/source/repo.py#L438-L461 | train |
buildbot/buildbot | master/buildbot/master.py | BuildMaster.getObjectId | def getObjectId(self):
"""
Return the object id for this master, for associating state with the
master.
@returns: ID, via Deferred
"""
# try to get the cached value
if self._object_id is not None:
return defer.succeed(self._object_id)
# faili... | python | def getObjectId(self):
"""
Return the object id for this master, for associating state with the
master.
@returns: ID, via Deferred
"""
# try to get the cached value
if self._object_id is not None:
return defer.succeed(self._object_id)
# faili... | [
"def",
"getObjectId",
"(",
"self",
")",
":",
"# try to get the cached value",
"if",
"self",
".",
"_object_id",
"is",
"not",
"None",
":",
"return",
"defer",
".",
"succeed",
"(",
"self",
".",
"_object_id",
")",
"# failing that, get it from the DB; multiple calls to this... | Return the object id for this master, for associating state with the
master.
@returns: ID, via Deferred | [
"Return",
"the",
"object",
"id",
"for",
"this",
"master",
"for",
"associating",
"state",
"with",
"the",
"master",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/master.py#L446-L467 | train |
buildbot/buildbot | master/buildbot/master.py | BuildMaster._getState | def _getState(self, name, default=None):
"private wrapper around C{self.db.state.getState}"
d = self.getObjectId()
@d.addCallback
def get(objectid):
return self.db.state.getState(objectid, name, default)
return d | python | def _getState(self, name, default=None):
"private wrapper around C{self.db.state.getState}"
d = self.getObjectId()
@d.addCallback
def get(objectid):
return self.db.state.getState(objectid, name, default)
return d | [
"def",
"_getState",
"(",
"self",
",",
"name",
",",
"default",
"=",
"None",
")",
":",
"d",
"=",
"self",
".",
"getObjectId",
"(",
")",
"@",
"d",
".",
"addCallback",
"def",
"get",
"(",
"objectid",
")",
":",
"return",
"self",
".",
"db",
".",
"state",
... | private wrapper around C{self.db.state.getState} | [
"private",
"wrapper",
"around",
"C",
"{",
"self",
".",
"db",
".",
"state",
".",
"getState",
"}"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/master.py#L469-L476 | train |
buildbot/buildbot | master/buildbot/master.py | BuildMaster._setState | def _setState(self, name, value):
"private wrapper around C{self.db.state.setState}"
d = self.getObjectId()
@d.addCallback
def set(objectid):
return self.db.state.setState(objectid, name, value)
return d | python | def _setState(self, name, value):
"private wrapper around C{self.db.state.setState}"
d = self.getObjectId()
@d.addCallback
def set(objectid):
return self.db.state.setState(objectid, name, value)
return d | [
"def",
"_setState",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"d",
"=",
"self",
".",
"getObjectId",
"(",
")",
"@",
"d",
".",
"addCallback",
"def",
"set",
"(",
"objectid",
")",
":",
"return",
"self",
".",
"db",
".",
"state",
".",
"setState",... | private wrapper around C{self.db.state.setState} | [
"private",
"wrapper",
"around",
"C",
"{",
"self",
".",
"db",
".",
"state",
".",
"setState",
"}"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/master.py#L478-L485 | train |
buildbot/buildbot | master/buildbot/process/users/users.py | createUserObject | def createUserObject(master, author, src=None):
"""
Take a Change author and source and translate them into a User Object,
storing the user in master.db, or returning None if the src is not
specified.
@param master: link to Buildmaster for database operations
@type master: master.Buildmaster in... | python | def createUserObject(master, author, src=None):
"""
Take a Change author and source and translate them into a User Object,
storing the user in master.db, or returning None if the src is not
specified.
@param master: link to Buildmaster for database operations
@type master: master.Buildmaster in... | [
"def",
"createUserObject",
"(",
"master",
",",
"author",
",",
"src",
"=",
"None",
")",
":",
"if",
"not",
"src",
":",
"log",
".",
"msg",
"(",
"\"No vcs information found, unable to create User Object\"",
")",
"return",
"defer",
".",
"succeed",
"(",
"None",
")",... | Take a Change author and source and translate them into a User Object,
storing the user in master.db, or returning None if the src is not
specified.
@param master: link to Buildmaster for database operations
@type master: master.Buildmaster instance
@param authors: Change author if string or Authz... | [
"Take",
"a",
"Change",
"author",
"and",
"source",
"and",
"translate",
"them",
"into",
"a",
"User",
"Object",
"storing",
"the",
"user",
"in",
"master",
".",
"db",
"or",
"returning",
"None",
"if",
"the",
"src",
"is",
"not",
"specified",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/users/users.py#L32-L61 | train |
buildbot/buildbot | master/buildbot/process/users/users.py | getUserContact | def getUserContact(master, contact_types, uid):
"""
This is a simple getter function that returns a user attribute
that matches the contact_types argument, or returns None if no
uid/match is found.
@param master: BuildMaster used to query the database
@type master: BuildMaster instance
@pa... | python | def getUserContact(master, contact_types, uid):
"""
This is a simple getter function that returns a user attribute
that matches the contact_types argument, or returns None if no
uid/match is found.
@param master: BuildMaster used to query the database
@type master: BuildMaster instance
@pa... | [
"def",
"getUserContact",
"(",
"master",
",",
"contact_types",
",",
"uid",
")",
":",
"d",
"=",
"master",
".",
"db",
".",
"users",
".",
"getUser",
"(",
"uid",
")",
"d",
".",
"addCallback",
"(",
"_extractContact",
",",
"contact_types",
",",
"uid",
")",
"r... | This is a simple getter function that returns a user attribute
that matches the contact_types argument, or returns None if no
uid/match is found.
@param master: BuildMaster used to query the database
@type master: BuildMaster instance
@param contact_types: list of contact attributes to look for in... | [
"This",
"is",
"a",
"simple",
"getter",
"function",
"that",
"returns",
"a",
"user",
"attribute",
"that",
"matches",
"the",
"contact_types",
"argument",
"or",
"returns",
"None",
"if",
"no",
"uid",
"/",
"match",
"is",
"found",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/users/users.py#L78-L98 | train |
buildbot/buildbot | master/buildbot/process/users/users.py | encrypt | def encrypt(passwd):
"""
Encrypts the incoming password after adding some salt to store
it in the database.
@param passwd: password portion of user credentials
@type passwd: string
@returns: encrypted/salted string
"""
m = sha1()
salt = hexlify(os.urandom(salt_len))
m.update(un... | python | def encrypt(passwd):
"""
Encrypts the incoming password after adding some salt to store
it in the database.
@param passwd: password portion of user credentials
@type passwd: string
@returns: encrypted/salted string
"""
m = sha1()
salt = hexlify(os.urandom(salt_len))
m.update(un... | [
"def",
"encrypt",
"(",
"passwd",
")",
":",
"m",
"=",
"sha1",
"(",
")",
"salt",
"=",
"hexlify",
"(",
"os",
".",
"urandom",
"(",
"salt_len",
")",
")",
"m",
".",
"update",
"(",
"unicode2bytes",
"(",
"passwd",
")",
"+",
"salt",
")",
"crypted",
"=",
"... | Encrypts the incoming password after adding some salt to store
it in the database.
@param passwd: password portion of user credentials
@type passwd: string
@returns: encrypted/salted string | [
"Encrypts",
"the",
"incoming",
"password",
"after",
"adding",
"some",
"salt",
"to",
"store",
"it",
"in",
"the",
"database",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/users/users.py#L155-L169 | train |
buildbot/buildbot | master/buildbot/process/users/users.py | check_passwd | def check_passwd(guess, passwd):
"""
Tests to see if the guess, after salting and hashing, matches the
passwd from the database.
@param guess: incoming password trying to be used for authentication
@param passwd: already encrypted password from the database
@returns: boolean
"""
m = sh... | python | def check_passwd(guess, passwd):
"""
Tests to see if the guess, after salting and hashing, matches the
passwd from the database.
@param guess: incoming password trying to be used for authentication
@param passwd: already encrypted password from the database
@returns: boolean
"""
m = sh... | [
"def",
"check_passwd",
"(",
"guess",
",",
"passwd",
")",
":",
"m",
"=",
"sha1",
"(",
")",
"salt",
"=",
"passwd",
"[",
":",
"salt_len",
"*",
"2",
"]",
"# salt_len * 2 due to encode('hex_codec')",
"m",
".",
"update",
"(",
"unicode2bytes",
"(",
"guess",
")",
... | Tests to see if the guess, after salting and hashing, matches the
passwd from the database.
@param guess: incoming password trying to be used for authentication
@param passwd: already encrypted password from the database
@returns: boolean | [
"Tests",
"to",
"see",
"if",
"the",
"guess",
"after",
"salting",
"and",
"hashing",
"matches",
"the",
"passwd",
"from",
"the",
"database",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/users/users.py#L172-L187 | train |
buildbot/buildbot | master/buildbot/www/oauth2.py | OAuth2Auth.getLoginURL | def getLoginURL(self, redirect_url):
"""
Returns the url to redirect the user to for user consent
"""
p = Properties()
p.master = self.master
clientId = yield p.render(self.clientId)
oauth_params = {'redirect_uri': self.loginUri,
'client_id... | python | def getLoginURL(self, redirect_url):
"""
Returns the url to redirect the user to for user consent
"""
p = Properties()
p.master = self.master
clientId = yield p.render(self.clientId)
oauth_params = {'redirect_uri': self.loginUri,
'client_id... | [
"def",
"getLoginURL",
"(",
"self",
",",
"redirect_url",
")",
":",
"p",
"=",
"Properties",
"(",
")",
"p",
".",
"master",
"=",
"self",
".",
"master",
"clientId",
"=",
"yield",
"p",
".",
"render",
"(",
"self",
".",
"clientId",
")",
"oauth_params",
"=",
... | Returns the url to redirect the user to for user consent | [
"Returns",
"the",
"url",
"to",
"redirect",
"the",
"user",
"to",
"for",
"user",
"consent"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/www/oauth2.py#L111-L124 | train |
buildbot/buildbot | master/buildbot/reporters/gerrit.py | _handleLegacyResult | def _handleLegacyResult(result):
"""
make sure the result is backward compatible
"""
if not isinstance(result, dict):
warnings.warn('The Gerrit status callback uses the old way to '
'communicate results. The outcome might be not what is '
'expected.')... | python | def _handleLegacyResult(result):
"""
make sure the result is backward compatible
"""
if not isinstance(result, dict):
warnings.warn('The Gerrit status callback uses the old way to '
'communicate results. The outcome might be not what is '
'expected.')... | [
"def",
"_handleLegacyResult",
"(",
"result",
")",
":",
"if",
"not",
"isinstance",
"(",
"result",
",",
"dict",
")",
":",
"warnings",
".",
"warn",
"(",
"'The Gerrit status callback uses the old way to '",
"'communicate results. The outcome might be not what is '",
"'expected... | make sure the result is backward compatible | [
"make",
"sure",
"the",
"result",
"is",
"backward",
"compatible"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/reporters/gerrit.py#L52-L64 | train |
buildbot/buildbot | master/buildbot/reporters/gerrit.py | GerritStatusPush._gerritCmd | def _gerritCmd(self, *args):
'''Construct a command as a list of strings suitable for
:func:`subprocess.call`.
'''
if self.gerrit_identity_file is not None:
options = ['-i', self.gerrit_identity_file]
else:
options = []
return ['ssh'] + options + [... | python | def _gerritCmd(self, *args):
'''Construct a command as a list of strings suitable for
:func:`subprocess.call`.
'''
if self.gerrit_identity_file is not None:
options = ['-i', self.gerrit_identity_file]
else:
options = []
return ['ssh'] + options + [... | [
"def",
"_gerritCmd",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"gerrit_identity_file",
"is",
"not",
"None",
":",
"options",
"=",
"[",
"'-i'",
",",
"self",
".",
"gerrit_identity_file",
"]",
"else",
":",
"options",
"=",
"[",
"]",
"retur... | Construct a command as a list of strings suitable for
:func:`subprocess.call`. | [
"Construct",
"a",
"command",
"as",
"a",
"list",
"of",
"strings",
"suitable",
"for",
":",
"func",
":",
"subprocess",
".",
"call",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/reporters/gerrit.py#L185-L197 | train |
buildbot/buildbot | master/buildbot/process/buildrequestdistributor.py | BuildRequestDistributor.maybeStartBuildsOn | def maybeStartBuildsOn(self, new_builders):
"""
Try to start any builds that can be started right now. This function
returns immediately, and promises to trigger those builders
eventually.
@param new_builders: names of new builders that should be given the
opportunity t... | python | def maybeStartBuildsOn(self, new_builders):
"""
Try to start any builds that can be started right now. This function
returns immediately, and promises to trigger those builders
eventually.
@param new_builders: names of new builders that should be given the
opportunity t... | [
"def",
"maybeStartBuildsOn",
"(",
"self",
",",
"new_builders",
")",
":",
"if",
"not",
"self",
".",
"running",
":",
"return",
"d",
"=",
"self",
".",
"_maybeStartBuildsOn",
"(",
"new_builders",
")",
"self",
".",
"_pendingMSBOCalls",
".",
"append",
"(",
"d",
... | Try to start any builds that can be started right now. This function
returns immediately, and promises to trigger those builders
eventually.
@param new_builders: names of new builders that should be given the
opportunity to check for new requests. | [
"Try",
"to",
"start",
"any",
"builds",
"that",
"can",
"be",
"started",
"right",
"now",
".",
"This",
"function",
"returns",
"immediately",
"and",
"promises",
"to",
"trigger",
"those",
"builders",
"eventually",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/buildrequestdistributor.py#L318-L338 | train |
buildbot/buildbot | master/buildbot/steps/worker.py | CompositeStepMixin.addLogForRemoteCommands | def addLogForRemoteCommands(self, logname):
"""This method must be called by user classes
composite steps could create several logs, this mixin functions will write
to the last one.
"""
self.rc_log = self.addLog(logname)
return self.rc_log | python | def addLogForRemoteCommands(self, logname):
"""This method must be called by user classes
composite steps could create several logs, this mixin functions will write
to the last one.
"""
self.rc_log = self.addLog(logname)
return self.rc_log | [
"def",
"addLogForRemoteCommands",
"(",
"self",
",",
"logname",
")",
":",
"self",
".",
"rc_log",
"=",
"self",
".",
"addLog",
"(",
"logname",
")",
"return",
"self",
".",
"rc_log"
] | This method must be called by user classes
composite steps could create several logs, this mixin functions will write
to the last one. | [
"This",
"method",
"must",
"be",
"called",
"by",
"user",
"classes",
"composite",
"steps",
"could",
"create",
"several",
"logs",
"this",
"mixin",
"functions",
"will",
"write",
"to",
"the",
"last",
"one",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/worker.py#L236-L242 | train |
buildbot/buildbot | master/buildbot/steps/worker.py | CompositeStepMixin.runRemoteCommand | def runRemoteCommand(self, cmd, args, abandonOnFailure=True,
evaluateCommand=lambda cmd: cmd.didFail()):
"""generic RemoteCommand boilerplate"""
cmd = remotecommand.RemoteCommand(cmd, args)
if hasattr(self, "rc_log"):
cmd.useLog(self.rc_log, False)
d ... | python | def runRemoteCommand(self, cmd, args, abandonOnFailure=True,
evaluateCommand=lambda cmd: cmd.didFail()):
"""generic RemoteCommand boilerplate"""
cmd = remotecommand.RemoteCommand(cmd, args)
if hasattr(self, "rc_log"):
cmd.useLog(self.rc_log, False)
d ... | [
"def",
"runRemoteCommand",
"(",
"self",
",",
"cmd",
",",
"args",
",",
"abandonOnFailure",
"=",
"True",
",",
"evaluateCommand",
"=",
"lambda",
"cmd",
":",
"cmd",
".",
"didFail",
"(",
")",
")",
":",
"cmd",
"=",
"remotecommand",
".",
"RemoteCommand",
"(",
"... | generic RemoteCommand boilerplate | [
"generic",
"RemoteCommand",
"boilerplate"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/worker.py#L244-L258 | train |
buildbot/buildbot | master/buildbot/steps/worker.py | CompositeStepMixin.runRmdir | def runRmdir(self, dir, timeout=None, **kwargs):
""" remove a directory from the worker """
cmd_args = {'dir': dir, 'logEnviron': self.logEnviron}
if timeout:
cmd_args['timeout'] = timeout
return self.runRemoteCommand('rmdir', cmd_args, **kwargs) | python | def runRmdir(self, dir, timeout=None, **kwargs):
""" remove a directory from the worker """
cmd_args = {'dir': dir, 'logEnviron': self.logEnviron}
if timeout:
cmd_args['timeout'] = timeout
return self.runRemoteCommand('rmdir', cmd_args, **kwargs) | [
"def",
"runRmdir",
"(",
"self",
",",
"dir",
",",
"timeout",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd_args",
"=",
"{",
"'dir'",
":",
"dir",
",",
"'logEnviron'",
":",
"self",
".",
"logEnviron",
"}",
"if",
"timeout",
":",
"cmd_args",
"[",
... | remove a directory from the worker | [
"remove",
"a",
"directory",
"from",
"the",
"worker"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/worker.py#L260-L265 | train |
buildbot/buildbot | master/buildbot/steps/worker.py | CompositeStepMixin.runRmFile | def runRmFile(self, path, timeout=None, **kwargs):
""" remove a file from the worker """
cmd_args = {'path': path, 'logEnviron': self.logEnviron}
if timeout:
cmd_args['timeout'] = timeout
if self.workerVersionIsOlderThan('rmfile', '3.1'):
cmd_args['dir'] = os.path... | python | def runRmFile(self, path, timeout=None, **kwargs):
""" remove a file from the worker """
cmd_args = {'path': path, 'logEnviron': self.logEnviron}
if timeout:
cmd_args['timeout'] = timeout
if self.workerVersionIsOlderThan('rmfile', '3.1'):
cmd_args['dir'] = os.path... | [
"def",
"runRmFile",
"(",
"self",
",",
"path",
",",
"timeout",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"cmd_args",
"=",
"{",
"'path'",
":",
"path",
",",
"'logEnviron'",
":",
"self",
".",
"logEnviron",
"}",
"if",
"timeout",
":",
"cmd_args",
"["... | remove a file from the worker | [
"remove",
"a",
"file",
"from",
"the",
"worker"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/worker.py#L267-L275 | train |
buildbot/buildbot | master/buildbot/steps/worker.py | CompositeStepMixin.pathExists | def pathExists(self, path):
""" test whether path exists"""
def commandComplete(cmd):
return not cmd.didFail()
return self.runRemoteCommand('stat', {'file': path,
'logEnviron': self.logEnviron, },
aba... | python | def pathExists(self, path):
""" test whether path exists"""
def commandComplete(cmd):
return not cmd.didFail()
return self.runRemoteCommand('stat', {'file': path,
'logEnviron': self.logEnviron, },
aba... | [
"def",
"pathExists",
"(",
"self",
",",
"path",
")",
":",
"def",
"commandComplete",
"(",
"cmd",
")",
":",
"return",
"not",
"cmd",
".",
"didFail",
"(",
")",
"return",
"self",
".",
"runRemoteCommand",
"(",
"'stat'",
",",
"{",
"'file'",
":",
"path",
",",
... | test whether path exists | [
"test",
"whether",
"path",
"exists"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/worker.py#L277-L285 | train |
buildbot/buildbot | master/buildbot/steps/worker.py | CompositeStepMixin.runMkdir | def runMkdir(self, _dir, **kwargs):
""" create a directory and its parents"""
return self.runRemoteCommand('mkdir', {'dir': _dir,
'logEnviron': self.logEnviron, },
**kwargs) | python | def runMkdir(self, _dir, **kwargs):
""" create a directory and its parents"""
return self.runRemoteCommand('mkdir', {'dir': _dir,
'logEnviron': self.logEnviron, },
**kwargs) | [
"def",
"runMkdir",
"(",
"self",
",",
"_dir",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"runRemoteCommand",
"(",
"'mkdir'",
",",
"{",
"'dir'",
":",
"_dir",
",",
"'logEnviron'",
":",
"self",
".",
"logEnviron",
",",
"}",
",",
"*",
"*",
... | create a directory and its parents | [
"create",
"a",
"directory",
"and",
"its",
"parents"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/worker.py#L287-L291 | train |
buildbot/buildbot | master/buildbot/steps/worker.py | CompositeStepMixin.runGlob | def runGlob(self, path, **kwargs):
""" find files matching a shell-style pattern"""
def commandComplete(cmd):
return cmd.updates['files'][-1]
return self.runRemoteCommand('glob', {'path': path,
'logEnviron': self.logEnviron, },
... | python | def runGlob(self, path, **kwargs):
""" find files matching a shell-style pattern"""
def commandComplete(cmd):
return cmd.updates['files'][-1]
return self.runRemoteCommand('glob', {'path': path,
'logEnviron': self.logEnviron, },
... | [
"def",
"runGlob",
"(",
"self",
",",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"commandComplete",
"(",
"cmd",
")",
":",
"return",
"cmd",
".",
"updates",
"[",
"'files'",
"]",
"[",
"-",
"1",
"]",
"return",
"self",
".",
"runRemoteCommand",
"(",
... | find files matching a shell-style pattern | [
"find",
"files",
"matching",
"a",
"shell",
"-",
"style",
"pattern"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/worker.py#L293-L300 | train |
buildbot/buildbot | master/buildbot/worker_transition.py | _compat_name | def _compat_name(new_name, compat_name=None):
"""Returns old API ("slave") name for new name ("worker").
>>> assert _compat_name("Worker") == "Slave"
>>> assert _compat_name("SomeWorkerStuff") == "SomeSlaveStuff"
>>> assert _compat_name("SomeWorker", compat_name="SomeBuildSlave") == \
"SomeBuil... | python | def _compat_name(new_name, compat_name=None):
"""Returns old API ("slave") name for new name ("worker").
>>> assert _compat_name("Worker") == "Slave"
>>> assert _compat_name("SomeWorkerStuff") == "SomeSlaveStuff"
>>> assert _compat_name("SomeWorker", compat_name="SomeBuildSlave") == \
"SomeBuil... | [
"def",
"_compat_name",
"(",
"new_name",
",",
"compat_name",
"=",
"None",
")",
":",
"if",
"compat_name",
"is",
"not",
"None",
":",
"assert",
"\"slave\"",
"in",
"compat_name",
".",
"lower",
"(",
")",
"assert",
"new_name",
"==",
"\"\"",
"or",
"\"worker\"",
"i... | Returns old API ("slave") name for new name ("worker").
>>> assert _compat_name("Worker") == "Slave"
>>> assert _compat_name("SomeWorkerStuff") == "SomeSlaveStuff"
>>> assert _compat_name("SomeWorker", compat_name="SomeBuildSlave") == \
"SomeBuildSlave"
If `compat_name` is not specified old na... | [
"Returns",
"old",
"API",
"(",
"slave",
")",
"name",
"for",
"new",
"name",
"(",
"worker",
")",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker_transition.py#L37-L74 | train |
buildbot/buildbot | master/buildbot/worker_transition.py | reportDeprecatedWorkerNameUsage | def reportDeprecatedWorkerNameUsage(message, stacklevel=None, filename=None,
lineno=None):
"""Hook that is ran when old API name is used.
:param stacklevel: stack level relative to the caller's frame.
Defaults to caller of the caller of this function.
"""
if fil... | python | def reportDeprecatedWorkerNameUsage(message, stacklevel=None, filename=None,
lineno=None):
"""Hook that is ran when old API name is used.
:param stacklevel: stack level relative to the caller's frame.
Defaults to caller of the caller of this function.
"""
if fil... | [
"def",
"reportDeprecatedWorkerNameUsage",
"(",
"message",
",",
"stacklevel",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"lineno",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"if",
"stacklevel",
"is",
"None",
":",
"# Warning will refer to t... | Hook that is ran when old API name is used.
:param stacklevel: stack level relative to the caller's frame.
Defaults to caller of the caller of this function. | [
"Hook",
"that",
"is",
"ran",
"when",
"old",
"API",
"name",
"is",
"used",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker_transition.py#L102-L128 | train |
buildbot/buildbot | master/buildbot/worker_transition.py | setupWorkerTransition | def setupWorkerTransition():
"""Hook Twisted deprecation machinery to use custom warning class
for Worker API deprecation warnings."""
default_warn_method = getWarningMethod()
def custom_warn_method(message, category, stacklevel):
if stacklevel is not None:
stacklevel += 1
... | python | def setupWorkerTransition():
"""Hook Twisted deprecation machinery to use custom warning class
for Worker API deprecation warnings."""
default_warn_method = getWarningMethod()
def custom_warn_method(message, category, stacklevel):
if stacklevel is not None:
stacklevel += 1
... | [
"def",
"setupWorkerTransition",
"(",
")",
":",
"default_warn_method",
"=",
"getWarningMethod",
"(",
")",
"def",
"custom_warn_method",
"(",
"message",
",",
"category",
",",
"stacklevel",
")",
":",
"if",
"stacklevel",
"is",
"not",
"None",
":",
"stacklevel",
"+=",
... | Hook Twisted deprecation machinery to use custom warning class
for Worker API deprecation warnings. | [
"Hook",
"Twisted",
"deprecation",
"machinery",
"to",
"use",
"custom",
"warning",
"class",
"for",
"Worker",
"API",
"deprecation",
"warnings",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker_transition.py#L131-L150 | train |
buildbot/buildbot | master/buildbot/steps/source/git.py | Git._fetchOrFallback | def _fetchOrFallback(self, _=None):
"""
Handles fallbacks for failure of fetch,
wrapper for self._fetch
"""
res = yield self._fetch(None)
if res == RC_SUCCESS:
return res
elif self.retryFetch:
yield self._fetch(None)
elif self.clobb... | python | def _fetchOrFallback(self, _=None):
"""
Handles fallbacks for failure of fetch,
wrapper for self._fetch
"""
res = yield self._fetch(None)
if res == RC_SUCCESS:
return res
elif self.retryFetch:
yield self._fetch(None)
elif self.clobb... | [
"def",
"_fetchOrFallback",
"(",
"self",
",",
"_",
"=",
"None",
")",
":",
"res",
"=",
"yield",
"self",
".",
"_fetch",
"(",
"None",
")",
"if",
"res",
"==",
"RC_SUCCESS",
":",
"return",
"res",
"elif",
"self",
".",
"retryFetch",
":",
"yield",
"self",
"."... | Handles fallbacks for failure of fetch,
wrapper for self._fetch | [
"Handles",
"fallbacks",
"for",
"failure",
"of",
"fetch",
"wrapper",
"for",
"self",
".",
"_fetch"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/source/git.py#L348-L361 | train |
buildbot/buildbot | master/buildbot/steps/source/git.py | Git._clone | def _clone(self, shallowClone):
"""Retry if clone failed"""
command = ['clone']
switchToBranch = False
if self.supportsBranch and self.branch != 'HEAD':
if self.branch.startswith('refs/'):
# we can't choose this branch from 'git clone' directly; we
... | python | def _clone(self, shallowClone):
"""Retry if clone failed"""
command = ['clone']
switchToBranch = False
if self.supportsBranch and self.branch != 'HEAD':
if self.branch.startswith('refs/'):
# we can't choose this branch from 'git clone' directly; we
... | [
"def",
"_clone",
"(",
"self",
",",
"shallowClone",
")",
":",
"command",
"=",
"[",
"'clone'",
"]",
"switchToBranch",
"=",
"False",
"if",
"self",
".",
"supportsBranch",
"and",
"self",
".",
"branch",
"!=",
"'HEAD'",
":",
"if",
"self",
".",
"branch",
".",
... | Retry if clone failed | [
"Retry",
"if",
"clone",
"failed"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/source/git.py#L364-L411 | train |
buildbot/buildbot | master/buildbot/steps/source/git.py | Git._fullClone | def _fullClone(self, shallowClone=False):
"""Perform full clone and checkout to the revision if specified
In the case of shallow clones if any of the step fail abort whole build step.
"""
res = yield self._clone(shallowClone)
if res != RC_SUCCESS:
return res
... | python | def _fullClone(self, shallowClone=False):
"""Perform full clone and checkout to the revision if specified
In the case of shallow clones if any of the step fail abort whole build step.
"""
res = yield self._clone(shallowClone)
if res != RC_SUCCESS:
return res
... | [
"def",
"_fullClone",
"(",
"self",
",",
"shallowClone",
"=",
"False",
")",
":",
"res",
"=",
"yield",
"self",
".",
"_clone",
"(",
"shallowClone",
")",
"if",
"res",
"!=",
"RC_SUCCESS",
":",
"return",
"res",
"# If revision specified checkout that revision",
"if",
... | Perform full clone and checkout to the revision if specified
In the case of shallow clones if any of the step fail abort whole build step. | [
"Perform",
"full",
"clone",
"and",
"checkout",
"to",
"the",
"revision",
"if",
"specified",
"In",
"the",
"case",
"of",
"shallow",
"clones",
"if",
"any",
"of",
"the",
"step",
"fail",
"abort",
"whole",
"build",
"step",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/source/git.py#L414-L434 | train |
buildbot/buildbot | master/buildbot/steps/source/git.py | Git._fullCloneOrFallback | def _fullCloneOrFallback(self):
"""Wrapper for _fullClone(). In the case of failure, if clobberOnFailure
is set to True remove the build directory and try a full clone again.
"""
res = yield self._fullClone()
if res != RC_SUCCESS:
if not self.clobberOnFailure:
... | python | def _fullCloneOrFallback(self):
"""Wrapper for _fullClone(). In the case of failure, if clobberOnFailure
is set to True remove the build directory and try a full clone again.
"""
res = yield self._fullClone()
if res != RC_SUCCESS:
if not self.clobberOnFailure:
... | [
"def",
"_fullCloneOrFallback",
"(",
"self",
")",
":",
"res",
"=",
"yield",
"self",
".",
"_fullClone",
"(",
")",
"if",
"res",
"!=",
"RC_SUCCESS",
":",
"if",
"not",
"self",
".",
"clobberOnFailure",
":",
"raise",
"buildstep",
".",
"BuildStepFailed",
"(",
")",... | Wrapper for _fullClone(). In the case of failure, if clobberOnFailure
is set to True remove the build directory and try a full clone again. | [
"Wrapper",
"for",
"_fullClone",
"()",
".",
"In",
"the",
"case",
"of",
"failure",
"if",
"clobberOnFailure",
"is",
"set",
"to",
"True",
"remove",
"the",
"build",
"directory",
"and",
"try",
"a",
"full",
"clone",
"again",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/source/git.py#L437-L447 | train |
buildbot/buildbot | master/buildbot/steps/source/git.py | Git._doClobber | def _doClobber(self):
"""Remove the work directory"""
rc = yield self.runRmdir(self.workdir, timeout=self.timeout)
if rc != RC_SUCCESS:
raise RuntimeError("Failed to delete directory")
return rc | python | def _doClobber(self):
"""Remove the work directory"""
rc = yield self.runRmdir(self.workdir, timeout=self.timeout)
if rc != RC_SUCCESS:
raise RuntimeError("Failed to delete directory")
return rc | [
"def",
"_doClobber",
"(",
"self",
")",
":",
"rc",
"=",
"yield",
"self",
".",
"runRmdir",
"(",
"self",
".",
"workdir",
",",
"timeout",
"=",
"self",
".",
"timeout",
")",
"if",
"rc",
"!=",
"RC_SUCCESS",
":",
"raise",
"RuntimeError",
"(",
"\"Failed to delete... | Remove the work directory | [
"Remove",
"the",
"work",
"directory"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/source/git.py#L450-L455 | train |
buildbot/buildbot | master/buildbot/www/hooks/bitbucket.py | BitBucketHandler.getChanges | def getChanges(self, request):
"""Catch a POST request from BitBucket and start a build process
Check the URL below if you require more information about payload
https://confluence.atlassian.com/display/BITBUCKET/POST+Service+Management
:param request: the http request Twisted object
... | python | def getChanges(self, request):
"""Catch a POST request from BitBucket and start a build process
Check the URL below if you require more information about payload
https://confluence.atlassian.com/display/BITBUCKET/POST+Service+Management
:param request: the http request Twisted object
... | [
"def",
"getChanges",
"(",
"self",
",",
"request",
")",
":",
"event_type",
"=",
"request",
".",
"getHeader",
"(",
"_HEADER_EVENT",
")",
"event_type",
"=",
"bytes2unicode",
"(",
"event_type",
")",
"payload",
"=",
"json",
".",
"loads",
"(",
"bytes2unicode",
"("... | Catch a POST request from BitBucket and start a build process
Check the URL below if you require more information about payload
https://confluence.atlassian.com/display/BITBUCKET/POST+Service+Management
:param request: the http request Twisted object
:param options: additional options | [
"Catch",
"a",
"POST",
"request",
"from",
"BitBucket",
"and",
"start",
"a",
"build",
"process"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/www/hooks/bitbucket.py#L32-L69 | train |
buildbot/buildbot | master/buildbot/data/buildrequests.py | Db2DataMixin._generate_filtered_properties | def _generate_filtered_properties(self, props, filters):
"""
This method returns Build's properties according to property filters.
:param props: Properties as a dict (from db)
:param filters: Desired properties keys as a list (from API URI)
"""
# by default no properties... | python | def _generate_filtered_properties(self, props, filters):
"""
This method returns Build's properties according to property filters.
:param props: Properties as a dict (from db)
:param filters: Desired properties keys as a list (from API URI)
"""
# by default no properties... | [
"def",
"_generate_filtered_properties",
"(",
"self",
",",
"props",
",",
"filters",
")",
":",
"# by default no properties are returned",
"if",
"props",
"and",
"filters",
":",
"return",
"(",
"props",
"if",
"'*'",
"in",
"filters",
"else",
"dict",
"(",
"(",
"(",
"... | This method returns Build's properties according to property filters.
:param props: Properties as a dict (from db)
:param filters: Desired properties keys as a list (from API URI) | [
"This",
"method",
"returns",
"Build",
"s",
"properties",
"according",
"to",
"property",
"filters",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/data/buildrequests.py#L28-L39 | train |
buildbot/buildbot | master/buildbot/secrets/providers/vault.py | HashiCorpVaultSecretProvider.get | def get(self, entry):
"""
get the value from vault secret backend
"""
if self.apiVersion == 1:
path = self.secretsmount + '/' + entry
else:
path = self.secretsmount + '/data/' + entry
# note that the HTTP path contains v1 for both versions of the ... | python | def get(self, entry):
"""
get the value from vault secret backend
"""
if self.apiVersion == 1:
path = self.secretsmount + '/' + entry
else:
path = self.secretsmount + '/data/' + entry
# note that the HTTP path contains v1 for both versions of the ... | [
"def",
"get",
"(",
"self",
",",
"entry",
")",
":",
"if",
"self",
".",
"apiVersion",
"==",
"1",
":",
"path",
"=",
"self",
".",
"secretsmount",
"+",
"'/'",
"+",
"entry",
"else",
":",
"path",
"=",
"self",
".",
"secretsmount",
"+",
"'/data/'",
"+",
"en... | get the value from vault secret backend | [
"get",
"the",
"value",
"from",
"vault",
"secret",
"backend"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/secrets/providers/vault.py#L59-L82 | train |
buildbot/buildbot | master/buildbot/reporters/gerrit_verify_status.py | GerritVerifyStatusPush.createStatus | def createStatus(self,
change_id,
revision_id,
name,
value,
abstain=None,
rerun=None,
comment=None,
url=None,
reporter=None,
... | python | def createStatus(self,
change_id,
revision_id,
name,
value,
abstain=None,
rerun=None,
comment=None,
url=None,
reporter=None,
... | [
"def",
"createStatus",
"(",
"self",
",",
"change_id",
",",
"revision_id",
",",
"name",
",",
"value",
",",
"abstain",
"=",
"None",
",",
"rerun",
"=",
"None",
",",
"comment",
"=",
"None",
",",
"url",
"=",
"None",
",",
"reporter",
"=",
"None",
",",
"cat... | Abstract the POST REST api documented here:
https://gerrit.googlesource.com/plugins/verify-status/+/master/src/main/resources/Documentation/rest-api-changes.md
:param change_id: The change_id for the change tested (can be in the long form e.g:
myProject~master~I8473b95934b5732ac55d26311a706... | [
"Abstract",
"the",
"POST",
"REST",
"api",
"documented",
"here",
":",
"https",
":",
"//",
"gerrit",
".",
"googlesource",
".",
"com",
"/",
"plugins",
"/",
"verify",
"-",
"status",
"/",
"+",
"/",
"master",
"/",
"src",
"/",
"main",
"/",
"resources",
"/",
... | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/reporters/gerrit_verify_status.py#L82-L149 | train |
buildbot/buildbot | master/buildbot/reporters/gerrit_verify_status.py | GerritVerifyStatusPush.formatDuration | def formatDuration(self, duration):
"""Format the duration.
This method could be overridden if really needed, as the duration format in gerrit
is an arbitrary string.
:param duration: duration in timedelta
"""
days = duration.days
hours, remainder = divmod(durati... | python | def formatDuration(self, duration):
"""Format the duration.
This method could be overridden if really needed, as the duration format in gerrit
is an arbitrary string.
:param duration: duration in timedelta
"""
days = duration.days
hours, remainder = divmod(durati... | [
"def",
"formatDuration",
"(",
"self",
",",
"duration",
")",
":",
"days",
"=",
"duration",
".",
"days",
"hours",
",",
"remainder",
"=",
"divmod",
"(",
"duration",
".",
"seconds",
",",
"3600",
")",
"minutes",
",",
"seconds",
"=",
"divmod",
"(",
"remainder"... | Format the duration.
This method could be overridden if really needed, as the duration format in gerrit
is an arbitrary string.
:param duration: duration in timedelta | [
"Format",
"the",
"duration",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/reporters/gerrit_verify_status.py#L151-L166 | train |
buildbot/buildbot | master/buildbot/reporters/gerrit_verify_status.py | GerritVerifyStatusPush.getGerritChanges | def getGerritChanges(props):
""" Get the gerrit changes
This method could be overridden if really needed to accommodate for other
custom steps method for fetching gerrit changes.
:param props: an IProperty
:return: (optionally via deferred) a list of dictionary... | python | def getGerritChanges(props):
""" Get the gerrit changes
This method could be overridden if really needed to accommodate for other
custom steps method for fetching gerrit changes.
:param props: an IProperty
:return: (optionally via deferred) a list of dictionary... | [
"def",
"getGerritChanges",
"(",
"props",
")",
":",
"if",
"'gerrit_changes'",
"in",
"props",
":",
"return",
"props",
".",
"getProperty",
"(",
"'gerrit_changes'",
")",
"if",
"'event.change.number'",
"in",
"props",
":",
"return",
"[",
"{",
"'change_id'",
":",
"pr... | Get the gerrit changes
This method could be overridden if really needed to accommodate for other
custom steps method for fetching gerrit changes.
:param props: an IProperty
:return: (optionally via deferred) a list of dictionary with at list
change_id, ... | [
"Get",
"the",
"gerrit",
"changes"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/reporters/gerrit_verify_status.py#L169-L190 | train |
buildbot/buildbot | worker/buildbot_worker/scripts/windows_service.py | DetermineRunner | def DetermineRunner(bbdir):
'''Checks if the given directory is a buildbot worker or a master and
returns the appropriate run function.'''
try:
import buildbot_worker.scripts.runner
tacfile = os.path.join(bbdir, 'buildbot.tac')
if os.path.exists(tacfile):
with open(tacfi... | python | def DetermineRunner(bbdir):
'''Checks if the given directory is a buildbot worker or a master and
returns the appropriate run function.'''
try:
import buildbot_worker.scripts.runner
tacfile = os.path.join(bbdir, 'buildbot.tac')
if os.path.exists(tacfile):
with open(tacfi... | [
"def",
"DetermineRunner",
"(",
"bbdir",
")",
":",
"try",
":",
"import",
"buildbot_worker",
".",
"scripts",
".",
"runner",
"tacfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"bbdir",
",",
"'buildbot.tac'",
")",
"if",
"os",
".",
"path",
".",
"exists",
... | Checks if the given directory is a buildbot worker or a master and
returns the appropriate run function. | [
"Checks",
"if",
"the",
"given",
"directory",
"is",
"a",
"buildbot",
"worker",
"or",
"a",
"master",
"and",
"returns",
"the",
"appropriate",
"run",
"function",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/scripts/windows_service.py#L584-L602 | train |
buildbot/buildbot | master/buildbot/db/logs.py | LogsConnectorComponent._splitBigChunk | def _splitBigChunk(self, content, logid):
"""
Split CONTENT on a line boundary into a prefix smaller than 64k and
a suffix containing the remainder, omitting the splitting newline.
"""
# if it's small enough, just return it
if len(content) < self.MAX_CHUNK_SIZE:
... | python | def _splitBigChunk(self, content, logid):
"""
Split CONTENT on a line boundary into a prefix smaller than 64k and
a suffix containing the remainder, omitting the splitting newline.
"""
# if it's small enough, just return it
if len(content) < self.MAX_CHUNK_SIZE:
... | [
"def",
"_splitBigChunk",
"(",
"self",
",",
"content",
",",
"logid",
")",
":",
"# if it's small enough, just return it",
"if",
"len",
"(",
"content",
")",
"<",
"self",
".",
"MAX_CHUNK_SIZE",
":",
"return",
"content",
",",
"None",
"# find the last newline before the l... | Split CONTENT on a line boundary into a prefix smaller than 64k and
a suffix containing the remainder, omitting the splitting newline. | [
"Split",
"CONTENT",
"on",
"a",
"line",
"boundary",
"into",
"a",
"prefix",
"smaller",
"than",
"64k",
"and",
"a",
"suffix",
"containing",
"the",
"remainder",
"omitting",
"the",
"splitting",
"newline",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/logs.py#L220-L249 | train |
buildbot/buildbot | master/buildbot/www/service.py | BuildbotSession.updateSession | def updateSession(self, request):
"""
Update the cookie after session object was modified
@param request: the request object which should get a new cookie
"""
# we actually need to copy some hardcoded constants from twisted :-(
# Make sure we aren't creating a secure ses... | python | def updateSession(self, request):
"""
Update the cookie after session object was modified
@param request: the request object which should get a new cookie
"""
# we actually need to copy some hardcoded constants from twisted :-(
# Make sure we aren't creating a secure ses... | [
"def",
"updateSession",
"(",
"self",
",",
"request",
")",
":",
"# we actually need to copy some hardcoded constants from twisted :-(",
"# Make sure we aren't creating a secure session on a non-secure page",
"secure",
"=",
"request",
".",
"isSecure",
"(",
")",
"if",
"not",
"secu... | Update the cookie after session object was modified
@param request: the request object which should get a new cookie | [
"Update",
"the",
"cookie",
"after",
"session",
"object",
"was",
"modified"
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/www/service.py#L91-L108 | train |
buildbot/buildbot | master/buildbot/www/service.py | BuildbotSession.uid | def uid(self):
"""uid is now generated automatically according to the claims.
This should actually only be used for cookie generation
"""
exp = datetime.datetime.utcnow() + self.expDelay
claims = {
'user_info': self.user_info,
# Note that we use JWT stand... | python | def uid(self):
"""uid is now generated automatically according to the claims.
This should actually only be used for cookie generation
"""
exp = datetime.datetime.utcnow() + self.expDelay
claims = {
'user_info': self.user_info,
# Note that we use JWT stand... | [
"def",
"uid",
"(",
"self",
")",
":",
"exp",
"=",
"datetime",
".",
"datetime",
".",
"utcnow",
"(",
")",
"+",
"self",
".",
"expDelay",
"claims",
"=",
"{",
"'user_info'",
":",
"self",
".",
"user_info",
",",
"# Note that we use JWT standard 'exp' field to implemen... | uid is now generated automatically according to the claims.
This should actually only be used for cookie generation | [
"uid",
"is",
"now",
"generated",
"automatically",
"according",
"to",
"the",
"claims",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/www/service.py#L122-L134 | train |
buildbot/buildbot | worker/buildbot_worker/scripts/create_worker.py | _makeBaseDir | def _makeBaseDir(basedir, quiet):
"""
Make worker base directory if needed.
@param basedir: worker base directory relative path
@param quiet: if True, don't print info messages
@raise CreateWorkerError: on error making base directory
"""
if os.path.exists(basedir):
if not quiet:
... | python | def _makeBaseDir(basedir, quiet):
"""
Make worker base directory if needed.
@param basedir: worker base directory relative path
@param quiet: if True, don't print info messages
@raise CreateWorkerError: on error making base directory
"""
if os.path.exists(basedir):
if not quiet:
... | [
"def",
"_makeBaseDir",
"(",
"basedir",
",",
"quiet",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"basedir",
")",
":",
"if",
"not",
"quiet",
":",
"print",
"(",
"\"updating existing installation\"",
")",
"return",
"if",
"not",
"quiet",
":",
"pri... | Make worker base directory if needed.
@param basedir: worker base directory relative path
@param quiet: if True, don't print info messages
@raise CreateWorkerError: on error making base directory | [
"Make",
"worker",
"base",
"directory",
"if",
"needed",
"."
] | 5df3cfae6d760557d99156633c32b1822a1e130c | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/scripts/create_worker.py#L77-L98 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.