partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | onlyOnce | Set up FN to only run once within an interpreter instance | master/buildbot/monkeypatches/__init__.py | def onlyOnce(fn):
'Set up FN to only run once within an interpreter instance'
def wrap(*args, **kwargs):
if hasattr(fn, 'called'):
return
fn.called = 1
return fn(*args, **kwargs)
util.mergeFunctionMetadata(fn, wrap)
return wrap | def onlyOnce(fn):
'Set up FN to only run once within an interpreter instance'
def wrap(*args, **kwargs):
if hasattr(fn, 'called'):
return
fn.called = 1
return fn(*args, **kwargs)
util.mergeFunctionMetadata(fn, wrap)
return wrap | [
"Set",
"up",
"FN",
"to",
"only",
"run",
"once",
"within",
"an",
"interpreter",
"instance"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/monkeypatches/__init__.py#L21-L29 | [
"def",
"onlyOnce",
"(",
"fn",
")",
":",
"def",
"wrap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"hasattr",
"(",
"fn",
",",
"'called'",
")",
":",
"return",
"fn",
".",
"called",
"=",
"1",
"return",
"fn",
"(",
"*",
"args",
",",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | DataConnector.allEndpoints | return the full spec of the connector as a list of dicts | master/buildbot/data/connector.py | def allEndpoints(self):
"""return the full spec of the connector as a list of dicts
"""
paths = []
for k, v in sorted(self.matcher.iterPatterns()):
paths.append(dict(path="/".join(k),
plural=str(v.rtype.plural),
type... | def allEndpoints(self):
"""return the full spec of the connector as a list of dicts
"""
paths = []
for k, v in sorted(self.matcher.iterPatterns()):
paths.append(dict(path="/".join(k),
plural=str(v.rtype.plural),
type... | [
"return",
"the",
"full",
"spec",
"of",
"the",
"connector",
"as",
"a",
"list",
"of",
"dicts"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/data/connector.py#L138-L147 | [
"def",
"allEndpoints",
"(",
"self",
")",
":",
"paths",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"sorted",
"(",
"self",
".",
"matcher",
".",
"iterPatterns",
"(",
")",
")",
":",
"paths",
".",
"append",
"(",
"dict",
"(",
"path",
"=",
"\"/\"",
".",... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | validateMasterOption | Validate master (-m, --master) command line option.
Checks that option is a string of the 'hostname:port' form, otherwise
raises an UsageError exception.
@type master: string
@param master: master option
@raise usage.UsageError: on invalid master option | master/buildbot/scripts/runner.py | def validateMasterOption(master):
"""
Validate master (-m, --master) command line option.
Checks that option is a string of the 'hostname:port' form, otherwise
raises an UsageError exception.
@type master: string
@param master: master option
@raise usage.UsageError: on invalid master opt... | def validateMasterOption(master):
"""
Validate master (-m, --master) command line option.
Checks that option is a string of the 'hostname:port' form, otherwise
raises an UsageError exception.
@type master: string
@param master: master option
@raise usage.UsageError: on invalid master opt... | [
"Validate",
"master",
"(",
"-",
"m",
"--",
"master",
")",
"command",
"line",
"option",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/scripts/runner.py#L38-L54 | [
"def",
"validateMasterOption",
"(",
"master",
")",
":",
"try",
":",
"hostname",
",",
"port",
"=",
"master",
".",
"split",
"(",
"\":\"",
")",
"port",
"=",
"int",
"(",
"port",
")",
"except",
"(",
"TypeError",
",",
"ValueError",
")",
":",
"raise",
"usage"... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | addEnvPath | concat a path for this name | master/buildbot/steps/vstudio.py | def addEnvPath(env, name, value):
""" concat a path for this name """
try:
oldval = env[name]
if not oldval.endswith(';'):
oldval = oldval + ';'
except KeyError:
oldval = ""
if not value.endswith(';'):
value = value + ';'
env[name] = oldval + value | def addEnvPath(env, name, value):
""" concat a path for this name """
try:
oldval = env[name]
if not oldval.endswith(';'):
oldval = oldval + ';'
except KeyError:
oldval = ""
if not value.endswith(';'):
value = value + ';'
env[name] = oldval + value | [
"concat",
"a",
"path",
"for",
"this",
"name"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/vstudio.py#L29-L39 | [
"def",
"addEnvPath",
"(",
"env",
",",
"name",
",",
"value",
")",
":",
"try",
":",
"oldval",
"=",
"env",
"[",
"name",
"]",
"if",
"not",
"oldval",
".",
"endswith",
"(",
"';'",
")",
":",
"oldval",
"=",
"oldval",
"+",
"';'",
"except",
"KeyError",
":",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | AbstractWorkerForBuilder.ping | Ping the worker to make sure it is still there. Returns a Deferred
that fires with True if it is.
@param status: if you point this at a BuilderStatus, a 'pinging'
event will be pushed. | master/buildbot/process/workerforbuilder.py | def ping(self, status=None):
"""Ping the worker to make sure it is still there. Returns a Deferred
that fires with True if it is.
@param status: if you point this at a BuilderStatus, a 'pinging'
event will be pushed.
"""
newping = not self.ping_watchers
... | def ping(self, status=None):
"""Ping the worker to make sure it is still there. Returns a Deferred
that fires with True if it is.
@param status: if you point this at a BuilderStatus, a 'pinging'
event will be pushed.
"""
newping = not self.ping_watchers
... | [
"Ping",
"the",
"worker",
"to",
"make",
"sure",
"it",
"is",
"still",
"there",
".",
"Returns",
"a",
"Deferred",
"that",
"fires",
"with",
"True",
"if",
"it",
"is",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/workerforbuilder.py#L116-L129 | [
"def",
"ping",
"(",
"self",
",",
"status",
"=",
"None",
")",
":",
"newping",
"=",
"not",
"self",
".",
"ping_watchers",
"d",
"=",
"defer",
".",
"Deferred",
"(",
")",
"self",
".",
"ping_watchers",
".",
"append",
"(",
"d",
")",
"if",
"newping",
":",
"... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | HTTPClientService.checkAvailable | Call me at checkConfig time to properly report config error
if neither txrequests or treq is installed | master/buildbot/util/httpclientservice.py | def checkAvailable(from_module):
"""Call me at checkConfig time to properly report config error
if neither txrequests or treq is installed
"""
if txrequests is None and treq is None:
config.error("neither txrequests nor treq is installed, but {} is requiring it\n\n{}".form... | def checkAvailable(from_module):
"""Call me at checkConfig time to properly report config error
if neither txrequests or treq is installed
"""
if txrequests is None and treq is None:
config.error("neither txrequests nor treq is installed, but {} is requiring it\n\n{}".form... | [
"Call",
"me",
"at",
"checkConfig",
"time",
"to",
"properly",
"report",
"config",
"error",
"if",
"neither",
"txrequests",
"or",
"treq",
"is",
"installed"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/util/httpclientservice.py#L107-L113 | [
"def",
"checkAvailable",
"(",
"from_module",
")",
":",
"if",
"txrequests",
"is",
"None",
"and",
"treq",
"is",
"None",
":",
"config",
".",
"error",
"(",
"\"neither txrequests nor treq is installed, but {} is requiring it\\n\\n{}\"",
".",
"format",
"(",
"from_module",
"... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | flattened_iterator | Generator for a list/tuple that potentially contains nested/lists/tuples of arbitrary nesting
that returns every individual non-list/tuple element. In other words, [(5, 6, [8, 3]), 2, [2, 1, (3, 4)]]
will yield 5, 6, 8, 3, 2, 2, 1, 3, 4
This is safe to call on something not a list/tuple - the original inp... | master/buildbot/util/__init__.py | def flattened_iterator(l, types=(list, tuple)):
"""
Generator for a list/tuple that potentially contains nested/lists/tuples of arbitrary nesting
that returns every individual non-list/tuple element. In other words, [(5, 6, [8, 3]), 2, [2, 1, (3, 4)]]
will yield 5, 6, 8, 3, 2, 2, 1, 3, 4
This is s... | def flattened_iterator(l, types=(list, tuple)):
"""
Generator for a list/tuple that potentially contains nested/lists/tuples of arbitrary nesting
that returns every individual non-list/tuple element. In other words, [(5, 6, [8, 3]), 2, [2, 1, (3, 4)]]
will yield 5, 6, 8, 3, 2, 2, 1, 3, 4
This is s... | [
"Generator",
"for",
"a",
"list",
"/",
"tuple",
"that",
"potentially",
"contains",
"nested",
"/",
"lists",
"/",
"tuples",
"of",
"arbitrary",
"nesting",
"that",
"returns",
"every",
"individual",
"non",
"-",
"list",
"/",
"tuple",
"element",
".",
"In",
"other",
... | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/util/__init__.py#L59-L73 | [
"def",
"flattened_iterator",
"(",
"l",
",",
"types",
"=",
"(",
"list",
",",
"tuple",
")",
")",
":",
"if",
"not",
"isinstance",
"(",
"l",
",",
"types",
")",
":",
"yield",
"l",
"return",
"for",
"element",
"in",
"l",
":",
"for",
"sub_element",
"in",
"... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | flatten | Given a list/tuple that potentially contains nested lists/tuples of arbitrary nesting,
flatten into a single dimension. In other words, turn [(5, 6, [8, 3]), 2, [2, 1, (3, 4)]]
into [5, 6, 8, 3, 2, 2, 1, 3, 4]
This is safe to call on something not a list/tuple - the original input is returned as a list | master/buildbot/util/__init__.py | def flatten(l, types=(list, )):
"""
Given a list/tuple that potentially contains nested lists/tuples of arbitrary nesting,
flatten into a single dimension. In other words, turn [(5, 6, [8, 3]), 2, [2, 1, (3, 4)]]
into [5, 6, 8, 3, 2, 2, 1, 3, 4]
This is safe to call on something not a list/tuple -... | def flatten(l, types=(list, )):
"""
Given a list/tuple that potentially contains nested lists/tuples of arbitrary nesting,
flatten into a single dimension. In other words, turn [(5, 6, [8, 3]), 2, [2, 1, (3, 4)]]
into [5, 6, 8, 3, 2, 2, 1, 3, 4]
This is safe to call on something not a list/tuple -... | [
"Given",
"a",
"list",
"/",
"tuple",
"that",
"potentially",
"contains",
"nested",
"lists",
"/",
"tuples",
"of",
"arbitrary",
"nesting",
"flatten",
"into",
"a",
"single",
"dimension",
".",
"In",
"other",
"words",
"turn",
"[",
"(",
"5",
"6",
"[",
"8",
"3",
... | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/util/__init__.py#L76-L88 | [
"def",
"flatten",
"(",
"l",
",",
"types",
"=",
"(",
"list",
",",
")",
")",
":",
"# For backwards compatibility, this returned a list, not an iterable.",
"# Changing to return an iterable could break things.",
"if",
"not",
"isinstance",
"(",
"l",
",",
"types",
")",
":",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | human_readable_delta | Return a string of human readable time delta. | master/buildbot/util/__init__.py | def human_readable_delta(start, end):
"""
Return a string of human readable time delta.
"""
start_date = datetime.datetime.fromtimestamp(start)
end_date = datetime.datetime.fromtimestamp(end)
delta = end_date - start_date
result = []
if delta.days > 0:
result.append('%d days' % ... | def human_readable_delta(start, end):
"""
Return a string of human readable time delta.
"""
start_date = datetime.datetime.fromtimestamp(start)
end_date = datetime.datetime.fromtimestamp(end)
delta = end_date - start_date
result = []
if delta.days > 0:
result.append('%d days' % ... | [
"Return",
"a",
"string",
"of",
"human",
"readable",
"time",
"delta",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/util/__init__.py#L274-L298 | [
"def",
"human_readable_delta",
"(",
"start",
",",
"end",
")",
":",
"start_date",
"=",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"start",
")",
"end_date",
"=",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"end",
")",
"delta",
"=",
"... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | in_reactor | decorate a function by running it with maybeDeferred in a reactor | master/buildbot/util/__init__.py | def in_reactor(f):
"""decorate a function by running it with maybeDeferred in a reactor"""
def wrap(*args, **kwargs):
from twisted.internet import reactor, defer
result = []
def _async():
d = defer.maybeDeferred(f, *args, **kwargs)
@d.addErrback
def ... | def in_reactor(f):
"""decorate a function by running it with maybeDeferred in a reactor"""
def wrap(*args, **kwargs):
from twisted.internet import reactor, defer
result = []
def _async():
d = defer.maybeDeferred(f, *args, **kwargs)
@d.addErrback
def ... | [
"decorate",
"a",
"function",
"by",
"running",
"it",
"with",
"maybeDeferred",
"in",
"a",
"reactor"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/util/__init__.py#L309-L332 | [
"def",
"in_reactor",
"(",
"f",
")",
":",
"def",
"wrap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"twisted",
".",
"internet",
"import",
"reactor",
",",
"defer",
"result",
"=",
"[",
"]",
"def",
"_async",
"(",
")",
":",
"d",
"=",... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | dictionary_merge | merges dictionary b into a
Like dict.update, but recursive | master/buildbot/util/__init__.py | def dictionary_merge(a, b):
"""merges dictionary b into a
Like dict.update, but recursive
"""
for key, value in b.items():
if key in a and isinstance(a[key], dict) and isinstance(value, dict):
dictionary_merge(a[key], b[key])
continue
a[key] = b[key]
return... | def dictionary_merge(a, b):
"""merges dictionary b into a
Like dict.update, but recursive
"""
for key, value in b.items():
if key in a and isinstance(a[key], dict) and isinstance(value, dict):
dictionary_merge(a[key], b[key])
continue
a[key] = b[key]
return... | [
"merges",
"dictionary",
"b",
"into",
"a",
"Like",
"dict",
".",
"update",
"but",
"recursive"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/util/__init__.py#L454-L463 | [
"def",
"dictionary_merge",
"(",
"a",
",",
"b",
")",
":",
"for",
"key",
",",
"value",
"in",
"b",
".",
"items",
"(",
")",
":",
"if",
"key",
"in",
"a",
"and",
"isinstance",
"(",
"a",
"[",
"key",
"]",
",",
"dict",
")",
"and",
"isinstance",
"(",
"va... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | RpmLint.createSummary | Create nice summary logs.
@param log: log to create summary off of. | master/buildbot/steps/package/rpm/rpmlint.py | def createSummary(self, log):
"""
Create nice summary logs.
@param log: log to create summary off of.
"""
warnings = self.obs.warnings
errors = []
if warnings:
self.addCompleteLog('%d Warnings' % len(warnings), "\n".join(warnings))
if errors:
... | def createSummary(self, log):
"""
Create nice summary logs.
@param log: log to create summary off of.
"""
warnings = self.obs.warnings
errors = []
if warnings:
self.addCompleteLog('%d Warnings' % len(warnings), "\n".join(warnings))
if errors:
... | [
"Create",
"nice",
"summary",
"logs",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/package/rpm/rpmlint.py#L68-L79 | [
"def",
"createSummary",
"(",
"self",
",",
"log",
")",
":",
"warnings",
"=",
"self",
".",
"obs",
".",
"warnings",
"errors",
"=",
"[",
"]",
"if",
"warnings",
":",
"self",
".",
"addCompleteLog",
"(",
"'%d Warnings'",
"%",
"len",
"(",
"warnings",
")",
",",... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | Builder.getOldestRequestTime | Returns the submitted_at of the oldest unclaimed build request for
this builder, or None if there are no build requests.
@returns: datetime instance or None, via Deferred | master/buildbot/process/builder.py | def getOldestRequestTime(self):
"""Returns the submitted_at of the oldest unclaimed build request for
this builder, or None if there are no build requests.
@returns: datetime instance or None, via Deferred
"""
bldrid = yield self.getBuilderId()
unclaimed = yield self.mas... | def getOldestRequestTime(self):
"""Returns the submitted_at of the oldest unclaimed build request for
this builder, or None if there are no build requests.
@returns: datetime instance or None, via Deferred
"""
bldrid = yield self.getBuilderId()
unclaimed = yield self.mas... | [
"Returns",
"the",
"submitted_at",
"of",
"the",
"oldest",
"unclaimed",
"build",
"request",
"for",
"this",
"builder",
"or",
"None",
"if",
"there",
"are",
"no",
"build",
"requests",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/builder.py#L144-L156 | [
"def",
"getOldestRequestTime",
"(",
"self",
")",
":",
"bldrid",
"=",
"yield",
"self",
".",
"getBuilderId",
"(",
")",
"unclaimed",
"=",
"yield",
"self",
".",
"master",
".",
"data",
".",
"get",
"(",
"(",
"'builders'",
",",
"bldrid",
",",
"'buildrequests'",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | Builder.getNewestCompleteTime | Returns the complete_at of the latest completed build request for
this builder, or None if there are no such build requests.
@returns: datetime instance or None, via Deferred | master/buildbot/process/builder.py | def getNewestCompleteTime(self):
"""Returns the complete_at of the latest completed build request for
this builder, or None if there are no such build requests.
@returns: datetime instance or None, via Deferred
"""
bldrid = yield self.getBuilderId()
completed = yield sel... | def getNewestCompleteTime(self):
"""Returns the complete_at of the latest completed build request for
this builder, or None if there are no such build requests.
@returns: datetime instance or None, via Deferred
"""
bldrid = yield self.getBuilderId()
completed = yield sel... | [
"Returns",
"the",
"complete_at",
"of",
"the",
"latest",
"completed",
"build",
"request",
"for",
"this",
"builder",
"or",
"None",
"if",
"there",
"are",
"no",
"such",
"build",
"requests",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/builder.py#L159-L173 | [
"def",
"getNewestCompleteTime",
"(",
"self",
")",
":",
"bldrid",
"=",
"yield",
"self",
".",
"getBuilderId",
"(",
")",
"completed",
"=",
"yield",
"self",
".",
"master",
".",
"data",
".",
"get",
"(",
"(",
"'builders'",
",",
"bldrid",
",",
"'buildrequests'",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | Builder.attached | This is invoked by the Worker when the self.workername bot
registers their builder.
@type worker: L{buildbot.worker.Worker}
@param worker: the Worker that represents the worker as a whole
@type commands: dict: string -> string, or None
@param commands: provides the worker's ve... | master/buildbot/process/builder.py | def attached(self, worker, commands):
"""This is invoked by the Worker when the self.workername bot
registers their builder.
@type worker: L{buildbot.worker.Worker}
@param worker: the Worker that represents the worker as a whole
@type commands: dict: string -> string, or None
... | def attached(self, worker, commands):
"""This is invoked by the Worker when the self.workername bot
registers their builder.
@type worker: L{buildbot.worker.Worker}
@param worker: the Worker that represents the worker as a whole
@type commands: dict: string -> string, or None
... | [
"This",
"is",
"invoked",
"by",
"the",
"Worker",
"when",
"the",
"self",
".",
"workername",
"bot",
"registers",
"their",
"builder",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/builder.py#L195-L238 | [
"def",
"attached",
"(",
"self",
",",
"worker",
",",
"commands",
")",
":",
"for",
"w",
"in",
"self",
".",
"attaching_workers",
"+",
"self",
".",
"workers",
":",
"if",
"w",
".",
"worker",
"==",
"worker",
":",
"# already attached to them. This is fairly common, s... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | Builder.detached | This is called when the connection to the bot is lost. | master/buildbot/process/builder.py | def detached(self, worker):
"""This is called when the connection to the bot is lost."""
for wfb in self.attaching_workers + self.workers:
if wfb.worker == worker:
break
else:
log.msg("WEIRD: Builder.detached(%s) (%s)"
" not in attachin... | def detached(self, worker):
"""This is called when the connection to the bot is lost."""
for wfb in self.attaching_workers + self.workers:
if wfb.worker == worker:
break
else:
log.msg("WEIRD: Builder.detached(%s) (%s)"
" not in attachin... | [
"This",
"is",
"called",
"when",
"the",
"connection",
"to",
"the",
"bot",
"is",
"lost",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/builder.py#L240-L259 | [
"def",
"detached",
"(",
"self",
",",
"worker",
")",
":",
"for",
"wfb",
"in",
"self",
".",
"attaching_workers",
"+",
"self",
".",
"workers",
":",
"if",
"wfb",
".",
"worker",
"==",
"worker",
":",
"break",
"else",
":",
"log",
".",
"msg",
"(",
"\"WEIRD: ... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | Builder.buildFinished | This is called when the Build has finished (either success or
failure). Any exceptions during the build are reported with
results=FAILURE, not with an errback. | master/buildbot/process/builder.py | def buildFinished(self, build, wfb):
"""This is called when the Build has finished (either success or
failure). Any exceptions during the build are reported with
results=FAILURE, not with an errback."""
# by the time we get here, the Build has already released the worker,
# whic... | def buildFinished(self, build, wfb):
"""This is called when the Build has finished (either success or
failure). Any exceptions during the build are reported with
results=FAILURE, not with an errback."""
# by the time we get here, the Build has already released the worker,
# whic... | [
"This",
"is",
"called",
"when",
"the",
"Build",
"has",
"finished",
"(",
"either",
"success",
"or",
"failure",
")",
".",
"Any",
"exceptions",
"during",
"the",
"build",
"are",
"reported",
"with",
"results",
"=",
"FAILURE",
"not",
"with",
"an",
"errback",
"."... | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/builder.py#L380-L407 | [
"def",
"buildFinished",
"(",
"self",
",",
"build",
",",
"wfb",
")",
":",
"# by the time we get here, the Build has already released the worker,",
"# which will trigger a check for any now-possible build requests",
"# (maybeStartBuilds)",
"results",
"=",
"build",
".",
"build_status"... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | Builder.getCollapseRequestsFn | Helper function to determine which collapseRequests function to use
from L{_collapseRequests}, or None for no merging | master/buildbot/process/builder.py | def getCollapseRequestsFn(self):
"""Helper function to determine which collapseRequests function to use
from L{_collapseRequests}, or None for no merging"""
# first, seek through builder, global, and the default
collapseRequests_fn = self.config.collapseRequests
if collapseReques... | def getCollapseRequestsFn(self):
"""Helper function to determine which collapseRequests function to use
from L{_collapseRequests}, or None for no merging"""
# first, seek through builder, global, and the default
collapseRequests_fn = self.config.collapseRequests
if collapseReques... | [
"Helper",
"function",
"to",
"determine",
"which",
"collapseRequests",
"function",
"to",
"use",
"from",
"L",
"{",
"_collapseRequests",
"}",
"or",
"None",
"for",
"no",
"merging"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/builder.py#L441-L457 | [
"def",
"getCollapseRequestsFn",
"(",
"self",
")",
":",
"# first, seek through builder, global, and the default",
"collapseRequests_fn",
"=",
"self",
".",
"config",
".",
"collapseRequests",
"if",
"collapseRequests_fn",
"is",
"None",
":",
"collapseRequests_fn",
"=",
"self",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | RunProcess._spawnProcess | private implementation of reactor.spawnProcess, to allow use of
L{ProcGroupProcess} | worker/buildbot_worker/runprocess.py | def _spawnProcess(self, processProtocol, executable, args=(), env=None,
path=None, uid=None, gid=None, usePTY=False, childFDs=None):
"""private implementation of reactor.spawnProcess, to allow use of
L{ProcGroupProcess}"""
if env is None:
env = {}
# use... | def _spawnProcess(self, processProtocol, executable, args=(), env=None,
path=None, uid=None, gid=None, usePTY=False, childFDs=None):
"""private implementation of reactor.spawnProcess, to allow use of
L{ProcGroupProcess}"""
if env is None:
env = {}
# use... | [
"private",
"implementation",
"of",
"reactor",
".",
"spawnProcess",
"to",
"allow",
"use",
"of",
"L",
"{",
"ProcGroupProcess",
"}"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/runprocess.py#L589-L607 | [
"def",
"_spawnProcess",
"(",
"self",
",",
"processProtocol",
",",
"executable",
",",
"args",
"=",
"(",
")",
",",
"env",
"=",
"None",
",",
"path",
"=",
"None",
",",
"uid",
"=",
"None",
",",
"gid",
"=",
"None",
",",
"usePTY",
"=",
"False",
",",
"chil... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | RunProcess._spawnAsBatch | A cheat that routes around the impedance mismatch between
twisted and cmd.exe with respect to escaping quotes | worker/buildbot_worker/runprocess.py | def _spawnAsBatch(self, processProtocol, executable, args, env,
path, usePTY):
"""A cheat that routes around the impedance mismatch between
twisted and cmd.exe with respect to escaping quotes"""
# NamedTemporaryFile differs in PY2 and PY3.
# In PY2, it needs encode... | def _spawnAsBatch(self, processProtocol, executable, args, env,
path, usePTY):
"""A cheat that routes around the impedance mismatch between
twisted and cmd.exe with respect to escaping quotes"""
# NamedTemporaryFile differs in PY2 and PY3.
# In PY2, it needs encode... | [
"A",
"cheat",
"that",
"routes",
"around",
"the",
"impedance",
"mismatch",
"between",
"twisted",
"and",
"cmd",
".",
"exe",
"with",
"respect",
"to",
"escaping",
"quotes"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/runprocess.py#L609-L643 | [
"def",
"_spawnAsBatch",
"(",
"self",
",",
"processProtocol",
",",
"executable",
",",
"args",
",",
"env",
",",
"path",
",",
"usePTY",
")",
":",
"# NamedTemporaryFile differs in PY2 and PY3.",
"# In PY2, it needs encoded str and its encoding cannot be specified.",
"# In PY3, it... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | RunProcess._chunkForSend | limit the chunks that we send over PB to 128k, since it has a hardwired
string-size limit of 640k. | worker/buildbot_worker/runprocess.py | def _chunkForSend(self, data):
"""
limit the chunks that we send over PB to 128k, since it has a hardwired
string-size limit of 640k.
"""
LIMIT = self.CHUNK_LIMIT
for i in range(0, len(data), LIMIT):
yield data[i:i + LIMIT] | def _chunkForSend(self, data):
"""
limit the chunks that we send over PB to 128k, since it has a hardwired
string-size limit of 640k.
"""
LIMIT = self.CHUNK_LIMIT
for i in range(0, len(data), LIMIT):
yield data[i:i + LIMIT] | [
"limit",
"the",
"chunks",
"that",
"we",
"send",
"over",
"PB",
"to",
"128k",
"since",
"it",
"has",
"a",
"hardwired",
"string",
"-",
"size",
"limit",
"of",
"640k",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/runprocess.py#L645-L652 | [
"def",
"_chunkForSend",
"(",
"self",
",",
"data",
")",
":",
"LIMIT",
"=",
"self",
".",
"CHUNK_LIMIT",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"data",
")",
",",
"LIMIT",
")",
":",
"yield",
"data",
"[",
"i",
":",
"i",
"+",
"LIMIT",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | RunProcess._collapseMsg | Take msg, which is a dictionary of lists of output chunks, and
concatenate all the chunks into a single string | worker/buildbot_worker/runprocess.py | def _collapseMsg(self, msg):
"""
Take msg, which is a dictionary of lists of output chunks, and
concatenate all the chunks into a single string
"""
retval = {}
for logname in msg:
data = u""
for m in msg[logname]:
m = bytes2unicode(... | def _collapseMsg(self, msg):
"""
Take msg, which is a dictionary of lists of output chunks, and
concatenate all the chunks into a single string
"""
retval = {}
for logname in msg:
data = u""
for m in msg[logname]:
m = bytes2unicode(... | [
"Take",
"msg",
"which",
"is",
"a",
"dictionary",
"of",
"lists",
"of",
"output",
"chunks",
"and",
"concatenate",
"all",
"the",
"chunks",
"into",
"a",
"single",
"string"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/runprocess.py#L654-L669 | [
"def",
"_collapseMsg",
"(",
"self",
",",
"msg",
")",
":",
"retval",
"=",
"{",
"}",
"for",
"logname",
"in",
"msg",
":",
"data",
"=",
"u\"\"",
"for",
"m",
"in",
"msg",
"[",
"logname",
"]",
":",
"m",
"=",
"bytes2unicode",
"(",
"m",
",",
"self",
".",... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | RunProcess._sendMessage | Collapse and send msg to the master | worker/buildbot_worker/runprocess.py | def _sendMessage(self, msg):
"""
Collapse and send msg to the master
"""
if not msg:
return
msg = self._collapseMsg(msg)
self.sendStatus(msg) | def _sendMessage(self, msg):
"""
Collapse and send msg to the master
"""
if not msg:
return
msg = self._collapseMsg(msg)
self.sendStatus(msg) | [
"Collapse",
"and",
"send",
"msg",
"to",
"the",
"master"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/runprocess.py#L671-L678 | [
"def",
"_sendMessage",
"(",
"self",
",",
"msg",
")",
":",
"if",
"not",
"msg",
":",
"return",
"msg",
"=",
"self",
".",
"_collapseMsg",
"(",
"msg",
")",
"self",
".",
"sendStatus",
"(",
"msg",
")"
] | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | RunProcess._sendBuffers | Send all the content in our buffers. | worker/buildbot_worker/runprocess.py | def _sendBuffers(self):
"""
Send all the content in our buffers.
"""
msg = {}
msg_size = 0
lastlog = None
logdata = []
while self.buffered:
# Grab the next bits from the buffer
logname, data = self.buffered.popleft()
# ... | def _sendBuffers(self):
"""
Send all the content in our buffers.
"""
msg = {}
msg_size = 0
lastlog = None
logdata = []
while self.buffered:
# Grab the next bits from the buffer
logname, data = self.buffered.popleft()
# ... | [
"Send",
"all",
"the",
"content",
"in",
"our",
"buffers",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/runprocess.py#L684-L735 | [
"def",
"_sendBuffers",
"(",
"self",
")",
":",
"msg",
"=",
"{",
"}",
"msg_size",
"=",
"0",
"lastlog",
"=",
"None",
"logdata",
"=",
"[",
"]",
"while",
"self",
".",
"buffered",
":",
"# Grab the next bits from the buffer",
"logname",
",",
"data",
"=",
"self",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | RunProcess._addToBuffers | Add data to the buffer for logname
Start a timer to send the buffers if BUFFER_TIMEOUT elapses.
If adding data causes the buffer size to grow beyond BUFFER_SIZE, then
the buffers will be sent. | worker/buildbot_worker/runprocess.py | def _addToBuffers(self, logname, data):
"""
Add data to the buffer for logname
Start a timer to send the buffers if BUFFER_TIMEOUT elapses.
If adding data causes the buffer size to grow beyond BUFFER_SIZE, then
the buffers will be sent.
"""
n = len(data)
... | def _addToBuffers(self, logname, data):
"""
Add data to the buffer for logname
Start a timer to send the buffers if BUFFER_TIMEOUT elapses.
If adding data causes the buffer size to grow beyond BUFFER_SIZE, then
the buffers will be sent.
"""
n = len(data)
... | [
"Add",
"data",
"to",
"the",
"buffer",
"for",
"logname",
"Start",
"a",
"timer",
"to",
"send",
"the",
"buffers",
"if",
"BUFFER_TIMEOUT",
"elapses",
".",
"If",
"adding",
"data",
"causes",
"the",
"buffer",
"size",
"to",
"grow",
"beyond",
"BUFFER_SIZE",
"then",
... | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/runprocess.py#L737-L752 | [
"def",
"_addToBuffers",
"(",
"self",
",",
"logname",
",",
"data",
")",
":",
"n",
"=",
"len",
"(",
"data",
")",
"self",
".",
"buflen",
"+=",
"n",
"self",
".",
"buffered",
".",
"append",
"(",
"(",
"logname",
",",
"data",
")",
")",
"if",
"self",
"."... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | WorkerForBuilderBase.remote_startCommand | This gets invoked by L{buildbot.process.step.RemoteCommand.start}, as
part of various master-side BuildSteps, to start various commands
that actually do the build. I return nothing. Eventually I will call
.commandComplete() to notify the master-side RemoteCommand that I'm
done. | worker/buildbot_worker/base.py | def remote_startCommand(self, stepref, stepId, command, args):
"""
This gets invoked by L{buildbot.process.step.RemoteCommand.start}, as
part of various master-side BuildSteps, to start various commands
that actually do the build. I return nothing. Eventually I will call
.command... | def remote_startCommand(self, stepref, stepId, command, args):
"""
This gets invoked by L{buildbot.process.step.RemoteCommand.start}, as
part of various master-side BuildSteps, to start various commands
that actually do the build. I return nothing. Eventually I will call
.command... | [
"This",
"gets",
"invoked",
"by",
"L",
"{",
"buildbot",
".",
"process",
".",
"step",
".",
"RemoteCommand",
".",
"start",
"}",
"as",
"part",
"of",
"various",
"master",
"-",
"side",
"BuildSteps",
"to",
"start",
"various",
"commands",
"that",
"actually",
"do",... | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/base.py#L126-L156 | [
"def",
"remote_startCommand",
"(",
"self",
",",
"stepref",
",",
"stepId",
",",
"command",
",",
"args",
")",
":",
"stepId",
"=",
"decode",
"(",
"stepId",
")",
"command",
"=",
"decode",
"(",
"command",
")",
"args",
"=",
"decode",
"(",
"args",
")",
"self"... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | WorkerForBuilderBase.remote_interruptCommand | Halt the current step. | worker/buildbot_worker/base.py | def remote_interruptCommand(self, stepId, why):
"""Halt the current step."""
log.msg("asked to interrupt current command: {0}".format(why))
self.activity()
if not self.command:
# TODO: just log it, a race could result in their interrupting a
# command that wasn't ... | def remote_interruptCommand(self, stepId, why):
"""Halt the current step."""
log.msg("asked to interrupt current command: {0}".format(why))
self.activity()
if not self.command:
# TODO: just log it, a race could result in their interrupting a
# command that wasn't ... | [
"Halt",
"the",
"current",
"step",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/base.py#L158-L167 | [
"def",
"remote_interruptCommand",
"(",
"self",
",",
"stepId",
",",
"why",
")",
":",
"log",
".",
"msg",
"(",
"\"asked to interrupt current command: {0}\"",
".",
"format",
"(",
"why",
")",
")",
"self",
".",
"activity",
"(",
")",
"if",
"not",
"self",
".",
"co... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | WorkerForBuilderBase.stopCommand | Make any currently-running command die, with no further status
output. This is used when the worker is shutting down or the
connection to the master has been lost. Interrupt the command,
silence it, and then forget about it. | worker/buildbot_worker/base.py | def stopCommand(self):
"""Make any currently-running command die, with no further status
output. This is used when the worker is shutting down or the
connection to the master has been lost. Interrupt the command,
silence it, and then forget about it."""
if not self.command:
... | def stopCommand(self):
"""Make any currently-running command die, with no further status
output. This is used when the worker is shutting down or the
connection to the master has been lost. Interrupt the command,
silence it, and then forget about it."""
if not self.command:
... | [
"Make",
"any",
"currently",
"-",
"running",
"command",
"die",
"with",
"no",
"further",
"status",
"output",
".",
"This",
"is",
"used",
"when",
"the",
"worker",
"is",
"shutting",
"down",
"or",
"the",
"connection",
"to",
"the",
"master",
"has",
"been",
"lost"... | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/base.py#L169-L178 | [
"def",
"stopCommand",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"command",
":",
"return",
"log",
".",
"msg",
"(",
"\"stopCommand: halting current command {0}\"",
".",
"format",
"(",
"self",
".",
"command",
")",
")",
"self",
".",
"command",
".",
"doI... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | WorkerForBuilderBase.sendUpdate | This sends the status update to the master-side
L{buildbot.process.step.RemoteCommand} object, giving it a sequence
number in the process. It adds the update to a queue, and asks the
master to acknowledge the update so it can be removed from that
queue. | worker/buildbot_worker/base.py | def sendUpdate(self, data):
"""This sends the status update to the master-side
L{buildbot.process.step.RemoteCommand} object, giving it a sequence
number in the process. It adds the update to a queue, and asks the
master to acknowledge the update so it can be removed from that
qu... | def sendUpdate(self, data):
"""This sends the status update to the master-side
L{buildbot.process.step.RemoteCommand} object, giving it a sequence
number in the process. It adds the update to a queue, and asks the
master to acknowledge the update so it can be removed from that
qu... | [
"This",
"sends",
"the",
"status",
"update",
"to",
"the",
"master",
"-",
"side",
"L",
"{",
"buildbot",
".",
"process",
".",
"step",
".",
"RemoteCommand",
"}",
"object",
"giving",
"it",
"a",
"sequence",
"number",
"in",
"the",
"process",
".",
"It",
"adds",
... | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/base.py#L181-L201 | [
"def",
"sendUpdate",
"(",
"self",
",",
"data",
")",
":",
"if",
"not",
"self",
".",
"running",
":",
"# .running comes from service.Service, and says whether the",
"# service is running or not. If we aren't running, don't send any",
"# status messages.",
"return",
"# the update[1]=... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | BotBase.remote_getWorkerInfo | This command retrieves data from the files in WORKERDIR/info/* and
sends the contents to the buildmaster. These are used to describe
the worker and its configuration, and should be created and
maintained by the worker administrator. They will be retrieved each
time the master-worker conn... | worker/buildbot_worker/base.py | def remote_getWorkerInfo(self):
"""This command retrieves data from the files in WORKERDIR/info/* and
sends the contents to the buildmaster. These are used to describe
the worker and its configuration, and should be created and
maintained by the worker administrator. They will be retriev... | def remote_getWorkerInfo(self):
"""This command retrieves data from the files in WORKERDIR/info/* and
sends the contents to the buildmaster. These are used to describe
the worker and its configuration, and should be created and
maintained by the worker administrator. They will be retriev... | [
"This",
"command",
"retrieves",
"data",
"from",
"the",
"files",
"in",
"WORKERDIR",
"/",
"info",
"/",
"*",
"and",
"sends",
"the",
"contents",
"to",
"the",
"buildmaster",
".",
"These",
"are",
"used",
"to",
"describe",
"the",
"worker",
"and",
"its",
"configur... | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/base.py#L307-L337 | [
"def",
"remote_getWorkerInfo",
"(",
"self",
")",
":",
"files",
"=",
"{",
"}",
"basedir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"basedir",
",",
"\"info\"",
")",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"basedir",
")",
":",
"for",... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | WorkerBase.recordHostname | Record my hostname in twistd.hostname, for user convenience | worker/buildbot_worker/base.py | def recordHostname(self, basedir):
"Record my hostname in twistd.hostname, for user convenience"
log.msg("recording hostname in twistd.hostname")
filename = os.path.join(basedir, "twistd.hostname")
try:
hostname = os.uname()[1] # only on unix
except AttributeError:
... | def recordHostname(self, basedir):
"Record my hostname in twistd.hostname, for user convenience"
log.msg("recording hostname in twistd.hostname")
filename = os.path.join(basedir, "twistd.hostname")
try:
hostname = os.uname()[1] # only on unix
except AttributeError:
... | [
"Record",
"my",
"hostname",
"in",
"twistd",
".",
"hostname",
"for",
"user",
"convenience"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/base.py#L380-L396 | [
"def",
"recordHostname",
"(",
"self",
",",
"basedir",
")",
":",
"log",
".",
"msg",
"(",
"\"recording hostname in twistd.hostname\"",
")",
"filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"basedir",
",",
"\"twistd.hostname\"",
")",
"try",
":",
"hostname",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | getTopdir | walk upwards from the current directory until we find this topfile | master/buildbot/clients/tryclient.py | def getTopdir(topfile, start=None):
"""walk upwards from the current directory until we find this topfile"""
if not start:
start = os.getcwd()
here = start
toomany = 20
while toomany > 0:
if os.path.exists(os.path.join(here, topfile)):
return here
next = os.path.d... | def getTopdir(topfile, start=None):
"""walk upwards from the current directory until we find this topfile"""
if not start:
start = os.getcwd()
here = start
toomany = 20
while toomany > 0:
if os.path.exists(os.path.join(here, topfile)):
return here
next = os.path.d... | [
"walk",
"upwards",
"from",
"the",
"current",
"directory",
"until",
"we",
"find",
"this",
"topfile"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/clients/tryclient.py#L486-L502 | [
"def",
"getTopdir",
"(",
"topfile",
",",
"start",
"=",
"None",
")",
":",
"if",
"not",
"start",
":",
"start",
"=",
"os",
".",
"getcwd",
"(",
")",
"here",
"=",
"start",
"toomany",
"=",
"20",
"while",
"toomany",
">",
"0",
":",
"if",
"os",
".",
"path... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | SourceStampExtractor.dovc | This accepts the arguments of a command, without the actual
command itself. | master/buildbot/clients/tryclient.py | def dovc(self, cmd):
"""This accepts the arguments of a command, without the actual
command itself."""
env = os.environ.copy()
env['LC_ALL'] = "C"
d = utils.getProcessOutputAndValue(self.exe, cmd, env=env,
path=self.treetop)
d.ad... | def dovc(self, cmd):
"""This accepts the arguments of a command, without the actual
command itself."""
env = os.environ.copy()
env['LC_ALL'] = "C"
d = utils.getProcessOutputAndValue(self.exe, cmd, env=env,
path=self.treetop)
d.ad... | [
"This",
"accepts",
"the",
"arguments",
"of",
"a",
"command",
"without",
"the",
"actual",
"command",
"itself",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/clients/tryclient.py#L67-L75 | [
"def",
"dovc",
"(",
"self",
",",
"cmd",
")",
":",
"env",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"env",
"[",
"'LC_ALL'",
"]",
"=",
"\"C\"",
"d",
"=",
"utils",
".",
"getProcessOutputAndValue",
"(",
"self",
".",
"exe",
",",
"cmd",
",",
"e... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | SourceStampExtractor.get | Return a Deferred that fires with a SourceStamp instance. | master/buildbot/clients/tryclient.py | def get(self):
"""Return a Deferred that fires with a SourceStamp instance."""
d = self.getBaseRevision()
d.addCallback(self.getPatch)
d.addCallback(self.done)
return d | def get(self):
"""Return a Deferred that fires with a SourceStamp instance."""
d = self.getBaseRevision()
d.addCallback(self.getPatch)
d.addCallback(self.done)
return d | [
"Return",
"a",
"Deferred",
"that",
"fires",
"with",
"a",
"SourceStamp",
"instance",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/clients/tryclient.py#L83-L88 | [
"def",
"get",
"(",
"self",
")",
":",
"d",
"=",
"self",
".",
"getBaseRevision",
"(",
")",
"d",
".",
"addCallback",
"(",
"self",
".",
"getPatch",
")",
"d",
".",
"addCallback",
"(",
"self",
".",
"done",
")",
"return",
"d"
] | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | check_output | Version of check_output which does not throw error | pkg/buildbot_pkg.py | def check_output(cmd):
"""Version of check_output which does not throw error"""
popen = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
out = popen.communicate()[0].strip()
if not isinstance(out, str):
out = out.decode(sys.stdout.encoding)
return out | def check_output(cmd):
"""Version of check_output which does not throw error"""
popen = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
out = popen.communicate()[0].strip()
if not isinstance(out, str):
out = out.decode(sys.stdout.encoding)
return out | [
"Version",
"of",
"check_output",
"which",
"does",
"not",
"throw",
"error"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/pkg/buildbot_pkg.py#L48-L54 | [
"def",
"check_output",
"(",
"cmd",
")",
":",
"popen",
"=",
"subprocess",
".",
"Popen",
"(",
"cmd",
",",
"shell",
"=",
"True",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
"out",
"=",
"popen",
".",
"communicate",
"(",
")",
"[",
"0",
"]",
".",... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | getVersionFromArchiveId | Extract the tag if a source is from git archive.
When source is exported via `git archive`, the git_archive_id init value is modified
and placeholders are expanded to the "archived" revision:
%ct: committer date, UNIX timestamp
%d: ref names, like the --decorate option of git-l... | pkg/buildbot_pkg.py | def getVersionFromArchiveId(git_archive_id='$Format:%ct %d$'):
""" Extract the tag if a source is from git archive.
When source is exported via `git archive`, the git_archive_id init value is modified
and placeholders are expanded to the "archived" revision:
%ct: committer date, UNIX t... | def getVersionFromArchiveId(git_archive_id='$Format:%ct %d$'):
""" Extract the tag if a source is from git archive.
When source is exported via `git archive`, the git_archive_id init value is modified
and placeholders are expanded to the "archived" revision:
%ct: committer date, UNIX t... | [
"Extract",
"the",
"tag",
"if",
"a",
"source",
"is",
"from",
"git",
"archive",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/pkg/buildbot_pkg.py#L89-L114 | [
"def",
"getVersionFromArchiveId",
"(",
"git_archive_id",
"=",
"'$Format:%ct %d$'",
")",
":",
"# mangle the magic string to make sure it is not replaced by git archive",
"if",
"not",
"git_archive_id",
".",
"startswith",
"(",
"'$For'",
"'mat:'",
")",
":",
"# source was modified b... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | getVersion | Return BUILDBOT_VERSION environment variable, content of VERSION file, git
tag or 'latest' | pkg/buildbot_pkg.py | def getVersion(init_file):
"""
Return BUILDBOT_VERSION environment variable, content of VERSION file, git
tag or 'latest'
"""
try:
return os.environ['BUILDBOT_VERSION']
except KeyError:
pass
try:
cwd = os.path.dirname(os.path.abspath(init_file))
fn = os.path... | def getVersion(init_file):
"""
Return BUILDBOT_VERSION environment variable, content of VERSION file, git
tag or 'latest'
"""
try:
return os.environ['BUILDBOT_VERSION']
except KeyError:
pass
try:
cwd = os.path.dirname(os.path.abspath(init_file))
fn = os.path... | [
"Return",
"BUILDBOT_VERSION",
"environment",
"variable",
"content",
"of",
"VERSION",
"file",
"git",
"tag",
"or",
"latest"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/pkg/buildbot_pkg.py#L117-L157 | [
"def",
"getVersion",
"(",
"init_file",
")",
":",
"try",
":",
"return",
"os",
".",
"environ",
"[",
"'BUILDBOT_VERSION'",
"]",
"except",
"KeyError",
":",
"pass",
"try",
":",
"cwd",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"a... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | BuildJsCommand.run | Run command. | pkg/buildbot_pkg.py | def run(self):
"""Run command."""
if self.already_run:
return
package = self.distribution.packages[0]
if os.path.exists("gulpfile.js") or os.path.exists("webpack.config.js"):
yarn_version = check_output("yarn --version")
npm_version = check_output("npm... | def run(self):
"""Run command."""
if self.already_run:
return
package = self.distribution.packages[0]
if os.path.exists("gulpfile.js") or os.path.exists("webpack.config.js"):
yarn_version = check_output("yarn --version")
npm_version = check_output("npm... | [
"Run",
"command",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/pkg/buildbot_pkg.py#L199-L246 | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"self",
".",
"already_run",
":",
"return",
"package",
"=",
"self",
".",
"distribution",
".",
"packages",
"[",
"0",
"]",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"\"gulpfile.js\"",
")",
"or",
"os",
".",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | GitHubEventHandler._get_commit_msg | :param repo: the repo full name, ``{owner}/{project}``.
e.g. ``buildbot/buildbot`` | master/buildbot/www/hooks/github.py | def _get_commit_msg(self, repo, sha):
'''
:param repo: the repo full name, ``{owner}/{project}``.
e.g. ``buildbot/buildbot``
'''
headers = {
'User-Agent': 'Buildbot'
}
if self._token:
headers['Authorization'] = 'token ' + self._token
... | def _get_commit_msg(self, repo, sha):
'''
:param repo: the repo full name, ``{owner}/{project}``.
e.g. ``buildbot/buildbot``
'''
headers = {
'User-Agent': 'Buildbot'
}
if self._token:
headers['Authorization'] = 'token ' + self._token
... | [
":",
"param",
"repo",
":",
"the",
"repo",
"full",
"name",
"{",
"owner",
"}",
"/",
"{",
"project",
"}",
".",
"e",
".",
"g",
".",
"buildbot",
"/",
"buildbot"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/www/hooks/github.py#L225-L243 | [
"def",
"_get_commit_msg",
"(",
"self",
",",
"repo",
",",
"sha",
")",
":",
"headers",
"=",
"{",
"'User-Agent'",
":",
"'Buildbot'",
"}",
"if",
"self",
".",
"_token",
":",
"headers",
"[",
"'Authorization'",
"]",
"=",
"'token '",
"+",
"self",
".",
"_token",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | GitHubEventHandler._process_change | Consumes the JSON as a python object and actually starts the build.
:arguments:
payload
Python Object that represents the JSON sent by GitHub Service
Hook. | master/buildbot/www/hooks/github.py | def _process_change(self, payload, user, repo, repo_url, project, event,
properties):
"""
Consumes the JSON as a python object and actually starts the build.
:arguments:
payload
Python Object that represents the JSON sent by GitHub Service
... | def _process_change(self, payload, user, repo, repo_url, project, event,
properties):
"""
Consumes the JSON as a python object and actually starts the build.
:arguments:
payload
Python Object that represents the JSON sent by GitHub Service
... | [
"Consumes",
"the",
"JSON",
"as",
"a",
"python",
"object",
"and",
"actually",
"starts",
"the",
"build",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/www/hooks/github.py#L245-L315 | [
"def",
"_process_change",
"(",
"self",
",",
"payload",
",",
"user",
",",
"repo",
",",
"repo_url",
",",
"project",
",",
"event",
",",
"properties",
")",
":",
"changes",
"=",
"[",
"]",
"refname",
"=",
"payload",
"[",
"'ref'",
"]",
"# We only care about regul... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | GitHubEventHandler._has_skip | The message contains the skipping keyword no not.
:return type: Bool | master/buildbot/www/hooks/github.py | def _has_skip(self, msg):
'''
The message contains the skipping keyword no not.
:return type: Bool
'''
for skip in self.skips:
if re.search(skip, msg):
return True
return False | def _has_skip(self, msg):
'''
The message contains the skipping keyword no not.
:return type: Bool
'''
for skip in self.skips:
if re.search(skip, msg):
return True
return False | [
"The",
"message",
"contains",
"the",
"skipping",
"keyword",
"no",
"not",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/www/hooks/github.py#L317-L326 | [
"def",
"_has_skip",
"(",
"self",
",",
"msg",
")",
":",
"for",
"skip",
"in",
"self",
".",
"skips",
":",
"if",
"re",
".",
"search",
"(",
"skip",
",",
"msg",
")",
":",
"return",
"True",
"return",
"False"
] | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | DebLintian.createSummary | Create nice summary logs.
@param log: log to create summary off of. | master/buildbot/steps/package/deb/lintian.py | def createSummary(self, log):
"""
Create nice summary logs.
@param log: log to create summary off of.
"""
warnings = self.obs.warnings
errors = self.obs.errors
if warnings:
self.addCompleteLog('%d Warnings' % len(warnings), "\n".join(warnings))
... | def createSummary(self, log):
"""
Create nice summary logs.
@param log: log to create summary off of.
"""
warnings = self.obs.warnings
errors = self.obs.errors
if warnings:
self.addCompleteLog('%d Warnings' % len(warnings), "\n".join(warnings))
... | [
"Create",
"nice",
"summary",
"logs",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/package/deb/lintian.py#L84-L98 | [
"def",
"createSummary",
"(",
"self",
",",
"log",
")",
":",
"warnings",
"=",
"self",
".",
"obs",
".",
"warnings",
"errors",
"=",
"self",
".",
"obs",
".",
"errors",
"if",
"warnings",
":",
"self",
".",
"addCompleteLog",
"(",
"'%d Warnings'",
"%",
"len",
"... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | WorkerFileUploadCommand._writeBlock | Write a block of data to the remote writer | worker/buildbot_worker/commands/transfer.py | def _writeBlock(self):
"""Write a block of data to the remote writer"""
if self.interrupted or self.fp is None:
if self.debug:
log.msg('WorkerFileUploadCommand._writeBlock(): end')
return True
length = self.blocksize
if self.remaining is not None... | def _writeBlock(self):
"""Write a block of data to the remote writer"""
if self.interrupted or self.fp is None:
if self.debug:
log.msg('WorkerFileUploadCommand._writeBlock(): end')
return True
length = self.blocksize
if self.remaining is not None... | [
"Write",
"a",
"block",
"of",
"data",
"to",
"the",
"remote",
"writer"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/commands/transfer.py#L153-L186 | [
"def",
"_writeBlock",
"(",
"self",
")",
":",
"if",
"self",
".",
"interrupted",
"or",
"self",
".",
"fp",
"is",
"None",
":",
"if",
"self",
".",
"debug",
":",
"log",
".",
"msg",
"(",
"'WorkerFileUploadCommand._writeBlock(): end'",
")",
"return",
"True",
"leng... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | WorkerFileDownloadCommand._readBlock | Read a block of data from the remote reader. | worker/buildbot_worker/commands/transfer.py | def _readBlock(self):
"""Read a block of data from the remote reader."""
if self.interrupted or self.fp is None:
if self.debug:
log.msg('WorkerFileDownloadCommand._readBlock(): end')
return True
length = self.blocksize
if self.bytes_remaining is ... | def _readBlock(self):
"""Read a block of data from the remote reader."""
if self.interrupted or self.fp is None:
if self.debug:
log.msg('WorkerFileDownloadCommand._readBlock(): end')
return True
length = self.blocksize
if self.bytes_remaining is ... | [
"Read",
"a",
"block",
"of",
"data",
"from",
"the",
"remote",
"reader",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/commands/transfer.py#L348-L369 | [
"def",
"_readBlock",
"(",
"self",
")",
":",
"if",
"self",
".",
"interrupted",
"or",
"self",
".",
"fp",
"is",
"None",
":",
"if",
"self",
".",
"debug",
":",
"log",
".",
"msg",
"(",
"'WorkerFileDownloadCommand._readBlock(): end'",
")",
"return",
"True",
"leng... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | MessageFormatter.formatMessageForBuildResults | Generate a buildbot mail message and return a dictionary
containing the message body, type and subject. | master/buildbot/reporters/message.py | def formatMessageForBuildResults(self, mode, buildername, buildset, build, master, previous_results, blamelist):
"""Generate a buildbot mail message and return a dictionary
containing the message body, type and subject."""
ss_list = buildset['sourcestamps']
results = build['results']
... | def formatMessageForBuildResults(self, mode, buildername, buildset, build, master, previous_results, blamelist):
"""Generate a buildbot mail message and return a dictionary
containing the message body, type and subject."""
ss_list = buildset['sourcestamps']
results = build['results']
... | [
"Generate",
"a",
"buildbot",
"mail",
"message",
"and",
"return",
"a",
"dictionary",
"containing",
"the",
"message",
"body",
"type",
"and",
"subject",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/reporters/message.py#L187-L213 | [
"def",
"formatMessageForBuildResults",
"(",
"self",
",",
"mode",
",",
"buildername",
",",
"buildset",
",",
"build",
",",
"master",
",",
"previous_results",
",",
"blamelist",
")",
":",
"ss_list",
"=",
"buildset",
"[",
"'sourcestamps'",
"]",
"results",
"=",
"bui... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | BaseParameter.fullName | A full name, intended to uniquely identify a parameter | master/buildbot/schedulers/forcesched.py | def fullName(self):
"""A full name, intended to uniquely identify a parameter"""
# join with '_' if both are set (cannot put '.', because it is used as
# **kwargs)
if self.parentName and self.name:
return self.parentName + '_' + self.name
# otherwise just use the one ... | def fullName(self):
"""A full name, intended to uniquely identify a parameter"""
# join with '_' if both are set (cannot put '.', because it is used as
# **kwargs)
if self.parentName and self.name:
return self.parentName + '_' + self.name
# otherwise just use the one ... | [
"A",
"full",
"name",
"intended",
"to",
"uniquely",
"identify",
"a",
"parameter"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/schedulers/forcesched.py#L88-L96 | [
"def",
"fullName",
"(",
"self",
")",
":",
"# join with '_' if both are set (cannot put '.', because it is used as",
"# **kwargs)",
"if",
"self",
".",
"parentName",
"and",
"self",
".",
"name",
":",
"return",
"self",
".",
"parentName",
"+",
"'_'",
"+",
"self",
".",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | BaseParameter.getFromKwargs | Simple customization point for child classes that do not need the other
parameters supplied to updateFromKwargs. Return the value for the property
named 'self.name'.
The default implementation converts from a list of items, validates using
the optional regex field and calls ... | master/buildbot/schedulers/forcesched.py | def getFromKwargs(self, kwargs):
"""Simple customization point for child classes that do not need the other
parameters supplied to updateFromKwargs. Return the value for the property
named 'self.name'.
The default implementation converts from a list of items, validates using
... | def getFromKwargs(self, kwargs):
"""Simple customization point for child classes that do not need the other
parameters supplied to updateFromKwargs. Return the value for the property
named 'self.name'.
The default implementation converts from a list of items, validates using
... | [
"Simple",
"customization",
"point",
"for",
"child",
"classes",
"that",
"do",
"not",
"need",
"the",
"other",
"parameters",
"supplied",
"to",
"updateFromKwargs",
".",
"Return",
"the",
"value",
"for",
"the",
"property",
"named",
"self",
".",
"name",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/schedulers/forcesched.py#L132-L178 | [
"def",
"getFromKwargs",
"(",
"self",
",",
"kwargs",
")",
":",
"args",
"=",
"kwargs",
".",
"get",
"(",
"self",
".",
"fullName",
",",
"[",
"]",
")",
"# delete white space for args",
"for",
"arg",
"in",
"args",
":",
"if",
"isinstance",
"(",
"arg",
",",
"s... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | BaseParameter.updateFromKwargs | Primary entry point to turn 'kwargs' into 'properties | master/buildbot/schedulers/forcesched.py | def updateFromKwargs(self, properties, kwargs, collector, **unused):
"""Primary entry point to turn 'kwargs' into 'properties'"""
properties[self.name] = self.getFromKwargs(kwargs) | def updateFromKwargs(self, properties, kwargs, collector, **unused):
"""Primary entry point to turn 'kwargs' into 'properties'"""
properties[self.name] = self.getFromKwargs(kwargs) | [
"Primary",
"entry",
"point",
"to",
"turn",
"kwargs",
"into",
"properties"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/schedulers/forcesched.py#L180-L182 | [
"def",
"updateFromKwargs",
"(",
"self",
",",
"properties",
",",
"kwargs",
",",
"collector",
",",
"*",
"*",
"unused",
")",
":",
"properties",
"[",
"self",
".",
"name",
"]",
"=",
"self",
".",
"getFromKwargs",
"(",
"kwargs",
")"
] | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | BaseParameter.parse_from_args | Secondary customization point, called from getFromKwargs to turn
a validated value into a single property value | master/buildbot/schedulers/forcesched.py | def parse_from_args(self, l):
"""Secondary customization point, called from getFromKwargs to turn
a validated value into a single property value"""
if self.multiple:
return [self.parse_from_arg(arg) for arg in l]
return self.parse_from_arg(l[0]) | def parse_from_args(self, l):
"""Secondary customization point, called from getFromKwargs to turn
a validated value into a single property value"""
if self.multiple:
return [self.parse_from_arg(arg) for arg in l]
return self.parse_from_arg(l[0]) | [
"Secondary",
"customization",
"point",
"called",
"from",
"getFromKwargs",
"to",
"turn",
"a",
"validated",
"value",
"into",
"a",
"single",
"property",
"value"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/schedulers/forcesched.py#L184-L189 | [
"def",
"parse_from_args",
"(",
"self",
",",
"l",
")",
":",
"if",
"self",
".",
"multiple",
":",
"return",
"[",
"self",
".",
"parse_from_arg",
"(",
"arg",
")",
"for",
"arg",
"in",
"l",
"]",
"return",
"self",
".",
"parse_from_arg",
"(",
"l",
"[",
"0",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | NestedParameter.collectChildProperties | Collapse the child values into a dictionary. This is intended to be
called by child classes to fix up the fullName->name conversions. | master/buildbot/schedulers/forcesched.py | def collectChildProperties(self, kwargs, properties, collector, **kw):
"""Collapse the child values into a dictionary. This is intended to be
called by child classes to fix up the fullName->name conversions."""
childProperties = {}
for field in self.fields: # pylint: disable=not-an-... | def collectChildProperties(self, kwargs, properties, collector, **kw):
"""Collapse the child values into a dictionary. This is intended to be
called by child classes to fix up the fullName->name conversions."""
childProperties = {}
for field in self.fields: # pylint: disable=not-an-... | [
"Collapse",
"the",
"child",
"values",
"into",
"a",
"dictionary",
".",
"This",
"is",
"intended",
"to",
"be",
"called",
"by",
"child",
"classes",
"to",
"fix",
"up",
"the",
"fullName",
"-",
">",
"name",
"conversions",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/schedulers/forcesched.py#L425-L437 | [
"def",
"collectChildProperties",
"(",
"self",
",",
"kwargs",
",",
"properties",
",",
"collector",
",",
"*",
"*",
"kw",
")",
":",
"childProperties",
"=",
"{",
"}",
"for",
"field",
"in",
"self",
".",
"fields",
":",
"# pylint: disable=not-an-iterable",
"yield",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | NestedParameter.updateFromKwargs | By default, the child values will be collapsed into a dictionary. If
the parent is anonymous, this dictionary is the top-level properties. | master/buildbot/schedulers/forcesched.py | def updateFromKwargs(self, kwargs, properties, collector, **kw):
"""By default, the child values will be collapsed into a dictionary. If
the parent is anonymous, this dictionary is the top-level properties."""
yield self.collectChildProperties(kwargs=kwargs, properties=properties,
... | def updateFromKwargs(self, kwargs, properties, collector, **kw):
"""By default, the child values will be collapsed into a dictionary. If
the parent is anonymous, this dictionary is the top-level properties."""
yield self.collectChildProperties(kwargs=kwargs, properties=properties,
... | [
"By",
"default",
"the",
"child",
"values",
"will",
"be",
"collapsed",
"into",
"a",
"dictionary",
".",
"If",
"the",
"parent",
"is",
"anonymous",
"this",
"dictionary",
"is",
"the",
"top",
"-",
"level",
"properties",
"."
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/schedulers/forcesched.py#L440-L453 | [
"def",
"updateFromKwargs",
"(",
"self",
",",
"kwargs",
",",
"properties",
",",
"collector",
",",
"*",
"*",
"kw",
")",
":",
"yield",
"self",
".",
"collectChildProperties",
"(",
"kwargs",
"=",
"kwargs",
",",
"properties",
"=",
"properties",
",",
"collector",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | ForceScheduler.force | We check the parameters, and launch the build, if everything is correct | master/buildbot/schedulers/forcesched.py | def force(self, owner, builderNames=None, builderid=None, **kwargs):
"""
We check the parameters, and launch the build, if everything is correct
"""
builderNames = yield self.computeBuilderNames(builderNames, builderid)
if not builderNames:
raise KeyError("builderName... | def force(self, owner, builderNames=None, builderid=None, **kwargs):
"""
We check the parameters, and launch the build, if everything is correct
"""
builderNames = yield self.computeBuilderNames(builderNames, builderid)
if not builderNames:
raise KeyError("builderName... | [
"We",
"check",
"the",
"parameters",
"and",
"launch",
"the",
"build",
"if",
"everything",
"is",
"correct"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/schedulers/forcesched.py#L799-L845 | [
"def",
"force",
"(",
"self",
",",
"owner",
",",
"builderNames",
"=",
"None",
",",
"builderid",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"builderNames",
"=",
"yield",
"self",
".",
"computeBuilderNames",
"(",
"builderNames",
",",
"builderid",
")",
"... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | SecretManager.get | get secrets from the provider defined in the secret using args and
kwargs
@secrets: secrets keys
@type: string
@return type: SecretDetails | master/buildbot/secrets/manager.py | def get(self, secret, *args, **kwargs):
"""
get secrets from the provider defined in the secret using args and
kwargs
@secrets: secrets keys
@type: string
@return type: SecretDetails
"""
for provider in self.services:
value = yield provider.get... | def get(self, secret, *args, **kwargs):
"""
get secrets from the provider defined in the secret using args and
kwargs
@secrets: secrets keys
@type: string
@return type: SecretDetails
"""
for provider in self.services:
value = yield provider.get... | [
"get",
"secrets",
"from",
"the",
"provider",
"defined",
"in",
"the",
"secret",
"using",
"args",
"and",
"kwargs"
] | buildbot/buildbot | python | https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/secrets/manager.py#L33-L45 | [
"def",
"get",
"(",
"self",
",",
"secret",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"provider",
"in",
"self",
".",
"services",
":",
"value",
"=",
"yield",
"provider",
".",
"get",
"(",
"secret",
")",
"source_name",
"=",
"provider",
... | 5df3cfae6d760557d99156633c32b1822a1e130c |
train | save | save function | misc/cpu.py | def save():
"""
save function
"""
results = {}
cpu_number = 0
while True:
try:
_file = open(
CPU_PREFIX + 'cpu{}/cpufreq/scaling_governor'.format(cpu_number))
except:
break
governor = _file.read().strip()
results.setdefaul... | def save():
"""
save function
"""
results = {}
cpu_number = 0
while True:
try:
_file = open(
CPU_PREFIX + 'cpu{}/cpufreq/scaling_governor'.format(cpu_number))
except:
break
governor = _file.read().strip()
results.setdefaul... | [
"save",
"function"
] | squeaky-pl/japronto | python | https://github.com/squeaky-pl/japronto/blob/a526277a2f59100388c9f39d4ca22bfb4909955b/misc/cpu.py#L14-L45 | [
"def",
"save",
"(",
")",
":",
"results",
"=",
"{",
"}",
"cpu_number",
"=",
"0",
"while",
"True",
":",
"try",
":",
"_file",
"=",
"open",
"(",
"CPU_PREFIX",
"+",
"'cpu{}/cpufreq/scaling_governor'",
".",
"format",
"(",
"cpu_number",
")",
")",
"except",
":",... | a526277a2f59100388c9f39d4ca22bfb4909955b |
train | change | change function | misc/cpu.py | def change(governor, freq=None):
"""
change function
"""
cpu_number = 0
while True:
try:
subprocess.check_output([
"sudo", "bash", "-c",
"echo {governor} > {CPU_PREFIX}cpu{cpu_number}/cpufreq/scaling_governor"
.format(governor=gove... | def change(governor, freq=None):
"""
change function
"""
cpu_number = 0
while True:
try:
subprocess.check_output([
"sudo", "bash", "-c",
"echo {governor} > {CPU_PREFIX}cpu{cpu_number}/cpufreq/scaling_governor"
.format(governor=gove... | [
"change",
"function"
] | squeaky-pl/japronto | python | https://github.com/squeaky-pl/japronto/blob/a526277a2f59100388c9f39d4ca22bfb4909955b/misc/cpu.py#L48-L75 | [
"def",
"change",
"(",
"governor",
",",
"freq",
"=",
"None",
")",
":",
"cpu_number",
"=",
"0",
"while",
"True",
":",
"try",
":",
"subprocess",
".",
"check_output",
"(",
"[",
"\"sudo\"",
",",
"\"bash\"",
",",
"\"-c\"",
",",
"\"echo {governor} > {CPU_PREFIX}cpu... | a526277a2f59100388c9f39d4ca22bfb4909955b |
train | available_freq | function for checking available frequency | misc/cpu.py | def available_freq():
"""
function for checking available frequency
"""
_file = open(CPU_PREFIX + 'cpu0/cpufreq/scaling_available_frequencies')
freq = [int(_file) for _file in _file.read().strip().split()]
_file.close()
return freq | def available_freq():
"""
function for checking available frequency
"""
_file = open(CPU_PREFIX + 'cpu0/cpufreq/scaling_available_frequencies')
freq = [int(_file) for _file in _file.read().strip().split()]
_file.close()
return freq | [
"function",
"for",
"checking",
"available",
"frequency"
] | squeaky-pl/japronto | python | https://github.com/squeaky-pl/japronto/blob/a526277a2f59100388c9f39d4ca22bfb4909955b/misc/cpu.py#L78-L88 | [
"def",
"available_freq",
"(",
")",
":",
"_file",
"=",
"open",
"(",
"CPU_PREFIX",
"+",
"'cpu0/cpufreq/scaling_available_frequencies'",
")",
"freq",
"=",
"[",
"int",
"(",
"_file",
")",
"for",
"_file",
"in",
"_file",
".",
"read",
"(",
")",
".",
"strip",
"(",
... | a526277a2f59100388c9f39d4ca22bfb4909955b |
train | dump | dump function | misc/cpu.py | def dump():
"""
dump function
"""
try:
sensors = subprocess.check_output('sensors').decode('utf-8')
except (FileNotFoundError, subprocess.CalledProcessError):
print("Couldn't read CPU temp")
else:
cores = []
for line in sensors.splitlines():
if lin... | def dump():
"""
dump function
"""
try:
sensors = subprocess.check_output('sensors').decode('utf-8')
except (FileNotFoundError, subprocess.CalledProcessError):
print("Couldn't read CPU temp")
else:
cores = []
for line in sensors.splitlines():
if lin... | [
"dump",
"function"
] | squeaky-pl/japronto | python | https://github.com/squeaky-pl/japronto/blob/a526277a2f59100388c9f39d4ca22bfb4909955b/misc/cpu.py#L105-L151 | [
"def",
"dump",
"(",
")",
":",
"try",
":",
"sensors",
"=",
"subprocess",
".",
"check_output",
"(",
"'sensors'",
")",
".",
"decode",
"(",
"'utf-8'",
")",
"except",
"(",
"FileNotFoundError",
",",
"subprocess",
".",
"CalledProcessError",
")",
":",
"print",
"("... | a526277a2f59100388c9f39d4ca22bfb4909955b |
train | padto8 | Pads data to the multiplies of 8 bytes.
This makes x86_64 faster and prevents
undefined behavior on other platforms | src/japronto/router/route.py | def padto8(data):
"""Pads data to the multiplies of 8 bytes.
This makes x86_64 faster and prevents
undefined behavior on other platforms"""
length = len(data)
return data + b'\xdb' * (roundto8(length) - length) | def padto8(data):
"""Pads data to the multiplies of 8 bytes.
This makes x86_64 faster and prevents
undefined behavior on other platforms"""
length = len(data)
return data + b'\xdb' * (roundto8(length) - length) | [
"Pads",
"data",
"to",
"the",
"multiplies",
"of",
"8",
"bytes",
"."
] | squeaky-pl/japronto | python | https://github.com/squeaky-pl/japronto/blob/a526277a2f59100388c9f39d4ca22bfb4909955b/src/japronto/router/route.py#L125-L131 | [
"def",
"padto8",
"(",
"data",
")",
":",
"length",
"=",
"len",
"(",
"data",
")",
"return",
"data",
"+",
"b'\\xdb'",
"*",
"(",
"roundto8",
"(",
"length",
")",
"-",
"length",
")"
] | a526277a2f59100388c9f39d4ca22bfb4909955b |
train | parse_cookie | Parse a ``Cookie`` HTTP header into a dict of name/value pairs.
This function attempts to mimic browser cookie parsing behavior;
it specifically does not follow any of the cookie-related RFCs
(because browsers don't either).
The algorithm used is identical to that used by Django version 1.9.10. | src/japronto/request/__init__.py | def parse_cookie(cookie):
"""Parse a ``Cookie`` HTTP header into a dict of name/value pairs.
This function attempts to mimic browser cookie parsing behavior;
it specifically does not follow any of the cookie-related RFCs
(because browsers don't either).
The algorithm used is identical to that used b... | def parse_cookie(cookie):
"""Parse a ``Cookie`` HTTP header into a dict of name/value pairs.
This function attempts to mimic browser cookie parsing behavior;
it specifically does not follow any of the cookie-related RFCs
(because browsers don't either).
The algorithm used is identical to that used b... | [
"Parse",
"a",
"Cookie",
"HTTP",
"header",
"into",
"a",
"dict",
"of",
"name",
"/",
"value",
"pairs",
".",
"This",
"function",
"attempts",
"to",
"mimic",
"browser",
"cookie",
"parsing",
"behavior",
";",
"it",
"specifically",
"does",
"not",
"follow",
"any",
"... | squeaky-pl/japronto | python | https://github.com/squeaky-pl/japronto/blob/a526277a2f59100388c9f39d4ca22bfb4909955b/src/japronto/request/__init__.py#L131-L150 | [
"def",
"parse_cookie",
"(",
"cookie",
")",
":",
"cookiedict",
"=",
"{",
"}",
"for",
"chunk",
"in",
"cookie",
".",
"split",
"(",
"str",
"(",
"';'",
")",
")",
":",
"if",
"str",
"(",
"'='",
")",
"in",
"chunk",
":",
"key",
",",
"val",
"=",
"chunk",
... | a526277a2f59100388c9f39d4ca22bfb4909955b |
train | is_simple | A heuristic to find out if a function is simple enough. | src/japronto/router/analyzer.py | def is_simple(fun):
"""A heuristic to find out if a function is simple enough."""
seen_load_fast_0 = False
seen_load_response = False
seen_call_fun = False
for instruction in dis.get_instructions(fun):
if instruction.opname == 'LOAD_FAST' and instruction.arg == 0:
seen_load_fast... | def is_simple(fun):
"""A heuristic to find out if a function is simple enough."""
seen_load_fast_0 = False
seen_load_response = False
seen_call_fun = False
for instruction in dis.get_instructions(fun):
if instruction.opname == 'LOAD_FAST' and instruction.arg == 0:
seen_load_fast... | [
"A",
"heuristic",
"to",
"find",
"out",
"if",
"a",
"function",
"is",
"simple",
"enough",
"."
] | squeaky-pl/japronto | python | https://github.com/squeaky-pl/japronto/blob/a526277a2f59100388c9f39d4ca22bfb4909955b/src/japronto/router/analyzer.py#L9-L32 | [
"def",
"is_simple",
"(",
"fun",
")",
":",
"seen_load_fast_0",
"=",
"False",
"seen_load_response",
"=",
"False",
"seen_call_fun",
"=",
"False",
"for",
"instruction",
"in",
"dis",
".",
"get_instructions",
"(",
"fun",
")",
":",
"if",
"instruction",
".",
"opname",... | a526277a2f59100388c9f39d4ca22bfb4909955b |
train | ProfileReport.get_rejected_variables | Return a list of variable names being rejected for high
correlation with one of remaining variables.
Parameters:
----------
threshold : float
Correlation value which is above the threshold are rejected
Returns
-------
list
The lis... | pandas_profiling/__init__.py | def get_rejected_variables(self, threshold=0.9):
"""Return a list of variable names being rejected for high
correlation with one of remaining variables.
Parameters:
----------
threshold : float
Correlation value which is above the threshold are rejected
... | def get_rejected_variables(self, threshold=0.9):
"""Return a list of variable names being rejected for high
correlation with one of remaining variables.
Parameters:
----------
threshold : float
Correlation value which is above the threshold are rejected
... | [
"Return",
"a",
"list",
"of",
"variable",
"names",
"being",
"rejected",
"for",
"high",
"correlation",
"with",
"one",
"of",
"remaining",
"variables",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/__init__.py#L86-L104 | [
"def",
"get_rejected_variables",
"(",
"self",
",",
"threshold",
"=",
"0.9",
")",
":",
"variable_profile",
"=",
"self",
".",
"description_set",
"[",
"'variables'",
"]",
"result",
"=",
"[",
"]",
"if",
"hasattr",
"(",
"variable_profile",
",",
"'correlation'",
")"... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | ProfileReport.to_file | Write the report to a file.
By default a name is generated.
Parameters:
----------
outputfile : str
The name or the path of the file to generale including the extension (.html). | pandas_profiling/__init__.py | def to_file(self, outputfile=DEFAULT_OUTPUTFILE):
"""Write the report to a file.
By default a name is generated.
Parameters:
----------
outputfile : str
The name or the path of the file to generale including the extension (.html).
"""
if... | def to_file(self, outputfile=DEFAULT_OUTPUTFILE):
"""Write the report to a file.
By default a name is generated.
Parameters:
----------
outputfile : str
The name or the path of the file to generale including the extension (.html).
"""
if... | [
"Write",
"the",
"report",
"to",
"a",
"file",
".",
"By",
"default",
"a",
"name",
"is",
"generated",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/__init__.py#L106-L122 | [
"def",
"to_file",
"(",
"self",
",",
"outputfile",
"=",
"DEFAULT_OUTPUTFILE",
")",
":",
"if",
"outputfile",
"!=",
"NO_OUTPUTFILE",
":",
"if",
"outputfile",
"==",
"DEFAULT_OUTPUTFILE",
":",
"outputfile",
"=",
"'profile_'",
"+",
"str",
"(",
"hash",
"(",
"self",
... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | template | Return a jinja template ready for rendering. If needed, global variables are initialized.
Parameters
----------
template_name: str, the name of the template as defined in the templates mapping
Returns
-------
The Jinja template ready for rendering | pandas_profiling/templates.py | def template(template_name):
"""Return a jinja template ready for rendering. If needed, global variables are initialized.
Parameters
----------
template_name: str, the name of the template as defined in the templates mapping
Returns
-------
The Jinja template ready for rendering
"""
... | def template(template_name):
"""Return a jinja template ready for rendering. If needed, global variables are initialized.
Parameters
----------
template_name: str, the name of the template as defined in the templates mapping
Returns
-------
The Jinja template ready for rendering
"""
... | [
"Return",
"a",
"jinja",
"template",
"ready",
"for",
"rendering",
".",
"If",
"needed",
"global",
"variables",
"are",
"initialized",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/templates.py#L44-L60 | [
"def",
"template",
"(",
"template_name",
")",
":",
"globals",
"=",
"None",
"if",
"template_name",
".",
"startswith",
"(",
"'row_'",
")",
":",
"# This is a row template setting global variable",
"globals",
"=",
"dict",
"(",
")",
"globals",
"[",
"'vartype'",
"]",
... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | to_html | Generate a HTML report from summary statistics and a given sample.
Parameters
----------
sample : DataFrame
the sample you want to print
stats_object : dict
Summary statistics. Should be generated with an appropriate describe() function
Returns
-------
str
containin... | pandas_profiling/report.py | def to_html(sample, stats_object):
"""Generate a HTML report from summary statistics and a given sample.
Parameters
----------
sample : DataFrame
the sample you want to print
stats_object : dict
Summary statistics. Should be generated with an appropriate describe() function
Ret... | def to_html(sample, stats_object):
"""Generate a HTML report from summary statistics and a given sample.
Parameters
----------
sample : DataFrame
the sample you want to print
stats_object : dict
Summary statistics. Should be generated with an appropriate describe() function
Ret... | [
"Generate",
"a",
"HTML",
"report",
"from",
"summary",
"statistics",
"and",
"a",
"given",
"sample",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/report.py#L11-L214 | [
"def",
"to_html",
"(",
"sample",
",",
"stats_object",
")",
":",
"n_obs",
"=",
"stats_object",
"[",
"'table'",
"]",
"[",
"'n'",
"]",
"value_formatters",
"=",
"formatters",
".",
"value_formatters",
"row_formatters",
"=",
"formatters",
".",
"row_formatters",
"if",
... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | describe_numeric_1d | Compute summary statistics of a numerical (`TYPE_NUM`) variable (a Series).
Also create histograms (mini an full) of its distribution.
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with in... | pandas_profiling/describe.py | def describe_numeric_1d(series, **kwargs):
"""Compute summary statistics of a numerical (`TYPE_NUM`) variable (a Series).
Also create histograms (mini an full) of its distribution.
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
T... | def describe_numeric_1d(series, **kwargs):
"""Compute summary statistics of a numerical (`TYPE_NUM`) variable (a Series).
Also create histograms (mini an full) of its distribution.
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
T... | [
"Compute",
"summary",
"statistics",
"of",
"a",
"numerical",
"(",
"TYPE_NUM",
")",
"variable",
"(",
"a",
"Series",
")",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/describe.py#L15-L56 | [
"def",
"describe_numeric_1d",
"(",
"series",
",",
"*",
"*",
"kwargs",
")",
":",
"# Format a number as a percentage. For example 0.25 will be turned to 25%.",
"_percentile_format",
"=",
"\"{:.0%}\"",
"stats",
"=",
"dict",
"(",
")",
"stats",
"[",
"'type'",
"]",
"=",
"ba... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | describe_date_1d | Compute summary statistics of a date (`TYPE_DATE`) variable (a Series).
Also create histograms (mini an full) of its distribution.
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index ... | pandas_profiling/describe.py | def describe_date_1d(series):
"""Compute summary statistics of a date (`TYPE_DATE`) variable (a Series).
Also create histograms (mini an full) of its distribution.
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of... | def describe_date_1d(series):
"""Compute summary statistics of a date (`TYPE_DATE`) variable (a Series).
Also create histograms (mini an full) of its distribution.
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of... | [
"Compute",
"summary",
"statistics",
"of",
"a",
"date",
"(",
"TYPE_DATE",
")",
"variable",
"(",
"a",
"Series",
")",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/describe.py#L59-L82 | [
"def",
"describe_date_1d",
"(",
"series",
")",
":",
"stats",
"=",
"dict",
"(",
")",
"stats",
"[",
"'type'",
"]",
"=",
"base",
".",
"TYPE_DATE",
"stats",
"[",
"'min'",
"]",
"=",
"series",
".",
"min",
"(",
")",
"stats",
"[",
"'max'",
"]",
"=",
"serie... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | describe_categorical_1d | Compute summary statistics of a categorical (`TYPE_CAT`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats keys. | pandas_profiling/describe.py | def describe_categorical_1d(series):
"""Compute summary statistics of a categorical (`TYPE_CAT`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats ke... | def describe_categorical_1d(series):
"""Compute summary statistics of a categorical (`TYPE_CAT`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats ke... | [
"Compute",
"summary",
"statistics",
"of",
"a",
"categorical",
"(",
"TYPE_CAT",
")",
"variable",
"(",
"a",
"Series",
")",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/describe.py#L84-L107 | [
"def",
"describe_categorical_1d",
"(",
"series",
")",
":",
"# Only run if at least 1 non-missing value",
"value_counts",
",",
"distinct_count",
"=",
"base",
".",
"get_groupby_statistic",
"(",
"series",
")",
"top",
",",
"freq",
"=",
"value_counts",
".",
"index",
"[",
... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | describe_boolean_1d | Compute summary statistics of a boolean (`TYPE_BOOL`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats keys. | pandas_profiling/describe.py | def describe_boolean_1d(series):
"""Compute summary statistics of a boolean (`TYPE_BOOL`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats keys.
... | def describe_boolean_1d(series):
"""Compute summary statistics of a boolean (`TYPE_BOOL`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats keys.
... | [
"Compute",
"summary",
"statistics",
"of",
"a",
"boolean",
"(",
"TYPE_BOOL",
")",
"variable",
"(",
"a",
"Series",
")",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/describe.py#L109-L131 | [
"def",
"describe_boolean_1d",
"(",
"series",
")",
":",
"value_counts",
",",
"distinct_count",
"=",
"base",
".",
"get_groupby_statistic",
"(",
"series",
")",
"top",
",",
"freq",
"=",
"value_counts",
".",
"index",
"[",
"0",
"]",
",",
"value_counts",
".",
"iloc... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | describe_constant_1d | Compute summary statistics of a constant (`S_TYPE_CONST`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats keys. | pandas_profiling/describe.py | def describe_constant_1d(series):
"""Compute summary statistics of a constant (`S_TYPE_CONST`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats keys... | def describe_constant_1d(series):
"""Compute summary statistics of a constant (`S_TYPE_CONST`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats keys... | [
"Compute",
"summary",
"statistics",
"of",
"a",
"constant",
"(",
"S_TYPE_CONST",
")",
"variable",
"(",
"a",
"Series",
")",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/describe.py#L133-L146 | [
"def",
"describe_constant_1d",
"(",
"series",
")",
":",
"return",
"pd",
".",
"Series",
"(",
"[",
"base",
".",
"S_TYPE_CONST",
"]",
",",
"index",
"=",
"[",
"'type'",
"]",
",",
"name",
"=",
"series",
".",
"name",
")"
] | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | describe_unique_1d | Compute summary statistics of a unique (`S_TYPE_UNIQUE`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats keys. | pandas_profiling/describe.py | def describe_unique_1d(series):
"""Compute summary statistics of a unique (`S_TYPE_UNIQUE`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats keys.
... | def describe_unique_1d(series):
"""Compute summary statistics of a unique (`S_TYPE_UNIQUE`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats keys.
... | [
"Compute",
"summary",
"statistics",
"of",
"a",
"unique",
"(",
"S_TYPE_UNIQUE",
")",
"variable",
"(",
"a",
"Series",
")",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/describe.py#L148-L161 | [
"def",
"describe_unique_1d",
"(",
"series",
")",
":",
"return",
"pd",
".",
"Series",
"(",
"[",
"base",
".",
"S_TYPE_UNIQUE",
"]",
",",
"index",
"=",
"[",
"'type'",
"]",
",",
"name",
"=",
"series",
".",
"name",
")"
] | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | describe_supported | Compute summary statistics of a supported variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats keys. | pandas_profiling/describe.py | def describe_supported(series, **kwargs):
"""Compute summary statistics of a supported variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats keys.
""... | def describe_supported(series, **kwargs):
"""Compute summary statistics of a supported variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats keys.
""... | [
"Compute",
"summary",
"statistics",
"of",
"a",
"supported",
"variable",
"(",
"a",
"Series",
")",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/describe.py#L163-L201 | [
"def",
"describe_supported",
"(",
"series",
",",
"*",
"*",
"kwargs",
")",
":",
"leng",
"=",
"len",
"(",
"series",
")",
"# number of observations in the Series",
"count",
"=",
"series",
".",
"count",
"(",
")",
"# number of non-NaN observations in the Series",
"n_infi... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | describe_unsupported | Compute summary statistics of a unsupported (`S_TYPE_UNSUPPORTED`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with index being stats keys. | pandas_profiling/describe.py | def describe_unsupported(series, **kwargs):
"""Compute summary statistics of a unsupported (`S_TYPE_UNSUPPORTED`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with ind... | def describe_unsupported(series, **kwargs):
"""Compute summary statistics of a unsupported (`S_TYPE_UNSUPPORTED`) variable (a Series).
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The description of the variable as a Series with ind... | [
"Compute",
"summary",
"statistics",
"of",
"a",
"unsupported",
"(",
"S_TYPE_UNSUPPORTED",
")",
"variable",
"(",
"a",
"Series",
")",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/describe.py#L203-L233 | [
"def",
"describe_unsupported",
"(",
"series",
",",
"*",
"*",
"kwargs",
")",
":",
"leng",
"=",
"len",
"(",
"series",
")",
"# number of observations in the Series",
"count",
"=",
"series",
".",
"count",
"(",
")",
"# number of non-NaN observations in the Series",
"n_in... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | describe_1d | Compute summary statistics of a variable (a Series).
The description is different according to the type of the variable.
However a set of common stats is also computed.
Parameters
----------
series : Series
The variable to describe.
Returns
-------
Series
The descripti... | pandas_profiling/describe.py | def describe_1d(data, **kwargs):
"""Compute summary statistics of a variable (a Series).
The description is different according to the type of the variable.
However a set of common stats is also computed.
Parameters
----------
series : Series
The variable to describe.
Returns
... | def describe_1d(data, **kwargs):
"""Compute summary statistics of a variable (a Series).
The description is different according to the type of the variable.
However a set of common stats is also computed.
Parameters
----------
series : Series
The variable to describe.
Returns
... | [
"Compute",
"summary",
"statistics",
"of",
"a",
"variable",
"(",
"a",
"Series",
")",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/describe.py#L235-L279 | [
"def",
"describe_1d",
"(",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"# Replace infinite values with NaNs to avoid issues with",
"# histograms later.",
"data",
".",
"replace",
"(",
"to_replace",
"=",
"[",
"np",
".",
"inf",
",",
"np",
".",
"NINF",
",",
"np",
"... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | describe | Generates a dict containing summary statistics for a given dataset stored as a pandas `DataFrame`.
Used has is it will output its content as an HTML report in a Jupyter notebook.
Parameters
----------
df : DataFrame
Data to be analyzed
bins : int
Number of bins in histogram.
... | pandas_profiling/describe.py | def describe(df, bins=10, check_correlation=True, correlation_threshold=0.9, correlation_overrides=None, check_recoded=False, pool_size=multiprocessing.cpu_count(), **kwargs):
"""Generates a dict containing summary statistics for a given dataset stored as a pandas `DataFrame`.
Used has is it will output its co... | def describe(df, bins=10, check_correlation=True, correlation_threshold=0.9, correlation_overrides=None, check_recoded=False, pool_size=multiprocessing.cpu_count(), **kwargs):
"""Generates a dict containing summary statistics for a given dataset stored as a pandas `DataFrame`.
Used has is it will output its co... | [
"Generates",
"a",
"dict",
"containing",
"summary",
"statistics",
"for",
"a",
"given",
"dataset",
"stored",
"as",
"a",
"pandas",
"DataFrame",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/describe.py#L284-L429 | [
"def",
"describe",
"(",
"df",
",",
"bins",
"=",
"10",
",",
"check_correlation",
"=",
"True",
",",
"correlation_threshold",
"=",
"0.9",
",",
"correlation_overrides",
"=",
"None",
",",
"check_recoded",
"=",
"False",
",",
"pool_size",
"=",
"multiprocessing",
".",... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | _plot_histogram | Plot an histogram from the data and return the AxesSubplot object.
Parameters
----------
series : Series
The data to plot
figsize : tuple
The size of the figure (width, height) in inches, default (6,4)
facecolor : str
The color code.
Returns
-------
matplotlib.A... | pandas_profiling/plot.py | def _plot_histogram(series, bins=10, figsize=(6, 4), facecolor='#337ab7'):
"""Plot an histogram from the data and return the AxesSubplot object.
Parameters
----------
series : Series
The data to plot
figsize : tuple
The size of the figure (width, height) in inches, default (6,4)
... | def _plot_histogram(series, bins=10, figsize=(6, 4), facecolor='#337ab7'):
"""Plot an histogram from the data and return the AxesSubplot object.
Parameters
----------
series : Series
The data to plot
figsize : tuple
The size of the figure (width, height) in inches, default (6,4)
... | [
"Plot",
"an",
"histogram",
"from",
"the",
"data",
"and",
"return",
"the",
"AxesSubplot",
"object",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/plot.py#L26-L56 | [
"def",
"_plot_histogram",
"(",
"series",
",",
"bins",
"=",
"10",
",",
"figsize",
"=",
"(",
"6",
",",
"4",
")",
",",
"facecolor",
"=",
"'#337ab7'",
")",
":",
"if",
"base",
".",
"get_vartype",
"(",
"series",
")",
"==",
"base",
".",
"TYPE_DATE",
":",
... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | histogram | Plot an histogram of the data.
Parameters
----------
series: Series
The data to plot.
Returns
-------
str
The resulting image encoded as a string. | pandas_profiling/plot.py | def histogram(series, **kwargs):
"""Plot an histogram of the data.
Parameters
----------
series: Series
The data to plot.
Returns
-------
str
The resulting image encoded as a string.
"""
imgdata = BytesIO()
plot = _plot_histogram(series, **kwargs)
plot.figur... | def histogram(series, **kwargs):
"""Plot an histogram of the data.
Parameters
----------
series: Series
The data to plot.
Returns
-------
str
The resulting image encoded as a string.
"""
imgdata = BytesIO()
plot = _plot_histogram(series, **kwargs)
plot.figur... | [
"Plot",
"an",
"histogram",
"of",
"the",
"data",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/plot.py#L59-L80 | [
"def",
"histogram",
"(",
"series",
",",
"*",
"*",
"kwargs",
")",
":",
"imgdata",
"=",
"BytesIO",
"(",
")",
"plot",
"=",
"_plot_histogram",
"(",
"series",
",",
"*",
"*",
"kwargs",
")",
"plot",
".",
"figure",
".",
"subplots_adjust",
"(",
"left",
"=",
"... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | mini_histogram | Plot a small (mini) histogram of the data.
Parameters
----------
series: Series
The data to plot.
Returns
-------
str
The resulting image encoded as a string. | pandas_profiling/plot.py | def mini_histogram(series, **kwargs):
"""Plot a small (mini) histogram of the data.
Parameters
----------
series: Series
The data to plot.
Returns
-------
str
The resulting image encoded as a string.
"""
imgdata = BytesIO()
plot = _plot_histogram(series, figsize... | def mini_histogram(series, **kwargs):
"""Plot a small (mini) histogram of the data.
Parameters
----------
series: Series
The data to plot.
Returns
-------
str
The resulting image encoded as a string.
"""
imgdata = BytesIO()
plot = _plot_histogram(series, figsize... | [
"Plot",
"a",
"small",
"(",
"mini",
")",
"histogram",
"of",
"the",
"data",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/plot.py#L83-L116 | [
"def",
"mini_histogram",
"(",
"series",
",",
"*",
"*",
"kwargs",
")",
":",
"imgdata",
"=",
"BytesIO",
"(",
")",
"plot",
"=",
"_plot_histogram",
"(",
"series",
",",
"figsize",
"=",
"(",
"2",
",",
"0.75",
")",
",",
"*",
"*",
"kwargs",
")",
"plot",
".... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | correlation_matrix | Plot image of a matrix correlation.
Parameters
----------
corrdf: DataFrame
The matrix correlation to plot.
title: str
The matrix title
Returns
-------
str, The resulting image encoded as a string. | pandas_profiling/plot.py | def correlation_matrix(corrdf, title, **kwargs):
"""Plot image of a matrix correlation.
Parameters
----------
corrdf: DataFrame
The matrix correlation to plot.
title: str
The matrix title
Returns
-------
str, The resulting image encoded as a string.
"""
imgdata = ... | def correlation_matrix(corrdf, title, **kwargs):
"""Plot image of a matrix correlation.
Parameters
----------
corrdf: DataFrame
The matrix correlation to plot.
title: str
The matrix title
Returns
-------
str, The resulting image encoded as a string.
"""
imgdata = ... | [
"Plot",
"image",
"of",
"a",
"matrix",
"correlation",
".",
"Parameters",
"----------",
"corrdf",
":",
"DataFrame",
"The",
"matrix",
"correlation",
"to",
"plot",
".",
"title",
":",
"str",
"The",
"matrix",
"title",
"Returns",
"-------",
"str",
"The",
"resulting",... | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/plot.py#L118-L145 | [
"def",
"correlation_matrix",
"(",
"corrdf",
",",
"title",
",",
"*",
"*",
"kwargs",
")",
":",
"imgdata",
"=",
"BytesIO",
"(",
")",
"fig_cor",
",",
"axes_cor",
"=",
"plt",
".",
"subplots",
"(",
"1",
",",
"1",
")",
"labels",
"=",
"corrdf",
".",
"columns... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | get_groupby_statistic | Calculate value counts and distinct count of a variable (technically a Series).
The result is cached by column name in a global variable to avoid recomputing.
Parameters
----------
data : Series
The data type of the Series.
Returns
-------
list
value count and distinct cou... | pandas_profiling/base.py | def get_groupby_statistic(data):
"""Calculate value counts and distinct count of a variable (technically a Series).
The result is cached by column name in a global variable to avoid recomputing.
Parameters
----------
data : Series
The data type of the Series.
Returns
-------
l... | def get_groupby_statistic(data):
"""Calculate value counts and distinct count of a variable (technically a Series).
The result is cached by column name in a global variable to avoid recomputing.
Parameters
----------
data : Series
The data type of the Series.
Returns
-------
l... | [
"Calculate",
"value",
"counts",
"and",
"distinct",
"count",
"of",
"a",
"variable",
"(",
"technically",
"a",
"Series",
")",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/base.py#L29-L60 | [
"def",
"get_groupby_statistic",
"(",
"data",
")",
":",
"if",
"data",
".",
"name",
"is",
"not",
"None",
"and",
"data",
".",
"name",
"in",
"_VALUE_COUNTS_MEMO",
":",
"return",
"_VALUE_COUNTS_MEMO",
"[",
"data",
".",
"name",
"]",
"value_counts_with_nan",
"=",
"... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | get_vartype | Infer the type of a variable (technically a Series).
The types supported are split in standard types and special types.
Standard types:
* Categorical (`TYPE_CAT`): the default type if no other one can be determined
* Numerical (`TYPE_NUM`): if it contains numbers
* Boolean (`TYPE_BOOL`... | pandas_profiling/base.py | def get_vartype(data):
"""Infer the type of a variable (technically a Series).
The types supported are split in standard types and special types.
Standard types:
* Categorical (`TYPE_CAT`): the default type if no other one can be determined
* Numerical (`TYPE_NUM`): if it contains numbers
... | def get_vartype(data):
"""Infer the type of a variable (technically a Series).
The types supported are split in standard types and special types.
Standard types:
* Categorical (`TYPE_CAT`): the default type if no other one can be determined
* Numerical (`TYPE_NUM`): if it contains numbers
... | [
"Infer",
"the",
"type",
"of",
"a",
"variable",
"(",
"technically",
"a",
"Series",
")",
"."
] | pandas-profiling/pandas-profiling | python | https://github.com/pandas-profiling/pandas-profiling/blob/003d236daee8b7aca39c62708b18d59bced0bc03/pandas_profiling/base.py#L63-L123 | [
"def",
"get_vartype",
"(",
"data",
")",
":",
"if",
"data",
".",
"name",
"is",
"not",
"None",
"and",
"data",
".",
"name",
"in",
"_MEMO",
":",
"return",
"_MEMO",
"[",
"data",
".",
"name",
"]",
"vartype",
"=",
"None",
"try",
":",
"distinct_count",
"=",
... | 003d236daee8b7aca39c62708b18d59bced0bc03 |
train | FilterRegistry.factory | Factory func for filters.
data - policy config for filters
manager - resource type manager (ec2, s3, etc) | c7n/filters/core.py | def factory(self, data, manager=None):
"""Factory func for filters.
data - policy config for filters
manager - resource type manager (ec2, s3, etc)
"""
# Make the syntax a little nicer for common cases.
if isinstance(data, dict) and len(data) == 1 and 'type' not in data... | def factory(self, data, manager=None):
"""Factory func for filters.
data - policy config for filters
manager - resource type manager (ec2, s3, etc)
"""
# Make the syntax a little nicer for common cases.
if isinstance(data, dict) and len(data) == 1 and 'type' not in data... | [
"Factory",
"func",
"for",
"filters",
"."
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/c7n/filters/core.py#L132-L164 | [
"def",
"factory",
"(",
"self",
",",
"data",
",",
"manager",
"=",
"None",
")",
":",
"# Make the syntax a little nicer for common cases.",
"if",
"isinstance",
"(",
"data",
",",
"dict",
")",
"and",
"len",
"(",
"data",
")",
"==",
"1",
"and",
"'type'",
"not",
"... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | Filter.get_block_operator | Determine the immediate parent boolean operator for a filter | c7n/filters/core.py | def get_block_operator(self):
"""Determine the immediate parent boolean operator for a filter"""
# Top level operator is `and`
block_stack = ['and']
for f in self.manager.iter_filters(block_end=True):
if f is None:
block_stack.pop()
continue
... | def get_block_operator(self):
"""Determine the immediate parent boolean operator for a filter"""
# Top level operator is `and`
block_stack = ['and']
for f in self.manager.iter_filters(block_end=True):
if f is None:
block_stack.pop()
continue
... | [
"Determine",
"the",
"immediate",
"parent",
"boolean",
"operator",
"for",
"a",
"filter"
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/c7n/filters/core.py#L198-L210 | [
"def",
"get_block_operator",
"(",
"self",
")",
":",
"# Top level operator is `and`",
"block_stack",
"=",
"[",
"'and'",
"]",
"for",
"f",
"in",
"self",
".",
"manager",
".",
"iter_filters",
"(",
"block_end",
"=",
"True",
")",
":",
"if",
"f",
"is",
"None",
":"... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | ValueFilter._validate_resource_count | Specific validation for `resource_count` type
The `resource_count` type works a little differently because it operates
on the entire set of resources. It:
- does not require `key`
- `value` must be a number
- supports a subset of the OPERATORS list | c7n/filters/core.py | def _validate_resource_count(self):
""" Specific validation for `resource_count` type
The `resource_count` type works a little differently because it operates
on the entire set of resources. It:
- does not require `key`
- `value` must be a number
- supports a subs... | def _validate_resource_count(self):
""" Specific validation for `resource_count` type
The `resource_count` type works a little differently because it operates
on the entire set of resources. It:
- does not require `key`
- `value` must be a number
- supports a subs... | [
"Specific",
"validation",
"for",
"resource_count",
"type"
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/c7n/filters/core.py#L387-L411 | [
"def",
"_validate_resource_count",
"(",
"self",
")",
":",
"for",
"field",
"in",
"(",
"'op'",
",",
"'value'",
")",
":",
"if",
"field",
"not",
"in",
"self",
".",
"data",
":",
"raise",
"PolicyValidationError",
"(",
"\"Missing '%s' in value filter %s\"",
"%",
"(",... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | load_manifest_file | Given an inventory csv file, return an iterator over keys | tools/c7n_salactus/c7n_salactus/inventory.py | def load_manifest_file(client, bucket, schema, versioned, ifilters, key_info):
"""Given an inventory csv file, return an iterator over keys
"""
# To avoid thundering herd downloads, we do an immediate yield for
# interspersed i/o
yield None
# Inline these values to avoid the local var lookup, t... | def load_manifest_file(client, bucket, schema, versioned, ifilters, key_info):
"""Given an inventory csv file, return an iterator over keys
"""
# To avoid thundering herd downloads, we do an immediate yield for
# interspersed i/o
yield None
# Inline these values to avoid the local var lookup, t... | [
"Given",
"an",
"inventory",
"csv",
"file",
"return",
"an",
"iterator",
"over",
"keys"
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_salactus/c7n_salactus/inventory.py#L32-L62 | [
"def",
"load_manifest_file",
"(",
"client",
",",
"bucket",
",",
"schema",
",",
"versioned",
",",
"ifilters",
",",
"key_info",
")",
":",
"# To avoid thundering herd downloads, we do an immediate yield for",
"# interspersed i/o",
"yield",
"None",
"# Inline these values to avoid... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | load_bucket_inventory | Given an inventory location for a bucket, return an iterator over keys
on the most recent delivered manifest. | tools/c7n_salactus/c7n_salactus/inventory.py | def load_bucket_inventory(
client, inventory_bucket, inventory_prefix, versioned, ifilters):
"""Given an inventory location for a bucket, return an iterator over keys
on the most recent delivered manifest.
"""
now = datetime.datetime.now()
key_prefix = "%s/%s" % (inventory_prefix, now.strft... | def load_bucket_inventory(
client, inventory_bucket, inventory_prefix, versioned, ifilters):
"""Given an inventory location for a bucket, return an iterator over keys
on the most recent delivered manifest.
"""
now = datetime.datetime.now()
key_prefix = "%s/%s" % (inventory_prefix, now.strft... | [
"Given",
"an",
"inventory",
"location",
"for",
"a",
"bucket",
"return",
"an",
"iterator",
"over",
"keys"
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_salactus/c7n_salactus/inventory.py#L75-L102 | [
"def",
"load_bucket_inventory",
"(",
"client",
",",
"inventory_bucket",
",",
"inventory_prefix",
",",
"versioned",
",",
"ifilters",
")",
":",
"now",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"key_prefix",
"=",
"\"%s/%s\"",
"%",
"(",
"inventory_pr... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | random_chain | Generator to generate a set of keys from
from a set of generators, each generator is selected
at random and consumed to exhaustion. | tools/c7n_salactus/c7n_salactus/inventory.py | def random_chain(generators):
"""Generator to generate a set of keys from
from a set of generators, each generator is selected
at random and consumed to exhaustion.
"""
while generators:
g = random.choice(generators)
try:
v = g.next()
if v is None:
... | def random_chain(generators):
"""Generator to generate a set of keys from
from a set of generators, each generator is selected
at random and consumed to exhaustion.
"""
while generators:
g = random.choice(generators)
try:
v = g.next()
if v is None:
... | [
"Generator",
"to",
"generate",
"a",
"set",
"of",
"keys",
"from",
"from",
"a",
"set",
"of",
"generators",
"each",
"generator",
"is",
"selected",
"at",
"random",
"and",
"consumed",
"to",
"exhaustion",
"."
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_salactus/c7n_salactus/inventory.py#L105-L118 | [
"def",
"random_chain",
"(",
"generators",
")",
":",
"while",
"generators",
":",
"g",
"=",
"random",
".",
"choice",
"(",
"generators",
")",
"try",
":",
"v",
"=",
"g",
".",
"next",
"(",
")",
"if",
"v",
"is",
"None",
":",
"continue",
"yield",
"v",
"ex... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | get_bucket_inventory | Check a bucket for a named inventory, and return the destination. | tools/c7n_salactus/c7n_salactus/inventory.py | def get_bucket_inventory(client, bucket, inventory_id):
"""Check a bucket for a named inventory, and return the destination."""
inventories = client.list_bucket_inventory_configurations(
Bucket=bucket).get('InventoryConfigurationList', [])
inventories = {i['Id']: i for i in inventories}
found = ... | def get_bucket_inventory(client, bucket, inventory_id):
"""Check a bucket for a named inventory, and return the destination."""
inventories = client.list_bucket_inventory_configurations(
Bucket=bucket).get('InventoryConfigurationList', [])
inventories = {i['Id']: i for i in inventories}
found = ... | [
"Check",
"a",
"bucket",
"for",
"a",
"named",
"inventory",
"and",
"return",
"the",
"destination",
"."
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_salactus/c7n_salactus/inventory.py#L121-L133 | [
"def",
"get_bucket_inventory",
"(",
"client",
",",
"bucket",
",",
"inventory_id",
")",
":",
"inventories",
"=",
"client",
".",
"list_bucket_inventory_configurations",
"(",
"Bucket",
"=",
"bucket",
")",
".",
"get",
"(",
"'InventoryConfigurationList'",
",",
"[",
"]"... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | create_html_file | You can customize the automated documentation by altering
the code directly in this script or the associated jinja2 template | tools/sandbox/c7n_autodoc/c7n-autodoc.py | def create_html_file(config):
""" You can customize the automated documentation by altering
the code directly in this script or the associated jinja2 template
"""
logging.debug("Starting create_html_file")
logging.debug(
"\tjinja2_template_file = {}"
.format(config['jinja2_templa... | def create_html_file(config):
""" You can customize the automated documentation by altering
the code directly in this script or the associated jinja2 template
"""
logging.debug("Starting create_html_file")
logging.debug(
"\tjinja2_template_file = {}"
.format(config['jinja2_templa... | [
"You",
"can",
"customize",
"the",
"automated",
"documentation",
"by",
"altering",
"the",
"code",
"directly",
"in",
"this",
"script",
"or",
"the",
"associated",
"jinja2",
"template"
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/sandbox/c7n_autodoc/c7n-autodoc.py#L28-L65 | [
"def",
"create_html_file",
"(",
"config",
")",
":",
"logging",
".",
"debug",
"(",
"\"Starting create_html_file\"",
")",
"logging",
".",
"debug",
"(",
"\"\\tjinja2_template_file = {}\"",
".",
"format",
"(",
"config",
"[",
"'jinja2_template_filename'",
"]",
")",
")",
... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | get_file_url | Update this function to help build the link to your file | tools/sandbox/c7n_autodoc/c7n-autodoc.py | def get_file_url(path, config):
""" Update this function to help build the link to your file
"""
file_url_regex = re.compile(config['file_url_regex'])
new_path = re.sub(file_url_regex, config['file_url_base'], path)
return new_path | def get_file_url(path, config):
""" Update this function to help build the link to your file
"""
file_url_regex = re.compile(config['file_url_regex'])
new_path = re.sub(file_url_regex, config['file_url_base'], path)
return new_path | [
"Update",
"this",
"function",
"to",
"help",
"build",
"the",
"link",
"to",
"your",
"file"
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/sandbox/c7n_autodoc/c7n-autodoc.py#L68-L73 | [
"def",
"get_file_url",
"(",
"path",
",",
"config",
")",
":",
"file_url_regex",
"=",
"re",
".",
"compile",
"(",
"config",
"[",
"'file_url_regex'",
"]",
")",
"new_path",
"=",
"re",
".",
"sub",
"(",
"file_url_regex",
",",
"config",
"[",
"'file_url_base'",
"]"... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | gather_file_data | Gather policy information from files | tools/sandbox/c7n_autodoc/c7n-autodoc.py | def gather_file_data(config):
""" Gather policy information from files
"""
file_regex = re.compile(config['file_regex'])
category_regex = re.compile(config['category_regex'])
policies = {}
for root, dirs, files in os.walk(config['c7n_policy_directory']):
for file in files:
i... | def gather_file_data(config):
""" Gather policy information from files
"""
file_regex = re.compile(config['file_regex'])
category_regex = re.compile(config['category_regex'])
policies = {}
for root, dirs, files in os.walk(config['c7n_policy_directory']):
for file in files:
i... | [
"Gather",
"policy",
"information",
"from",
"files"
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/sandbox/c7n_autodoc/c7n-autodoc.py#L76-L108 | [
"def",
"gather_file_data",
"(",
"config",
")",
":",
"file_regex",
"=",
"re",
".",
"compile",
"(",
"config",
"[",
"'file_regex'",
"]",
")",
"category_regex",
"=",
"re",
".",
"compile",
"(",
"config",
"[",
"'category_regex'",
"]",
")",
"policies",
"=",
"{",
... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | upload_to_s3 | Upload html file to S3 | tools/sandbox/c7n_autodoc/c7n-autodoc.py | def upload_to_s3(file_path, config):
""" Upload html file to S3
"""
logging.info("Uploading file to S3 bucket: %s", config['s3_bucket_name'])
s3 = boto3.resource('s3')
s3_filename = config['s3_bucket_path'] + config['rendered_filename']
s3.Bucket(config['s3_bucket_name']).upload_file(
fi... | def upload_to_s3(file_path, config):
""" Upload html file to S3
"""
logging.info("Uploading file to S3 bucket: %s", config['s3_bucket_name'])
s3 = boto3.resource('s3')
s3_filename = config['s3_bucket_path'] + config['rendered_filename']
s3.Bucket(config['s3_bucket_name']).upload_file(
fi... | [
"Upload",
"html",
"file",
"to",
"S3"
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/sandbox/c7n_autodoc/c7n-autodoc.py#L111-L119 | [
"def",
"upload_to_s3",
"(",
"file_path",
",",
"config",
")",
":",
"logging",
".",
"info",
"(",
"\"Uploading file to S3 bucket: %s\"",
",",
"config",
"[",
"'s3_bucket_name'",
"]",
")",
"s3",
"=",
"boto3",
".",
"resource",
"(",
"'s3'",
")",
"s3_filename",
"=",
... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | github_repos | Return all github repositories in an organization. | tools/c7n_policystream/policystream.py | def github_repos(organization, github_url, github_token):
"""Return all github repositories in an organization."""
# Get github repos
headers = {"Authorization": "token {}".format(github_token)}
next_cursor = None
while next_cursor is not False:
params = {'query': query, 'variables': {
... | def github_repos(organization, github_url, github_token):
"""Return all github repositories in an organization."""
# Get github repos
headers = {"Authorization": "token {}".format(github_token)}
next_cursor = None
while next_cursor is not False:
params = {'query': query, 'variables': {
... | [
"Return",
"all",
"github",
"repositories",
"in",
"an",
"organization",
"."
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_policystream/policystream.py#L671-L696 | [
"def",
"github_repos",
"(",
"organization",
",",
"github_url",
",",
"github_token",
")",
":",
"# Get github repos",
"headers",
"=",
"{",
"\"Authorization\"",
":",
"\"token {}\"",
".",
"format",
"(",
"github_token",
")",
"}",
"next_cursor",
"=",
"None",
"while",
... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | org_stream | Stream changes for repos in a GitHub organization. | tools/c7n_policystream/policystream.py | def org_stream(ctx, organization, github_url, github_token, clone_dir,
verbose, filter, exclude, stream_uri, assume):
"""Stream changes for repos in a GitHub organization.
"""
logging.basicConfig(
format="%(asctime)s: %(name)s:%(levelname)s %(message)s",
level=(verbose and log... | def org_stream(ctx, organization, github_url, github_token, clone_dir,
verbose, filter, exclude, stream_uri, assume):
"""Stream changes for repos in a GitHub organization.
"""
logging.basicConfig(
format="%(asctime)s: %(name)s:%(levelname)s %(message)s",
level=(verbose and log... | [
"Stream",
"changes",
"for",
"repos",
"in",
"a",
"GitHub",
"organization",
"."
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_policystream/policystream.py#L716-L744 | [
"def",
"org_stream",
"(",
"ctx",
",",
"organization",
",",
"github_url",
",",
"github_token",
",",
"clone_dir",
",",
"verbose",
",",
"filter",
",",
"exclude",
",",
"stream_uri",
",",
"assume",
")",
":",
"logging",
".",
"basicConfig",
"(",
"format",
"=",
"\... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | org_checkout | Checkout repositories from a GitHub organization. | tools/c7n_policystream/policystream.py | def org_checkout(organization, github_url, github_token, clone_dir,
verbose, filter, exclude):
"""Checkout repositories from a GitHub organization."""
logging.basicConfig(
format="%(asctime)s: %(name)s:%(levelname)s %(message)s",
level=(verbose and logging.DEBUG or logging.INFO)... | def org_checkout(organization, github_url, github_token, clone_dir,
verbose, filter, exclude):
"""Checkout repositories from a GitHub organization."""
logging.basicConfig(
format="%(asctime)s: %(name)s:%(levelname)s %(message)s",
level=(verbose and logging.DEBUG or logging.INFO)... | [
"Checkout",
"repositories",
"from",
"a",
"GitHub",
"organization",
"."
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_policystream/policystream.py#L758-L801 | [
"def",
"org_checkout",
"(",
"organization",
",",
"github_url",
",",
"github_token",
",",
"clone_dir",
",",
"verbose",
",",
"filter",
",",
"exclude",
")",
":",
"logging",
".",
"basicConfig",
"(",
"format",
"=",
"\"%(asctime)s: %(name)s:%(levelname)s %(message)s\"",
"... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | diff | Policy diff between two arbitrary revisions.
Revision specifiers for source and target can use fancy git refspec syntax
for symbolics, dates, etc.
See: https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection
Default revision selection is dependent on current working tree
branch. The intent is... | tools/c7n_policystream/policystream.py | def diff(repo_uri, source, target, output, verbose):
"""Policy diff between two arbitrary revisions.
Revision specifiers for source and target can use fancy git refspec syntax
for symbolics, dates, etc.
See: https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection
Default revision selection is... | def diff(repo_uri, source, target, output, verbose):
"""Policy diff between two arbitrary revisions.
Revision specifiers for source and target can use fancy git refspec syntax
for symbolics, dates, etc.
See: https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection
Default revision selection is... | [
"Policy",
"diff",
"between",
"two",
"arbitrary",
"revisions",
"."
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_policystream/policystream.py#L842-L885 | [
"def",
"diff",
"(",
"repo_uri",
",",
"source",
",",
"target",
",",
"output",
",",
"verbose",
")",
":",
"logging",
".",
"basicConfig",
"(",
"format",
"=",
"\"%(asctime)s: %(name)s:%(levelname)s %(message)s\"",
",",
"level",
"=",
"(",
"verbose",
"and",
"logging",
... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | stream | Stream git history policy changes to destination.
Default stream destination is a summary of the policy changes to stdout, one
per line. Also supported for stdout streaming is `jsonline`.
AWS Kinesis and SQS destinations are specified by providing the ARN.
Database destinations are supported by prov... | tools/c7n_policystream/policystream.py | def stream(repo_uri, stream_uri, verbose, assume, sort, before=None, after=None):
"""Stream git history policy changes to destination.
Default stream destination is a summary of the policy changes to stdout, one
per line. Also supported for stdout streaming is `jsonline`.
AWS Kinesis and SQS destinat... | def stream(repo_uri, stream_uri, verbose, assume, sort, before=None, after=None):
"""Stream git history policy changes to destination.
Default stream destination is a summary of the policy changes to stdout, one
per line. Also supported for stdout streaming is `jsonline`.
AWS Kinesis and SQS destinat... | [
"Stream",
"git",
"history",
"policy",
"changes",
"to",
"destination",
"."
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_policystream/policystream.py#L901-L949 | [
"def",
"stream",
"(",
"repo_uri",
",",
"stream_uri",
",",
"verbose",
",",
"assume",
",",
"sort",
",",
"before",
"=",
"None",
",",
"after",
"=",
"None",
")",
":",
"logging",
".",
"basicConfig",
"(",
"format",
"=",
"\"%(asctime)s: %(name)s:%(levelname)s %(messag... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | PolicyCollection.select | return the named subset of policies | tools/c7n_policystream/policystream.py | def select(self, names):
"""return the named subset of policies"""
return PolicyCollection(
[p for p in self.policies if p.name in names], self.options) | def select(self, names):
"""return the named subset of policies"""
return PolicyCollection(
[p for p in self.policies if p.name in names], self.options) | [
"return",
"the",
"named",
"subset",
"of",
"policies"
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_policystream/policystream.py#L220-L223 | [
"def",
"select",
"(",
"self",
",",
"names",
")",
":",
"return",
"PolicyCollection",
"(",
"[",
"p",
"for",
"p",
"in",
"self",
".",
"policies",
"if",
"p",
".",
"name",
"in",
"names",
"]",
",",
"self",
".",
"options",
")"
] | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | PolicyRepo.delta_commits | Show policies changes between arbitrary commits.
The common use form is comparing the heads of two branches. | tools/c7n_policystream/policystream.py | def delta_commits(self, baseline, target):
"""Show policies changes between arbitrary commits.
The common use form is comparing the heads of two branches.
"""
baseline_files = self._get_policy_fents(baseline.tree)
target_files = self._get_policy_fents(target.tree)
basel... | def delta_commits(self, baseline, target):
"""Show policies changes between arbitrary commits.
The common use form is comparing the heads of two branches.
"""
baseline_files = self._get_policy_fents(baseline.tree)
target_files = self._get_policy_fents(target.tree)
basel... | [
"Show",
"policies",
"changes",
"between",
"arbitrary",
"commits",
"."
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_policystream/policystream.py#L298-L325 | [
"def",
"delta_commits",
"(",
"self",
",",
"baseline",
",",
"target",
")",
":",
"baseline_files",
"=",
"self",
".",
"_get_policy_fents",
"(",
"baseline",
".",
"tree",
")",
"target_files",
"=",
"self",
".",
"_get_policy_fents",
"(",
"target",
".",
"tree",
")",... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | PolicyRepo.delta_stream | Return an iterator of policy changes along a commit lineage in a repo. | tools/c7n_policystream/policystream.py | def delta_stream(self, target='HEAD', limit=None,
sort=pygit2.GIT_SORT_TIME | pygit2.GIT_SORT_REVERSE,
after=None, before=None):
"""Return an iterator of policy changes along a commit lineage in a repo.
"""
if target == 'HEAD':
target = self.... | def delta_stream(self, target='HEAD', limit=None,
sort=pygit2.GIT_SORT_TIME | pygit2.GIT_SORT_REVERSE,
after=None, before=None):
"""Return an iterator of policy changes along a commit lineage in a repo.
"""
if target == 'HEAD':
target = self.... | [
"Return",
"an",
"iterator",
"of",
"policy",
"changes",
"along",
"a",
"commit",
"lineage",
"in",
"a",
"repo",
"."
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_policystream/policystream.py#L327-L356 | [
"def",
"delta_stream",
"(",
"self",
",",
"target",
"=",
"'HEAD'",
",",
"limit",
"=",
"None",
",",
"sort",
"=",
"pygit2",
".",
"GIT_SORT_TIME",
"|",
"pygit2",
".",
"GIT_SORT_REVERSE",
",",
"after",
"=",
"None",
",",
"before",
"=",
"None",
")",
":",
"if"... | 52ef732eb3d7bc939d1579faf519314814695c08 |
train | PolicyRepo._process_stream_delta | Bookkeeping on internal data structures while iterating a stream. | tools/c7n_policystream/policystream.py | def _process_stream_delta(self, delta_stream):
"""Bookkeeping on internal data structures while iterating a stream."""
for pchange in delta_stream:
if pchange.kind == ChangeType.ADD:
self.policy_files.setdefault(
pchange.file_path, PolicyCollection()).add(... | def _process_stream_delta(self, delta_stream):
"""Bookkeeping on internal data structures while iterating a stream."""
for pchange in delta_stream:
if pchange.kind == ChangeType.ADD:
self.policy_files.setdefault(
pchange.file_path, PolicyCollection()).add(... | [
"Bookkeeping",
"on",
"internal",
"data",
"structures",
"while",
"iterating",
"a",
"stream",
"."
] | cloud-custodian/cloud-custodian | python | https://github.com/cloud-custodian/cloud-custodian/blob/52ef732eb3d7bc939d1579faf519314814695c08/tools/c7n_policystream/policystream.py#L437-L456 | [
"def",
"_process_stream_delta",
"(",
"self",
",",
"delta_stream",
")",
":",
"for",
"pchange",
"in",
"delta_stream",
":",
"if",
"pchange",
".",
"kind",
"==",
"ChangeType",
".",
"ADD",
":",
"self",
".",
"policy_files",
".",
"setdefault",
"(",
"pchange",
".",
... | 52ef732eb3d7bc939d1579faf519314814695c08 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.