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
YowsupEnv.getCurrent
:rtype: YowsupEnv
yowsup/env/env.py
def getCurrent(cls): """ :rtype: YowsupEnv """ if cls.__CURR is None: env = DEFAULT envs = cls.getRegisteredEnvs() if env not in envs: env = envs[0] logger.debug("Env not set, setting it to %s" % env) cls.setEnv(...
def getCurrent(cls): """ :rtype: YowsupEnv """ if cls.__CURR is None: env = DEFAULT envs = cls.getRegisteredEnvs() if env not in envs: env = envs[0] logger.debug("Env not set, setting it to %s" % env) cls.setEnv(...
[ ":", "rtype", ":", "YowsupEnv" ]
tgalal/yowsup
python
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/env/env.py#L49-L60
[ "def", "getCurrent", "(", "cls", ")", ":", "if", "cls", ".", "__CURR", "is", "None", ":", "env", "=", "DEFAULT", "envs", "=", "cls", ".", "getRegisteredEnvs", "(", ")", "if", "env", "not", "in", "envs", ":", "env", "=", "envs", "[", "0", "]", "lo...
b0739461ba962bf221fc76047d9d60d8ce61bc3e
train
WARequest.encryptParams
:param params: :type params: list :param key: :type key: ECPublicKey :return: :rtype: list
yowsup/common/http/warequest.py
def encryptParams(self, params, key): """ :param params: :type params: list :param key: :type key: ECPublicKey :return: :rtype: list """ keypair = Curve.generateKeyPair() encodedparams = self.urlencodeParams(params) cipher = AESGCM...
def encryptParams(self, params, key): """ :param params: :type params: list :param key: :type key: ECPublicKey :return: :rtype: list """ keypair = Curve.generateKeyPair() encodedparams = self.urlencodeParams(params) cipher = AESGCM...
[ ":", "param", "params", ":", ":", "type", "params", ":", "list", ":", "param", "key", ":", ":", "type", "key", ":", "ECPublicKey", ":", "return", ":", ":", "rtype", ":", "list" ]
tgalal/yowsup
python
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/common/http/warequest.py#L159-L175
[ "def", "encryptParams", "(", "self", ",", "params", ",", "key", ")", ":", "keypair", "=", "Curve", ".", "generateKeyPair", "(", ")", "encodedparams", "=", "self", ".", "urlencodeParams", "(", "params", ")", "cipher", "=", "AESGCM", "(", "Curve", ".", "ca...
b0739461ba962bf221fc76047d9d60d8ce61bc3e
train
LitePreKeyStore.setAsSent
:param preKeyIds: :type preKeyIds: list :return: :rtype:
yowsup/axolotl/store/sqlite/liteprekeystore.py
def setAsSent(self, prekeyIds): """ :param preKeyIds: :type preKeyIds: list :return: :rtype: """ for prekeyId in prekeyIds: q = "UPDATE prekeys SET sent_to_server = ? WHERE prekey_id = ?" cursor = self.dbConn.cursor() cursor.exe...
def setAsSent(self, prekeyIds): """ :param preKeyIds: :type preKeyIds: list :return: :rtype: """ for prekeyId in prekeyIds: q = "UPDATE prekeys SET sent_to_server = ? WHERE prekey_id = ?" cursor = self.dbConn.cursor() cursor.exe...
[ ":", "param", "preKeyIds", ":", ":", "type", "preKeyIds", ":", "list", ":", "return", ":", ":", "rtype", ":" ]
tgalal/yowsup
python
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/axolotl/store/sqlite/liteprekeystore.py#L35-L46
[ "def", "setAsSent", "(", "self", ",", "prekeyIds", ")", ":", "for", "prekeyId", "in", "prekeyIds", ":", "q", "=", "\"UPDATE prekeys SET sent_to_server = ? WHERE prekey_id = ?\"", "cursor", "=", "self", ".", "dbConn", ".", "cursor", "(", ")", "cursor", ".", "exec...
b0739461ba962bf221fc76047d9d60d8ce61bc3e
train
ConfigDictTransform.transform
:param config: :type config: dict :return: :rtype: yowsup.config.config.Config
yowsup/config/transforms/config_dict.py
def transform(self, config): """ :param config: :type config: dict :return: :rtype: yowsup.config.config.Config """ out = {} for prop in vars(config): out[prop] = getattr(config, prop) return out
def transform(self, config): """ :param config: :type config: dict :return: :rtype: yowsup.config.config.Config """ out = {} for prop in vars(config): out[prop] = getattr(config, prop) return out
[ ":", "param", "config", ":", ":", "type", "config", ":", "dict", ":", "return", ":", ":", "rtype", ":", "yowsup", ".", "config", ".", "config", ".", "Config" ]
tgalal/yowsup
python
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/config/transforms/config_dict.py#L8-L18
[ "def", "transform", "(", "self", ",", "config", ")", ":", "out", "=", "{", "}", "for", "prop", "in", "vars", "(", "config", ")", ":", "out", "[", "prop", "]", "=", "getattr", "(", "config", ",", "prop", ")", "return", "out" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
train
notify
Show system notification with duration t (ms)
NEMbox/utils.py
def notify(msg, msg_type=0, t=None): msg = msg.replace('"', '\\"') "Show system notification with duration t (ms)" if platform.system() == "Darwin": command = notify_command_osx(msg, msg_type, t) else: command = notify_command_linux(msg, t) try: subprocess.call(command) ...
def notify(msg, msg_type=0, t=None): msg = msg.replace('"', '\\"') "Show system notification with duration t (ms)" if platform.system() == "Darwin": command = notify_command_osx(msg, msg_type, t) else: command = notify_command_linux(msg, t) try: subprocess.call(command) ...
[ "Show", "system", "notification", "with", "duration", "t", "(", "ms", ")" ]
darknessomi/musicbox
python
https://github.com/darknessomi/musicbox/blob/9d58201fa2fefcee99d34d2c7fcc7a57d1e45937/NEMbox/utils.py#L71-L83
[ "def", "notify", "(", "msg", ",", "msg_type", "=", "0", ",", "t", "=", "None", ")", ":", "msg", "=", "msg", ".", "replace", "(", "'\"'", ",", "'\\\\\"'", ")", "if", "platform", ".", "system", "(", ")", "==", "\"Darwin\"", ":", "command", "=", "no...
9d58201fa2fefcee99d34d2c7fcc7a57d1e45937
train
Player.start_playing
Runs the given args in subprocess.Popen, and then calls the function on_exit when the subprocess completes. on_exit is a callable object, and args is a lists/tuple of args that would give to subprocess.Popen.
NEMbox/player.py
def start_playing(self, on_exit, args): """ Runs the given args in subprocess.Popen, and then calls the function on_exit when the subprocess completes. on_exit is a callable object, and args is a lists/tuple of args that would give to subprocess.Popen. """ # log.d...
def start_playing(self, on_exit, args): """ Runs the given args in subprocess.Popen, and then calls the function on_exit when the subprocess completes. on_exit is a callable object, and args is a lists/tuple of args that would give to subprocess.Popen. """ # log.d...
[ "Runs", "the", "given", "args", "in", "subprocess", ".", "Popen", "and", "then", "calls", "the", "function", "on_exit", "when", "the", "subprocess", "completes", ".", "on_exit", "is", "a", "callable", "object", "and", "args", "is", "a", "lists", "/", "tupl...
darknessomi/musicbox
python
https://github.com/darknessomi/musicbox/blob/9d58201fa2fefcee99d34d2c7fcc7a57d1e45937/NEMbox/player.py#L309-L348
[ "def", "start_playing", "(", "self", ",", "on_exit", ",", "args", ")", ":", "# log.debug(\"%s,%s,%s\" % (args['song_id'], args['song_name'], args['mp3_url']))", "if", "\"cache\"", "in", "args", ".", "keys", "(", ")", "and", "os", ".", "path", ".", "isfile", "(", "...
9d58201fa2fefcee99d34d2c7fcc7a57d1e45937
train
expand
Expand a string containing $vars as Ninja would. Note: doesn't handle the full Ninja variable syntax, but it's enough to make configure.py's use of it work.
misc/ninja_syntax.py
def expand(string, vars, local_vars={}): """Expand a string containing $vars as Ninja would. Note: doesn't handle the full Ninja variable syntax, but it's enough to make configure.py's use of it work. """ def exp(m): var = m.group(1) if var == '$': return '$' ret...
def expand(string, vars, local_vars={}): """Expand a string containing $vars as Ninja would. Note: doesn't handle the full Ninja variable syntax, but it's enough to make configure.py's use of it work. """ def exp(m): var = m.group(1) if var == '$': return '$' ret...
[ "Expand", "a", "string", "containing", "$vars", "as", "Ninja", "would", "." ]
ninja-build/ninja
python
https://github.com/ninja-build/ninja/blob/2e64645749ff91eff2f999f03f55da360ae5913d/misc/ninja_syntax.py#L172-L183
[ "def", "expand", "(", "string", ",", "vars", ",", "local_vars", "=", "{", "}", ")", ":", "def", "exp", "(", "m", ")", ":", "var", "=", "m", ".", "group", "(", "1", ")", "if", "var", "==", "'$'", ":", "return", "'$'", "return", "local_vars", "."...
2e64645749ff91eff2f999f03f55da360ae5913d
train
Writer._count_dollars_before_index
Returns the number of '$' characters right in front of s[i].
misc/ninja_syntax.py
def _count_dollars_before_index(self, s, i): """Returns the number of '$' characters right in front of s[i].""" dollar_count = 0 dollar_index = i - 1 while dollar_index > 0 and s[dollar_index] == '$': dollar_count += 1 dollar_index -= 1 return dollar_count
def _count_dollars_before_index(self, s, i): """Returns the number of '$' characters right in front of s[i].""" dollar_count = 0 dollar_index = i - 1 while dollar_index > 0 and s[dollar_index] == '$': dollar_count += 1 dollar_index -= 1 return dollar_count
[ "Returns", "the", "number", "of", "$", "characters", "right", "in", "front", "of", "s", "[", "i", "]", "." ]
ninja-build/ninja
python
https://github.com/ninja-build/ninja/blob/2e64645749ff91eff2f999f03f55da360ae5913d/misc/ninja_syntax.py#L107-L114
[ "def", "_count_dollars_before_index", "(", "self", ",", "s", ",", "i", ")", ":", "dollar_count", "=", "0", "dollar_index", "=", "i", "-", "1", "while", "dollar_index", ">", "0", "and", "s", "[", "dollar_index", "]", "==", "'$'", ":", "dollar_count", "+="...
2e64645749ff91eff2f999f03f55da360ae5913d
train
Writer._line
Write 'text' word-wrapped at self.width characters.
misc/ninja_syntax.py
def _line(self, text, indent=0): """Write 'text' word-wrapped at self.width characters.""" leading_space = ' ' * indent while len(leading_space) + len(text) > self.width: # The text is too wide; wrap if possible. # Find the rightmost space that would obey our width cons...
def _line(self, text, indent=0): """Write 'text' word-wrapped at self.width characters.""" leading_space = ' ' * indent while len(leading_space) + len(text) > self.width: # The text is too wide; wrap if possible. # Find the rightmost space that would obey our width cons...
[ "Write", "text", "word", "-", "wrapped", "at", "self", ".", "width", "characters", "." ]
ninja-build/ninja
python
https://github.com/ninja-build/ninja/blob/2e64645749ff91eff2f999f03f55da360ae5913d/misc/ninja_syntax.py#L116-L150
[ "def", "_line", "(", "self", ",", "text", ",", "indent", "=", "0", ")", ":", "leading_space", "=", "' '", "*", "indent", "while", "len", "(", "leading_space", ")", "+", "len", "(", "text", ")", ">", "self", ".", "width", ":", "# The text is too wide; ...
2e64645749ff91eff2f999f03f55da360ae5913d
train
Bootstrap._expand_paths
Expand $vars in an array of paths, e.g. from a 'build' block.
configure.py
def _expand_paths(self, paths): """Expand $vars in an array of paths, e.g. from a 'build' block.""" paths = ninja_syntax.as_list(paths) return ' '.join(map(self._shell_escape, (map(self._expand, paths))))
def _expand_paths(self, paths): """Expand $vars in an array of paths, e.g. from a 'build' block.""" paths = ninja_syntax.as_list(paths) return ' '.join(map(self._shell_escape, (map(self._expand, paths))))
[ "Expand", "$vars", "in", "an", "array", "of", "paths", "e", ".", "g", ".", "from", "a", "build", "block", "." ]
ninja-build/ninja
python
https://github.com/ninja-build/ninja/blob/2e64645749ff91eff2f999f03f55da360ae5913d/configure.py#L171-L174
[ "def", "_expand_paths", "(", "self", ",", "paths", ")", ":", "paths", "=", "ninja_syntax", ".", "as_list", "(", "paths", ")", "return", "' '", ".", "join", "(", "map", "(", "self", ".", "_shell_escape", ",", "(", "map", "(", "self", ".", "_expand", "...
2e64645749ff91eff2f999f03f55da360ae5913d
train
Bootstrap._expand
Expand $vars in a string.
configure.py
def _expand(self, str, local_vars={}): """Expand $vars in a string.""" return ninja_syntax.expand(str, self.vars, local_vars)
def _expand(self, str, local_vars={}): """Expand $vars in a string.""" return ninja_syntax.expand(str, self.vars, local_vars)
[ "Expand", "$vars", "in", "a", "string", "." ]
ninja-build/ninja
python
https://github.com/ninja-build/ninja/blob/2e64645749ff91eff2f999f03f55da360ae5913d/configure.py#L176-L178
[ "def", "_expand", "(", "self", ",", "str", ",", "local_vars", "=", "{", "}", ")", ":", "return", "ninja_syntax", ".", "expand", "(", "str", ",", "self", ".", "vars", ",", "local_vars", ")" ]
2e64645749ff91eff2f999f03f55da360ae5913d
train
Bootstrap._run_command
Run a subcommand, quietly. Prints the full command on error.
configure.py
def _run_command(self, cmdline): """Run a subcommand, quietly. Prints the full command on error.""" try: if self.verbose: print(cmdline) subprocess.check_call(cmdline, shell=True) except subprocess.CalledProcessError: print('when running: ', c...
def _run_command(self, cmdline): """Run a subcommand, quietly. Prints the full command on error.""" try: if self.verbose: print(cmdline) subprocess.check_call(cmdline, shell=True) except subprocess.CalledProcessError: print('when running: ', c...
[ "Run", "a", "subcommand", "quietly", ".", "Prints", "the", "full", "command", "on", "error", "." ]
ninja-build/ninja
python
https://github.com/ninja-build/ninja/blob/2e64645749ff91eff2f999f03f55da360ae5913d/configure.py#L184-L192
[ "def", "_run_command", "(", "self", ",", "cmdline", ")", ":", "try", ":", "if", "self", ".", "verbose", ":", "print", "(", "cmdline", ")", "subprocess", ".", "check_call", "(", "cmdline", ",", "shell", "=", "True", ")", "except", "subprocess", ".", "Ca...
2e64645749ff91eff2f999f03f55da360ae5913d
train
paretoint
Returns a random integer that's avg on average, following a power law. alpha determines the shape of the power curve. alpha has to be larger than 1. The closer alpha is to 1, the higher the variation of the returned numbers.
misc/write_fake_manifests.py
def paretoint(avg, alpha): """Returns a random integer that's avg on average, following a power law. alpha determines the shape of the power curve. alpha has to be larger than 1. The closer alpha is to 1, the higher the variation of the returned numbers.""" return int(random.paretovariate(alpha) * a...
def paretoint(avg, alpha): """Returns a random integer that's avg on average, following a power law. alpha determines the shape of the power curve. alpha has to be larger than 1. The closer alpha is to 1, the higher the variation of the returned numbers.""" return int(random.paretovariate(alpha) * a...
[ "Returns", "a", "random", "integer", "that", "s", "avg", "on", "average", "following", "a", "power", "law", ".", "alpha", "determines", "the", "shape", "of", "the", "power", "curve", ".", "alpha", "has", "to", "be", "larger", "than", "1", ".", "The", "...
ninja-build/ninja
python
https://github.com/ninja-build/ninja/blob/2e64645749ff91eff2f999f03f55da360ae5913d/misc/write_fake_manifests.py#L25-L30
[ "def", "paretoint", "(", "avg", ",", "alpha", ")", ":", "return", "int", "(", "random", ".", "paretovariate", "(", "alpha", ")", "*", "avg", "/", "(", "alpha", "/", "(", "alpha", "-", "1", ")", ")", ")" ]
2e64645749ff91eff2f999f03f55da360ae5913d
train
write_master_ninja
Writes master build.ninja file, referencing all given subninjas.
misc/write_fake_manifests.py
def write_master_ninja(master_ninja, targets): """Writes master build.ninja file, referencing all given subninjas.""" master_ninja.variable('cxx', 'c++') master_ninja.variable('ld', '$cxx') if sys.platform == 'darwin': master_ninja.variable('alink', 'libtool -static') else: master_ni...
def write_master_ninja(master_ninja, targets): """Writes master build.ninja file, referencing all given subninjas.""" master_ninja.variable('cxx', 'c++') master_ninja.variable('ld', '$cxx') if sys.platform == 'darwin': master_ninja.variable('alink', 'libtool -static') else: master_ni...
[ "Writes", "master", "build", ".", "ninja", "file", "referencing", "all", "given", "subninjas", "." ]
ninja-build/ninja
python
https://github.com/ninja-build/ninja/blob/2e64645749ff91eff2f999f03f55da360ae5913d/misc/write_fake_manifests.py#L177-L211
[ "def", "write_master_ninja", "(", "master_ninja", ",", "targets", ")", ":", "master_ninja", ".", "variable", "(", "'cxx'", ",", "'c++'", ")", "master_ninja", ".", "variable", "(", "'ld'", ",", "'$cxx'", ")", "if", "sys", ".", "platform", "==", "'darwin'", ...
2e64645749ff91eff2f999f03f55da360ae5913d
train
FileWriter
Context manager for a ninja_syntax object writing to a file.
misc/write_fake_manifests.py
def FileWriter(path): """Context manager for a ninja_syntax object writing to a file.""" try: os.makedirs(os.path.dirname(path)) except OSError: pass f = open(path, 'w') yield ninja_syntax.Writer(f) f.close()
def FileWriter(path): """Context manager for a ninja_syntax object writing to a file.""" try: os.makedirs(os.path.dirname(path)) except OSError: pass f = open(path, 'w') yield ninja_syntax.Writer(f) f.close()
[ "Context", "manager", "for", "a", "ninja_syntax", "object", "writing", "to", "a", "file", "." ]
ninja-build/ninja
python
https://github.com/ninja-build/ninja/blob/2e64645749ff91eff2f999f03f55da360ae5913d/misc/write_fake_manifests.py#L215-L223
[ "def", "FileWriter", "(", "path", ")", ":", "try", ":", "os", ".", "makedirs", "(", "os", ".", "path", ".", "dirname", "(", "path", ")", ")", "except", "OSError", ":", "pass", "f", "=", "open", "(", "path", ",", "'w'", ")", "yield", "ninja_syntax",...
2e64645749ff91eff2f999f03f55da360ae5913d
train
load_jupyter_server_extension
Load the server extension.
applications/jupyter-extension/nteract_on_jupyter/extension.py
def load_jupyter_server_extension(nbapp): """Load the server extension. """ here = PACKAGE_DIR nbapp.log.info('nteract extension loaded from %s' % here) app_dir = here # bundle is part of the python package web_app = nbapp.web_app config = NteractConfig(parent=nbapp) # original #...
def load_jupyter_server_extension(nbapp): """Load the server extension. """ here = PACKAGE_DIR nbapp.log.info('nteract extension loaded from %s' % here) app_dir = here # bundle is part of the python package web_app = nbapp.web_app config = NteractConfig(parent=nbapp) # original #...
[ "Load", "the", "server", "extension", "." ]
nteract/nteract
python
https://github.com/nteract/nteract/blob/f63a01c4067b05541ebddd3932345d7102ea3e5b/applications/jupyter-extension/nteract_on_jupyter/extension.py#L18-L53
[ "def", "load_jupyter_server_extension", "(", "nbapp", ")", ":", "here", "=", "PACKAGE_DIR", "nbapp", ".", "log", ".", "info", "(", "'nteract extension loaded from %s'", "%", "here", ")", "app_dir", "=", "here", "# bundle is part of the python package", "web_app", "=",...
f63a01c4067b05541ebddd3932345d7102ea3e5b
train
add_handlers
Add the appropriate handlers to the web app.
applications/jupyter-extension/nteract_on_jupyter/handlers.py
def add_handlers(web_app, config): """Add the appropriate handlers to the web app. """ base_url = web_app.settings['base_url'] url = ujoin(base_url, config.page_url) assets_dir = config.assets_dir package_file = os.path.join(assets_dir, 'package.json') with open(package_file) as fid: ...
def add_handlers(web_app, config): """Add the appropriate handlers to the web app. """ base_url = web_app.settings['base_url'] url = ujoin(base_url, config.page_url) assets_dir = config.assets_dir package_file = os.path.join(assets_dir, 'package.json') with open(package_file) as fid: ...
[ "Add", "the", "appropriate", "handlers", "to", "the", "web", "app", "." ]
nteract/nteract
python
https://github.com/nteract/nteract/blob/f63a01c4067b05541ebddd3932345d7102ea3e5b/applications/jupyter-extension/nteract_on_jupyter/handlers.py#L83-L106
[ "def", "add_handlers", "(", "web_app", ",", "config", ")", ":", "base_url", "=", "web_app", ".", "settings", "[", "'base_url'", "]", "url", "=", "ujoin", "(", "base_url", ",", "config", ".", "page_url", ")", "assets_dir", "=", "config", ".", "assets_dir", ...
f63a01c4067b05541ebddd3932345d7102ea3e5b
train
semver
if (!(this instanceof SemVer)) return new SemVer(version, loose);
applications/jupyter-extension/nteract_on_jupyter/semver.py
def semver(version, loose): if isinstance(version, SemVer): if version.loose == loose: return version else: version = version.version elif not isinstance(version, string_type): # xxx: raise ValueError("Invalid Version: {}".format(version)) """ if (!(this...
def semver(version, loose): if isinstance(version, SemVer): if version.loose == loose: return version else: version = version.version elif not isinstance(version, string_type): # xxx: raise ValueError("Invalid Version: {}".format(version)) """ if (!(this...
[ "if", "(", "!", "(", "this", "instanceof", "SemVer", "))", "return", "new", "SemVer", "(", "version", "loose", ")", ";" ]
nteract/nteract
python
https://github.com/nteract/nteract/blob/f63a01c4067b05541ebddd3932345d7102ea3e5b/applications/jupyter-extension/nteract_on_jupyter/semver.py#L357-L370
[ "def", "semver", "(", "version", ",", "loose", ")", ":", "if", "isinstance", "(", "version", ",", "SemVer", ")", ":", "if", "version", ".", "loose", "==", "loose", ":", "return", "version", "else", ":", "version", "=", "version", ".", "version", "elif"...
f63a01c4067b05541ebddd3932345d7102ea3e5b
train
get_list_from_file
read the lines from a file into a list
additional_resources/build_emoji_lexicon.py
def get_list_from_file(file_name): """read the lines from a file into a list""" with open(file_name, mode='r', encoding='utf-8') as f1: lst = f1.readlines() return lst
def get_list_from_file(file_name): """read the lines from a file into a list""" with open(file_name, mode='r', encoding='utf-8') as f1: lst = f1.readlines() return lst
[ "read", "the", "lines", "from", "a", "file", "into", "a", "list" ]
cjhutto/vaderSentiment
python
https://github.com/cjhutto/vaderSentiment/blob/cfc2bce747afb2c49799c1de1dcf517358948d71/additional_resources/build_emoji_lexicon.py#L7-L11
[ "def", "get_list_from_file", "(", "file_name", ")", ":", "with", "open", "(", "file_name", ",", "mode", "=", "'r'", ",", "encoding", "=", "'utf-8'", ")", "as", "f1", ":", "lst", "=", "f1", ".", "readlines", "(", ")", "return", "lst" ]
cfc2bce747afb2c49799c1de1dcf517358948d71
train
append_to_file
append a line of text to a file
additional_resources/build_emoji_lexicon.py
def append_to_file(file_name, line_data): """append a line of text to a file""" with open(file_name, mode='a', encoding='utf-8') as f1: f1.write(line_data) f1.write("\n")
def append_to_file(file_name, line_data): """append a line of text to a file""" with open(file_name, mode='a', encoding='utf-8') as f1: f1.write(line_data) f1.write("\n")
[ "append", "a", "line", "of", "text", "to", "a", "file" ]
cjhutto/vaderSentiment
python
https://github.com/cjhutto/vaderSentiment/blob/cfc2bce747afb2c49799c1de1dcf517358948d71/additional_resources/build_emoji_lexicon.py#L14-L18
[ "def", "append_to_file", "(", "file_name", ",", "line_data", ")", ":", "with", "open", "(", "file_name", ",", "mode", "=", "'a'", ",", "encoding", "=", "'utf-8'", ")", "as", "f1", ":", "f1", ".", "write", "(", "line_data", ")", "f1", ".", "write", "(...
cfc2bce747afb2c49799c1de1dcf517358948d71
train
negated
Determine if input contains negation words
vaderSentiment/vaderSentiment.py
def negated(input_words, include_nt=True): """ Determine if input contains negation words """ input_words = [str(w).lower() for w in input_words] neg_words = [] neg_words.extend(NEGATE) for word in neg_words: if word in input_words: return True if include_nt: ...
def negated(input_words, include_nt=True): """ Determine if input contains negation words """ input_words = [str(w).lower() for w in input_words] neg_words = [] neg_words.extend(NEGATE) for word in neg_words: if word in input_words: return True if include_nt: ...
[ "Determine", "if", "input", "contains", "negation", "words" ]
cjhutto/vaderSentiment
python
https://github.com/cjhutto/vaderSentiment/blob/cfc2bce747afb2c49799c1de1dcf517358948d71/vaderSentiment/vaderSentiment.py#L84-L102
[ "def", "negated", "(", "input_words", ",", "include_nt", "=", "True", ")", ":", "input_words", "=", "[", "str", "(", "w", ")", ".", "lower", "(", ")", "for", "w", "in", "input_words", "]", "neg_words", "=", "[", "]", "neg_words", ".", "extend", "(", ...
cfc2bce747afb2c49799c1de1dcf517358948d71
train
normalize
Normalize the score to be between -1 and 1 using an alpha that approximates the max expected value
vaderSentiment/vaderSentiment.py
def normalize(score, alpha=15): """ Normalize the score to be between -1 and 1 using an alpha that approximates the max expected value """ norm_score = score / math.sqrt((score * score) + alpha) if norm_score < -1.0: return -1.0 elif norm_score > 1.0: return 1.0 else: ...
def normalize(score, alpha=15): """ Normalize the score to be between -1 and 1 using an alpha that approximates the max expected value """ norm_score = score / math.sqrt((score * score) + alpha) if norm_score < -1.0: return -1.0 elif norm_score > 1.0: return 1.0 else: ...
[ "Normalize", "the", "score", "to", "be", "between", "-", "1", "and", "1", "using", "an", "alpha", "that", "approximates", "the", "max", "expected", "value" ]
cjhutto/vaderSentiment
python
https://github.com/cjhutto/vaderSentiment/blob/cfc2bce747afb2c49799c1de1dcf517358948d71/vaderSentiment/vaderSentiment.py#L105-L116
[ "def", "normalize", "(", "score", ",", "alpha", "=", "15", ")", ":", "norm_score", "=", "score", "/", "math", ".", "sqrt", "(", "(", "score", "*", "score", ")", "+", "alpha", ")", "if", "norm_score", "<", "-", "1.0", ":", "return", "-", "1.0", "e...
cfc2bce747afb2c49799c1de1dcf517358948d71
train
allcap_differential
Check whether just some words in the input are ALL CAPS :param list words: The words to inspect :returns: `True` if some but not all items in `words` are ALL CAPS
vaderSentiment/vaderSentiment.py
def allcap_differential(words): """ Check whether just some words in the input are ALL CAPS :param list words: The words to inspect :returns: `True` if some but not all items in `words` are ALL CAPS """ is_different = False allcap_words = 0 for word in words: if word.isupper(): ...
def allcap_differential(words): """ Check whether just some words in the input are ALL CAPS :param list words: The words to inspect :returns: `True` if some but not all items in `words` are ALL CAPS """ is_different = False allcap_words = 0 for word in words: if word.isupper(): ...
[ "Check", "whether", "just", "some", "words", "in", "the", "input", "are", "ALL", "CAPS", ":", "param", "list", "words", ":", "The", "words", "to", "inspect", ":", "returns", ":", "True", "if", "some", "but", "not", "all", "items", "in", "words", "are",...
cjhutto/vaderSentiment
python
https://github.com/cjhutto/vaderSentiment/blob/cfc2bce747afb2c49799c1de1dcf517358948d71/vaderSentiment/vaderSentiment.py#L119-L133
[ "def", "allcap_differential", "(", "words", ")", ":", "is_different", "=", "False", "allcap_words", "=", "0", "for", "word", "in", "words", ":", "if", "word", ".", "isupper", "(", ")", ":", "allcap_words", "+=", "1", "cap_differential", "=", "len", "(", ...
cfc2bce747afb2c49799c1de1dcf517358948d71
train
scalar_inc_dec
Check if the preceding words increase, decrease, or negate/nullify the valence
vaderSentiment/vaderSentiment.py
def scalar_inc_dec(word, valence, is_cap_diff): """ Check if the preceding words increase, decrease, or negate/nullify the valence """ scalar = 0.0 word_lower = word.lower() if word_lower in BOOSTER_DICT: scalar = BOOSTER_DICT[word_lower] if valence < 0: scalar *=...
def scalar_inc_dec(word, valence, is_cap_diff): """ Check if the preceding words increase, decrease, or negate/nullify the valence """ scalar = 0.0 word_lower = word.lower() if word_lower in BOOSTER_DICT: scalar = BOOSTER_DICT[word_lower] if valence < 0: scalar *=...
[ "Check", "if", "the", "preceding", "words", "increase", "decrease", "or", "negate", "/", "nullify", "the", "valence" ]
cjhutto/vaderSentiment
python
https://github.com/cjhutto/vaderSentiment/blob/cfc2bce747afb2c49799c1de1dcf517358948d71/vaderSentiment/vaderSentiment.py#L136-L153
[ "def", "scalar_inc_dec", "(", "word", ",", "valence", ",", "is_cap_diff", ")", ":", "scalar", "=", "0.0", "word_lower", "=", "word", ".", "lower", "(", ")", "if", "word_lower", "in", "BOOSTER_DICT", ":", "scalar", "=", "BOOSTER_DICT", "[", "word_lower", "]...
cfc2bce747afb2c49799c1de1dcf517358948d71
train
SentiText._words_plus_punc
Returns mapping of form: { 'cat,': 'cat', ',cat': 'cat', }
vaderSentiment/vaderSentiment.py
def _words_plus_punc(self): """ Returns mapping of form: { 'cat,': 'cat', ',cat': 'cat', } """ no_punc_text = REGEX_REMOVE_PUNCTUATION.sub('', self.text) # removes punctuation (but loses emoticons & contractions) words_only = no_pun...
def _words_plus_punc(self): """ Returns mapping of form: { 'cat,': 'cat', ',cat': 'cat', } """ no_punc_text = REGEX_REMOVE_PUNCTUATION.sub('', self.text) # removes punctuation (but loses emoticons & contractions) words_only = no_pun...
[ "Returns", "mapping", "of", "form", ":", "{", "cat", ":", "cat", "cat", ":", "cat", "}" ]
cjhutto/vaderSentiment
python
https://github.com/cjhutto/vaderSentiment/blob/cfc2bce747afb2c49799c1de1dcf517358948d71/vaderSentiment/vaderSentiment.py#L170-L188
[ "def", "_words_plus_punc", "(", "self", ")", ":", "no_punc_text", "=", "REGEX_REMOVE_PUNCTUATION", ".", "sub", "(", "''", ",", "self", ".", "text", ")", "# removes punctuation (but loses emoticons & contractions)", "words_only", "=", "no_punc_text", ".", "split", "(",...
cfc2bce747afb2c49799c1de1dcf517358948d71
train
SentiText._words_and_emoticons
Removes leading and trailing puncutation Leaves contractions and most emoticons Does not preserve punc-plus-letter emoticons (e.g. :D)
vaderSentiment/vaderSentiment.py
def _words_and_emoticons(self): """ Removes leading and trailing puncutation Leaves contractions and most emoticons Does not preserve punc-plus-letter emoticons (e.g. :D) """ wes = self.text.split() words_punc_dict = self._words_plus_punc() wes = [we f...
def _words_and_emoticons(self): """ Removes leading and trailing puncutation Leaves contractions and most emoticons Does not preserve punc-plus-letter emoticons (e.g. :D) """ wes = self.text.split() words_punc_dict = self._words_plus_punc() wes = [we f...
[ "Removes", "leading", "and", "trailing", "puncutation", "Leaves", "contractions", "and", "most", "emoticons", "Does", "not", "preserve", "punc", "-", "plus", "-", "letter", "emoticons", "(", "e", ".", "g", ".", ":", "D", ")" ]
cjhutto/vaderSentiment
python
https://github.com/cjhutto/vaderSentiment/blob/cfc2bce747afb2c49799c1de1dcf517358948d71/vaderSentiment/vaderSentiment.py#L190-L202
[ "def", "_words_and_emoticons", "(", "self", ")", ":", "wes", "=", "self", ".", "text", ".", "split", "(", ")", "words_punc_dict", "=", "self", ".", "_words_plus_punc", "(", ")", "wes", "=", "[", "we", "for", "we", "in", "wes", "if", "len", "(", "we",...
cfc2bce747afb2c49799c1de1dcf517358948d71
train
SentimentIntensityAnalyzer.make_lex_dict
Convert lexicon file to a dictionary
vaderSentiment/vaderSentiment.py
def make_lex_dict(self): """ Convert lexicon file to a dictionary """ lex_dict = {} for line in self.lexicon_full_filepath.split('\n'): (word, measure) = line.strip().split('\t')[0:2] lex_dict[word] = float(measure) return lex_dict
def make_lex_dict(self): """ Convert lexicon file to a dictionary """ lex_dict = {} for line in self.lexicon_full_filepath.split('\n'): (word, measure) = line.strip().split('\t')[0:2] lex_dict[word] = float(measure) return lex_dict
[ "Convert", "lexicon", "file", "to", "a", "dictionary" ]
cjhutto/vaderSentiment
python
https://github.com/cjhutto/vaderSentiment/blob/cfc2bce747afb2c49799c1de1dcf517358948d71/vaderSentiment/vaderSentiment.py#L222-L230
[ "def", "make_lex_dict", "(", "self", ")", ":", "lex_dict", "=", "{", "}", "for", "line", "in", "self", ".", "lexicon_full_filepath", ".", "split", "(", "'\\n'", ")", ":", "(", "word", ",", "measure", ")", "=", "line", ".", "strip", "(", ")", ".", "...
cfc2bce747afb2c49799c1de1dcf517358948d71
train
SentimentIntensityAnalyzer.make_emoji_dict
Convert emoji lexicon file to a dictionary
vaderSentiment/vaderSentiment.py
def make_emoji_dict(self): """ Convert emoji lexicon file to a dictionary """ emoji_dict = {} for line in self.emoji_full_filepath.split('\n'): (emoji, description) = line.strip().split('\t')[0:2] emoji_dict[emoji] = description return emoji_dict
def make_emoji_dict(self): """ Convert emoji lexicon file to a dictionary """ emoji_dict = {} for line in self.emoji_full_filepath.split('\n'): (emoji, description) = line.strip().split('\t')[0:2] emoji_dict[emoji] = description return emoji_dict
[ "Convert", "emoji", "lexicon", "file", "to", "a", "dictionary" ]
cjhutto/vaderSentiment
python
https://github.com/cjhutto/vaderSentiment/blob/cfc2bce747afb2c49799c1de1dcf517358948d71/vaderSentiment/vaderSentiment.py#L232-L240
[ "def", "make_emoji_dict", "(", "self", ")", ":", "emoji_dict", "=", "{", "}", "for", "line", "in", "self", ".", "emoji_full_filepath", ".", "split", "(", "'\\n'", ")", ":", "(", "emoji", ",", "description", ")", "=", "line", ".", "strip", "(", ")", "...
cfc2bce747afb2c49799c1de1dcf517358948d71
train
SentimentIntensityAnalyzer.polarity_scores
Return a float for sentiment strength based on the input text. Positive values are positive valence, negative value are negative valence.
vaderSentiment/vaderSentiment.py
def polarity_scores(self, text): """ Return a float for sentiment strength based on the input text. Positive values are positive valence, negative value are negative valence. """ # convert emojis to their textual descriptions text_token_list = text.split() ...
def polarity_scores(self, text): """ Return a float for sentiment strength based on the input text. Positive values are positive valence, negative value are negative valence. """ # convert emojis to their textual descriptions text_token_list = text.split() ...
[ "Return", "a", "float", "for", "sentiment", "strength", "based", "on", "the", "input", "text", ".", "Positive", "values", "are", "positive", "valence", "negative", "value", "are", "negative", "valence", "." ]
cjhutto/vaderSentiment
python
https://github.com/cjhutto/vaderSentiment/blob/cfc2bce747afb2c49799c1de1dcf517358948d71/vaderSentiment/vaderSentiment.py#L242-L282
[ "def", "polarity_scores", "(", "self", ",", "text", ")", ":", "# convert emojis to their textual descriptions", "text_token_list", "=", "text", ".", "split", "(", ")", "text_no_emoji_lst", "=", "[", "]", "for", "token", "in", "text_token_list", ":", "if", "token",...
cfc2bce747afb2c49799c1de1dcf517358948d71
train
read
Build an absolute path from *parts* and and return the contents of the resulting file. Assume UTF-8 encoding.
setup.py
def read(*parts): """ Build an absolute path from *parts* and and return the contents of the resulting file. Assume UTF-8 encoding. """ with codecs.open(os.path.join(HERE, *parts), "rb", "utf-8") as f: return f.read()
def read(*parts): """ Build an absolute path from *parts* and and return the contents of the resulting file. Assume UTF-8 encoding. """ with codecs.open(os.path.join(HERE, *parts), "rb", "utf-8") as f: return f.read()
[ "Build", "an", "absolute", "path", "from", "*", "parts", "*", "and", "and", "return", "the", "contents", "of", "the", "resulting", "file", ".", "Assume", "UTF", "-", "8", "encoding", "." ]
cjhutto/vaderSentiment
python
https://github.com/cjhutto/vaderSentiment/blob/cfc2bce747afb2c49799c1de1dcf517358948d71/setup.py#L6-L12
[ "def", "read", "(", "*", "parts", ")", ":", "with", "codecs", ".", "open", "(", "os", ".", "path", ".", "join", "(", "HERE", ",", "*", "parts", ")", ",", "\"rb\"", ",", "\"utf-8\"", ")", "as", "f", ":", "return", "f", ".", "read", "(", ")" ]
cfc2bce747afb2c49799c1de1dcf517358948d71
train
CVSMaildirSource.parse
Parse messages sent by the 'buildbot-cvs-mail' program.
master/buildbot/changes/mail.py
def parse(self, m, prefix=None): """Parse messages sent by the 'buildbot-cvs-mail' program. """ # The mail is sent from the person doing the checkin. Assume that the # local username is enough to identify them (this assumes a one-server # cvs-over-rsh environment rather than the ...
def parse(self, m, prefix=None): """Parse messages sent by the 'buildbot-cvs-mail' program. """ # The mail is sent from the person doing the checkin. Assume that the # local username is enough to identify them (this assumes a one-server # cvs-over-rsh environment rather than the ...
[ "Parse", "messages", "sent", "by", "the", "buildbot", "-", "cvs", "-", "mail", "program", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/mail.py#L96-L263
[ "def", "parse", "(", "self", ",", "m", ",", "prefix", "=", "None", ")", ":", "# The mail is sent from the person doing the checkin. Assume that the", "# local username is enough to identify them (this assumes a one-server", "# cvs-over-rsh environment rather than the server-dirs-shared-o...
5df3cfae6d760557d99156633c32b1822a1e130c
train
SVNCommitEmailMaildirSource.parse
Parse messages sent by the svn 'commit-email.pl' trigger.
master/buildbot/changes/mail.py
def parse(self, m, prefix=None): """Parse messages sent by the svn 'commit-email.pl' trigger. """ # The mail is sent from the person doing the checkin. Assume that the # local username is enough to identify them (this assumes a one-server # cvs-over-rsh environment rather than t...
def parse(self, m, prefix=None): """Parse messages sent by the svn 'commit-email.pl' trigger. """ # The mail is sent from the person doing the checkin. Assume that the # local username is enough to identify them (this assumes a one-server # cvs-over-rsh environment rather than t...
[ "Parse", "messages", "sent", "by", "the", "svn", "commit", "-", "email", ".", "pl", "trigger", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/mail.py#L294-L389
[ "def", "parse", "(", "self", ",", "m", ",", "prefix", "=", "None", ")", ":", "# The mail is sent from the person doing the checkin. Assume that the", "# local username is enough to identify them (this assumes a one-server", "# cvs-over-rsh environment rather than the server-dirs-shared-o...
5df3cfae6d760557d99156633c32b1822a1e130c
train
BzrLaunchpadEmailMaildirSource.parse
Parse branch notification messages sent by Launchpad.
master/buildbot/changes/mail.py
def parse(self, m, prefix=None): """Parse branch notification messages sent by Launchpad. """ subject = m["subject"] match = re.search(r"^\s*\[Branch\s+([^]]+)\]", subject) if match: repository = match.group(1) else: repository = None # P...
def parse(self, m, prefix=None): """Parse branch notification messages sent by Launchpad. """ subject = m["subject"] match = re.search(r"^\s*\[Branch\s+([^]]+)\]", subject) if match: repository = match.group(1) else: repository = None # P...
[ "Parse", "branch", "notification", "messages", "sent", "by", "Launchpad", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/mail.py#L430-L531
[ "def", "parse", "(", "self", ",", "m", ",", "prefix", "=", "None", ")", ":", "subject", "=", "m", "[", "\"subject\"", "]", "match", "=", "re", ".", "search", "(", "r\"^\\s*\\[Branch\\s+([^]]+)\\]\"", ",", "subject", ")", "if", "match", ":", "repository",...
5df3cfae6d760557d99156633c32b1822a1e130c
train
FileWriter.remote_write
Called from remote worker to write L{data} to L{fp} within boundaries of L{maxsize} @type data: C{string} @param data: String of data to write
master/buildbot/process/remotetransfer.py
def remote_write(self, data): """ Called from remote worker to write L{data} to L{fp} within boundaries of L{maxsize} @type data: C{string} @param data: String of data to write """ data = unicode2bytes(data) if self.remaining is not None: if ...
def remote_write(self, data): """ Called from remote worker to write L{data} to L{fp} within boundaries of L{maxsize} @type data: C{string} @param data: String of data to write """ data = unicode2bytes(data) if self.remaining is not None: if ...
[ "Called", "from", "remote", "worker", "to", "write", "L", "{", "data", "}", "to", "L", "{", "fp", "}", "within", "boundaries", "of", "L", "{", "maxsize", "}" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/remotetransfer.py#L51-L66
[ "def", "remote_write", "(", "self", ",", "data", ")", ":", "data", "=", "unicode2bytes", "(", "data", ")", "if", "self", ".", "remaining", "is", "not", "None", ":", "if", "len", "(", "data", ")", ">", "self", ".", "remaining", ":", "data", "=", "da...
5df3cfae6d760557d99156633c32b1822a1e130c
train
FileWriter.remote_close
Called by remote worker to state that no more data will be transferred
master/buildbot/process/remotetransfer.py
def remote_close(self): """ Called by remote worker to state that no more data will be transferred """ self.fp.close() self.fp = None # on windows, os.rename does not automatically unlink, so do it # manually if os.path.exists(self.destfile): o...
def remote_close(self): """ Called by remote worker to state that no more data will be transferred """ self.fp.close() self.fp = None # on windows, os.rename does not automatically unlink, so do it # manually if os.path.exists(self.destfile): o...
[ "Called", "by", "remote", "worker", "to", "state", "that", "no", "more", "data", "will", "be", "transferred" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/remotetransfer.py#L71-L84
[ "def", "remote_close", "(", "self", ")", ":", "self", ".", "fp", ".", "close", "(", ")", "self", ".", "fp", "=", "None", "# on windows, os.rename does not automatically unlink, so do it", "# manually", "if", "os", ".", "path", ".", "exists", "(", "self", ".", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
DirectoryWriter.remote_unpack
Called by remote worker to state that no more data will be transferred
master/buildbot/process/remotetransfer.py
def remote_unpack(self): """ Called by remote worker to state that no more data will be transferred """ # Make sure remote_close is called, otherwise atomic rename won't happen self.remote_close() # Map configured compression to a TarFile setting if self.compress...
def remote_unpack(self): """ Called by remote worker to state that no more data will be transferred """ # Make sure remote_close is called, otherwise atomic rename won't happen self.remote_close() # Map configured compression to a TarFile setting if self.compress...
[ "Called", "by", "remote", "worker", "to", "state", "that", "no", "more", "data", "will", "be", "transferred" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/remotetransfer.py#L114-L133
[ "def", "remote_unpack", "(", "self", ")", ":", "# Make sure remote_close is called, otherwise atomic rename won't happen", "self", ".", "remote_close", "(", ")", "# Map configured compression to a TarFile setting", "if", "self", ".", "compress", "==", "'bz2'", ":", "mode", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
FileReader.remote_read
Called from remote worker to read at most L{maxlength} bytes of data @type maxlength: C{integer} @param maxlength: Maximum number of data bytes that can be returned @return: Data read from L{fp} @rtype: C{string} of bytes read from file
master/buildbot/process/remotetransfer.py
def remote_read(self, maxlength): """ Called from remote worker to read at most L{maxlength} bytes of data @type maxlength: C{integer} @param maxlength: Maximum number of data bytes that can be returned @return: Data read from L{fp} @rtype: C{string} of bytes read from...
def remote_read(self, maxlength): """ Called from remote worker to read at most L{maxlength} bytes of data @type maxlength: C{integer} @param maxlength: Maximum number of data bytes that can be returned @return: Data read from L{fp} @rtype: C{string} of bytes read from...
[ "Called", "from", "remote", "worker", "to", "read", "at", "most", "L", "{", "maxlength", "}", "bytes", "of", "data" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/remotetransfer.py#L145-L159
[ "def", "remote_read", "(", "self", ",", "maxlength", ")", ":", "if", "self", ".", "fp", "is", "None", ":", "return", "''", "data", "=", "self", ".", "fp", ".", "read", "(", "maxlength", ")", "return", "data" ]
5df3cfae6d760557d99156633c32b1822a1e130c
train
CMake.run
run CMake
master/buildbot/steps/cmake.py
def run(self): """ run CMake """ command = [self.cmake] if self.generator: command.extend([ '-G', self.generator ]) if self.path: command.append(self.path) if self.definitions is not None: for item...
def run(self): """ run CMake """ command = [self.cmake] if self.generator: command.extend([ '-G', self.generator ]) if self.path: command.append(self.path) if self.definitions is not None: for item...
[ "run", "CMake" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/cmake.py#L62-L87
[ "def", "run", "(", "self", ")", ":", "command", "=", "[", "self", ".", "cmake", "]", "if", "self", ".", "generator", ":", "command", ".", "extend", "(", "[", "'-G'", ",", "self", ".", "generator", "]", ")", "if", "self", ".", "path", ":", "comman...
5df3cfae6d760557d99156633c32b1822a1e130c
train
RemoteCommand.remote_update
I am called by the worker's L{buildbot_worker.base.WorkerForBuilderBase.sendUpdate} so I can receive updates from the running remote command. @type updates: list of [object, int] @param updates: list of updates from the remote command
master/buildbot/process/remotecommand.py
def remote_update(self, updates): """ I am called by the worker's L{buildbot_worker.base.WorkerForBuilderBase.sendUpdate} so I can receive updates from the running remote command. @type updates: list of [object, int] @param updates: list of updates from the remote comma...
def remote_update(self, updates): """ I am called by the worker's L{buildbot_worker.base.WorkerForBuilderBase.sendUpdate} so I can receive updates from the running remote command. @type updates: list of [object, int] @param updates: list of updates from the remote comma...
[ "I", "am", "called", "by", "the", "worker", "s", "L", "{", "buildbot_worker", ".", "base", ".", "WorkerForBuilderBase", ".", "sendUpdate", "}", "so", "I", "can", "receive", "updates", "from", "the", "running", "remote", "command", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/remotecommand.py#L178-L202
[ "def", "remote_update", "(", "self", ",", "updates", ")", ":", "updates", "=", "decode", "(", "updates", ")", "self", ".", "worker", ".", "messageReceivedFromWorker", "(", ")", "max_updatenum", "=", "0", "for", "(", "update", ",", "num", ")", "in", "upda...
5df3cfae6d760557d99156633c32b1822a1e130c
train
RemoteCommand.remote_complete
Called by the worker's L{buildbot_worker.base.WorkerForBuilderBase.commandComplete} to notify me the remote command has finished. @type failure: L{twisted.python.failure.Failure} or None @rtype: None
master/buildbot/process/remotecommand.py
def remote_complete(self, failure=None): """ Called by the worker's L{buildbot_worker.base.WorkerForBuilderBase.commandComplete} to notify me the remote command has finished. @type failure: L{twisted.python.failure.Failure} or None @rtype: None """ self...
def remote_complete(self, failure=None): """ Called by the worker's L{buildbot_worker.base.WorkerForBuilderBase.commandComplete} to notify me the remote command has finished. @type failure: L{twisted.python.failure.Failure} or None @rtype: None """ self...
[ "Called", "by", "the", "worker", "s", "L", "{", "buildbot_worker", ".", "base", ".", "WorkerForBuilderBase", ".", "commandComplete", "}", "to", "notify", "me", "the", "remote", "command", "has", "finished", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/remotecommand.py#L204-L219
[ "def", "remote_complete", "(", "self", ",", "failure", "=", "None", ")", ":", "self", ".", "worker", ".", "messageReceivedFromWorker", "(", ")", "# call the real remoteComplete a moment later, but first return an", "# acknowledgement so the worker can retire the completion messag...
5df3cfae6d760557d99156633c32b1822a1e130c
train
Source._hasAttrGroupMember
The hasattr equivalent for attribute groups: returns whether the given member is in the attribute group.
master/buildbot/steps/source/base.py
def _hasAttrGroupMember(self, attrGroup, attr): """ The hasattr equivalent for attribute groups: returns whether the given member is in the attribute group. """ method_name = '%s_%s' % (attrGroup, attr) return hasattr(self, method_name)
def _hasAttrGroupMember(self, attrGroup, attr): """ The hasattr equivalent for attribute groups: returns whether the given member is in the attribute group. """ method_name = '%s_%s' % (attrGroup, attr) return hasattr(self, method_name)
[ "The", "hasattr", "equivalent", "for", "attribute", "groups", ":", "returns", "whether", "the", "given", "member", "is", "in", "the", "attribute", "group", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/source/base.py#L135-L141
[ "def", "_hasAttrGroupMember", "(", "self", ",", "attrGroup", ",", "attr", ")", ":", "method_name", "=", "'%s_%s'", "%", "(", "attrGroup", ",", "attr", ")", "return", "hasattr", "(", "self", ",", "method_name", ")" ]
5df3cfae6d760557d99156633c32b1822a1e130c
train
Source._getAttrGroupMember
The getattr equivalent for attribute groups: gets and returns the attribute group member.
master/buildbot/steps/source/base.py
def _getAttrGroupMember(self, attrGroup, attr): """ The getattr equivalent for attribute groups: gets and returns the attribute group member. """ method_name = '%s_%s' % (attrGroup, attr) return getattr(self, method_name)
def _getAttrGroupMember(self, attrGroup, attr): """ The getattr equivalent for attribute groups: gets and returns the attribute group member. """ method_name = '%s_%s' % (attrGroup, attr) return getattr(self, method_name)
[ "The", "getattr", "equivalent", "for", "attribute", "groups", ":", "gets", "and", "returns", "the", "attribute", "group", "member", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/source/base.py#L143-L149
[ "def", "_getAttrGroupMember", "(", "self", ",", "attrGroup", ",", "attr", ")", ":", "method_name", "=", "'%s_%s'", "%", "(", "attrGroup", ",", "attr", ")", "return", "getattr", "(", "self", ",", "method_name", ")" ]
5df3cfae6d760557d99156633c32b1822a1e130c
train
Source._listAttrGroupMembers
Returns a list of all members in the attribute group.
master/buildbot/steps/source/base.py
def _listAttrGroupMembers(self, attrGroup): """ Returns a list of all members in the attribute group. """ from inspect import getmembers, ismethod methods = getmembers(self, ismethod) group_prefix = attrGroup + '_' group_len = len(group_prefix) group_membe...
def _listAttrGroupMembers(self, attrGroup): """ Returns a list of all members in the attribute group. """ from inspect import getmembers, ismethod methods = getmembers(self, ismethod) group_prefix = attrGroup + '_' group_len = len(group_prefix) group_membe...
[ "Returns", "a", "list", "of", "all", "members", "in", "the", "attribute", "group", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/source/base.py#L151-L162
[ "def", "_listAttrGroupMembers", "(", "self", ",", "attrGroup", ")", ":", "from", "inspect", "import", "getmembers", ",", "ismethod", "methods", "=", "getmembers", "(", "self", ",", "ismethod", ")", "group_prefix", "=", "attrGroup", "+", "'_'", "group_len", "="...
5df3cfae6d760557d99156633c32b1822a1e130c
train
Source.updateSourceProperty
Update a property, indexing the property by codebase if codebase is not ''. Source steps should generally use this instead of setProperty.
master/buildbot/steps/source/base.py
def updateSourceProperty(self, name, value, source=''): """ Update a property, indexing the property by codebase if codebase is not ''. Source steps should generally use this instead of setProperty. """ # pick a decent source name if source == '': source = se...
def updateSourceProperty(self, name, value, source=''): """ Update a property, indexing the property by codebase if codebase is not ''. Source steps should generally use this instead of setProperty. """ # pick a decent source name if source == '': source = se...
[ "Update", "a", "property", "indexing", "the", "property", "by", "codebase", "if", "codebase", "is", "not", ".", "Source", "steps", "should", "generally", "use", "this", "instead", "of", "setProperty", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/source/base.py#L164-L184
[ "def", "updateSourceProperty", "(", "self", ",", "name", ",", "value", ",", "source", "=", "''", ")", ":", "# pick a decent source name", "if", "source", "==", "''", ":", "source", "=", "self", ".", "__class__", ".", "__name__", "if", "self", ".", "codebas...
5df3cfae6d760557d99156633c32b1822a1e130c
train
_gerrit_user_to_author
Convert Gerrit account properties to Buildbot format Take into account missing values
master/buildbot/changes/gerritchangesource.py
def _gerrit_user_to_author(props, username="unknown"): """ Convert Gerrit account properties to Buildbot format Take into account missing values """ username = props.get("username", username) username = props.get("name", username) if "email" in props: username += " <%(email)s>" % pr...
def _gerrit_user_to_author(props, username="unknown"): """ Convert Gerrit account properties to Buildbot format Take into account missing values """ username = props.get("username", username) username = props.get("name", username) if "email" in props: username += " <%(email)s>" % pr...
[ "Convert", "Gerrit", "account", "properties", "to", "Buildbot", "format" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/gerritchangesource.py#L51-L61
[ "def", "_gerrit_user_to_author", "(", "props", ",", "username", "=", "\"unknown\"", ")", ":", "username", "=", "props", ".", "get", "(", "\"username\"", ",", "username", ")", "username", "=", "props", ".", "get", "(", "\"name\"", ",", "username", ")", "if"...
5df3cfae6d760557d99156633c32b1822a1e130c
train
getName
This method finds the first parent class which is within the buildbot namespace it prepends the name with as many ">" as the class is subclassed
master/buildbot/buildbot_net_usage_data.py
def getName(obj): """This method finds the first parent class which is within the buildbot namespace it prepends the name with as many ">" as the class is subclassed """ # elastic search does not like '.' in dict keys, so we replace by / def sanitize(name): return name.replace(".", "/") ...
def getName(obj): """This method finds the first parent class which is within the buildbot namespace it prepends the name with as many ">" as the class is subclassed """ # elastic search does not like '.' in dict keys, so we replace by / def sanitize(name): return name.replace(".", "/") ...
[ "This", "method", "finds", "the", "first", "parent", "class", "which", "is", "within", "the", "buildbot", "namespace", "it", "prepends", "the", "name", "with", "as", "many", ">", "as", "the", "class", "is", "subclassed" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/buildbot_net_usage_data.py#L75-L93
[ "def", "getName", "(", "obj", ")", ":", "# elastic search does not like '.' in dict keys, so we replace by /", "def", "sanitize", "(", "name", ")", ":", "return", "name", ".", "replace", "(", "\".\"", ",", "\"/\"", ")", "if", "isinstance", "(", "obj", ",", "_Bui...
5df3cfae6d760557d99156633c32b1822a1e130c
train
fullData
Send the actual configuration of the builders, how the steps are agenced. Note that full data will never send actual detail of what command is run, name of servers, etc.
master/buildbot/buildbot_net_usage_data.py
def fullData(master): """ Send the actual configuration of the builders, how the steps are agenced. Note that full data will never send actual detail of what command is run, name of servers, etc. """ builders = [] for b in master.config.builders: steps = [] for step in b...
def fullData(master): """ Send the actual configuration of the builders, how the steps are agenced. Note that full data will never send actual detail of what command is run, name of servers, etc. """ builders = [] for b in master.config.builders: steps = [] for step in b...
[ "Send", "the", "actual", "configuration", "of", "the", "builders", "how", "the", "steps", "are", "agenced", ".", "Note", "that", "full", "data", "will", "never", "send", "actual", "detail", "of", "what", "command", "is", "run", "name", "of", "servers", "et...
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/buildbot_net_usage_data.py#L147-L159
[ "def", "fullData", "(", "master", ")", ":", "builders", "=", "[", "]", "for", "b", "in", "master", ".", "config", ".", "builders", ":", "steps", "=", "[", "]", "for", "step", "in", "b", ".", "factory", ".", "steps", ":", "steps", ".", "append", "...
5df3cfae6d760557d99156633c32b1822a1e130c
train
include
Generate a pair of (directory, file-list) for installation. 'd' -- A directory 'e' -- A glob pattern
master/setup.py
def include(d, e): """Generate a pair of (directory, file-list) for installation. 'd' -- A directory 'e' -- A glob pattern""" return (d, [f for f in glob.glob('%s/%s' % (d, e)) if os.path.isfile(f)])
def include(d, e): """Generate a pair of (directory, file-list) for installation. 'd' -- A directory 'e' -- A glob pattern""" return (d, [f for f in glob.glob('%s/%s' % (d, e)) if os.path.isfile(f)])
[ "Generate", "a", "pair", "of", "(", "directory", "file", "-", "list", ")", "for", "installation", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/setup.py#L42-L48
[ "def", "include", "(", "d", ",", "e", ")", ":", "return", "(", "d", ",", "[", "f", "for", "f", "in", "glob", ".", "glob", "(", "'%s/%s'", "%", "(", "d", ",", "e", ")", ")", "if", "os", ".", "path", ".", "isfile", "(", "f", ")", "]", ")" ]
5df3cfae6d760557d99156633c32b1822a1e130c
train
define_plugin_entry
helper to produce lines suitable for setup.py's entry_points
master/setup.py
def define_plugin_entry(name, module_name): """ helper to produce lines suitable for setup.py's entry_points """ if isinstance(name, tuple): entry, name = name else: entry = name return '%s = %s:%s' % (entry, module_name, name)
def define_plugin_entry(name, module_name): """ helper to produce lines suitable for setup.py's entry_points """ if isinstance(name, tuple): entry, name = name else: entry = name return '%s = %s:%s' % (entry, module_name, name)
[ "helper", "to", "produce", "lines", "suitable", "for", "setup", ".", "py", "s", "entry_points" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/setup.py#L99-L107
[ "def", "define_plugin_entry", "(", "name", ",", "module_name", ")", ":", "if", "isinstance", "(", "name", ",", "tuple", ")", ":", "entry", ",", "name", "=", "name", "else", ":", "entry", "=", "name", "return", "'%s = %s:%s'", "%", "(", "entry", ",", "m...
5df3cfae6d760557d99156633c32b1822a1e130c
train
define_plugin_entries
helper to all groups for plugins
master/setup.py
def define_plugin_entries(groups): """ helper to all groups for plugins """ result = dict() for group, modules in groups: tempo = [] for module_name, names in modules: tempo.extend([define_plugin_entry(name, module_name) for name in names]) ...
def define_plugin_entries(groups): """ helper to all groups for plugins """ result = dict() for group, modules in groups: tempo = [] for module_name, names in modules: tempo.extend([define_plugin_entry(name, module_name) for name in names]) ...
[ "helper", "to", "all", "groups", "for", "plugins" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/setup.py#L117-L130
[ "def", "define_plugin_entries", "(", "groups", ")", ":", "result", "=", "dict", "(", ")", "for", "group", ",", "modules", "in", "groups", ":", "tempo", "=", "[", "]", "for", "module_name", ",", "names", "in", "modules", ":", "tempo", ".", "extend", "("...
5df3cfae6d760557d99156633c32b1822a1e130c
train
ChangeFilter.fromSchedulerConstructorArgs
Static method to create a filter based on constructor args change_filter, branch, and categories; use default values @code{None}, @code{NotABranch}, and @code{None}, respectively. These arguments are interpreted as documented for the L{buildbot.schedulers.basic.Scheduler} class. ...
master/buildbot/changes/filter.py
def fromSchedulerConstructorArgs(change_filter=None, branch=NotABranch, categories=None): """ Static method to create a filter based on constructor args change_filter, branch, and categories; use default values @code{None}, @code{NotABranch}, and @cod...
def fromSchedulerConstructorArgs(change_filter=None, branch=NotABranch, categories=None): """ Static method to create a filter based on constructor args change_filter, branch, and categories; use default values @code{None}, @code{NotABranch}, and @cod...
[ "Static", "method", "to", "create", "a", "filter", "based", "on", "constructor", "args", "change_filter", "branch", "and", "categories", ";", "use", "default", "values", "@code", "{", "None", "}", "@code", "{", "NotABranch", "}", "and", "@code", "{", "None",...
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/filter.py#L111-L139
[ "def", "fromSchedulerConstructorArgs", "(", "change_filter", "=", "None", ",", "branch", "=", "NotABranch", ",", "categories", "=", "None", ")", ":", "# use a change_filter, if given one", "if", "change_filter", ":", "if", "(", "branch", "is", "not", "NotABranch", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
GitPoller._process_changes
Read changes since last change. - Read list of commit hashes. - Extract details from each commit. - Add changes to database.
master/buildbot/changes/gitpoller.py
def _process_changes(self, newRev, branch): """ Read changes since last change. - Read list of commit hashes. - Extract details from each commit. - Add changes to database. """ # initial run, don't parse all history if not self.lastRev: retur...
def _process_changes(self, newRev, branch): """ Read changes since last change. - Read list of commit hashes. - Extract details from each commit. - Add changes to database. """ # initial run, don't parse all history if not self.lastRev: retur...
[ "Read", "changes", "since", "last", "change", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/gitpoller.py#L289-L367
[ "def", "_process_changes", "(", "self", ",", "newRev", ",", "branch", ")", ":", "# initial run, don't parse all history", "if", "not", "self", ".", "lastRev", ":", "return", "rebuild", "=", "False", "if", "newRev", "in", "self", ".", "lastRev", ".", "values", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
BotMaster.cleanShutdown
Shut down the entire process, once all currently-running builds are complete. quickMode will mark all builds as retry (except the ones that were triggered)
master/buildbot/process/botmaster.py
def cleanShutdown(self, quickMode=False, stopReactor=True, _reactor=reactor): """Shut down the entire process, once all currently-running builds are complete. quickMode will mark all builds as retry (except the ones that were triggered) """ if self.shuttingDown: retur...
def cleanShutdown(self, quickMode=False, stopReactor=True, _reactor=reactor): """Shut down the entire process, once all currently-running builds are complete. quickMode will mark all builds as retry (except the ones that were triggered) """ if self.shuttingDown: retur...
[ "Shut", "down", "the", "entire", "process", "once", "all", "currently", "-", "running", "builds", "are", "complete", ".", "quickMode", "will", "mark", "all", "builds", "as", "retry", "(", "except", "the", "ones", "that", "were", "triggered", ")" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/botmaster.py#L63-L132
[ "def", "cleanShutdown", "(", "self", ",", "quickMode", "=", "False", ",", "stopReactor", "=", "True", ",", "_reactor", "=", "reactor", ")", ":", "if", "self", ".", "shuttingDown", ":", "return", "log", ".", "msg", "(", "\"Initiating clean shutdown\"", ")", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
BotMaster.getLockByID
Convert a Lock identifier into an actual Lock instance. @param lockid: a locks.MasterLock or locks.WorkerLock instance @return: a locks.RealMasterLock or locks.RealWorkerLock instance
master/buildbot/process/botmaster.py
def getLockByID(self, lockid): """Convert a Lock identifier into an actual Lock instance. @param lockid: a locks.MasterLock or locks.WorkerLock instance @return: a locks.RealMasterLock or locks.RealWorkerLock instance """ assert isinstance(lockid, (locks.MasterLock, locks.WorkerL...
def getLockByID(self, lockid): """Convert a Lock identifier into an actual Lock instance. @param lockid: a locks.MasterLock or locks.WorkerLock instance @return: a locks.RealMasterLock or locks.RealWorkerLock instance """ assert isinstance(lockid, (locks.MasterLock, locks.WorkerL...
[ "Convert", "a", "Lock", "identifier", "into", "an", "actual", "Lock", "instance", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/botmaster.py#L259-L271
[ "def", "getLockByID", "(", "self", ",", "lockid", ")", ":", "assert", "isinstance", "(", "lockid", ",", "(", "locks", ".", "MasterLock", ",", "locks", ".", "WorkerLock", ")", ")", "if", "lockid", "not", "in", "self", ".", "locks", ":", "self", ".", "...
5df3cfae6d760557d99156633c32b1822a1e130c
train
BotMaster.maybeStartBuildsForWorker
Call this when something suggests that a particular worker may now be available to start a build. @param worker_name: the name of the worker
master/buildbot/process/botmaster.py
def maybeStartBuildsForWorker(self, worker_name): """ Call this when something suggests that a particular worker may now be available to start a build. @param worker_name: the name of the worker """ builders = self.getBuildersForWorker(worker_name) self.brd.maybe...
def maybeStartBuildsForWorker(self, worker_name): """ Call this when something suggests that a particular worker may now be available to start a build. @param worker_name: the name of the worker """ builders = self.getBuildersForWorker(worker_name) self.brd.maybe...
[ "Call", "this", "when", "something", "suggests", "that", "a", "particular", "worker", "may", "now", "be", "available", "to", "start", "a", "build", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/botmaster.py#L290-L298
[ "def", "maybeStartBuildsForWorker", "(", "self", ",", "worker_name", ")", ":", "builders", "=", "self", ".", "getBuildersForWorker", "(", "worker_name", ")", "self", ".", "brd", ".", "maybeStartBuildsOn", "(", "[", "b", ".", "name", "for", "b", "in", "builde...
5df3cfae6d760557d99156633c32b1822a1e130c
train
rewrap
Rewrap text for output to the console. Removes common indentation and rewraps paragraphs according to the console width. Line feeds between paragraphs preserved. Formatting of paragraphs that starts with additional indentation preserved.
worker/buildbot_worker/util/__init__.py
def rewrap(text, width=None): """ Rewrap text for output to the console. Removes common indentation and rewraps paragraphs according to the console width. Line feeds between paragraphs preserved. Formatting of paragraphs that starts with additional indentation preserved. """ if wi...
def rewrap(text, width=None): """ Rewrap text for output to the console. Removes common indentation and rewraps paragraphs according to the console width. Line feeds between paragraphs preserved. Formatting of paragraphs that starts with additional indentation preserved. """ if wi...
[ "Rewrap", "text", "for", "output", "to", "the", "console", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/util/__init__.py#L102-L135
[ "def", "rewrap", "(", "text", ",", "width", "=", "None", ")", ":", "if", "width", "is", "None", ":", "width", "=", "80", "# Remove common indentation.", "text", "=", "textwrap", ".", "dedent", "(", "text", ")", "def", "needs_wrapping", "(", "line", ")", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
BaseHookHandler.getChanges
Consumes a naive build notification (the default for now) basically, set POST variables to match commit object parameters: revision, revlink, comments, branch, who, files, links files, links and properties will be de-json'd, the rest are interpreted as strings
master/buildbot/www/hooks/base.py
def getChanges(self, request): """ Consumes a naive build notification (the default for now) basically, set POST variables to match commit object parameters: revision, revlink, comments, branch, who, files, links files, links and properties will be de-json'd, the rest are interp...
def getChanges(self, request): """ Consumes a naive build notification (the default for now) basically, set POST variables to match commit object parameters: revision, revlink, comments, branch, who, files, links files, links and properties will be de-json'd, the rest are interp...
[ "Consumes", "a", "naive", "build", "notification", "(", "the", "default", "for", "now", ")", "basically", "set", "POST", "variables", "to", "match", "commit", "object", "parameters", ":", "revision", "revlink", "comments", "branch", "who", "files", "links" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/www/hooks/base.py#L32-L88
[ "def", "getChanges", "(", "self", ",", "request", ")", ":", "def", "firstOrNothing", "(", "value", ")", ":", "\"\"\"\n Small helper function to return the first value (if value is a list)\n or return the whole thing otherwise.\n\n Make sure to properly de...
5df3cfae6d760557d99156633c32b1822a1e130c
train
make_ref_target_directive
Create and return a L{BBRefTargetDirective} subclass.
master/docs/bbdocs/ext.py
def make_ref_target_directive(ref_type, indextemplates=None, **kwargs): """ Create and return a L{BBRefTargetDirective} subclass. """ class_vars = dict(ref_type=ref_type, indextemplates=indextemplates) class_vars.update(kwargs) return type("BB%sRefTargetDirective" % (ref_type.capitalize(),), ...
def make_ref_target_directive(ref_type, indextemplates=None, **kwargs): """ Create and return a L{BBRefTargetDirective} subclass. """ class_vars = dict(ref_type=ref_type, indextemplates=indextemplates) class_vars.update(kwargs) return type("BB%sRefTargetDirective" % (ref_type.capitalize(),), ...
[ "Create", "and", "return", "a", "L", "{", "BBRefTargetDirective", "}", "subclass", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/docs/bbdocs/ext.py#L123-L130
[ "def", "make_ref_target_directive", "(", "ref_type", ",", "indextemplates", "=", "None", ",", "*", "*", "kwargs", ")", ":", "class_vars", "=", "dict", "(", "ref_type", "=", "ref_type", ",", "indextemplates", "=", "indextemplates", ")", "class_vars", ".", "upda...
5df3cfae6d760557d99156633c32b1822a1e130c
train
make_index
Create and return a L{BBIndex} subclass, for use in the domain's C{indices}
master/docs/bbdocs/ext.py
def make_index(name, localname): """ Create and return a L{BBIndex} subclass, for use in the domain's C{indices} """ return type("BB%sIndex" % (name.capitalize(),), (BBIndex,), dict(name=name, localname=localname))
def make_index(name, localname): """ Create and return a L{BBIndex} subclass, for use in the domain's C{indices} """ return type("BB%sIndex" % (name.capitalize(),), (BBIndex,), dict(name=name, localname=localname))
[ "Create", "and", "return", "a", "L", "{", "BBIndex", "}", "subclass", "for", "use", "in", "the", "domain", "s", "C", "{", "indices", "}" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/docs/bbdocs/ext.py#L170-L176
[ "def", "make_index", "(", "name", ",", "localname", ")", ":", "return", "type", "(", "\"BB%sIndex\"", "%", "(", "name", ".", "capitalize", "(", ")", ",", ")", ",", "(", "BBIndex", ",", ")", ",", "dict", "(", "name", "=", "name", ",", "localname", "...
5df3cfae6d760557d99156633c32b1822a1e130c
train
BBRefTargetDirective.resolve_ref
Resolve a reference to a directive of this class
master/docs/bbdocs/ext.py
def resolve_ref(cls, domain, env, fromdocname, builder, typ, target, node, contnode): """ Resolve a reference to a directive of this class """ targets = domain.data['targets'].get(cls.ref_type, {}) try: todocname, targetname = targets[target] ...
def resolve_ref(cls, domain, env, fromdocname, builder, typ, target, node, contnode): """ Resolve a reference to a directive of this class """ targets = domain.data['targets'].get(cls.ref_type, {}) try: todocname, targetname = targets[target] ...
[ "Resolve", "a", "reference", "to", "a", "directive", "of", "this", "class" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/docs/bbdocs/ext.py#L105-L120
[ "def", "resolve_ref", "(", "cls", ",", "domain", ",", "env", ",", "fromdocname", ",", "builder", ",", "typ", ",", "target", ",", "node", ",", "contnode", ")", ":", "targets", "=", "domain", ".", "data", "[", "'targets'", "]", ".", "get", "(", "cls", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
BBIndex.resolve_ref
Resolve a reference to an index to the document containing the index, using the index's C{localname} as the content of the link.
master/docs/bbdocs/ext.py
def resolve_ref(cls, domain, env, fromdocname, builder, typ, target, node, contnode): """ Resolve a reference to an index to the document containing the index, using the index's C{localname} as the content of the link. """ # indexes appear to be automatically ...
def resolve_ref(cls, domain, env, fromdocname, builder, typ, target, node, contnode): """ Resolve a reference to an index to the document containing the index, using the index's C{localname} as the content of the link. """ # indexes appear to be automatically ...
[ "Resolve", "a", "reference", "to", "an", "index", "to", "the", "document", "containing", "the", "index", "using", "the", "index", "s", "C", "{", "localname", "}", "as", "the", "content", "of", "the", "link", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/docs/bbdocs/ext.py#L154-L167
[ "def", "resolve_ref", "(", "cls", ",", "domain", ",", "env", ",", "fromdocname", ",", "builder", ",", "typ", ",", "target", ",", "node", ",", "contnode", ")", ":", "# indexes appear to be automatically generated at doc DOMAIN-NAME", "todocname", "=", "\"bb-%s\"", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
RpmSpec.load
call this function after the file exists to populate properties
master/buildbot/steps/package/rpm/rpmspec.py
def load(self): """ call this function after the file exists to populate properties """ # If we are given a string, open it up else assume it's something we # can call read on. if isinstance(self.specfile, str): f = open(self.specfile, 'r') else: ...
def load(self): """ call this function after the file exists to populate properties """ # If we are given a string, open it up else assume it's something we # can call read on. if isinstance(self.specfile, str): f = open(self.specfile, 'r') else: ...
[ "call", "this", "function", "after", "the", "file", "exists", "to", "populate", "properties" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/package/rpm/rpmspec.py#L54-L71
[ "def", "load", "(", "self", ")", ":", "# If we are given a string, open it up else assume it's something we", "# can call read on.", "if", "isinstance", "(", "self", ".", "specfile", ",", "str", ")", ":", "f", "=", "open", "(", "self", ".", "specfile", ",", "'r'",...
5df3cfae6d760557d99156633c32b1822a1e130c
train
CapturePropertyBase.consume
Consumer for this (CaptureProperty) class. Gets the properties from data api and send them to the storage backends.
master/buildbot/statistics/capture.py
def consume(self, routingKey, msg): """ Consumer for this (CaptureProperty) class. Gets the properties from data api and send them to the storage backends. """ builder_info = yield self.master.data.get(("builders", msg['builderid'])) if self._builder_name_matches(builder...
def consume(self, routingKey, msg): """ Consumer for this (CaptureProperty) class. Gets the properties from data api and send them to the storage backends. """ builder_info = yield self.master.data.get(("builders", msg['builderid'])) if self._builder_name_matches(builder...
[ "Consumer", "for", "this", "(", "CaptureProperty", ")", "class", ".", "Gets", "the", "properties", "from", "data", "api", "and", "send", "them", "to", "the", "storage", "backends", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/statistics/capture.py#L80-L113
[ "def", "consume", "(", "self", ",", "routingKey", ",", "msg", ")", ":", "builder_info", "=", "yield", "self", ".", "master", ".", "data", ".", "get", "(", "(", "\"builders\"", ",", "msg", "[", "'builderid'", "]", ")", ")", "if", "self", ".", "_builde...
5df3cfae6d760557d99156633c32b1822a1e130c
train
CaptureBuildTimes.consume
Consumer for CaptureBuildStartTime. Gets the build start time.
master/buildbot/statistics/capture.py
def consume(self, routingKey, msg): """ Consumer for CaptureBuildStartTime. Gets the build start time. """ builder_info = yield self.master.data.get(("builders", msg['builderid'])) if self._builder_name_matches(builder_info): try: ret_val = self._callb...
def consume(self, routingKey, msg): """ Consumer for CaptureBuildStartTime. Gets the build start time. """ builder_info = yield self.master.data.get(("builders", msg['builderid'])) if self._builder_name_matches(builder_info): try: ret_val = self._callb...
[ "Consumer", "for", "CaptureBuildStartTime", ".", "Gets", "the", "build", "start", "time", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/statistics/capture.py#L160-L183
[ "def", "consume", "(", "self", ",", "routingKey", ",", "msg", ")", ":", "builder_info", "=", "yield", "self", ".", "master", ".", "data", ".", "get", "(", "(", "\"builders\"", ",", "msg", "[", "'builderid'", "]", ")", ")", "if", "self", ".", "_builde...
5df3cfae6d760557d99156633c32b1822a1e130c
train
CaptureDataBase.consume
Consumer for this (CaptureData) class. Gets the data sent from yieldMetricsValue and sends it to the storage backends.
master/buildbot/statistics/capture.py
def consume(self, routingKey, msg): """ Consumer for this (CaptureData) class. Gets the data sent from yieldMetricsValue and sends it to the storage backends. """ build_data = msg['build_data'] builder_info = yield self.master.data.get(("builders", build_data['builderid']...
def consume(self, routingKey, msg): """ Consumer for this (CaptureData) class. Gets the data sent from yieldMetricsValue and sends it to the storage backends. """ build_data = msg['build_data'] builder_info = yield self.master.data.get(("builders", build_data['builderid']...
[ "Consumer", "for", "this", "(", "CaptureData", ")", "class", ".", "Gets", "the", "data", "sent", "from", "yieldMetricsValue", "and", "sends", "it", "to", "the", "storage", "backends", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/statistics/capture.py#L339-L358
[ "def", "consume", "(", "self", ",", "routingKey", ",", "msg", ")", ":", "build_data", "=", "msg", "[", "'build_data'", "]", "builder_info", "=", "yield", "self", ".", "master", ".", "data", ".", "get", "(", "(", "\"builders\"", ",", "build_data", "[", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
GitHubStatusPush.createStatus
:param repo_user: GitHub user or organization :param repo_name: Name of the repository :param sha: Full sha to create the status for. :param state: one of the following 'pending', 'success', 'error' or 'failure'. :param target_url: Target url to associate with this ...
master/buildbot/reporters/github.py
def createStatus(self, repo_user, repo_name, sha, state, target_url=None, context=None, issue=None, description=None): """ :param repo_user: GitHub user or organization :param repo_name: Name of the repository :param sha: Full sha to create the s...
def createStatus(self, repo_user, repo_name, sha, state, target_url=None, context=None, issue=None, description=None): """ :param repo_user: GitHub user or organization :param repo_name: Name of the repository :param sha: Full sha to create the s...
[ ":", "param", "repo_user", ":", "GitHub", "user", "or", "organization", ":", "param", "repo_name", ":", "Name", "of", "the", "repository", ":", "param", "sha", ":", "Full", "sha", "to", "create", "the", "status", "for", ".", ":", "param", "state", ":", ...
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/reporters/github.py#L68-L99
[ "def", "createStatus", "(", "self", ",", "repo_user", ",", "repo_name", ",", "sha", ",", "state", ",", "target_url", "=", "None", ",", "context", "=", "None", ",", "issue", "=", "None", ",", "description", "=", "None", ")", ":", "payload", "=", "{", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
GitHubCommentPush.createStatus
:param repo_user: GitHub user or organization :param repo_name: Name of the repository :param issue: Pull request number :param state: one of the following 'pending', 'success', 'error' or 'failure'. :param description: Short description of the status. :retu...
master/buildbot/reporters/github.py
def createStatus(self, repo_user, repo_name, sha, state, target_url=None, context=None, issue=None, description=None): """ :param repo_user: GitHub user or organization :param repo_name: Name of the repository :param issue: Pull request number ...
def createStatus(self, repo_user, repo_name, sha, state, target_url=None, context=None, issue=None, description=None): """ :param repo_user: GitHub user or organization :param repo_name: Name of the repository :param issue: Pull request number ...
[ ":", "param", "repo_user", ":", "GitHub", "user", "or", "organization", ":", "param", "repo_name", ":", "Name", "of", "the", "repository", ":", "param", "issue", ":", "Pull", "request", "number", ":", "param", "state", ":", "one", "of", "the", "following",...
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/reporters/github.py#L197-L217
[ "def", "createStatus", "(", "self", ",", "repo_user", ",", "repo_name", ",", "sha", ",", "state", ",", "target_url", "=", "None", ",", "context", "=", "None", ",", "issue", "=", "None", ",", "description", "=", "None", ")", ":", "payload", "=", "{", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
stopWorker
Stop worker process by sending it a signal. Using the specified basedir path, read worker process's pid file and try to terminate that process with specified signal. @param basedir: worker's basedir path @param quite: if False, don't print any messages to stdout @param signame: signal to send to...
worker/buildbot_worker/scripts/stop.py
def stopWorker(basedir, quiet, signame="TERM"): """ Stop worker process by sending it a signal. Using the specified basedir path, read worker process's pid file and try to terminate that process with specified signal. @param basedir: worker's basedir path @param quite: if False, don't print ...
def stopWorker(basedir, quiet, signame="TERM"): """ Stop worker process by sending it a signal. Using the specified basedir path, read worker process's pid file and try to terminate that process with specified signal. @param basedir: worker's basedir path @param quite: if False, don't print ...
[ "Stop", "worker", "process", "by", "sending", "it", "a", "signal", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/worker/buildbot_worker/scripts/stop.py#L33-L76
[ "def", "stopWorker", "(", "basedir", ",", "quiet", ",", "signame", "=", "\"TERM\"", ")", ":", "import", "signal", "os", ".", "chdir", "(", "basedir", ")", "try", ":", "f", "=", "open", "(", "\"twistd.pid\"", ",", "\"rt\"", ")", "except", "IOError", ":"...
5df3cfae6d760557d99156633c32b1822a1e130c
train
BuildFactory.newBuild
Create a new Build instance. @param requests: a list of buildrequest dictionaries describing what is to be built
master/buildbot/process/factory.py
def newBuild(self, requests): """Create a new Build instance. @param requests: a list of buildrequest dictionaries describing what is to be built """ b = self.buildClass(requests) b.useProgress = self.useProgress b.workdir = self.workdir b.setStepFactorie...
def newBuild(self, requests): """Create a new Build instance. @param requests: a list of buildrequest dictionaries describing what is to be built """ b = self.buildClass(requests) b.useProgress = self.useProgress b.workdir = self.workdir b.setStepFactorie...
[ "Create", "a", "new", "Build", "instance", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/process/factory.py#L62-L72
[ "def", "newBuild", "(", "self", ",", "requests", ")", ":", "b", "=", "self", ".", "buildClass", "(", "requests", ")", "b", ".", "useProgress", "=", "self", ".", "useProgress", "b", ".", "workdir", "=", "self", ".", "workdir", "b", ".", "setStepFactorie...
5df3cfae6d760557d99156633c32b1822a1e130c
train
WarningCountingShellCommand.addSuppression
This method can be used to add patters of warnings that should not be counted. It takes a single argument, a list of patterns. Each pattern is a 4-tuple (FILE-RE, WARN-RE, START, END). FILE-RE is a regular expression (string or compiled regexp), or None. If None, the pattern m...
master/buildbot/steps/shell.py
def addSuppression(self, suppressionList): """ This method can be used to add patters of warnings that should not be counted. It takes a single argument, a list of patterns. Each pattern is a 4-tuple (FILE-RE, WARN-RE, START, END). FILE-RE is a regular expression (stri...
def addSuppression(self, suppressionList): """ This method can be used to add patters of warnings that should not be counted. It takes a single argument, a list of patterns. Each pattern is a 4-tuple (FILE-RE, WARN-RE, START, END). FILE-RE is a regular expression (stri...
[ "This", "method", "can", "be", "used", "to", "add", "patters", "of", "warnings", "that", "should", "not", "be", "counted", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/shell.py#L446-L472
[ "def", "addSuppression", "(", "self", ",", "suppressionList", ")", ":", "for", "fileRe", ",", "warnRe", ",", "start", ",", "end", "in", "suppressionList", ":", "if", "fileRe", "is", "not", "None", "and", "isinstance", "(", "fileRe", ",", "str", ")", ":",...
5df3cfae6d760557d99156633c32b1822a1e130c
train
WarningCountingShellCommand.warnExtractFromRegexpGroups
Extract file name, line number, and warning text as groups (1,2,3) of warningPattern match.
master/buildbot/steps/shell.py
def warnExtractFromRegexpGroups(self, line, match): """ Extract file name, line number, and warning text as groups (1,2,3) of warningPattern match.""" file = match.group(1) lineNo = match.group(2) if lineNo is not None: lineNo = int(lineNo) text = matc...
def warnExtractFromRegexpGroups(self, line, match): """ Extract file name, line number, and warning text as groups (1,2,3) of warningPattern match.""" file = match.group(1) lineNo = match.group(2) if lineNo is not None: lineNo = int(lineNo) text = matc...
[ "Extract", "file", "name", "line", "number", "and", "warning", "text", "as", "groups", "(", "1", "2", "3", ")", "of", "warningPattern", "match", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/shell.py#L480-L489
[ "def", "warnExtractFromRegexpGroups", "(", "self", ",", "line", ",", "match", ")", ":", "file", "=", "match", ".", "group", "(", "1", ")", "lineNo", "=", "match", ".", "group", "(", "2", ")", "if", "lineNo", "is", "not", "None", ":", "lineNo", "=", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
WarningCountingShellCommand.createSummary
Match log lines against warningPattern. Warnings are collected into another log for this step, and the build-wide 'warnings-count' is updated.
master/buildbot/steps/shell.py
def createSummary(self, log): """ Match log lines against warningPattern. Warnings are collected into another log for this step, and the build-wide 'warnings-count' is updated.""" # If there were any warnings, make the log if lines with warnings # available if s...
def createSummary(self, log): """ Match log lines against warningPattern. Warnings are collected into another log for this step, and the build-wide 'warnings-count' is updated.""" # If there were any warnings, make the log if lines with warnings # available if s...
[ "Match", "log", "lines", "against", "warningPattern", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/shell.py#L584-L602
[ "def", "createSummary", "(", "self", ",", "log", ")", ":", "# If there were any warnings, make the log if lines with warnings", "# available", "if", "self", ".", "warnCount", ":", "self", ".", "addCompleteLog", "(", "\"warnings (%d)\"", "%", "self", ".", "warnCount", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
Cppcheck.evaluateCommand
cppcheck always return 0, unless a special parameter is given
master/buildbot/steps/cppcheck.py
def evaluateCommand(self, cmd): """ cppcheck always return 0, unless a special parameter is given """ for msg in self.flunkingIssues: if self.counts[msg] != 0: return FAILURE if self.getProperty('cppcheck-total') != 0: return WARNINGS return SUCCES...
def evaluateCommand(self, cmd): """ cppcheck always return 0, unless a special parameter is given """ for msg in self.flunkingIssues: if self.counts[msg] != 0: return FAILURE if self.getProperty('cppcheck-total') != 0: return WARNINGS return SUCCES...
[ "cppcheck", "always", "return", "0", "unless", "a", "special", "parameter", "is", "given" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/cppcheck.py#L88-L95
[ "def", "evaluateCommand", "(", "self", ",", "cmd", ")", ":", "for", "msg", "in", "self", ".", "flunkingIssues", ":", "if", "self", ".", "counts", "[", "msg", "]", "!=", "0", ":", "return", "FAILURE", "if", "self", ".", "getProperty", "(", "'cppcheck-to...
5df3cfae6d760557d99156633c32b1822a1e130c
train
SecretInPass.get
get the value from pass identified by 'entry'
master/buildbot/secrets/providers/passwordstore.py
def get(self, entry): """ get the value from pass identified by 'entry' """ try: output = yield utils.getProcessOutput( "pass", args=[entry], env=self._env ) return output.decode("utf-8", "ignore").splitl...
def get(self, entry): """ get the value from pass identified by 'entry' """ try: output = yield utils.getProcessOutput( "pass", args=[entry], env=self._env ) return output.decode("utf-8", "ignore").splitl...
[ "get", "the", "value", "from", "pass", "identified", "by", "entry" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/secrets/providers/passwordstore.py#L56-L68
[ "def", "get", "(", "self", ",", "entry", ")", ":", "try", ":", "output", "=", "yield", "utils", ".", "getProcessOutput", "(", "\"pass\"", ",", "args", "=", "[", "entry", "]", ",", "env", "=", "self", ".", "_env", ")", "return", "output", ".", "deco...
5df3cfae6d760557d99156633c32b1822a1e130c
train
patch
Patch startService and stopService so that they check the previous state first. (used for debugging only)
master/buildbot/monkeypatches/servicechecks.py
def patch(): """ Patch startService and stopService so that they check the previous state first. (used for debugging only) """ from twisted.application.service import Service old_startService = Service.startService old_stopService = Service.stopService def startService(self): ...
def patch(): """ Patch startService and stopService so that they check the previous state first. (used for debugging only) """ from twisted.application.service import Service old_startService = Service.startService old_stopService = Service.stopService def startService(self): ...
[ "Patch", "startService", "and", "stopService", "so", "that", "they", "check", "the", "previous", "state", "first", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/monkeypatches/servicechecks.py#L17-L36
[ "def", "patch", "(", ")", ":", "from", "twisted", ".", "application", ".", "service", "import", "Service", "old_startService", "=", "Service", ".", "startService", "old_stopService", "=", "Service", ".", "stopService", "def", "startService", "(", "self", ")", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
DBConnector._doCleanup
Perform any periodic database cleanup tasks. @returns: Deferred
master/buildbot/db/connector.py
def _doCleanup(self): """ Perform any periodic database cleanup tasks. @returns: Deferred """ # pass on this if we're not configured yet if not self.configured_url: return d = self.changes.pruneChanges(self.master.config.changeHorizon) d.addE...
def _doCleanup(self): """ Perform any periodic database cleanup tasks. @returns: Deferred """ # pass on this if we're not configured yet if not self.configured_url: return d = self.changes.pruneChanges(self.master.config.changeHorizon) d.addE...
[ "Perform", "any", "periodic", "database", "cleanup", "tasks", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/connector.py#L142-L154
[ "def", "_doCleanup", "(", "self", ")", ":", "# pass on this if we're not configured yet", "if", "not", "self", ".", "configured_url", ":", "return", "d", "=", "self", ".", "changes", ".", "pruneChanges", "(", "self", ".", "master", ".", "config", ".", "changeH...
5df3cfae6d760557d99156633c32b1822a1e130c
train
SqlLiteStrategy.set_up
Special setup for sqlite engines
master/buildbot/db/enginestrategy.py
def set_up(self, u, engine): """Special setup for sqlite engines""" def connect_listener_enable_fk(connection, record): # fk must be enabled for all connections if not getattr(engine, "fk_disabled", False): return # http://trac.buildbot.net/ticket/3490#ticket ...
def set_up(self, u, engine): """Special setup for sqlite engines""" def connect_listener_enable_fk(connection, record): # fk must be enabled for all connections if not getattr(engine, "fk_disabled", False): return # http://trac.buildbot.net/ticket/3490#ticket ...
[ "Special", "setup", "for", "sqlite", "engines" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/enginestrategy.py#L64-L84
[ "def", "set_up", "(", "self", ",", "u", ",", "engine", ")", ":", "def", "connect_listener_enable_fk", "(", "connection", ",", "record", ")", ":", "# fk must be enabled for all connections", "if", "not", "getattr", "(", "engine", ",", "\"fk_disabled\"", ",", "Fal...
5df3cfae6d760557d99156633c32b1822a1e130c
train
MySQLStrategy.set_up
Special setup for mysql engines
master/buildbot/db/enginestrategy.py
def set_up(self, u, engine): """Special setup for mysql engines""" # add the reconnecting PoolListener that will detect a # disconnected connection and automatically start a new # one. This provides a measure of additional safety over # the pool_recycle parameter, and is useful ...
def set_up(self, u, engine): """Special setup for mysql engines""" # add the reconnecting PoolListener that will detect a # disconnected connection and automatically start a new # one. This provides a measure of additional safety over # the pool_recycle parameter, and is useful ...
[ "Special", "setup", "for", "mysql", "engines" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/enginestrategy.py#L102-L130
[ "def", "set_up", "(", "self", ",", "u", ",", "engine", ")", ":", "# add the reconnecting PoolListener that will detect a", "# disconnected connection and automatically start a new", "# one. This provides a measure of additional safety over", "# the pool_recycle parameter, and is useful wh...
5df3cfae6d760557d99156633c32b1822a1e130c
train
BuildbotEngineStrategy.special_case_sqlite
For sqlite, percent-substitute %(basedir)s and use a full path to the basedir. If using a memory database, force the pool size to be 1.
master/buildbot/db/enginestrategy.py
def special_case_sqlite(self, u, kwargs): """For sqlite, percent-substitute %(basedir)s and use a full path to the basedir. If using a memory database, force the pool size to be 1.""" max_conns = 1 # when given a database path, stick the basedir in there if u.database: ...
def special_case_sqlite(self, u, kwargs): """For sqlite, percent-substitute %(basedir)s and use a full path to the basedir. If using a memory database, force the pool size to be 1.""" max_conns = 1 # when given a database path, stick the basedir in there if u.database: ...
[ "For", "sqlite", "percent", "-", "substitute", "%", "(", "basedir", ")", "s", "and", "use", "a", "full", "path", "to", "the", "basedir", ".", "If", "using", "a", "memory", "database", "force", "the", "pool", "size", "to", "be", "1", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/enginestrategy.py#L164-L198
[ "def", "special_case_sqlite", "(", "self", ",", "u", ",", "kwargs", ")", ":", "max_conns", "=", "1", "# when given a database path, stick the basedir in there", "if", "u", ".", "database", ":", "# Use NullPool instead of the sqlalchemy-0.6.8-default", "# SingletonThreadPool f...
5df3cfae6d760557d99156633c32b1822a1e130c
train
BuildbotEngineStrategy.special_case_mysql
For mysql, take max_idle out of the query arguments, and use its value for pool_recycle. Also, force use_unicode and charset to be True and 'utf8', failing if they were set to anything else.
master/buildbot/db/enginestrategy.py
def special_case_mysql(self, u, kwargs): """For mysql, take max_idle out of the query arguments, and use its value for pool_recycle. Also, force use_unicode and charset to be True and 'utf8', failing if they were set to anything else.""" kwargs['pool_recycle'] = int(u.query.pop...
def special_case_mysql(self, u, kwargs): """For mysql, take max_idle out of the query arguments, and use its value for pool_recycle. Also, force use_unicode and charset to be True and 'utf8', failing if they were set to anything else.""" kwargs['pool_recycle'] = int(u.query.pop...
[ "For", "mysql", "take", "max_idle", "out", "of", "the", "query", "arguments", "and", "use", "its", "value", "for", "pool_recycle", ".", "Also", "force", "use_unicode", "and", "charset", "to", "be", "True", "and", "utf8", "failing", "if", "they", "were", "s...
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/enginestrategy.py#L200-L228
[ "def", "special_case_mysql", "(", "self", ",", "u", ",", "kwargs", ")", ":", "kwargs", "[", "'pool_recycle'", "]", "=", "int", "(", "u", ".", "query", ".", "pop", "(", "'max_idle'", ",", "3600", ")", ")", "# default to the MyISAM storage engine", "storage_en...
5df3cfae6d760557d99156633c32b1822a1e130c
train
OpenStackLatentWorker._constructClient
Return a novaclient from the given args.
master/buildbot/worker/openstack.py
def _constructClient(client_version, username, user_domain, password, project_name, project_domain, auth_url): """Return a novaclient from the given args.""" loader = loading.get_plugin_loader('password') # These only work with v3 if user_domain is not None or p...
def _constructClient(client_version, username, user_domain, password, project_name, project_domain, auth_url): """Return a novaclient from the given args.""" loader = loading.get_plugin_loader('password') # These only work with v3 if user_domain is not None or p...
[ "Return", "a", "novaclient", "from", "the", "given", "args", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/openstack.py#L106-L120
[ "def", "_constructClient", "(", "client_version", ",", "username", ",", "user_domain", ",", "password", ",", "project_name", ",", "project_domain", ",", "auth_url", ")", ":", "loader", "=", "loading", ".", "get_plugin_loader", "(", "'password'", ")", "# These only...
5df3cfae6d760557d99156633c32b1822a1e130c
train
OpenStackLatentWorker._parseBlockDevice
Parse a higher-level view of the block device mapping into something novaclient wants. This should be similar to how Horizon presents it. Required keys: device_name: The name of the device; e.g. vda or xda. source_type: image, snapshot, volume, or blank/None. destinat...
master/buildbot/worker/openstack.py
def _parseBlockDevice(self, block_device): """ Parse a higher-level view of the block device mapping into something novaclient wants. This should be similar to how Horizon presents it. Required keys: device_name: The name of the device; e.g. vda or xda. source_typ...
def _parseBlockDevice(self, block_device): """ Parse a higher-level view of the block device mapping into something novaclient wants. This should be similar to how Horizon presents it. Required keys: device_name: The name of the device; e.g. vda or xda. source_typ...
[ "Parse", "a", "higher", "-", "level", "view", "of", "the", "block", "device", "mapping", "into", "something", "novaclient", "wants", ".", "This", "should", "be", "similar", "to", "how", "Horizon", "presents", "it", ".", "Required", "keys", ":", "device_name"...
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/openstack.py#L122-L149
[ "def", "_parseBlockDevice", "(", "self", ",", "block_device", ")", ":", "client_block_device", "=", "{", "}", "client_block_device", "[", "'device_name'", "]", "=", "block_device", ".", "get", "(", "'device_name'", ",", "'vda'", ")", "client_block_device", "[", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
OpenStackLatentWorker._renderBlockDevice
Render all of the block device's values.
master/buildbot/worker/openstack.py
def _renderBlockDevice(self, block_device, build): """Render all of the block device's values.""" rendered_block_device = yield build.render(block_device) if rendered_block_device['volume_size'] is None: source_type = rendered_block_device['source_type'] source_uuid = ren...
def _renderBlockDevice(self, block_device, build): """Render all of the block device's values.""" rendered_block_device = yield build.render(block_device) if rendered_block_device['volume_size'] is None: source_type = rendered_block_device['source_type'] source_uuid = ren...
[ "Render", "all", "of", "the", "block", "device", "s", "values", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/openstack.py#L152-L160
[ "def", "_renderBlockDevice", "(", "self", ",", "block_device", ",", "build", ")", ":", "rendered_block_device", "=", "yield", "build", ".", "render", "(", "block_device", ")", "if", "rendered_block_device", "[", "'volume_size'", "]", "is", "None", ":", "source_t...
5df3cfae6d760557d99156633c32b1822a1e130c
train
OpenStackLatentWorker._determineVolumeSize
Determine the minimum size the volume needs to be for the source. Returns the size in GiB.
master/buildbot/worker/openstack.py
def _determineVolumeSize(self, source_type, source_uuid): """ Determine the minimum size the volume needs to be for the source. Returns the size in GiB. """ nova = self.novaclient if source_type == 'image': # The size returned for an image is in bytes. Round u...
def _determineVolumeSize(self, source_type, source_uuid): """ Determine the minimum size the volume needs to be for the source. Returns the size in GiB. """ nova = self.novaclient if source_type == 'image': # The size returned for an image is in bytes. Round u...
[ "Determine", "the", "minimum", "size", "the", "volume", "needs", "to", "be", "for", "the", "source", ".", "Returns", "the", "size", "in", "GiB", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/openstack.py#L162-L186
[ "def", "_determineVolumeSize", "(", "self", ",", "source_type", ",", "source_uuid", ")", ":", "nova", "=", "self", ".", "novaclient", "if", "source_type", "==", "'image'", ":", "# The size returned for an image is in bytes. Round up to the next", "# integer GiB.", "image"...
5df3cfae6d760557d99156633c32b1822a1e130c
train
MTR.runInteractionWithRetry
Run a database transaction with dbpool.runInteraction, but retry the transaction in case of a temporary error (like connection lost). This is needed to be robust against things like database connection idle timeouts. The passed callable that implements the transaction must be retryable...
master/buildbot/steps/mtrlogobserver.py
def runInteractionWithRetry(self, actionFn, *args, **kw): """ Run a database transaction with dbpool.runInteraction, but retry the transaction in case of a temporary error (like connection lost). This is needed to be robust against things like database connection idle timeouts. ...
def runInteractionWithRetry(self, actionFn, *args, **kw): """ Run a database transaction with dbpool.runInteraction, but retry the transaction in case of a temporary error (like connection lost). This is needed to be robust against things like database connection idle timeouts. ...
[ "Run", "a", "database", "transaction", "with", "dbpool", ".", "runInteraction", "but", "retry", "the", "transaction", "in", "case", "of", "a", "temporary", "error", "(", "like", "connection", "lost", ")", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/mtrlogobserver.py#L339-L368
[ "def", "runInteractionWithRetry", "(", "self", ",", "actionFn", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "def", "runWithRetry", "(", "txn", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "retryCount", "=", "0", "while", "(", "True", ")", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
MTR.runQueryWithRetry
Run a database query, like with dbpool.runQuery, but retry the query in case of a temporary error (like connection lost). This is needed to be robust against things like database connection idle timeouts.
master/buildbot/steps/mtrlogobserver.py
def runQueryWithRetry(self, *args, **kw): """ Run a database query, like with dbpool.runQuery, but retry the query in case of a temporary error (like connection lost). This is needed to be robust against things like database connection idle timeouts.""" def runQuery(txn...
def runQueryWithRetry(self, *args, **kw): """ Run a database query, like with dbpool.runQuery, but retry the query in case of a temporary error (like connection lost). This is needed to be robust against things like database connection idle timeouts.""" def runQuery(txn...
[ "Run", "a", "database", "query", "like", "with", "dbpool", ".", "runQuery", "but", "retry", "the", "query", "in", "case", "of", "a", "temporary", "error", "(", "like", "connection", "lost", ")", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/steps/mtrlogobserver.py#L370-L382
[ "def", "runQueryWithRetry", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "def", "runQuery", "(", "txn", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "txn", ".", "execute", "(", "*", "args", ",", "*", "*", "kw", ")", "retu...
5df3cfae6d760557d99156633c32b1822a1e130c
train
timed_do_fn
Decorate a do function to log before, after, and elapsed time, with the name of the calling function. This is not speedy!
master/buildbot/db/pool.py
def timed_do_fn(f): """Decorate a do function to log before, after, and elapsed time, with the name of the calling function. This is not speedy!""" def wrap(callable, *args, **kwargs): global _debug_id # get a description of the function that called us st = traceback.extract_stack(...
def timed_do_fn(f): """Decorate a do function to log before, after, and elapsed time, with the name of the calling function. This is not speedy!""" def wrap(callable, *args, **kwargs): global _debug_id # get a description of the function that called us st = traceback.extract_stack(...
[ "Decorate", "a", "do", "function", "to", "log", "before", "after", "and", "elapsed", "time", "with", "the", "name", "of", "the", "calling", "function", ".", "This", "is", "not", "speedy!" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/pool.py#L42-L87
[ "def", "timed_do_fn", "(", "f", ")", ":", "def", "wrap", "(", "callable", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "global", "_debug_id", "# get a description of the function that called us", "st", "=", "traceback", ".", "extract_stack", "(", "limi...
5df3cfae6d760557d99156633c32b1822a1e130c
train
DBThreadPool.shutdown
Manually stop the pool. This is only necessary from tests, as the pool will stop itself when the reactor stops under normal circumstances.
master/buildbot/db/pool.py
def shutdown(self): """Manually stop the pool. This is only necessary from tests, as the pool will stop itself when the reactor stops under normal circumstances.""" if not self._stop_evt: return # pool is already stopped self.reactor.removeSystemEventTrigger(self._s...
def shutdown(self): """Manually stop the pool. This is only necessary from tests, as the pool will stop itself when the reactor stops under normal circumstances.""" if not self._stop_evt: return # pool is already stopped self.reactor.removeSystemEventTrigger(self._s...
[ "Manually", "stop", "the", "pool", ".", "This", "is", "only", "necessary", "from", "tests", "as", "the", "pool", "will", "stop", "itself", "when", "the", "reactor", "stops", "under", "normal", "circumstances", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/db/pool.py#L152-L159
[ "def", "shutdown", "(", "self", ")", ":", "if", "not", "self", ".", "_stop_evt", ":", "return", "# pool is already stopped", "self", ".", "reactor", ".", "removeSystemEventTrigger", "(", "self", ".", "_stop_evt", ")", "self", ".", "_stop", "(", ")" ]
5df3cfae6d760557d99156633c32b1822a1e130c
train
show
Display the data attributes of an object in a readable format
master/buildbot/manhole.py
def show(x): """Display the data attributes of an object in a readable format""" print("data attributes of %r" % (x,)) names = dir(x) maxlen = max([0] + [len(n) for n in names]) for k in names: v = getattr(x, k) if isinstance(v, types.MethodType): continue if k[:2...
def show(x): """Display the data attributes of an object in a readable format""" print("data attributes of %r" % (x,)) names = dir(x) maxlen = max([0] + [len(n) for n in names]) for k in names: v = getattr(x, k) if isinstance(v, types.MethodType): continue if k[:2...
[ "Display", "the", "data", "attributes", "of", "an", "object", "in", "a", "readable", "format" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/manhole.py#L340-L361
[ "def", "show", "(", "x", ")", ":", "print", "(", "\"data attributes of %r\"", "%", "(", "x", ",", ")", ")", "names", "=", "dir", "(", "x", ")", "maxlen", "=", "max", "(", "[", "0", "]", "+", "[", "len", "(", "n", ")", "for", "n", "in", "names...
5df3cfae6d760557d99156633c32b1822a1e130c
train
Connection.lookupByName
I lookup an existing predefined domain
master/buildbot/worker/libvirt.py
def lookupByName(self, name): """ I lookup an existing predefined domain """ res = yield queue.executeInThread(self.connection.lookupByName, name) return self.DomainClass(self, res)
def lookupByName(self, name): """ I lookup an existing predefined domain """ res = yield queue.executeInThread(self.connection.lookupByName, name) return self.DomainClass(self, res)
[ "I", "lookup", "an", "existing", "predefined", "domain" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/libvirt.py#L133-L136
[ "def", "lookupByName", "(", "self", ",", "name", ")", ":", "res", "=", "yield", "queue", ".", "executeInThread", "(", "self", ".", "connection", ".", "lookupByName", ",", "name", ")", "return", "self", ".", "DomainClass", "(", "self", ",", "res", ")" ]
5df3cfae6d760557d99156633c32b1822a1e130c
train
Connection.create
I take libvirt XML and start a new VM
master/buildbot/worker/libvirt.py
def create(self, xml): """ I take libvirt XML and start a new VM """ res = yield queue.executeInThread(self.connection.createXML, xml, 0) return self.DomainClass(self, res)
def create(self, xml): """ I take libvirt XML and start a new VM """ res = yield queue.executeInThread(self.connection.createXML, xml, 0) return self.DomainClass(self, res)
[ "I", "take", "libvirt", "XML", "and", "start", "a", "new", "VM" ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/libvirt.py#L139-L142
[ "def", "create", "(", "self", ",", "xml", ")", ":", "res", "=", "yield", "queue", ".", "executeInThread", "(", "self", ".", "connection", ".", "createXML", ",", "xml", ",", "0", ")", "return", "self", ".", "DomainClass", "(", "self", ",", "res", ")" ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
LibVirtWorker._find_existing_instance
I find existing VMs that are already running that might be orphaned instances of this worker.
master/buildbot/worker/libvirt.py
def _find_existing_instance(self): """ I find existing VMs that are already running that might be orphaned instances of this worker. """ if not self.connection: return None domains = yield self.connection.all() for d in domains: name = yield d.nam...
def _find_existing_instance(self): """ I find existing VMs that are already running that might be orphaned instances of this worker. """ if not self.connection: return None domains = yield self.connection.all() for d in domains: name = yield d.nam...
[ "I", "find", "existing", "VMs", "that", "are", "already", "running", "that", "might", "be", "orphaned", "instances", "of", "this", "worker", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/libvirt.py#L179-L193
[ "def", "_find_existing_instance", "(", "self", ")", ":", "if", "not", "self", ".", "connection", ":", "return", "None", "domains", "=", "yield", "self", ".", "connection", ".", "all", "(", ")", "for", "d", "in", "domains", ":", "name", "=", "yield", "d...
5df3cfae6d760557d99156633c32b1822a1e130c
train
LibVirtWorker._prepare_base_image
I am a private method for creating (possibly cheap) copies of a base_image for start_instance to boot.
master/buildbot/worker/libvirt.py
def _prepare_base_image(self): """ I am a private method for creating (possibly cheap) copies of a base_image for start_instance to boot. """ if not self.base_image: return defer.succeed(True) if self.cheap_copy: clone_cmd = "qemu-img" ...
def _prepare_base_image(self): """ I am a private method for creating (possibly cheap) copies of a base_image for start_instance to boot. """ if not self.base_image: return defer.succeed(True) if self.cheap_copy: clone_cmd = "qemu-img" ...
[ "I", "am", "a", "private", "method", "for", "creating", "(", "possibly", "cheap", ")", "copies", "of", "a", "base_image", "for", "start_instance", "to", "boot", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/libvirt.py#L207-L241
[ "def", "_prepare_base_image", "(", "self", ")", ":", "if", "not", "self", ".", "base_image", ":", "return", "defer", ".", "succeed", "(", "True", ")", "if", "self", ".", "cheap_copy", ":", "clone_cmd", "=", "\"qemu-img\"", "clone_args", "=", "\"create -b %(b...
5df3cfae6d760557d99156633c32b1822a1e130c
train
LibVirtWorker.start_instance
I start a new instance of a VM. If a base_image is specified, I will make a clone of that otherwise i will use image directly. If i'm not given libvirt domain definition XML, I will look for my name in the list of defined virtual machines and start that.
master/buildbot/worker/libvirt.py
def start_instance(self, build): """ I start a new instance of a VM. If a base_image is specified, I will make a clone of that otherwise i will use image directly. If i'm not given libvirt domain definition XML, I will look for my name in the list of defined virtual mac...
def start_instance(self, build): """ I start a new instance of a VM. If a base_image is specified, I will make a clone of that otherwise i will use image directly. If i'm not given libvirt domain definition XML, I will look for my name in the list of defined virtual mac...
[ "I", "start", "a", "new", "instance", "of", "a", "VM", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/libvirt.py#L244-L274
[ "def", "start_instance", "(", "self", ",", "build", ")", ":", "if", "self", ".", "domain", "is", "not", "None", ":", "log", ".", "msg", "(", "\"Cannot start_instance '%s' as already active\"", "%", "self", ".", "workername", ")", "return", "False", "yield", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
LibVirtWorker.stop_instance
I attempt to stop a running VM. I make sure any connection to the worker is removed. If the VM was using a cloned image, I remove the clone When everything is tidied up, I ask that bbot looks for work to do
master/buildbot/worker/libvirt.py
def stop_instance(self, fast=False): """ I attempt to stop a running VM. I make sure any connection to the worker is removed. If the VM was using a cloned image, I remove the clone When everything is tidied up, I ask that bbot looks for work to do """ log.msg("Att...
def stop_instance(self, fast=False): """ I attempt to stop a running VM. I make sure any connection to the worker is removed. If the VM was using a cloned image, I remove the clone When everything is tidied up, I ask that bbot looks for work to do """ log.msg("Att...
[ "I", "attempt", "to", "stop", "a", "running", "VM", ".", "I", "make", "sure", "any", "connection", "to", "the", "worker", "is", "removed", ".", "If", "the", "VM", "was", "using", "a", "cloned", "image", "I", "remove", "the", "clone", "When", "everythin...
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/worker/libvirt.py#L276-L312
[ "def", "stop_instance", "(", "self", ",", "fast", "=", "False", ")", ":", "log", ".", "msg", "(", "\"Attempting to stop '%s'\"", "%", "self", ".", "workername", ")", "if", "self", ".", "domain", "is", "None", ":", "log", ".", "msg", "(", "\"I don't think...
5df3cfae6d760557d99156633c32b1822a1e130c
train
get_simple_split
Splits the branchfile argument and assuming branch is the first path component in branchfile, will return branch and file else None.
master/buildbot/changes/p4poller.py
def get_simple_split(branchfile): """Splits the branchfile argument and assuming branch is the first path component in branchfile, will return branch and file else None.""" index = branchfile.find('/') if index == -1: return None, None branch, file = branchfile.split('/', 1) r...
def get_simple_split(branchfile): """Splits the branchfile argument and assuming branch is the first path component in branchfile, will return branch and file else None.""" index = branchfile.find('/') if index == -1: return None, None branch, file = branchfile.split('/', 1) r...
[ "Splits", "the", "branchfile", "argument", "and", "assuming", "branch", "is", "the", "first", "path", "component", "in", "branchfile", "will", "return", "branch", "and", "file", "else", "None", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/changes/p4poller.py#L83-L92
[ "def", "get_simple_split", "(", "branchfile", ")", ":", "index", "=", "branchfile", ".", "find", "(", "'/'", ")", "if", "index", "==", "-", "1", ":", "return", "None", ",", "None", "branch", ",", "file", "=", "branchfile", ".", "split", "(", "'/'", "...
5df3cfae6d760557d99156633c32b1822a1e130c
train
TryBase.filterBuilderList
Make sure that C{builderNames} is a subset of the configured C{self.builderNames}, returning an empty list if not. If C{builderNames} is empty, use C{self.builderNames}. @returns: list of builder names to build on
master/buildbot/schedulers/trysched.py
def filterBuilderList(self, builderNames): """ Make sure that C{builderNames} is a subset of the configured C{self.builderNames}, returning an empty list if not. If C{builderNames} is empty, use C{self.builderNames}. @returns: list of builder names to build on """ ...
def filterBuilderList(self, builderNames): """ Make sure that C{builderNames} is a subset of the configured C{self.builderNames}, returning an empty list if not. If C{builderNames} is empty, use C{self.builderNames}. @returns: list of builder names to build on """ ...
[ "Make", "sure", "that", "C", "{", "builderNames", "}", "is", "a", "subset", "of", "the", "configured", "C", "{", "self", ".", "builderNames", "}", "returning", "an", "empty", "list", "if", "not", ".", "If", "C", "{", "builderNames", "}", "is", "empty",...
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/schedulers/trysched.py#L34-L56
[ "def", "filterBuilderList", "(", "self", ",", "builderNames", ")", ":", "# self.builderNames is the configured list of builders", "# available for try. If the user supplies a list of builders,", "# it must be restricted to the configured list. If not, build", "# on all of the configured buil...
5df3cfae6d760557d99156633c32b1822a1e130c
train
LRUCache._ref_key
Record a reference to the argument key.
master/buildbot/util/lru.py
def _ref_key(self, key): """Record a reference to the argument key.""" queue = self.queue refcount = self.refcount queue.append(key) refcount[key] = refcount[key] + 1 # periodically compact the queue by eliminating duplicate keys # while preserving order of most...
def _ref_key(self, key): """Record a reference to the argument key.""" queue = self.queue refcount = self.refcount queue.append(key) refcount[key] = refcount[key] + 1 # periodically compact the queue by eliminating duplicate keys # while preserving order of most...
[ "Record", "a", "reference", "to", "the", "argument", "key", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/util/lru.py#L108-L127
[ "def", "_ref_key", "(", "self", ",", "key", ")", ":", "queue", "=", "self", ".", "queue", "refcount", "=", "self", ".", "refcount", "queue", ".", "append", "(", "key", ")", "refcount", "[", "key", "]", "=", "refcount", "[", "key", "]", "+", "1", ...
5df3cfae6d760557d99156633c32b1822a1e130c
train
LRUCache._get_hit
Try to do a value lookup from the existing cache entries.
master/buildbot/util/lru.py
def _get_hit(self, key): """Try to do a value lookup from the existing cache entries.""" try: result = self.cache[key] self.hits += 1 self._ref_key(key) return result except KeyError: pass result = self.weakrefs[key] se...
def _get_hit(self, key): """Try to do a value lookup from the existing cache entries.""" try: result = self.cache[key] self.hits += 1 self._ref_key(key) return result except KeyError: pass result = self.weakrefs[key] se...
[ "Try", "to", "do", "a", "value", "lookup", "from", "the", "existing", "cache", "entries", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/util/lru.py#L129-L143
[ "def", "_get_hit", "(", "self", ",", "key", ")", ":", "try", ":", "result", "=", "self", ".", "cache", "[", "key", "]", "self", ".", "hits", "+=", "1", "self", ".", "_ref_key", "(", "key", ")", "return", "result", "except", "KeyError", ":", "pass",...
5df3cfae6d760557d99156633c32b1822a1e130c
train
LRUCache._purge
Trim the cache down to max_size by evicting the least-recently-used entries.
master/buildbot/util/lru.py
def _purge(self): """ Trim the cache down to max_size by evicting the least-recently-used entries. """ if len(self.cache) <= self.max_size: return cache = self.cache refcount = self.refcount queue = self.queue max_size = self.max_size ...
def _purge(self): """ Trim the cache down to max_size by evicting the least-recently-used entries. """ if len(self.cache) <= self.max_size: return cache = self.cache refcount = self.refcount queue = self.queue max_size = self.max_size ...
[ "Trim", "the", "cache", "down", "to", "max_size", "by", "evicting", "the", "least", "-", "recently", "-", "used", "entries", "." ]
buildbot/buildbot
python
https://github.com/buildbot/buildbot/blob/5df3cfae6d760557d99156633c32b1822a1e130c/master/buildbot/util/lru.py#L145-L166
[ "def", "_purge", "(", "self", ")", ":", "if", "len", "(", "self", ".", "cache", ")", "<=", "self", ".", "max_size", ":", "return", "cache", "=", "self", ".", "cache", "refcount", "=", "self", ".", "refcount", "queue", "=", "self", ".", "queue", "ma...
5df3cfae6d760557d99156633c32b1822a1e130c