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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | SeleniumSatchel.record_manifest | Called after a deployment to record any data necessary to detect changes
for a future deployment. | burlap/selenium.py | def record_manifest(self):
"""
Called after a deployment to record any data necessary to detect changes
for a future deployment.
"""
manifest = super(SeleniumSatchel, self).record_manifest()
manifest['fingerprint'] = str(self.get_target_geckodriver_version_number())
... | def record_manifest(self):
"""
Called after a deployment to record any data necessary to detect changes
for a future deployment.
"""
manifest = super(SeleniumSatchel, self).record_manifest()
manifest['fingerprint'] = str(self.get_target_geckodriver_version_number())
... | [
"Called",
"after",
"a",
"deployment",
"to",
"record",
"any",
"data",
"necessary",
"to",
"detect",
"changes",
"for",
"a",
"future",
"deployment",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/selenium.py#L118-L125 | [
"def",
"record_manifest",
"(",
"self",
")",
":",
"manifest",
"=",
"super",
"(",
"SeleniumSatchel",
",",
"self",
")",
".",
"record_manifest",
"(",
")",
"manifest",
"[",
"'fingerprint'",
"]",
"=",
"str",
"(",
"self",
".",
"get_target_geckodriver_version_number",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | update | Upgrade all packages, skip obsoletes if ``obsoletes=0`` in ``yum.conf``.
Exclude *kernel* upgrades by default. | burlap/rpm.py | def update(kernel=False):
"""
Upgrade all packages, skip obsoletes if ``obsoletes=0`` in ``yum.conf``.
Exclude *kernel* upgrades by default.
"""
manager = MANAGER
cmds = {'yum -y --color=never': {False: '--exclude=kernel* update', True: 'update'}}
cmd = cmds[manager][kernel]
run_as_root... | def update(kernel=False):
"""
Upgrade all packages, skip obsoletes if ``obsoletes=0`` in ``yum.conf``.
Exclude *kernel* upgrades by default.
"""
manager = MANAGER
cmds = {'yum -y --color=never': {False: '--exclude=kernel* update', True: 'update'}}
cmd = cmds[manager][kernel]
run_as_root... | [
"Upgrade",
"all",
"packages",
"skip",
"obsoletes",
"if",
"obsoletes",
"=",
"0",
"in",
"yum",
".",
"conf",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rpm.py#L21-L30 | [
"def",
"update",
"(",
"kernel",
"=",
"False",
")",
":",
"manager",
"=",
"MANAGER",
"cmds",
"=",
"{",
"'yum -y --color=never'",
":",
"{",
"False",
":",
"'--exclude=kernel* update'",
",",
"True",
":",
"'update'",
"}",
"}",
"cmd",
"=",
"cmds",
"[",
"manager",... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | is_installed | Check if an RPM package is installed. | burlap/rpm.py | def is_installed(pkg_name):
"""
Check if an RPM package is installed.
"""
manager = MANAGER
with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):
res = run("rpm --query %(pkg_name)s" % locals())
if res.succeeded:
return True
return False | def is_installed(pkg_name):
"""
Check if an RPM package is installed.
"""
manager = MANAGER
with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):
res = run("rpm --query %(pkg_name)s" % locals())
if res.succeeded:
return True
return False | [
"Check",
"if",
"an",
"RPM",
"package",
"is",
"installed",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rpm.py#L60-L69 | [
"def",
"is_installed",
"(",
"pkg_name",
")",
":",
"manager",
"=",
"MANAGER",
"with",
"settings",
"(",
"hide",
"(",
"'running'",
",",
"'stdout'",
",",
"'stderr'",
",",
"'warnings'",
")",
",",
"warn_only",
"=",
"True",
")",
":",
"res",
"=",
"run",
"(",
"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | install | Install one or more RPM packages.
Extra *repos* may be passed to ``yum`` to enable extra repositories at install time.
Extra *yes* may be passed to ``yum`` to validate license if necessary.
Extra *options* may be passed to ``yum`` if necessary
(e.g. ``['--nogpgcheck', '--exclude=package']``).
::... | burlap/rpm.py | def install(packages, repos=None, yes=None, options=None):
"""
Install one or more RPM packages.
Extra *repos* may be passed to ``yum`` to enable extra repositories at install time.
Extra *yes* may be passed to ``yum`` to validate license if necessary.
Extra *options* may be passed to ``yum`` if ... | def install(packages, repos=None, yes=None, options=None):
"""
Install one or more RPM packages.
Extra *repos* may be passed to ``yum`` to enable extra repositories at install time.
Extra *yes* may be passed to ``yum`` to validate license if necessary.
Extra *options* may be passed to ``yum`` if ... | [
"Install",
"one",
"or",
"more",
"RPM",
"packages",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rpm.py#L72-L111 | [
"def",
"install",
"(",
"packages",
",",
"repos",
"=",
"None",
",",
"yes",
"=",
"None",
",",
"options",
"=",
"None",
")",
":",
"manager",
"=",
"MANAGER",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"[",
"]",
"elif",
"isinstance",
"(",
"options... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | groupinstall | Install a group of packages.
You can use ``yum grouplist`` to get the list of groups.
Extra *options* may be passed to ``yum`` if necessary like
(e.g. ``['--nogpgcheck', '--exclude=package']``).
::
import burlap
# Install development packages
burlap.rpm.groupinstall('Develop... | burlap/rpm.py | def groupinstall(group, options=None):
"""
Install a group of packages.
You can use ``yum grouplist`` to get the list of groups.
Extra *options* may be passed to ``yum`` if necessary like
(e.g. ``['--nogpgcheck', '--exclude=package']``).
::
import burlap
# Install developmen... | def groupinstall(group, options=None):
"""
Install a group of packages.
You can use ``yum grouplist`` to get the list of groups.
Extra *options* may be passed to ``yum`` if necessary like
(e.g. ``['--nogpgcheck', '--exclude=package']``).
::
import burlap
# Install developmen... | [
"Install",
"a",
"group",
"of",
"packages",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rpm.py#L114-L137 | [
"def",
"groupinstall",
"(",
"group",
",",
"options",
"=",
"None",
")",
":",
"manager",
"=",
"MANAGER",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"[",
"]",
"elif",
"isinstance",
"(",
"options",
",",
"str",
")",
":",
"options",
"=",
"[",
"opt... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | uninstall | Remove one or more packages.
Extra *options* may be passed to ``yum`` if necessary. | burlap/rpm.py | def uninstall(packages, options=None):
"""
Remove one or more packages.
Extra *options* may be passed to ``yum`` if necessary.
"""
manager = MANAGER
if options is None:
options = []
elif isinstance(options, six.string_types):
options = [options]
if not isinstance(packag... | def uninstall(packages, options=None):
"""
Remove one or more packages.
Extra *options* may be passed to ``yum`` if necessary.
"""
manager = MANAGER
if options is None:
options = []
elif isinstance(options, six.string_types):
options = [options]
if not isinstance(packag... | [
"Remove",
"one",
"or",
"more",
"packages",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rpm.py#L140-L155 | [
"def",
"uninstall",
"(",
"packages",
",",
"options",
"=",
"None",
")",
":",
"manager",
"=",
"MANAGER",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"[",
"]",
"elif",
"isinstance",
"(",
"options",
",",
"six",
".",
"string_types",
")",
":",
"optio... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | groupuninstall | Remove an existing software group.
Extra *options* may be passed to ``yum`` if necessary. | burlap/rpm.py | def groupuninstall(group, options=None):
"""
Remove an existing software group.
Extra *options* may be passed to ``yum`` if necessary.
"""
manager = MANAGER
if options is None:
options = []
elif isinstance(options, str):
options = [options]
options = " ".join(options)
... | def groupuninstall(group, options=None):
"""
Remove an existing software group.
Extra *options* may be passed to ``yum`` if necessary.
"""
manager = MANAGER
if options is None:
options = []
elif isinstance(options, str):
options = [options]
options = " ".join(options)
... | [
"Remove",
"an",
"existing",
"software",
"group",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rpm.py#L158-L171 | [
"def",
"groupuninstall",
"(",
"group",
",",
"options",
"=",
"None",
")",
":",
"manager",
"=",
"MANAGER",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"[",
"]",
"elif",
"isinstance",
"(",
"options",
",",
"str",
")",
":",
"options",
"=",
"[",
"o... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | repolist | Get the list of ``yum`` repositories.
Returns enabled repositories by default. Extra *status* may be passed
to list disabled repositories if necessary.
Media and debug repositories are kept disabled, except if you pass *media*.
::
import burlap
# Install a package that may be includ... | burlap/rpm.py | def repolist(status='', media=None):
"""
Get the list of ``yum`` repositories.
Returns enabled repositories by default. Extra *status* may be passed
to list disabled repositories if necessary.
Media and debug repositories are kept disabled, except if you pass *media*.
::
import burla... | def repolist(status='', media=None):
"""
Get the list of ``yum`` repositories.
Returns enabled repositories by default. Extra *status* may be passed
to list disabled repositories if necessary.
Media and debug repositories are kept disabled, except if you pass *media*.
::
import burla... | [
"Get",
"the",
"list",
"of",
"yum",
"repositories",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rpm.py#L174-L197 | [
"def",
"repolist",
"(",
"status",
"=",
"''",
",",
"media",
"=",
"None",
")",
":",
"manager",
"=",
"MANAGER",
"with",
"settings",
"(",
"hide",
"(",
"'running'",
",",
"'stdout'",
")",
")",
":",
"if",
"media",
":",
"repos",
"=",
"run_as_root",
"(",
"\"%... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | S3Satchel.sync | Uploads media to an Amazon S3 bucket using s3sync.
Requires s3cmd. Install with:
pip install s3cmd | burlap/s3.py | def sync(self, sync_set, force=0, site=None, role=None):
"""
Uploads media to an Amazon S3 bucket using s3sync.
Requires s3cmd. Install with:
pip install s3cmd
"""
from burlap.dj import dj
force = int(force)
r = self.local_renderer
r.env.s... | def sync(self, sync_set, force=0, site=None, role=None):
"""
Uploads media to an Amazon S3 bucket using s3sync.
Requires s3cmd. Install with:
pip install s3cmd
"""
from burlap.dj import dj
force = int(force)
r = self.local_renderer
r.env.s... | [
"Uploads",
"media",
"to",
"an",
"Amazon",
"S3",
"bucket",
"using",
"s3sync",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/s3.py#L39-L100 | [
"def",
"sync",
"(",
"self",
",",
"sync_set",
",",
"force",
"=",
"0",
",",
"site",
"=",
"None",
",",
"role",
"=",
"None",
")",
":",
"from",
"burlap",
".",
"dj",
"import",
"dj",
"force",
"=",
"int",
"(",
"force",
")",
"r",
"=",
"self",
".",
"loca... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | S3Satchel.invalidate | Issues invalidation requests to a Cloudfront distribution
for the current static media bucket, triggering it to reload the specified
paths from the origin.
Note, only 1000 paths can be issued in a request at any one time. | burlap/s3.py | def invalidate(self, *paths):
"""
Issues invalidation requests to a Cloudfront distribution
for the current static media bucket, triggering it to reload the specified
paths from the origin.
Note, only 1000 paths can be issued in a request at any one time.
"""
dj ... | def invalidate(self, *paths):
"""
Issues invalidation requests to a Cloudfront distribution
for the current static media bucket, triggering it to reload the specified
paths from the origin.
Note, only 1000 paths can be issued in a request at any one time.
"""
dj ... | [
"Issues",
"invalidation",
"requests",
"to",
"a",
"Cloudfront",
"distribution",
"for",
"the",
"current",
"static",
"media",
"bucket",
"triggering",
"it",
"to",
"reload",
"the",
"specified",
"paths",
"from",
"the",
"origin",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/s3.py#L103-L142 | [
"def",
"invalidate",
"(",
"self",
",",
"*",
"paths",
")",
":",
"dj",
"=",
"self",
".",
"get_satchel",
"(",
"'dj'",
")",
"if",
"not",
"paths",
":",
"return",
"# http://boto.readthedocs.org/en/latest/cloudfront_tut.html",
"_settings",
"=",
"dj",
".",
"get_settings... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | S3Satchel.get_or_create_bucket | Gets an S3 bucket of the given name, creating one if it doesn't already exist.
Should be called with a role, if AWS credentials are stored in role settings. e.g.
fab local s3.get_or_create_bucket:mybucket | burlap/s3.py | def get_or_create_bucket(self, name):
"""
Gets an S3 bucket of the given name, creating one if it doesn't already exist.
Should be called with a role, if AWS credentials are stored in role settings. e.g.
fab local s3.get_or_create_bucket:mybucket
"""
from boto.s3 im... | def get_or_create_bucket(self, name):
"""
Gets an S3 bucket of the given name, creating one if it doesn't already exist.
Should be called with a role, if AWS credentials are stored in role settings. e.g.
fab local s3.get_or_create_bucket:mybucket
"""
from boto.s3 im... | [
"Gets",
"an",
"S3",
"bucket",
"of",
"the",
"given",
"name",
"creating",
"one",
"if",
"it",
"doesn",
"t",
"already",
"exist",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/s3.py#L145-L162 | [
"def",
"get_or_create_bucket",
"(",
"self",
",",
"name",
")",
":",
"from",
"boto",
".",
"s3",
"import",
"connection",
"if",
"self",
".",
"dryrun",
":",
"print",
"(",
"'boto.connect_s3().create_bucket(%s)'",
"%",
"repr",
"(",
"name",
")",
")",
"else",
":",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | IPSatchel.static | Configures the server to use a static IP. | burlap/ip.py | def static(self):
"""
Configures the server to use a static IP.
"""
fn = self.render_to_file('ip/ip_interfaces_static.template')
r = self.local_renderer
r.put(local_path=fn, remote_path=r.env.interfaces_fn, use_sudo=True) | def static(self):
"""
Configures the server to use a static IP.
"""
fn = self.render_to_file('ip/ip_interfaces_static.template')
r = self.local_renderer
r.put(local_path=fn, remote_path=r.env.interfaces_fn, use_sudo=True) | [
"Configures",
"the",
"server",
"to",
"use",
"a",
"static",
"IP",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/ip.py#L50-L56 | [
"def",
"static",
"(",
"self",
")",
":",
"fn",
"=",
"self",
".",
"render_to_file",
"(",
"'ip/ip_interfaces_static.template'",
")",
"r",
"=",
"self",
".",
"local_renderer",
"r",
".",
"put",
"(",
"local_path",
"=",
"fn",
",",
"remote_path",
"=",
"r",
".",
"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | TarballSatchel.record_manifest | Called after a deployment to record any data necessary to detect changes
for a future deployment. | burlap/tarball.py | def record_manifest(self):
"""
Called after a deployment to record any data necessary to detect changes
for a future deployment.
"""
manifest = super(TarballSatchel, self).record_manifest()
manifest['timestamp'] = self.timestamp
return manifest | def record_manifest(self):
"""
Called after a deployment to record any data necessary to detect changes
for a future deployment.
"""
manifest = super(TarballSatchel, self).record_manifest()
manifest['timestamp'] = self.timestamp
return manifest | [
"Called",
"after",
"a",
"deployment",
"to",
"record",
"any",
"data",
"necessary",
"to",
"detect",
"changes",
"for",
"a",
"future",
"deployment",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/tarball.py#L85-L92 | [
"def",
"record_manifest",
"(",
"self",
")",
":",
"manifest",
"=",
"super",
"(",
"TarballSatchel",
",",
"self",
")",
".",
"record_manifest",
"(",
")",
"manifest",
"[",
"'timestamp'",
"]",
"=",
"self",
".",
"timestamp",
"return",
"manifest"
] | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | FilesystemTracker.get_thumbprint | Calculates the current thumbprint of the item being tracked. | burlap/trackers.py | def get_thumbprint(self):
"""
Calculates the current thumbprint of the item being tracked.
"""
extensions = self.extensions.split(' ')
name_str = ' -or '.join('-name "%s"' % ext for ext in extensions)
cmd = 'find ' + self.base_dir + r' -type f \( ' + name_str + r' \) -exe... | def get_thumbprint(self):
"""
Calculates the current thumbprint of the item being tracked.
"""
extensions = self.extensions.split(' ')
name_str = ' -or '.join('-name "%s"' % ext for ext in extensions)
cmd = 'find ' + self.base_dir + r' -type f \( ' + name_str + r' \) -exe... | [
"Calculates",
"the",
"current",
"thumbprint",
"of",
"the",
"item",
"being",
"tracked",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/trackers.py#L78-L85 | [
"def",
"get_thumbprint",
"(",
"self",
")",
":",
"extensions",
"=",
"self",
".",
"extensions",
".",
"split",
"(",
"' '",
")",
"name_str",
"=",
"' -or '",
".",
"join",
"(",
"'-name \"%s\"'",
"%",
"ext",
"for",
"ext",
"in",
"extensions",
")",
"cmd",
"=",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | SettingsTracker.get_thumbprint | Calculates the current thumbprint of the item being tracked. | burlap/trackers.py | def get_thumbprint(self):
"""
Calculates the current thumbprint of the item being tracked.
"""
d = {}
if self.names:
names = self.names
else:
names = list(self.satchel.lenv)
for name in self.names:
d[name] = deepcopy(self.satche... | def get_thumbprint(self):
"""
Calculates the current thumbprint of the item being tracked.
"""
d = {}
if self.names:
names = self.names
else:
names = list(self.satchel.lenv)
for name in self.names:
d[name] = deepcopy(self.satche... | [
"Calculates",
"the",
"current",
"thumbprint",
"of",
"the",
"item",
"being",
"tracked",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/trackers.py#L118-L129 | [
"def",
"get_thumbprint",
"(",
"self",
")",
":",
"d",
"=",
"{",
"}",
"if",
"self",
".",
"names",
":",
"names",
"=",
"self",
".",
"names",
"else",
":",
"names",
"=",
"list",
"(",
"self",
".",
"satchel",
".",
"lenv",
")",
"for",
"name",
"in",
"self"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | ORTracker.get_thumbprint | Calculates the current thumbprint of the item being tracked. | burlap/trackers.py | def get_thumbprint(self):
"""
Calculates the current thumbprint of the item being tracked.
"""
d = {}
for tracker in self.trackers:
d[type(tracker).__name__] = tracker.get_thumbprint()
return d | def get_thumbprint(self):
"""
Calculates the current thumbprint of the item being tracked.
"""
d = {}
for tracker in self.trackers:
d[type(tracker).__name__] = tracker.get_thumbprint()
return d | [
"Calculates",
"the",
"current",
"thumbprint",
"of",
"the",
"item",
"being",
"tracked",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/trackers.py#L152-L159 | [
"def",
"get_thumbprint",
"(",
"self",
")",
":",
"d",
"=",
"{",
"}",
"for",
"tracker",
"in",
"self",
".",
"trackers",
":",
"d",
"[",
"type",
"(",
"tracker",
")",
".",
"__name__",
"]",
"=",
"tracker",
".",
"get_thumbprint",
"(",
")",
"return",
"d"
] | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | upgrade | Upgrade all packages. | burlap/deb.py | def upgrade(safe=True):
"""
Upgrade all packages.
"""
manager = MANAGER
if safe:
cmd = 'upgrade'
else:
cmd = 'dist-upgrade'
run_as_root("%(manager)s --assume-yes %(cmd)s" % locals(), pty=False) | def upgrade(safe=True):
"""
Upgrade all packages.
"""
manager = MANAGER
if safe:
cmd = 'upgrade'
else:
cmd = 'dist-upgrade'
run_as_root("%(manager)s --assume-yes %(cmd)s" % locals(), pty=False) | [
"Upgrade",
"all",
"packages",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/deb.py#L33-L42 | [
"def",
"upgrade",
"(",
"safe",
"=",
"True",
")",
":",
"manager",
"=",
"MANAGER",
"if",
"safe",
":",
"cmd",
"=",
"'upgrade'",
"else",
":",
"cmd",
"=",
"'dist-upgrade'",
"run_as_root",
"(",
"\"%(manager)s --assume-yes %(cmd)s\"",
"%",
"locals",
"(",
")",
",",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | is_installed | Check if a package is installed. | burlap/deb.py | def is_installed(pkg_name):
"""
Check if a package is installed.
"""
with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):
res = run("dpkg -s %(pkg_name)s" % locals())
for line in res.splitlines():
if line.startswith("Status: "):
stat... | def is_installed(pkg_name):
"""
Check if a package is installed.
"""
with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):
res = run("dpkg -s %(pkg_name)s" % locals())
for line in res.splitlines():
if line.startswith("Status: "):
stat... | [
"Check",
"if",
"a",
"package",
"is",
"installed",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/deb.py#L45-L56 | [
"def",
"is_installed",
"(",
"pkg_name",
")",
":",
"with",
"settings",
"(",
"hide",
"(",
"'running'",
",",
"'stdout'",
",",
"'stderr'",
",",
"'warnings'",
")",
",",
"warn_only",
"=",
"True",
")",
":",
"res",
"=",
"run",
"(",
"\"dpkg -s %(pkg_name)s\"",
"%",... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | install | Install one or more packages.
If *update* is ``True``, the package definitions will be updated
first, using :py:func:`~burlap.deb.update_index`.
Extra *options* may be passed to ``apt-get`` if necessary.
Example::
import burlap
# Update index, then install a single package
b... | burlap/deb.py | def install(packages, update=False, options=None, version=None):
"""
Install one or more packages.
If *update* is ``True``, the package definitions will be updated
first, using :py:func:`~burlap.deb.update_index`.
Extra *options* may be passed to ``apt-get`` if necessary.
Example::
i... | def install(packages, update=False, options=None, version=None):
"""
Install one or more packages.
If *update* is ``True``, the package definitions will be updated
first, using :py:func:`~burlap.deb.update_index`.
Extra *options* may be passed to ``apt-get`` if necessary.
Example::
i... | [
"Install",
"one",
"or",
"more",
"packages",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/deb.py#L59-L100 | [
"def",
"install",
"(",
"packages",
",",
"update",
"=",
"False",
",",
"options",
"=",
"None",
",",
"version",
"=",
"None",
")",
":",
"manager",
"=",
"MANAGER",
"if",
"update",
":",
"update_index",
"(",
")",
"if",
"options",
"is",
"None",
":",
"options",... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | uninstall | Remove one or more packages.
If *purge* is ``True``, the package configuration files will be
removed from the system.
Extra *options* may be passed to ``apt-get`` if necessary. | burlap/deb.py | def uninstall(packages, purge=False, options=None):
"""
Remove one or more packages.
If *purge* is ``True``, the package configuration files will be
removed from the system.
Extra *options* may be passed to ``apt-get`` if necessary.
"""
manager = MANAGER
command = "purge" if purge else... | def uninstall(packages, purge=False, options=None):
"""
Remove one or more packages.
If *purge* is ``True``, the package configuration files will be
removed from the system.
Extra *options* may be passed to ``apt-get`` if necessary.
"""
manager = MANAGER
command = "purge" if purge else... | [
"Remove",
"one",
"or",
"more",
"packages",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/deb.py#L103-L121 | [
"def",
"uninstall",
"(",
"packages",
",",
"purge",
"=",
"False",
",",
"options",
"=",
"None",
")",
":",
"manager",
"=",
"MANAGER",
"command",
"=",
"\"purge\"",
"if",
"purge",
"else",
"\"remove\"",
"if",
"options",
"is",
"None",
":",
"options",
"=",
"[",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | preseed_package | Enable unattended package installation by preseeding ``debconf``
parameters.
Example::
import burlap
# Unattended install of Postfix mail server
burlap.deb.preseed_package('postfix', {
'postfix/main_mailer_type': ('select', 'Internet Site'),
'postfix/mailname':... | burlap/deb.py | def preseed_package(pkg_name, preseed):
"""
Enable unattended package installation by preseeding ``debconf``
parameters.
Example::
import burlap
# Unattended install of Postfix mail server
burlap.deb.preseed_package('postfix', {
'postfix/main_mailer_type': ('select... | def preseed_package(pkg_name, preseed):
"""
Enable unattended package installation by preseeding ``debconf``
parameters.
Example::
import burlap
# Unattended install of Postfix mail server
burlap.deb.preseed_package('postfix', {
'postfix/main_mailer_type': ('select... | [
"Enable",
"unattended",
"package",
"installation",
"by",
"preseeding",
"debconf",
"parameters",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/deb.py#L124-L144 | [
"def",
"preseed_package",
"(",
"pkg_name",
",",
"preseed",
")",
":",
"for",
"q_name",
",",
"_",
"in",
"preseed",
".",
"items",
"(",
")",
":",
"q_type",
",",
"q_answer",
"=",
"_",
"run_as_root",
"(",
"'echo \"%(pkg_name)s %(q_name)s %(q_type)s %(q_answer)s\" | debc... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | get_selections | Get the state of ``dkpg`` selections.
Returns a dict with state => [packages]. | burlap/deb.py | def get_selections():
"""
Get the state of ``dkpg`` selections.
Returns a dict with state => [packages].
"""
with settings(hide('stdout')):
res = run_as_root('dpkg --get-selections')
selections = dict()
for line in res.splitlines():
package, status = line.split()
sel... | def get_selections():
"""
Get the state of ``dkpg`` selections.
Returns a dict with state => [packages].
"""
with settings(hide('stdout')):
res = run_as_root('dpkg --get-selections')
selections = dict()
for line in res.splitlines():
package, status = line.split()
sel... | [
"Get",
"the",
"state",
"of",
"dkpg",
"selections",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/deb.py#L147-L159 | [
"def",
"get_selections",
"(",
")",
":",
"with",
"settings",
"(",
"hide",
"(",
"'stdout'",
")",
")",
":",
"res",
"=",
"run_as_root",
"(",
"'dpkg --get-selections'",
")",
"selections",
"=",
"dict",
"(",
")",
"for",
"line",
"in",
"res",
".",
"splitlines",
"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | apt_key_exists | Check if the given key id exists in apt keyring. | burlap/deb.py | def apt_key_exists(keyid):
"""
Check if the given key id exists in apt keyring.
"""
# Command extracted from apt-key source
gpg_cmd = 'gpg --ignore-time-conflict --no-options --no-default-keyring --keyring /etc/apt/trusted.gpg'
with settings(hide('everything'), warn_only=True):
res = r... | def apt_key_exists(keyid):
"""
Check if the given key id exists in apt keyring.
"""
# Command extracted from apt-key source
gpg_cmd = 'gpg --ignore-time-conflict --no-options --no-default-keyring --keyring /etc/apt/trusted.gpg'
with settings(hide('everything'), warn_only=True):
res = r... | [
"Check",
"if",
"the",
"given",
"key",
"id",
"exists",
"in",
"apt",
"keyring",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/deb.py#L162-L173 | [
"def",
"apt_key_exists",
"(",
"keyid",
")",
":",
"# Command extracted from apt-key source",
"gpg_cmd",
"=",
"'gpg --ignore-time-conflict --no-options --no-default-keyring --keyring /etc/apt/trusted.gpg'",
"with",
"settings",
"(",
"hide",
"(",
"'everything'",
")",
",",
"warn_only"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | add_apt_key | Trust packages signed with this public key.
Example::
import burlap
# Varnish signing key from URL and verify fingerprint)
burlap.deb.add_apt_key(keyid='C4DEFFEB', url='http://repo.varnish-cache.org/debian/GPG-key.txt')
# Nginx signing key from default key server (subkeys.pgp.net... | burlap/deb.py | def add_apt_key(filename=None, url=None, keyid=None, keyserver='subkeys.pgp.net', update=False):
"""
Trust packages signed with this public key.
Example::
import burlap
# Varnish signing key from URL and verify fingerprint)
burlap.deb.add_apt_key(keyid='C4DEFFEB', url='http://repo... | def add_apt_key(filename=None, url=None, keyid=None, keyserver='subkeys.pgp.net', update=False):
"""
Trust packages signed with this public key.
Example::
import burlap
# Varnish signing key from URL and verify fingerprint)
burlap.deb.add_apt_key(keyid='C4DEFFEB', url='http://repo... | [
"Trust",
"packages",
"signed",
"with",
"this",
"public",
"key",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/deb.py#L181-L223 | [
"def",
"add_apt_key",
"(",
"filename",
"=",
"None",
",",
"url",
"=",
"None",
",",
"keyid",
"=",
"None",
",",
"keyserver",
"=",
"'subkeys.pgp.net'",
",",
"update",
"=",
"False",
")",
":",
"if",
"keyid",
"is",
"None",
":",
"if",
"filename",
"is",
"not",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | VirtualboxSatchel.configure | Enables the repository for a most current version on Debian systems.
https://www.rabbitmq.com/install-debian.html | burlap/virtualbox.py | def configure(self):
"""
Enables the repository for a most current version on Debian systems.
https://www.rabbitmq.com/install-debian.html
"""
os_version = self.os_version
if not self.dryrun and os_version.distro != UBUNTU:
raise NotImplementedError("OS ... | def configure(self):
"""
Enables the repository for a most current version on Debian systems.
https://www.rabbitmq.com/install-debian.html
"""
os_version = self.os_version
if not self.dryrun and os_version.distro != UBUNTU:
raise NotImplementedError("OS ... | [
"Enables",
"the",
"repository",
"for",
"a",
"most",
"current",
"version",
"on",
"Debian",
"systems",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/virtualbox.py#L13-L29 | [
"def",
"configure",
"(",
"self",
")",
":",
"os_version",
"=",
"self",
".",
"os_version",
"if",
"not",
"self",
".",
"dryrun",
"and",
"os_version",
".",
"distro",
"!=",
"UBUNTU",
":",
"raise",
"NotImplementedError",
"(",
"\"OS %s is not supported.\"",
"%",
"os_v... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | GroupSatchel.exists | Check if a group exists. | burlap/group.py | def exists(self, name):
"""
Check if a group exists.
"""
with self.settings(hide('running', 'stdout', 'warnings'), warn_only=True):
return self.run('getent group %(name)s' % locals()).succeeded | def exists(self, name):
"""
Check if a group exists.
"""
with self.settings(hide('running', 'stdout', 'warnings'), warn_only=True):
return self.run('getent group %(name)s' % locals()).succeeded | [
"Check",
"if",
"a",
"group",
"exists",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/group.py#L19-L24 | [
"def",
"exists",
"(",
"self",
",",
"name",
")",
":",
"with",
"self",
".",
"settings",
"(",
"hide",
"(",
"'running'",
",",
"'stdout'",
",",
"'warnings'",
")",
",",
"warn_only",
"=",
"True",
")",
":",
"return",
"self",
".",
"run",
"(",
"'getent group %(n... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | GroupSatchel.create | Create a new group.
Example::
import burlap
if not burlap.group.exists('admin'):
burlap.group.create('admin') | burlap/group.py | def create(self, name, gid=None):
"""
Create a new group.
Example::
import burlap
if not burlap.group.exists('admin'):
burlap.group.create('admin')
"""
args = []
if gid:
args.append('-g %s' % gid)
args.append... | def create(self, name, gid=None):
"""
Create a new group.
Example::
import burlap
if not burlap.group.exists('admin'):
burlap.group.create('admin')
"""
args = []
if gid:
args.append('-g %s' % gid)
args.append... | [
"Create",
"a",
"new",
"group",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/group.py#L27-L44 | [
"def",
"create",
"(",
"self",
",",
"name",
",",
"gid",
"=",
"None",
")",
":",
"args",
"=",
"[",
"]",
"if",
"gid",
":",
"args",
".",
"append",
"(",
"'-g %s'",
"%",
"gid",
")",
"args",
".",
"append",
"(",
"name",
")",
"args",
"=",
"' '",
".",
"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | UserSatchel.enter_password_change | Responds to a forced password change via `passwd` prompts due to password expiration. | burlap/user.py | def enter_password_change(self, username=None, old_password=None):
"""
Responds to a forced password change via `passwd` prompts due to password expiration.
"""
from fabric.state import connections
from fabric.network import disconnect_all
r = self.local_renderer
# ... | def enter_password_change(self, username=None, old_password=None):
"""
Responds to a forced password change via `passwd` prompts due to password expiration.
"""
from fabric.state import connections
from fabric.network import disconnect_all
r = self.local_renderer
# ... | [
"Responds",
"to",
"a",
"forced",
"password",
"change",
"via",
"passwd",
"prompts",
"due",
"to",
"password",
"expiration",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/user.py#L57-L114 | [
"def",
"enter_password_change",
"(",
"self",
",",
"username",
"=",
"None",
",",
"old_password",
"=",
"None",
")",
":",
"from",
"fabric",
".",
"state",
"import",
"connections",
"from",
"fabric",
".",
"network",
"import",
"disconnect_all",
"r",
"=",
"self",
".... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | UserSatchel.togroups | Adds the user to the given list of groups. | burlap/user.py | def togroups(self, user, groups):
"""
Adds the user to the given list of groups.
"""
r = self.local_renderer
if isinstance(groups, six.string_types):
groups = [_.strip() for _ in groups.split(',') if _.strip()]
for group in groups:
r.env.username... | def togroups(self, user, groups):
"""
Adds the user to the given list of groups.
"""
r = self.local_renderer
if isinstance(groups, six.string_types):
groups = [_.strip() for _ in groups.split(',') if _.strip()]
for group in groups:
r.env.username... | [
"Adds",
"the",
"user",
"to",
"the",
"given",
"list",
"of",
"groups",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/user.py#L122-L135 | [
"def",
"togroups",
"(",
"self",
",",
"user",
",",
"groups",
")",
":",
"r",
"=",
"self",
".",
"local_renderer",
"if",
"isinstance",
"(",
"groups",
",",
"six",
".",
"string_types",
")",
":",
"groups",
"=",
"[",
"_",
".",
"strip",
"(",
")",
"for",
"_"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | UserSatchel.passwordless | Configures the user to use an SSL key without a password.
Assumes you've run generate_keys() first. | burlap/user.py | def passwordless(self, username, pubkey):
"""
Configures the user to use an SSL key without a password.
Assumes you've run generate_keys() first.
"""
r = self.local_renderer
r.env.username = username
r.env.pubkey = pubkey
if not self.dryrun:
... | def passwordless(self, username, pubkey):
"""
Configures the user to use an SSL key without a password.
Assumes you've run generate_keys() first.
"""
r = self.local_renderer
r.env.username = username
r.env.pubkey = pubkey
if not self.dryrun:
... | [
"Configures",
"the",
"user",
"to",
"use",
"an",
"SSL",
"key",
"without",
"a",
"password",
".",
"Assumes",
"you",
"ve",
"run",
"generate_keys",
"()",
"first",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/user.py#L138-L184 | [
"def",
"passwordless",
"(",
"self",
",",
"username",
",",
"pubkey",
")",
":",
"r",
"=",
"self",
".",
"local_renderer",
"r",
".",
"env",
".",
"username",
"=",
"username",
"r",
".",
"env",
".",
"pubkey",
"=",
"pubkey",
"if",
"not",
"self",
".",
"dryrun... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | UserSatchel.generate_keys | Generates *.pem and *.pub key files suitable for setting up passwordless SSH. | burlap/user.py | def generate_keys(self, username, hostname):
"""
Generates *.pem and *.pub key files suitable for setting up passwordless SSH.
"""
r = self.local_renderer
#r.env.key_filename = r.env.key_filename or env.key_filename
#assert r.env.key_filename, 'r.env.key_filename or env... | def generate_keys(self, username, hostname):
"""
Generates *.pem and *.pub key files suitable for setting up passwordless SSH.
"""
r = self.local_renderer
#r.env.key_filename = r.env.key_filename or env.key_filename
#assert r.env.key_filename, 'r.env.key_filename or env... | [
"Generates",
"*",
".",
"pem",
"and",
"*",
".",
"pub",
"key",
"files",
"suitable",
"for",
"setting",
"up",
"passwordless",
"SSH",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/user.py#L187-L213 | [
"def",
"generate_keys",
"(",
"self",
",",
"username",
",",
"hostname",
")",
":",
"r",
"=",
"self",
".",
"local_renderer",
"#r.env.key_filename = r.env.key_filename or env.key_filename",
"#assert r.env.key_filename, 'r.env.key_filename or env.key_filename must be set. e.g. roles/role/... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | UserSatchel.create | Creates a user with the given username. | burlap/user.py | def create(self, username, groups=None, uid=None, create_home=None, system=False, password=None, home_dir=None):
"""
Creates a user with the given username.
"""
r = self.local_renderer
r.env.username = username
args = []
if uid:
args.append('-u %s' %... | def create(self, username, groups=None, uid=None, create_home=None, system=False, password=None, home_dir=None):
"""
Creates a user with the given username.
"""
r = self.local_renderer
r.env.username = username
args = []
if uid:
args.append('-u %s' %... | [
"Creates",
"a",
"user",
"with",
"the",
"given",
"username",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/user.py#L224-L266 | [
"def",
"create",
"(",
"self",
",",
"username",
",",
"groups",
"=",
"None",
",",
"uid",
"=",
"None",
",",
"create_home",
"=",
"None",
",",
"system",
"=",
"False",
",",
"password",
"=",
"None",
",",
"home_dir",
"=",
"None",
")",
":",
"r",
"=",
"self"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | UserSatchel.expire_password | Forces the user to change their password the next time they login. | burlap/user.py | def expire_password(self, username):
"""
Forces the user to change their password the next time they login.
"""
r = self.local_renderer
r.env.username = username
r.sudo('chage -d 0 {username}') | def expire_password(self, username):
"""
Forces the user to change their password the next time they login.
"""
r = self.local_renderer
r.env.username = username
r.sudo('chage -d 0 {username}') | [
"Forces",
"the",
"user",
"to",
"change",
"their",
"password",
"the",
"next",
"time",
"they",
"login",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/user.py#L269-L275 | [
"def",
"expire_password",
"(",
"self",
",",
"username",
")",
":",
"r",
"=",
"self",
".",
"local_renderer",
"r",
".",
"env",
".",
"username",
"=",
"username",
"r",
".",
"sudo",
"(",
"'chage -d 0 {username}'",
")"
] | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | run_as_root | Run a remote command as the root user.
When connecting as root to the remote system, this will use Fabric's
``run`` function. In other cases, it will use ``sudo``. | burlap/utils.py | def run_as_root(command, *args, **kwargs):
"""
Run a remote command as the root user.
When connecting as root to the remote system, this will use Fabric's
``run`` function. In other cases, it will use ``sudo``.
"""
from burlap.common import run_or_dryrun, sudo_or_dryrun
if env.user == 'root... | def run_as_root(command, *args, **kwargs):
"""
Run a remote command as the root user.
When connecting as root to the remote system, this will use Fabric's
``run`` function. In other cases, it will use ``sudo``.
"""
from burlap.common import run_or_dryrun, sudo_or_dryrun
if env.user == 'root... | [
"Run",
"a",
"remote",
"command",
"as",
"the",
"root",
"user",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/utils.py#L17-L29 | [
"def",
"run_as_root",
"(",
"command",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"burlap",
".",
"common",
"import",
"run_or_dryrun",
",",
"sudo_or_dryrun",
"if",
"env",
".",
"user",
"==",
"'root'",
":",
"func",
"=",
"run_or_dryrun",
"el... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | oct | A backwards compatible version of oct() that works with Python2.7 and Python3. | burlap/utils.py | def oct(v, **kwargs): # pylint: disable=redefined-builtin
"""
A backwards compatible version of oct() that works with Python2.7 and Python3.
"""
v = str(v)
if six.PY2:
if v.startswith('0o'):
v = '0' + v[2:]
else:
if not v.starswith('0o'):
assert v[0] == '0... | def oct(v, **kwargs): # pylint: disable=redefined-builtin
"""
A backwards compatible version of oct() that works with Python2.7 and Python3.
"""
v = str(v)
if six.PY2:
if v.startswith('0o'):
v = '0' + v[2:]
else:
if not v.starswith('0o'):
assert v[0] == '0... | [
"A",
"backwards",
"compatible",
"version",
"of",
"oct",
"()",
"that",
"works",
"with",
"Python2",
".",
"7",
"and",
"Python3",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/utils.py#L69-L81 | [
"def",
"oct",
"(",
"v",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=redefined-builtin",
"v",
"=",
"str",
"(",
"v",
")",
"if",
"six",
".",
"PY2",
":",
"if",
"v",
".",
"startswith",
"(",
"'0o'",
")",
":",
"v",
"=",
"'0'",
"+",
"v",
"[",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | get_file_hash | Iteratively builds a file hash without loading the entire file into memory.
Designed to process an arbitrary binary file. | burlap/utils.py | def get_file_hash(fin, block_size=2**20):
"""
Iteratively builds a file hash without loading the entire file into memory.
Designed to process an arbitrary binary file.
"""
if isinstance(fin, six.string_types):
fin = open(fin)
h = hashlib.sha512()
while True:
data = fin.read(b... | def get_file_hash(fin, block_size=2**20):
"""
Iteratively builds a file hash without loading the entire file into memory.
Designed to process an arbitrary binary file.
"""
if isinstance(fin, six.string_types):
fin = open(fin)
h = hashlib.sha512()
while True:
data = fin.read(b... | [
"Iteratively",
"builds",
"a",
"file",
"hash",
"without",
"loading",
"the",
"entire",
"file",
"into",
"memory",
".",
"Designed",
"to",
"process",
"an",
"arbitrary",
"binary",
"file",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/utils.py#L84-L101 | [
"def",
"get_file_hash",
"(",
"fin",
",",
"block_size",
"=",
"2",
"**",
"20",
")",
":",
"if",
"isinstance",
"(",
"fin",
",",
"six",
".",
"string_types",
")",
":",
"fin",
"=",
"open",
"(",
"fin",
")",
"h",
"=",
"hashlib",
".",
"sha512",
"(",
")",
"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | InadynSatchel.check | Run inadyn from the commandline to test the configuration.
To be run like:
fab role inadyn.check | burlap/inadyn.py | def check(self):
"""
Run inadyn from the commandline to test the configuration.
To be run like:
fab role inadyn.check
"""
self._validate_settings()
r = self.local_renderer
r.env.alias = r.env.aliases[0]
r.sudo(r.env.check_command_template) | def check(self):
"""
Run inadyn from the commandline to test the configuration.
To be run like:
fab role inadyn.check
"""
self._validate_settings()
r = self.local_renderer
r.env.alias = r.env.aliases[0]
r.sudo(r.env.check_command_template) | [
"Run",
"inadyn",
"from",
"the",
"commandline",
"to",
"test",
"the",
"configuration",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/inadyn.py#L70-L82 | [
"def",
"check",
"(",
"self",
")",
":",
"self",
".",
"_validate_settings",
"(",
")",
"r",
"=",
"self",
".",
"local_renderer",
"r",
".",
"env",
".",
"alias",
"=",
"r",
".",
"env",
".",
"aliases",
"[",
"0",
"]",
"r",
".",
"sudo",
"(",
"r",
".",
"e... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | DebugSatchel.list_env | Displays a list of environment key/value pairs. | burlap/debug.py | def list_env(self, key=None):
"""
Displays a list of environment key/value pairs.
"""
for k, v in sorted(self.genv.items(), key=lambda o: o[0]):
if key and k != key:
continue
print('%s ' % (k,))
pprint(v, indent=4) | def list_env(self, key=None):
"""
Displays a list of environment key/value pairs.
"""
for k, v in sorted(self.genv.items(), key=lambda o: o[0]):
if key and k != key:
continue
print('%s ' % (k,))
pprint(v, indent=4) | [
"Displays",
"a",
"list",
"of",
"environment",
"key",
"/",
"value",
"pairs",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/debug.py#L53-L61 | [
"def",
"list_env",
"(",
"self",
",",
"key",
"=",
"None",
")",
":",
"for",
"k",
",",
"v",
"in",
"sorted",
"(",
"self",
".",
"genv",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"o",
":",
"o",
"[",
"0",
"]",
")",
":",
"if",
"key",
"and"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | DebugSatchel.list_server_specs | Displays a list of common servers characteristics, like number
of CPU cores, amount of memory and hard drive capacity. | burlap/debug.py | def list_server_specs(self, cpu=1, memory=1, hdd=1):
"""
Displays a list of common servers characteristics, like number
of CPU cores, amount of memory and hard drive capacity.
"""
r = self.local_renderer
cpu = int(cpu)
memory = int(memory)
hdd = int(hdd)
... | def list_server_specs(self, cpu=1, memory=1, hdd=1):
"""
Displays a list of common servers characteristics, like number
of CPU cores, amount of memory and hard drive capacity.
"""
r = self.local_renderer
cpu = int(cpu)
memory = int(memory)
hdd = int(hdd)
... | [
"Displays",
"a",
"list",
"of",
"common",
"servers",
"characteristics",
"like",
"number",
"of",
"CPU",
"cores",
"amount",
"of",
"memory",
"and",
"hard",
"drive",
"capacity",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/debug.py#L70-L181 | [
"def",
"list_server_specs",
"(",
"self",
",",
"cpu",
"=",
"1",
",",
"memory",
"=",
"1",
",",
"hdd",
"=",
"1",
")",
":",
"r",
"=",
"self",
".",
"local_renderer",
"cpu",
"=",
"int",
"(",
"cpu",
")",
"memory",
"=",
"int",
"(",
"memory",
")",
"hdd",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | DebugSatchel.shell | Opens an SSH connection. | burlap/debug.py | def shell(self, gui=0, command='', dryrun=None, shell_interactive_cmd_str=None):
"""
Opens an SSH connection.
"""
from burlap.common import get_hosts_for_site
if dryrun is not None:
self.dryrun = dryrun
r = self.local_renderer
if r.genv.SITE != r.ge... | def shell(self, gui=0, command='', dryrun=None, shell_interactive_cmd_str=None):
"""
Opens an SSH connection.
"""
from burlap.common import get_hosts_for_site
if dryrun is not None:
self.dryrun = dryrun
r = self.local_renderer
if r.genv.SITE != r.ge... | [
"Opens",
"an",
"SSH",
"connection",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/debug.py#L196-L251 | [
"def",
"shell",
"(",
"self",
",",
"gui",
"=",
"0",
",",
"command",
"=",
"''",
",",
"dryrun",
"=",
"None",
",",
"shell_interactive_cmd_str",
"=",
"None",
")",
":",
"from",
"burlap",
".",
"common",
"import",
"get_hosts_for_site",
"if",
"dryrun",
"is",
"not... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | DebugSatchel.disk | Display percent of disk usage. | burlap/debug.py | def disk(self):
"""
Display percent of disk usage.
"""
r = self.local_renderer
r.run(r.env.disk_usage_command) | def disk(self):
"""
Display percent of disk usage.
"""
r = self.local_renderer
r.run(r.env.disk_usage_command) | [
"Display",
"percent",
"of",
"disk",
"usage",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/debug.py#L254-L259 | [
"def",
"disk",
"(",
"self",
")",
":",
"r",
"=",
"self",
".",
"local_renderer",
"r",
".",
"run",
"(",
"r",
".",
"env",
".",
"disk_usage_command",
")"
] | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | DebugSatchel.tunnel | Creates an SSH tunnel. | burlap/debug.py | def tunnel(self, local_port, remote_port):
"""
Creates an SSH tunnel.
"""
r = self.local_renderer
r.env.tunnel_local_port = local_port
r.env.tunnel_remote_port = remote_port
r.local(' ssh -i {key_filename} -L {tunnel_local_port}:localhost:{tunnel_remote_port} {use... | def tunnel(self, local_port, remote_port):
"""
Creates an SSH tunnel.
"""
r = self.local_renderer
r.env.tunnel_local_port = local_port
r.env.tunnel_remote_port = remote_port
r.local(' ssh -i {key_filename} -L {tunnel_local_port}:localhost:{tunnel_remote_port} {use... | [
"Creates",
"an",
"SSH",
"tunnel",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/debug.py#L262-L269 | [
"def",
"tunnel",
"(",
"self",
",",
"local_port",
",",
"remote_port",
")",
":",
"r",
"=",
"self",
".",
"local_renderer",
"r",
".",
"env",
".",
"tunnel_local_port",
"=",
"local_port",
"r",
".",
"env",
".",
"tunnel_remote_port",
"=",
"remote_port",
"r",
".",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | DebugSatchel.set_satchel_value | Sets a key/value pair in a satchel's local renderer. | burlap/debug.py | def set_satchel_value(self, satchel, key, value):
"""
Sets a key/value pair in a satchel's local renderer.
"""
satchel = self.get_satchel(satchel)
r = satchel.local_renderer
setattr(r.env, key, value)
print('Set %s=%s in satchel %s.' % (key, value, satchel.name)) | def set_satchel_value(self, satchel, key, value):
"""
Sets a key/value pair in a satchel's local renderer.
"""
satchel = self.get_satchel(satchel)
r = satchel.local_renderer
setattr(r.env, key, value)
print('Set %s=%s in satchel %s.' % (key, value, satchel.name)) | [
"Sets",
"a",
"key",
"/",
"value",
"pair",
"in",
"a",
"satchel",
"s",
"local",
"renderer",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/debug.py#L284-L291 | [
"def",
"set_satchel_value",
"(",
"self",
",",
"satchel",
",",
"key",
",",
"value",
")",
":",
"satchel",
"=",
"self",
".",
"get_satchel",
"(",
"satchel",
")",
"r",
"=",
"satchel",
".",
"local_renderer",
"setattr",
"(",
"r",
".",
"env",
",",
"key",
",",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | package_version | Get the installed version of a package
Returns ``None`` if it can't be found. | burlap/python_setuptools.py | def package_version(name, python_cmd='python'):
"""
Get the installed version of a package
Returns ``None`` if it can't be found.
"""
cmd = '''%(python_cmd)s -c \
"import pkg_resources;\
dist = pkg_resources.get_distribution('%(name)s');\
print dist.version"
''' % lo... | def package_version(name, python_cmd='python'):
"""
Get the installed version of a package
Returns ``None`` if it can't be found.
"""
cmd = '''%(python_cmd)s -c \
"import pkg_resources;\
dist = pkg_resources.get_distribution('%(name)s');\
print dist.version"
''' % lo... | [
"Get",
"the",
"installed",
"version",
"of",
"a",
"package"
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/python_setuptools.py#L22-L36 | [
"def",
"package_version",
"(",
"name",
",",
"python_cmd",
"=",
"'python'",
")",
":",
"cmd",
"=",
"'''%(python_cmd)s -c \\\n \"import pkg_resources;\\\n dist = pkg_resources.get_distribution('%(name)s');\\\n print dist.version\"\n '''",
"%",
"locals",
"(",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | install_setuptools | Install the latest version of `setuptools`_.
::
import burlap
burlap.python_setuptools.install_setuptools() | burlap/python_setuptools.py | def install_setuptools(python_cmd='python', use_sudo=True):
"""
Install the latest version of `setuptools`_.
::
import burlap
burlap.python_setuptools.install_setuptools()
"""
setuptools_version = package_version('setuptools', python_cmd)
distribute_version = package_version... | def install_setuptools(python_cmd='python', use_sudo=True):
"""
Install the latest version of `setuptools`_.
::
import burlap
burlap.python_setuptools.install_setuptools()
"""
setuptools_version = package_version('setuptools', python_cmd)
distribute_version = package_version... | [
"Install",
"the",
"latest",
"version",
"of",
"setuptools",
"_",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/python_setuptools.py#L49-L70 | [
"def",
"install_setuptools",
"(",
"python_cmd",
"=",
"'python'",
",",
"use_sudo",
"=",
"True",
")",
":",
"setuptools_version",
"=",
"package_version",
"(",
"'setuptools'",
",",
"python_cmd",
")",
"distribute_version",
"=",
"package_version",
"(",
"'distribute'",
","... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | _install_from_scratch | Install setuptools from scratch using installer | burlap/python_setuptools.py | def _install_from_scratch(python_cmd, use_sudo):
"""
Install setuptools from scratch using installer
"""
with cd("/tmp"):
download(EZ_SETUP_URL)
command = '%(python_cmd)s ez_setup.py' % locals()
if use_sudo:
run_as_root(command)
else:
run(command... | def _install_from_scratch(python_cmd, use_sudo):
"""
Install setuptools from scratch using installer
"""
with cd("/tmp"):
download(EZ_SETUP_URL)
command = '%(python_cmd)s ez_setup.py' % locals()
if use_sudo:
run_as_root(command)
else:
run(command... | [
"Install",
"setuptools",
"from",
"scratch",
"using",
"installer"
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/python_setuptools.py#L73-L87 | [
"def",
"_install_from_scratch",
"(",
"python_cmd",
",",
"use_sudo",
")",
":",
"with",
"cd",
"(",
"\"/tmp\"",
")",
":",
"download",
"(",
"EZ_SETUP_URL",
")",
"command",
"=",
"'%(python_cmd)s ez_setup.py'",
"%",
"locals",
"(",
")",
"if",
"use_sudo",
":",
"run_as... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | install | Install Python packages with ``easy_install``.
Examples::
import burlap
# Install a single package
burlap.python_setuptools.install('package', use_sudo=True)
# Install a list of packages
burlap.python_setuptools.install(['pkg1', 'pkg2'], use_sudo=True)
.. note:: most... | burlap/python_setuptools.py | def install(packages, upgrade=False, use_sudo=False, python_cmd='python'):
"""
Install Python packages with ``easy_install``.
Examples::
import burlap
# Install a single package
burlap.python_setuptools.install('package', use_sudo=True)
# Install a list of packages
... | def install(packages, upgrade=False, use_sudo=False, python_cmd='python'):
"""
Install Python packages with ``easy_install``.
Examples::
import burlap
# Install a single package
burlap.python_setuptools.install('package', use_sudo=True)
# Install a list of packages
... | [
"Install",
"Python",
"packages",
"with",
"easy_install",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/python_setuptools.py#L106-L132 | [
"def",
"install",
"(",
"packages",
",",
"upgrade",
"=",
"False",
",",
"use_sudo",
"=",
"False",
",",
"python_cmd",
"=",
"'python'",
")",
":",
"argv",
"=",
"[",
"]",
"if",
"upgrade",
":",
"argv",
".",
"append",
"(",
"\"-U\"",
")",
"if",
"isinstance",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | _easy_install | Install packages using easy_install
We don't know if the easy_install command in the path will be the
right one, so we use the setuptools entry point to call the script's
main function ourselves. | burlap/python_setuptools.py | def _easy_install(argv, python_cmd, use_sudo):
"""
Install packages using easy_install
We don't know if the easy_install command in the path will be the
right one, so we use the setuptools entry point to call the script's
main function ourselves.
"""
command = """python -c "\
from p... | def _easy_install(argv, python_cmd, use_sudo):
"""
Install packages using easy_install
We don't know if the easy_install command in the path will be the
right one, so we use the setuptools entry point to call the script's
main function ourselves.
"""
command = """python -c "\
from p... | [
"Install",
"packages",
"using",
"easy_install"
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/python_setuptools.py#L135-L151 | [
"def",
"_easy_install",
"(",
"argv",
",",
"python_cmd",
",",
"use_sudo",
")",
":",
"command",
"=",
"\"\"\"python -c \"\\\n from pkg_resources import load_entry_point;\\\n ez = load_entry_point('setuptools', 'console_scripts', 'easy_install');\\\n ez(argv=%(argv)r)\\\n ... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | PIPSatchel.bootstrap | Installs all the necessary packages necessary for managing virtual
environments with pip. | burlap/pip.py | def bootstrap(self, force=0):
"""
Installs all the necessary packages necessary for managing virtual
environments with pip.
"""
force = int(force)
if self.has_pip() and not force:
return
r = self.local_renderer
if r.env.bootstrap_method == GE... | def bootstrap(self, force=0):
"""
Installs all the necessary packages necessary for managing virtual
environments with pip.
"""
force = int(force)
if self.has_pip() and not force:
return
r = self.local_renderer
if r.env.bootstrap_method == GE... | [
"Installs",
"all",
"the",
"necessary",
"packages",
"necessary",
"for",
"managing",
"virtual",
"environments",
"with",
"pip",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/pip.py#L70-L94 | [
"def",
"bootstrap",
"(",
"self",
",",
"force",
"=",
"0",
")",
":",
"force",
"=",
"int",
"(",
"force",
")",
"if",
"self",
".",
"has_pip",
"(",
")",
"and",
"not",
"force",
":",
"return",
"r",
"=",
"self",
".",
"local_renderer",
"if",
"r",
".",
"env... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | PIPSatchel.has_virtualenv | Returns true if the virtualenv tool is installed. | burlap/pip.py | def has_virtualenv(self):
"""
Returns true if the virtualenv tool is installed.
"""
with self.settings(warn_only=True):
ret = self.run_or_local('which virtualenv').strip()
return bool(ret) | def has_virtualenv(self):
"""
Returns true if the virtualenv tool is installed.
"""
with self.settings(warn_only=True):
ret = self.run_or_local('which virtualenv').strip()
return bool(ret) | [
"Returns",
"true",
"if",
"the",
"virtualenv",
"tool",
"is",
"installed",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/pip.py#L104-L110 | [
"def",
"has_virtualenv",
"(",
"self",
")",
":",
"with",
"self",
".",
"settings",
"(",
"warn_only",
"=",
"True",
")",
":",
"ret",
"=",
"self",
".",
"run_or_local",
"(",
"'which virtualenv'",
")",
".",
"strip",
"(",
")",
"return",
"bool",
"(",
"ret",
")"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | PIPSatchel.virtualenv_exists | Returns true if the virtual environment has been created. | burlap/pip.py | def virtualenv_exists(self, virtualenv_dir=None):
"""
Returns true if the virtual environment has been created.
"""
r = self.local_renderer
ret = True
with self.settings(warn_only=True):
ret = r.run_or_local('ls {virtualenv_dir}') or ''
ret = 'cann... | def virtualenv_exists(self, virtualenv_dir=None):
"""
Returns true if the virtual environment has been created.
"""
r = self.local_renderer
ret = True
with self.settings(warn_only=True):
ret = r.run_or_local('ls {virtualenv_dir}') or ''
ret = 'cann... | [
"Returns",
"true",
"if",
"the",
"virtual",
"environment",
"has",
"been",
"created",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/pip.py#L113-L129 | [
"def",
"virtualenv_exists",
"(",
"self",
",",
"virtualenv_dir",
"=",
"None",
")",
":",
"r",
"=",
"self",
".",
"local_renderer",
"ret",
"=",
"True",
"with",
"self",
".",
"settings",
"(",
"warn_only",
"=",
"True",
")",
":",
"ret",
"=",
"r",
".",
"run_or_... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | PIPSatchel.what_requires | Lists the packages that require the given package. | burlap/pip.py | def what_requires(self, name):
"""
Lists the packages that require the given package.
"""
r = self.local_renderer
r.env.name = name
r.local('pipdeptree -p {name} --reverse') | def what_requires(self, name):
"""
Lists the packages that require the given package.
"""
r = self.local_renderer
r.env.name = name
r.local('pipdeptree -p {name} --reverse') | [
"Lists",
"the",
"packages",
"that",
"require",
"the",
"given",
"package",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/pip.py#L132-L138 | [
"def",
"what_requires",
"(",
"self",
",",
"name",
")",
":",
"r",
"=",
"self",
".",
"local_renderer",
"r",
".",
"env",
".",
"name",
"=",
"name",
"r",
".",
"local",
"(",
"'pipdeptree -p {name} --reverse'",
")"
] | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | PIPSatchel.init | Creates the virtual environment. | burlap/pip.py | def init(self):
"""
Creates the virtual environment.
"""
r = self.local_renderer
# if self.virtualenv_exists():
# print('virtualenv exists')
# return
print('Creating new virtual environment...')
with self.settings(warn_only=True):
... | def init(self):
"""
Creates the virtual environment.
"""
r = self.local_renderer
# if self.virtualenv_exists():
# print('virtualenv exists')
# return
print('Creating new virtual environment...')
with self.settings(warn_only=True):
... | [
"Creates",
"the",
"virtual",
"environment",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/pip.py#L141-L157 | [
"def",
"init",
"(",
"self",
")",
":",
"r",
"=",
"self",
".",
"local_renderer",
"# if self.virtualenv_exists():",
"# print('virtualenv exists')",
"# return",
"print",
"(",
"'Creating new virtual environment...'",
")",
"with",
"self",
".",
"set... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | PIPSatchel.get_combined_requirements | Returns all requirements files combined into one string. | burlap/pip.py | def get_combined_requirements(self, requirements=None):
"""
Returns all requirements files combined into one string.
"""
requirements = requirements or self.env.requirements
def iter_lines(fn):
with open(fn, 'r') as fin:
for line in fin.readlines():
... | def get_combined_requirements(self, requirements=None):
"""
Returns all requirements files combined into one string.
"""
requirements = requirements or self.env.requirements
def iter_lines(fn):
with open(fn, 'r') as fin:
for line in fin.readlines():
... | [
"Returns",
"all",
"requirements",
"files",
"combined",
"into",
"one",
"string",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/pip.py#L166-L191 | [
"def",
"get_combined_requirements",
"(",
"self",
",",
"requirements",
"=",
"None",
")",
":",
"requirements",
"=",
"requirements",
"or",
"self",
".",
"env",
".",
"requirements",
"def",
"iter_lines",
"(",
"fn",
")",
":",
"with",
"open",
"(",
"fn",
",",
"'r'"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | PIPSatchel.record_manifest | Called after a deployment to record any data necessary to detect changes
for a future deployment. | burlap/pip.py | def record_manifest(self):
"""
Called after a deployment to record any data necessary to detect changes
for a future deployment.
"""
manifest = super(PIPSatchel, self).record_manifest()
manifest['all-requirements'] = self.get_combined_requirements()
if self.verbos... | def record_manifest(self):
"""
Called after a deployment to record any data necessary to detect changes
for a future deployment.
"""
manifest = super(PIPSatchel, self).record_manifest()
manifest['all-requirements'] = self.get_combined_requirements()
if self.verbos... | [
"Called",
"after",
"a",
"deployment",
"to",
"record",
"any",
"data",
"necessary",
"to",
"detect",
"changes",
"for",
"a",
"future",
"deployment",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/pip.py#L239-L248 | [
"def",
"record_manifest",
"(",
"self",
")",
":",
"manifest",
"=",
"super",
"(",
"PIPSatchel",
",",
"self",
")",
".",
"record_manifest",
"(",
")",
"manifest",
"[",
"'all-requirements'",
"]",
"=",
"self",
".",
"get_combined_requirements",
"(",
")",
"if",
"self... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | list_instances | Retrieves all virtual machines instances in the current environment. | burlap/vm.py | def list_instances(show=1, name=None, group=None, release=None, except_release=None):
"""
Retrieves all virtual machines instances in the current environment.
"""
from burlap.common import shelf, OrderedDict, get_verbose
verbose = get_verbose()
require('vm_type', 'vm_group')
assert env.vm_t... | def list_instances(show=1, name=None, group=None, release=None, except_release=None):
"""
Retrieves all virtual machines instances in the current environment.
"""
from burlap.common import shelf, OrderedDict, get_verbose
verbose = get_verbose()
require('vm_type', 'vm_group')
assert env.vm_t... | [
"Retrieves",
"all",
"virtual",
"machines",
"instances",
"in",
"the",
"current",
"environment",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vm.py#L139-L212 | [
"def",
"list_instances",
"(",
"show",
"=",
"1",
",",
"name",
"=",
"None",
",",
"group",
"=",
"None",
",",
"release",
"=",
"None",
",",
"except_release",
"=",
"None",
")",
":",
"from",
"burlap",
".",
"common",
"import",
"shelf",
",",
"OrderedDict",
",",... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | get_or_create_ec2_security_groups | Creates a security group opening 22, 80 and 443 | burlap/vm.py | def get_or_create_ec2_security_groups(names=None, verbose=1):
"""
Creates a security group opening 22, 80 and 443
"""
verbose = int(verbose)
if verbose:
print('Creating EC2 security groups...')
conn = get_ec2_connection()
if isinstance(names, six.string_types):
names = nam... | def get_or_create_ec2_security_groups(names=None, verbose=1):
"""
Creates a security group opening 22, 80 and 443
"""
verbose = int(verbose)
if verbose:
print('Creating EC2 security groups...')
conn = get_ec2_connection()
if isinstance(names, six.string_types):
names = nam... | [
"Creates",
"a",
"security",
"group",
"opening",
"22",
"80",
"and",
"443"
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vm.py#L254-L351 | [
"def",
"get_or_create_ec2_security_groups",
"(",
"names",
"=",
"None",
",",
"verbose",
"=",
"1",
")",
":",
"verbose",
"=",
"int",
"(",
"verbose",
")",
"if",
"verbose",
":",
"print",
"(",
"'Creating EC2 security groups...'",
")",
"conn",
"=",
"get_ec2_connection"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | get_or_create_ec2_key_pair | Creates and saves an EC2 key pair to a local PEM file. | burlap/vm.py | def get_or_create_ec2_key_pair(name=None, verbose=1):
"""
Creates and saves an EC2 key pair to a local PEM file.
"""
verbose = int(verbose)
name = name or env.vm_ec2_keypair_name
pem_path = 'roles/%s/%s.pem' % (env.ROLE, name)
conn = get_ec2_connection()
kp = conn.get_key_pair(name)
... | def get_or_create_ec2_key_pair(name=None, verbose=1):
"""
Creates and saves an EC2 key pair to a local PEM file.
"""
verbose = int(verbose)
name = name or env.vm_ec2_keypair_name
pem_path = 'roles/%s/%s.pem' % (env.ROLE, name)
conn = get_ec2_connection()
kp = conn.get_key_pair(name)
... | [
"Creates",
"and",
"saves",
"an",
"EC2",
"key",
"pair",
"to",
"a",
"local",
"PEM",
"file",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vm.py#L354-L373 | [
"def",
"get_or_create_ec2_key_pair",
"(",
"name",
"=",
"None",
",",
"verbose",
"=",
"1",
")",
":",
"verbose",
"=",
"int",
"(",
"verbose",
")",
"name",
"=",
"name",
"or",
"env",
".",
"vm_ec2_keypair_name",
"pem_path",
"=",
"'roles/%s/%s.pem'",
"%",
"(",
"en... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | get_or_create_ec2_instance | Creates a new EC2 instance.
You should normally run get_or_create() instead of directly calling this. | burlap/vm.py | def get_or_create_ec2_instance(name=None, group=None, release=None, verbose=0, backend_opts=None):
"""
Creates a new EC2 instance.
You should normally run get_or_create() instead of directly calling this.
"""
from burlap.common import shelf, OrderedDict
from boto.exception import EC2ResponseErr... | def get_or_create_ec2_instance(name=None, group=None, release=None, verbose=0, backend_opts=None):
"""
Creates a new EC2 instance.
You should normally run get_or_create() instead of directly calling this.
"""
from burlap.common import shelf, OrderedDict
from boto.exception import EC2ResponseErr... | [
"Creates",
"a",
"new",
"EC2",
"instance",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vm.py#L383-L526 | [
"def",
"get_or_create_ec2_instance",
"(",
"name",
"=",
"None",
",",
"group",
"=",
"None",
",",
"release",
"=",
"None",
",",
"verbose",
"=",
"0",
",",
"backend_opts",
"=",
"None",
")",
":",
"from",
"burlap",
".",
"common",
"import",
"shelf",
",",
"Ordered... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | exists | Determines if a virtual machine instance exists. | burlap/vm.py | def exists(name=None, group=None, release=None, except_release=None, verbose=1):
"""
Determines if a virtual machine instance exists.
"""
verbose = int(verbose)
instances = list_instances(
name=name,
group=group,
release=release,
except_release=except_release,
... | def exists(name=None, group=None, release=None, except_release=None, verbose=1):
"""
Determines if a virtual machine instance exists.
"""
verbose = int(verbose)
instances = list_instances(
name=name,
group=group,
release=release,
except_release=except_release,
... | [
"Determines",
"if",
"a",
"virtual",
"machine",
"instance",
"exists",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vm.py#L529-L545 | [
"def",
"exists",
"(",
"name",
"=",
"None",
",",
"group",
"=",
"None",
",",
"release",
"=",
"None",
",",
"except_release",
"=",
"None",
",",
"verbose",
"=",
"1",
")",
":",
"verbose",
"=",
"int",
"(",
"verbose",
")",
"instances",
"=",
"list_instances",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | get_or_create | Creates a virtual machine instance. | burlap/vm.py | def get_or_create(name=None, group=None, config=None, extra=0, verbose=0, backend_opts=None):
"""
Creates a virtual machine instance.
"""
require('vm_type', 'vm_group')
backend_opts = backend_opts or {}
verbose = int(verbose)
extra = int(extra)
if config:
config_fn = common.fi... | def get_or_create(name=None, group=None, config=None, extra=0, verbose=0, backend_opts=None):
"""
Creates a virtual machine instance.
"""
require('vm_type', 'vm_group')
backend_opts = backend_opts or {}
verbose = int(verbose)
extra = int(extra)
if config:
config_fn = common.fi... | [
"Creates",
"a",
"virtual",
"machine",
"instance",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vm.py#L548-L594 | [
"def",
"get_or_create",
"(",
"name",
"=",
"None",
",",
"group",
"=",
"None",
",",
"config",
"=",
"None",
",",
"extra",
"=",
"0",
",",
"verbose",
"=",
"0",
",",
"backend_opts",
"=",
"None",
")",
":",
"require",
"(",
"'vm_type'",
",",
"'vm_group'",
")"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | delete | Permanently erase one or more VM instances from existence. | burlap/vm.py | def delete(name=None, group=None, release=None, except_release=None,
dryrun=1, verbose=1):
"""
Permanently erase one or more VM instances from existence.
"""
verbose = int(verbose)
if env.vm_type == EC2:
conn = get_ec2_connection()
instances = list_instances(
name=... | def delete(name=None, group=None, release=None, except_release=None,
dryrun=1, verbose=1):
"""
Permanently erase one or more VM instances from existence.
"""
verbose = int(verbose)
if env.vm_type == EC2:
conn = get_ec2_connection()
instances = list_instances(
name=... | [
"Permanently",
"erase",
"one",
"or",
"more",
"VM",
"instances",
"from",
"existence",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vm.py#L597-L628 | [
"def",
"delete",
"(",
"name",
"=",
"None",
",",
"group",
"=",
"None",
",",
"release",
"=",
"None",
",",
"except_release",
"=",
"None",
",",
"dryrun",
"=",
"1",
",",
"verbose",
"=",
"1",
")",
":",
"verbose",
"=",
"int",
"(",
"verbose",
")",
"if",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | get_name | Retrieves the instance name associated with the current host string. | burlap/vm.py | def get_name():
"""
Retrieves the instance name associated with the current host string.
"""
if env.vm_type == EC2:
for instance in get_all_running_ec2_instances():
if env.host_string == instance.public_dns_name:
name = instance.tags.get(env.vm_name_tag)
... | def get_name():
"""
Retrieves the instance name associated with the current host string.
"""
if env.vm_type == EC2:
for instance in get_all_running_ec2_instances():
if env.host_string == instance.public_dns_name:
name = instance.tags.get(env.vm_name_tag)
... | [
"Retrieves",
"the",
"instance",
"name",
"associated",
"with",
"the",
"current",
"host",
"string",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vm.py#L631-L641 | [
"def",
"get_name",
"(",
")",
":",
"if",
"env",
".",
"vm_type",
"==",
"EC2",
":",
"for",
"instance",
"in",
"get_all_running_ec2_instances",
"(",
")",
":",
"if",
"env",
".",
"host_string",
"==",
"instance",
".",
"public_dns_name",
":",
"name",
"=",
"instance... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | respawn | Deletes and recreates one or more VM instances. | burlap/vm.py | def respawn(name=None, group=None):
"""
Deletes and recreates one or more VM instances.
"""
if name is None:
name = get_name()
delete(name=name, group=group)
instance = get_or_create(name=name, group=group)
env.host_string = instance.public_dns_name | def respawn(name=None, group=None):
"""
Deletes and recreates one or more VM instances.
"""
if name is None:
name = get_name()
delete(name=name, group=group)
instance = get_or_create(name=name, group=group)
env.host_string = instance.public_dns_name | [
"Deletes",
"and",
"recreates",
"one",
"or",
"more",
"VM",
"instances",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/vm.py#L644-L654 | [
"def",
"respawn",
"(",
"name",
"=",
"None",
",",
"group",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"get_name",
"(",
")",
"delete",
"(",
"name",
"=",
"name",
",",
"group",
"=",
"group",
")",
"instance",
"=",
"get_or_creat... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | RsyncSatchel.deploy_code | Generates a rsync of all deployable code. | burlap/rsync.py | def deploy_code(self):
"""
Generates a rsync of all deployable code.
"""
assert self.genv.SITE, 'Site unspecified.'
assert self.genv.ROLE, 'Role unspecified.'
r = self.local_renderer
if self.env.exclusions:
r.env.exclusions_str = ' '.join(
... | def deploy_code(self):
"""
Generates a rsync of all deployable code.
"""
assert self.genv.SITE, 'Site unspecified.'
assert self.genv.ROLE, 'Role unspecified.'
r = self.local_renderer
if self.env.exclusions:
r.env.exclusions_str = ' '.join(
... | [
"Generates",
"a",
"rsync",
"of",
"all",
"deployable",
"code",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/rsync.py#L32-L47 | [
"def",
"deploy_code",
"(",
"self",
")",
":",
"assert",
"self",
".",
"genv",
".",
"SITE",
",",
"'Site unspecified.'",
"assert",
"self",
".",
"genv",
".",
"ROLE",
",",
"'Role unspecified.'",
"r",
"=",
"self",
".",
"local_renderer",
"if",
"self",
".",
"env",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | init_env | Populates the global env variables with custom default settings. | burlap/common.py | def init_env():
"""
Populates the global env variables with custom default settings.
"""
env.ROLES_DIR = ROLE_DIR
env.services = []
env.confirm_deployment = False
env.is_local = None
env.base_config_dir = '.'
env.src_dir = 'src' # The path relative to fab where the code resides.
... | def init_env():
"""
Populates the global env variables with custom default settings.
"""
env.ROLES_DIR = ROLE_DIR
env.services = []
env.confirm_deployment = False
env.is_local = None
env.base_config_dir = '.'
env.src_dir = 'src' # The path relative to fab where the code resides.
... | [
"Populates",
"the",
"global",
"env",
"variables",
"with",
"custom",
"default",
"settings",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L66-L105 | [
"def",
"init_env",
"(",
")",
":",
"env",
".",
"ROLES_DIR",
"=",
"ROLE_DIR",
"env",
".",
"services",
"=",
"[",
"]",
"env",
".",
"confirm_deployment",
"=",
"False",
"env",
".",
"is_local",
"=",
"None",
"env",
".",
"base_config_dir",
"=",
"'.'",
"env",
".... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | create_module | Dynamically creates a module with the given name. | burlap/common.py | def create_module(name, code=None):
"""
Dynamically creates a module with the given name.
"""
if name not in sys.modules:
sys.modules[name] = imp.new_module(name)
module = sys.modules[name]
if code:
print('executing code for %s: %s' % (name, code))
exec(code in module.... | def create_module(name, code=None):
"""
Dynamically creates a module with the given name.
"""
if name not in sys.modules:
sys.modules[name] = imp.new_module(name)
module = sys.modules[name]
if code:
print('executing code for %s: %s' % (name, code))
exec(code in module.... | [
"Dynamically",
"creates",
"a",
"module",
"with",
"the",
"given",
"name",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L258-L273 | [
"def",
"create_module",
"(",
"name",
",",
"code",
"=",
"None",
")",
":",
"if",
"name",
"not",
"in",
"sys",
".",
"modules",
":",
"sys",
".",
"modules",
"[",
"name",
"]",
"=",
"imp",
".",
"new_module",
"(",
"name",
")",
"module",
"=",
"sys",
".",
"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | add_class_methods_as_module_level_functions_for_fabric | Utility to take the methods of the instance of a class, instance,
and add them as functions to a module, module_name, so that Fabric
can find and call them. Call this at the bottom of a module after
the class definition. | burlap/common.py | def add_class_methods_as_module_level_functions_for_fabric(instance, module_name, method_name, module_alias=None):
'''
Utility to take the methods of the instance of a class, instance,
and add them as functions to a module, module_name, so that Fabric
can find and call them. Call this at the bottom of a... | def add_class_methods_as_module_level_functions_for_fabric(instance, module_name, method_name, module_alias=None):
'''
Utility to take the methods of the instance of a class, instance,
and add them as functions to a module, module_name, so that Fabric
can find and call them. Call this at the bottom of a... | [
"Utility",
"to",
"take",
"the",
"methods",
"of",
"the",
"instance",
"of",
"a",
"class",
"instance",
"and",
"add",
"them",
"as",
"functions",
"to",
"a",
"module",
"module_name",
"so",
"that",
"Fabric",
"can",
"find",
"and",
"call",
"them",
".",
"Call",
"t... | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L277-L333 | [
"def",
"add_class_methods_as_module_level_functions_for_fabric",
"(",
"instance",
",",
"module_name",
",",
"method_name",
",",
"module_alias",
"=",
"None",
")",
":",
"import",
"imp",
"from",
".",
"decorators",
"import",
"task_or_dryrun",
"# get the module as an object",
"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | str_to_list | Converts a string of comma delimited values and returns a list. | burlap/common.py | def str_to_list(s):
"""
Converts a string of comma delimited values and returns a list.
"""
if s is None:
return []
elif isinstance(s, (tuple, list)):
return s
elif not isinstance(s, six.string_types):
raise NotImplementedError('Unknown type: %s' % type(s))
return [_.... | def str_to_list(s):
"""
Converts a string of comma delimited values and returns a list.
"""
if s is None:
return []
elif isinstance(s, (tuple, list)):
return s
elif not isinstance(s, six.string_types):
raise NotImplementedError('Unknown type: %s' % type(s))
return [_.... | [
"Converts",
"a",
"string",
"of",
"comma",
"delimited",
"values",
"and",
"returns",
"a",
"list",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L335-L345 | [
"def",
"str_to_list",
"(",
"s",
")",
":",
"if",
"s",
"is",
"None",
":",
"return",
"[",
"]",
"elif",
"isinstance",
"(",
"s",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"return",
"s",
"elif",
"not",
"isinstance",
"(",
"s",
",",
"six",
".",
"s... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | get_hosts_retriever | Given the function name, looks up the method for dynamically retrieving host data. | burlap/common.py | def get_hosts_retriever(s=None):
"""
Given the function name, looks up the method for dynamically retrieving host data.
"""
s = s or env.hosts_retriever
# #assert s, 'No hosts retriever specified.'
if not s:
return env_hosts_retriever
# module_name = '.'.join(s.split('.')[:-1])
# ... | def get_hosts_retriever(s=None):
"""
Given the function name, looks up the method for dynamically retrieving host data.
"""
s = s or env.hosts_retriever
# #assert s, 'No hosts retriever specified.'
if not s:
return env_hosts_retriever
# module_name = '.'.join(s.split('.')[:-1])
# ... | [
"Given",
"the",
"function",
"name",
"looks",
"up",
"the",
"method",
"for",
"dynamically",
"retrieving",
"host",
"data",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1671-L1683 | [
"def",
"get_hosts_retriever",
"(",
"s",
"=",
"None",
")",
":",
"s",
"=",
"s",
"or",
"env",
".",
"hosts_retriever",
"# #assert s, 'No hosts retriever specified.'",
"if",
"not",
"s",
":",
"return",
"env_hosts_retriever",
"# module_name = '.'.join(s.split('.')[:-1])"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | append_or_dryrun | Wrapper around Fabric's contrib.files.append() to give it a dryrun option.
text filename
http://docs.fabfile.org/en/0.9.1/api/contrib/files.html#fabric.contrib.files.append | burlap/common.py | def append_or_dryrun(*args, **kwargs):
"""
Wrapper around Fabric's contrib.files.append() to give it a dryrun option.
text filename
http://docs.fabfile.org/en/0.9.1/api/contrib/files.html#fabric.contrib.files.append
"""
from fabric.contrib.files import append
dryrun = get_dryrun(kwargs.ge... | def append_or_dryrun(*args, **kwargs):
"""
Wrapper around Fabric's contrib.files.append() to give it a dryrun option.
text filename
http://docs.fabfile.org/en/0.9.1/api/contrib/files.html#fabric.contrib.files.append
"""
from fabric.contrib.files import append
dryrun = get_dryrun(kwargs.ge... | [
"Wrapper",
"around",
"Fabric",
"s",
"contrib",
".",
"files",
".",
"append",
"()",
"to",
"give",
"it",
"a",
"dryrun",
"option",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1752-L1782 | [
"def",
"append_or_dryrun",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"fabric",
".",
"contrib",
".",
"files",
"import",
"append",
"dryrun",
"=",
"get_dryrun",
"(",
"kwargs",
".",
"get",
"(",
"'dryrun'",
")",
")",
"if",
"'dryrun'",
"in... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | disable_attribute_or_dryrun | Comments-out a line containing an attribute.
The inverse of enable_attribute_or_dryrun(). | burlap/common.py | def disable_attribute_or_dryrun(*args, **kwargs):
"""
Comments-out a line containing an attribute.
The inverse of enable_attribute_or_dryrun().
"""
dryrun = get_dryrun(kwargs.get('dryrun'))
if 'dryrun' in kwargs:
del kwargs['dryrun']
use_sudo = kwargs.pop('use_sudo', False)
run... | def disable_attribute_or_dryrun(*args, **kwargs):
"""
Comments-out a line containing an attribute.
The inverse of enable_attribute_or_dryrun().
"""
dryrun = get_dryrun(kwargs.get('dryrun'))
if 'dryrun' in kwargs:
del kwargs['dryrun']
use_sudo = kwargs.pop('use_sudo', False)
run... | [
"Comments",
"-",
"out",
"a",
"line",
"containing",
"an",
"attribute",
".",
"The",
"inverse",
"of",
"enable_attribute_or_dryrun",
"()",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1845-L1896 | [
"def",
"disable_attribute_or_dryrun",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"dryrun",
"=",
"get_dryrun",
"(",
"kwargs",
".",
"get",
"(",
"'dryrun'",
")",
")",
"if",
"'dryrun'",
"in",
"kwargs",
":",
"del",
"kwargs",
"[",
"'dryrun'",
"]",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | write_temp_file_or_dryrun | Writes the given content to a local temporary file. | burlap/common.py | def write_temp_file_or_dryrun(content, *args, **kwargs):
"""
Writes the given content to a local temporary file.
"""
dryrun = get_dryrun(kwargs.get('dryrun'))
if dryrun:
fd, tmp_fn = tempfile.mkstemp()
os.remove(tmp_fn)
cmd_run = 'local'
cmd = 'cat <<EOT >> %s\n%s\nEO... | def write_temp_file_or_dryrun(content, *args, **kwargs):
"""
Writes the given content to a local temporary file.
"""
dryrun = get_dryrun(kwargs.get('dryrun'))
if dryrun:
fd, tmp_fn = tempfile.mkstemp()
os.remove(tmp_fn)
cmd_run = 'local'
cmd = 'cat <<EOT >> %s\n%s\nEO... | [
"Writes",
"the",
"given",
"content",
"to",
"a",
"local",
"temporary",
"file",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1918-L1937 | [
"def",
"write_temp_file_or_dryrun",
"(",
"content",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"dryrun",
"=",
"get_dryrun",
"(",
"kwargs",
".",
"get",
"(",
"'dryrun'",
")",
")",
"if",
"dryrun",
":",
"fd",
",",
"tmp_fn",
"=",
"tempfile",
".",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | sed_or_dryrun | Wrapper around Fabric's contrib.files.sed() to give it a dryrun option.
http://docs.fabfile.org/en/0.9.1/api/contrib/files.html#fabric.contrib.files.sed | burlap/common.py | def sed_or_dryrun(*args, **kwargs):
"""
Wrapper around Fabric's contrib.files.sed() to give it a dryrun option.
http://docs.fabfile.org/en/0.9.1/api/contrib/files.html#fabric.contrib.files.sed
"""
dryrun = get_dryrun(kwargs.get('dryrun'))
if 'dryrun' in kwargs:
del kwargs['dryrun']
... | def sed_or_dryrun(*args, **kwargs):
"""
Wrapper around Fabric's contrib.files.sed() to give it a dryrun option.
http://docs.fabfile.org/en/0.9.1/api/contrib/files.html#fabric.contrib.files.sed
"""
dryrun = get_dryrun(kwargs.get('dryrun'))
if 'dryrun' in kwargs:
del kwargs['dryrun']
... | [
"Wrapper",
"around",
"Fabric",
"s",
"contrib",
".",
"files",
".",
"sed",
"()",
"to",
"give",
"it",
"a",
"dryrun",
"option",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1939-L1967 | [
"def",
"sed_or_dryrun",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"dryrun",
"=",
"get_dryrun",
"(",
"kwargs",
".",
"get",
"(",
"'dryrun'",
")",
")",
"if",
"'dryrun'",
"in",
"kwargs",
":",
"del",
"kwargs",
"[",
"'dryrun'",
"]",
"use_sudo",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | reboot_or_dryrun | An improved version of fabric.operations.reboot with better error handling. | burlap/common.py | def reboot_or_dryrun(*args, **kwargs):
"""
An improved version of fabric.operations.reboot with better error handling.
"""
from fabric.state import connections
verbose = get_verbose()
dryrun = get_dryrun(kwargs.get('dryrun'))
# Use 'wait' as max total wait time
kwargs.setdefault('wait... | def reboot_or_dryrun(*args, **kwargs):
"""
An improved version of fabric.operations.reboot with better error handling.
"""
from fabric.state import connections
verbose = get_verbose()
dryrun = get_dryrun(kwargs.get('dryrun'))
# Use 'wait' as max total wait time
kwargs.setdefault('wait... | [
"An",
"improved",
"version",
"of",
"fabric",
".",
"operations",
".",
"reboot",
"with",
"better",
"error",
"handling",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2059-L2130 | [
"def",
"reboot_or_dryrun",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"fabric",
".",
"state",
"import",
"connections",
"verbose",
"=",
"get_verbose",
"(",
")",
"dryrun",
"=",
"get_dryrun",
"(",
"kwargs",
".",
"get",
"(",
"'dryrun'",
")"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | pretty_bytes | Scales a byte count to the largest scale with a small whole number
that's easier to read.
Returns a tuple of the format (scaled_float, unit_string). | burlap/common.py | def pretty_bytes(bytes): # pylint: disable=redefined-builtin
"""
Scales a byte count to the largest scale with a small whole number
that's easier to read.
Returns a tuple of the format (scaled_float, unit_string).
"""
if not bytes:
return bytes, 'bytes'
sign = bytes/float(bytes)
... | def pretty_bytes(bytes): # pylint: disable=redefined-builtin
"""
Scales a byte count to the largest scale with a small whole number
that's easier to read.
Returns a tuple of the format (scaled_float, unit_string).
"""
if not bytes:
return bytes, 'bytes'
sign = bytes/float(bytes)
... | [
"Scales",
"a",
"byte",
"count",
"to",
"the",
"largest",
"scale",
"with",
"a",
"small",
"whole",
"number",
"that",
"s",
"easier",
"to",
"read",
".",
"Returns",
"a",
"tuple",
"of",
"the",
"format",
"(",
"scaled_float",
"unit_string",
")",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2257-L2271 | [
"def",
"pretty_bytes",
"(",
"bytes",
")",
":",
"# pylint: disable=redefined-builtin",
"if",
"not",
"bytes",
":",
"return",
"bytes",
",",
"'bytes'",
"sign",
"=",
"bytes",
"/",
"float",
"(",
"bytes",
")",
"bytes",
"=",
"abs",
"(",
"bytes",
")",
"for",
"x",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | get_component_settings | Returns a subset of the env dictionary containing
only those keys with the name prefix. | burlap/common.py | def get_component_settings(prefixes=None):
"""
Returns a subset of the env dictionary containing
only those keys with the name prefix.
"""
prefixes = prefixes or []
assert isinstance(prefixes, (tuple, list)), 'Prefixes must be a sequence type, not %s.' % type(prefixes)
data = {}
for name... | def get_component_settings(prefixes=None):
"""
Returns a subset of the env dictionary containing
only those keys with the name prefix.
"""
prefixes = prefixes or []
assert isinstance(prefixes, (tuple, list)), 'Prefixes must be a sequence type, not %s.' % type(prefixes)
data = {}
for name... | [
"Returns",
"a",
"subset",
"of",
"the",
"env",
"dictionary",
"containing",
"only",
"those",
"keys",
"with",
"the",
"name",
"prefix",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2274-L2288 | [
"def",
"get_component_settings",
"(",
"prefixes",
"=",
"None",
")",
":",
"prefixes",
"=",
"prefixes",
"or",
"[",
"]",
"assert",
"isinstance",
"(",
"prefixes",
",",
"(",
"tuple",
",",
"list",
")",
")",
",",
"'Prefixes must be a sequence type, not %s.'",
"%",
"t... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | get_last_modified_timestamp | Recursively finds the most recent timestamp in the given directory. | burlap/common.py | def get_last_modified_timestamp(path, ignore=None):
"""
Recursively finds the most recent timestamp in the given directory.
"""
ignore = ignore or []
if not isinstance(path, six.string_types):
return
ignore_str = ''
if ignore:
assert isinstance(ignore, (tuple, list))
... | def get_last_modified_timestamp(path, ignore=None):
"""
Recursively finds the most recent timestamp in the given directory.
"""
ignore = ignore or []
if not isinstance(path, six.string_types):
return
ignore_str = ''
if ignore:
assert isinstance(ignore, (tuple, list))
... | [
"Recursively",
"finds",
"the",
"most",
"recent",
"timestamp",
"in",
"the",
"given",
"directory",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2291-L2311 | [
"def",
"get_last_modified_timestamp",
"(",
"path",
",",
"ignore",
"=",
"None",
")",
":",
"ignore",
"=",
"ignore",
"or",
"[",
"]",
"if",
"not",
"isinstance",
"(",
"path",
",",
"six",
".",
"string_types",
")",
":",
"return",
"ignore_str",
"=",
"''",
"if",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | check_settings_for_differences | Returns a subset of the env dictionary keys that differ,
either being added, deleted or changed between old and new. | burlap/common.py | def check_settings_for_differences(old, new, as_bool=False, as_tri=False):
"""
Returns a subset of the env dictionary keys that differ,
either being added, deleted or changed between old and new.
"""
assert not as_bool or not as_tri
old = old or {}
new = new or {}
changes = set(k for ... | def check_settings_for_differences(old, new, as_bool=False, as_tri=False):
"""
Returns a subset of the env dictionary keys that differ,
either being added, deleted or changed between old and new.
"""
assert not as_bool or not as_tri
old = old or {}
new = new or {}
changes = set(k for ... | [
"Returns",
"a",
"subset",
"of",
"the",
"env",
"dictionary",
"keys",
"that",
"differ",
"either",
"being",
"added",
"deleted",
"or",
"changed",
"between",
"old",
"and",
"new",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2314-L2346 | [
"def",
"check_settings_for_differences",
"(",
"old",
",",
"new",
",",
"as_bool",
"=",
"False",
",",
"as_tri",
"=",
"False",
")",
":",
"assert",
"not",
"as_bool",
"or",
"not",
"as_tri",
"old",
"=",
"old",
"or",
"{",
"}",
"new",
"=",
"new",
"or",
"{",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | get_packager | Returns the packager detected on the remote system. | burlap/common.py | def get_packager():
"""
Returns the packager detected on the remote system.
"""
# TODO: remove once fabric stops using contextlib.nested.
# https://github.com/fabric/fabric/issues/1364
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
common_packager = get_... | def get_packager():
"""
Returns the packager detected on the remote system.
"""
# TODO: remove once fabric stops using contextlib.nested.
# https://github.com/fabric/fabric/issues/1364
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
common_packager = get_... | [
"Returns",
"the",
"packager",
"detected",
"on",
"the",
"remote",
"system",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2540-L2572 | [
"def",
"get_packager",
"(",
")",
":",
"# TODO: remove once fabric stops using contextlib.nested.",
"# https://github.com/fabric/fabric/issues/1364",
"import",
"warnings",
"warnings",
".",
"filterwarnings",
"(",
"\"ignore\"",
",",
"category",
"=",
"DeprecationWarning",
")",
"com... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | get_os_version | Returns a named tuple describing the operating system on the remote host. | burlap/common.py | def get_os_version():
"""
Returns a named tuple describing the operating system on the remote host.
"""
# TODO: remove once fabric stops using contextlib.nested.
# https://github.com/fabric/fabric/issues/1364
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
... | def get_os_version():
"""
Returns a named tuple describing the operating system on the remote host.
"""
# TODO: remove once fabric stops using contextlib.nested.
# https://github.com/fabric/fabric/issues/1364
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
... | [
"Returns",
"a",
"named",
"tuple",
"describing",
"the",
"operating",
"system",
"on",
"the",
"remote",
"host",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2581-L2618 | [
"def",
"get_os_version",
"(",
")",
":",
"# TODO: remove once fabric stops using contextlib.nested.",
"# https://github.com/fabric/fabric/issues/1364",
"import",
"warnings",
"warnings",
".",
"filterwarnings",
"(",
"\"ignore\"",
",",
"category",
"=",
"DeprecationWarning",
")",
"c... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | render_to_string | Renders the given template to a string. | burlap/common.py | def render_to_string(template, extra=None):
"""
Renders the given template to a string.
"""
from jinja2 import Template
extra = extra or {}
final_fqfn = find_template(template)
assert final_fqfn, 'Template not found: %s' % template
template_content = open(final_fqfn, 'r').read()
t = ... | def render_to_string(template, extra=None):
"""
Renders the given template to a string.
"""
from jinja2 import Template
extra = extra or {}
final_fqfn = find_template(template)
assert final_fqfn, 'Template not found: %s' % template
template_content = open(final_fqfn, 'r').read()
t = ... | [
"Renders",
"the",
"given",
"template",
"to",
"a",
"string",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2642-L2659 | [
"def",
"render_to_string",
"(",
"template",
",",
"extra",
"=",
"None",
")",
":",
"from",
"jinja2",
"import",
"Template",
"extra",
"=",
"extra",
"or",
"{",
"}",
"final_fqfn",
"=",
"find_template",
"(",
"template",
")",
"assert",
"final_fqfn",
",",
"'Template ... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | render_to_file | Returns a template to a local file.
If no filename given, a temporary filename will be generated and returned. | burlap/common.py | def render_to_file(template, fn=None, extra=None, **kwargs):
"""
Returns a template to a local file.
If no filename given, a temporary filename will be generated and returned.
"""
import tempfile
dryrun = get_dryrun(kwargs.get('dryrun'))
append_newline = kwargs.pop('append_newline', True)
... | def render_to_file(template, fn=None, extra=None, **kwargs):
"""
Returns a template to a local file.
If no filename given, a temporary filename will be generated and returned.
"""
import tempfile
dryrun = get_dryrun(kwargs.get('dryrun'))
append_newline = kwargs.pop('append_newline', True)
... | [
"Returns",
"a",
"template",
"to",
"a",
"local",
"file",
".",
"If",
"no",
"filename",
"given",
"a",
"temporary",
"filename",
"will",
"be",
"generated",
"and",
"returned",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2661-L2705 | [
"def",
"render_to_file",
"(",
"template",
",",
"fn",
"=",
"None",
",",
"extra",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"tempfile",
"dryrun",
"=",
"get_dryrun",
"(",
"kwargs",
".",
"get",
"(",
"'dryrun'",
")",
")",
"append_newline",
"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | install_config | Returns a template to a remote file.
If no filename given, a temporary filename will be generated and returned. | burlap/common.py | def install_config(local_path=None, remote_path=None, render=True, extra=None, formatter=None):
"""
Returns a template to a remote file.
If no filename given, a temporary filename will be generated and returned.
"""
local_path = find_template(local_path)
if render:
extra = extra or {}
... | def install_config(local_path=None, remote_path=None, render=True, extra=None, formatter=None):
"""
Returns a template to a remote file.
If no filename given, a temporary filename will be generated and returned.
"""
local_path = find_template(local_path)
if render:
extra = extra or {}
... | [
"Returns",
"a",
"template",
"to",
"a",
"remote",
"file",
".",
"If",
"no",
"filename",
"given",
"a",
"temporary",
"filename",
"will",
"be",
"generated",
"and",
"returned",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2707-L2716 | [
"def",
"install_config",
"(",
"local_path",
"=",
"None",
",",
"remote_path",
"=",
"None",
",",
"render",
"=",
"True",
",",
"extra",
"=",
"None",
",",
"formatter",
"=",
"None",
")",
":",
"local_path",
"=",
"find_template",
"(",
"local_path",
")",
"if",
"r... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | iter_sites | Iterates over sites, safely setting environment variables for each site. | burlap/common.py | def iter_sites(sites=None, site=None, renderer=None, setter=None, no_secure=False, verbose=None):
"""
Iterates over sites, safely setting environment variables for each site.
"""
if verbose is None:
verbose = get_verbose()
hostname = get_current_hostname()
target_sites = env.available_... | def iter_sites(sites=None, site=None, renderer=None, setter=None, no_secure=False, verbose=None):
"""
Iterates over sites, safely setting environment variables for each site.
"""
if verbose is None:
verbose = get_verbose()
hostname = get_current_hostname()
target_sites = env.available_... | [
"Iterates",
"over",
"sites",
"safely",
"setting",
"environment",
"variables",
"for",
"each",
"site",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2759-L2813 | [
"def",
"iter_sites",
"(",
"sites",
"=",
"None",
",",
"site",
"=",
"None",
",",
"renderer",
"=",
"None",
",",
"setter",
"=",
"None",
",",
"no_secure",
"=",
"False",
",",
"verbose",
"=",
"None",
")",
":",
"if",
"verbose",
"is",
"None",
":",
"verbose",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | topological_sort | perform topo sort on elements.
:arg source: list of ``(name, [list of dependancies])`` pairs
:returns: list of names, with dependancies listed first | burlap/common.py | def topological_sort(source):
"""perform topo sort on elements.
:arg source: list of ``(name, [list of dependancies])`` pairs
:returns: list of names, with dependancies listed first
"""
if isinstance(source, dict):
source = source.items()
pending = sorted([(name, set(deps)) for name, de... | def topological_sort(source):
"""perform topo sort on elements.
:arg source: list of ``(name, [list of dependancies])`` pairs
:returns: list of names, with dependancies listed first
"""
if isinstance(source, dict):
source = source.items()
pending = sorted([(name, set(deps)) for name, de... | [
"perform",
"topo",
"sort",
"on",
"elements",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2857-L2882 | [
"def",
"topological_sort",
"(",
"source",
")",
":",
"if",
"isinstance",
"(",
"source",
",",
"dict",
")",
":",
"source",
"=",
"source",
".",
"items",
"(",
")",
"pending",
"=",
"sorted",
"(",
"[",
"(",
"name",
",",
"set",
"(",
"deps",
")",
")",
"for"... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | get_hosts_for_site | Returns a list of hosts that have been configured to support the given site. | burlap/common.py | def get_hosts_for_site(site=None):
"""
Returns a list of hosts that have been configured to support the given site.
"""
site = site or env.SITE
hosts = set()
for hostname, _sites in six.iteritems(env.available_sites_by_host):
# print('checking hostname:',hostname, _sites)
for _si... | def get_hosts_for_site(site=None):
"""
Returns a list of hosts that have been configured to support the given site.
"""
site = site or env.SITE
hosts = set()
for hostname, _sites in six.iteritems(env.available_sites_by_host):
# print('checking hostname:',hostname, _sites)
for _si... | [
"Returns",
"a",
"list",
"of",
"hosts",
"that",
"have",
"been",
"configured",
"to",
"support",
"the",
"given",
"site",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L2918-L2934 | [
"def",
"get_hosts_for_site",
"(",
"site",
"=",
"None",
")",
":",
"site",
"=",
"site",
"or",
"env",
".",
"SITE",
"hosts",
"=",
"set",
"(",
")",
"for",
"hostname",
",",
"_sites",
"in",
"six",
".",
"iteritems",
"(",
"env",
".",
"available_sites_by_host",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | Renderer.collect_genv | Returns a copy of the global environment with all the local variables copied back into it. | burlap/common.py | def collect_genv(self, include_local=True, include_global=True):
"""
Returns a copy of the global environment with all the local variables copied back into it.
"""
e = type(self.genv)()
if include_global:
e.update(self.genv)
if include_local:
for k... | def collect_genv(self, include_local=True, include_global=True):
"""
Returns a copy of the global environment with all the local variables copied back into it.
"""
e = type(self.genv)()
if include_global:
e.update(self.genv)
if include_local:
for k... | [
"Returns",
"a",
"copy",
"of",
"the",
"global",
"environment",
"with",
"all",
"the",
"local",
"variables",
"copied",
"back",
"into",
"it",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L567-L577 | [
"def",
"collect_genv",
"(",
"self",
",",
"include_local",
"=",
"True",
",",
"include_global",
"=",
"True",
")",
":",
"e",
"=",
"type",
"(",
"self",
".",
"genv",
")",
"(",
")",
"if",
"include_global",
":",
"e",
".",
"update",
"(",
"self",
".",
"genv",... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | Satchel._set_defaults | Wrapper around the overrideable set_defaults(). | burlap/common.py | def _set_defaults(self):
"""
Wrapper around the overrideable set_defaults().
"""
# Register an "enabled" flag on all satchels.
# How this flag is interpreted depends on the individual satchel.
_prefix = '%s_enabled' % self.name
if _prefix not in env:
... | def _set_defaults(self):
"""
Wrapper around the overrideable set_defaults().
"""
# Register an "enabled" flag on all satchels.
# How this flag is interpreted depends on the individual satchel.
_prefix = '%s_enabled' % self.name
if _prefix not in env:
... | [
"Wrapper",
"around",
"the",
"overrideable",
"set_defaults",
"()",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L813-L828 | [
"def",
"_set_defaults",
"(",
"self",
")",
":",
"# Register an \"enabled\" flag on all satchels.",
"# How this flag is interpreted depends on the individual satchel.",
"_prefix",
"=",
"'%s_enabled'",
"%",
"self",
".",
"name",
"if",
"_prefix",
"not",
"in",
"env",
":",
"env",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | Satchel.capture_bash | Context manager that hides the command prefix and activates dryrun to capture all following task commands to their equivalent Bash outputs. | burlap/common.py | def capture_bash(self):
"""
Context manager that hides the command prefix and activates dryrun to capture all following task commands to their equivalent Bash outputs.
"""
class Capture(object):
def __init__(self, satchel):
self.satchel = satchel
... | def capture_bash(self):
"""
Context manager that hides the command prefix and activates dryrun to capture all following task commands to their equivalent Bash outputs.
"""
class Capture(object):
def __init__(self, satchel):
self.satchel = satchel
... | [
"Context",
"manager",
"that",
"hides",
"the",
"command",
"prefix",
"and",
"activates",
"dryrun",
"to",
"capture",
"all",
"following",
"task",
"commands",
"to",
"their",
"equivalent",
"Bash",
"outputs",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L848-L873 | [
"def",
"capture_bash",
"(",
"self",
")",
":",
"class",
"Capture",
"(",
"object",
")",
":",
"def",
"__init__",
"(",
"self",
",",
"satchel",
")",
":",
"self",
".",
"satchel",
"=",
"satchel",
"self",
".",
"_dryrun",
"=",
"self",
".",
"satchel",
".",
"dr... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | Satchel.register | Adds this satchel to the global registeries for fast lookup from other satchels. | burlap/common.py | def register(self):
"""
Adds this satchel to the global registeries for fast lookup from other satchels.
"""
self._set_defaults()
all_satchels[self.name.upper()] = self
manifest_recorder[self.name] = self.record_manifest
# Register service commands.
if... | def register(self):
"""
Adds this satchel to the global registeries for fast lookup from other satchels.
"""
self._set_defaults()
all_satchels[self.name.upper()] = self
manifest_recorder[self.name] = self.record_manifest
# Register service commands.
if... | [
"Adds",
"this",
"satchel",
"to",
"the",
"global",
"registeries",
"for",
"fast",
"lookup",
"from",
"other",
"satchels",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L875-L888 | [
"def",
"register",
"(",
"self",
")",
":",
"self",
".",
"_set_defaults",
"(",
")",
"all_satchels",
"[",
"self",
".",
"name",
".",
"upper",
"(",
")",
"]",
"=",
"self",
"manifest_recorder",
"[",
"self",
".",
"name",
"]",
"=",
"self",
".",
"record_manifest... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | Satchel.unregister | Removes this satchel from global registeries. | burlap/common.py | def unregister(self):
"""
Removes this satchel from global registeries.
"""
for k in list(env.keys()):
if k.startswith(self.env_prefix):
del env[k]
try:
del all_satchels[self.name.upper()]
except KeyError:
pass
... | def unregister(self):
"""
Removes this satchel from global registeries.
"""
for k in list(env.keys()):
if k.startswith(self.env_prefix):
del env[k]
try:
del all_satchels[self.name.upper()]
except KeyError:
pass
... | [
"Removes",
"this",
"satchel",
"from",
"global",
"registeries",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L890-L922 | [
"def",
"unregister",
"(",
"self",
")",
":",
"for",
"k",
"in",
"list",
"(",
"env",
".",
"keys",
"(",
")",
")",
":",
"if",
"k",
".",
"startswith",
"(",
"self",
".",
"env_prefix",
")",
":",
"del",
"env",
"[",
"k",
"]",
"try",
":",
"del",
"all_satc... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | Satchel.get_tasks | Returns an ordered list of all task names. | burlap/common.py | def get_tasks(self):
"""
Returns an ordered list of all task names.
"""
tasks = set(self.tasks)#DEPRECATED
for _name in dir(self):
# Skip properties so we don't accidentally execute any methods.
if isinstance(getattr(type(self), _name, None), property):
... | def get_tasks(self):
"""
Returns an ordered list of all task names.
"""
tasks = set(self.tasks)#DEPRECATED
for _name in dir(self):
# Skip properties so we don't accidentally execute any methods.
if isinstance(getattr(type(self), _name, None), property):
... | [
"Returns",
"an",
"ordered",
"list",
"of",
"all",
"task",
"names",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L938-L950 | [
"def",
"get_tasks",
"(",
"self",
")",
":",
"tasks",
"=",
"set",
"(",
"self",
".",
"tasks",
")",
"#DEPRECATED",
"for",
"_name",
"in",
"dir",
"(",
"self",
")",
":",
"# Skip properties so we don't accidentally execute any methods.",
"if",
"isinstance",
"(",
"getatt... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | Satchel.local_renderer | Retrieves the cached local renderer. | burlap/common.py | def local_renderer(self):
"""
Retrieves the cached local renderer.
"""
if not self._local_renderer:
r = self.create_local_renderer()
self._local_renderer = r
return self._local_renderer | def local_renderer(self):
"""
Retrieves the cached local renderer.
"""
if not self._local_renderer:
r = self.create_local_renderer()
self._local_renderer = r
return self._local_renderer | [
"Retrieves",
"the",
"cached",
"local",
"renderer",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L981-L988 | [
"def",
"local_renderer",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_local_renderer",
":",
"r",
"=",
"self",
".",
"create_local_renderer",
"(",
")",
"self",
".",
"_local_renderer",
"=",
"r",
"return",
"self",
".",
"_local_renderer"
] | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | Satchel.all_other_enabled_satchels | Returns a dictionary of satchels used in the current configuration, excluding ourselves. | burlap/common.py | def all_other_enabled_satchels(self):
"""
Returns a dictionary of satchels used in the current configuration, excluding ourselves.
"""
return dict(
(name, satchel)
for name, satchel in self.all_satchels.items()
if name != self.name.upper() and name.low... | def all_other_enabled_satchels(self):
"""
Returns a dictionary of satchels used in the current configuration, excluding ourselves.
"""
return dict(
(name, satchel)
for name, satchel in self.all_satchels.items()
if name != self.name.upper() and name.low... | [
"Returns",
"a",
"dictionary",
"of",
"satchels",
"used",
"in",
"the",
"current",
"configuration",
"excluding",
"ourselves",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1005-L1013 | [
"def",
"all_other_enabled_satchels",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"(",
"name",
",",
"satchel",
")",
"for",
"name",
",",
"satchel",
"in",
"self",
".",
"all_satchels",
".",
"items",
"(",
")",
"if",
"name",
"!=",
"self",
".",
"name",
".",... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | Satchel.lenv | Returns a version of env filtered to only include the variables in our namespace. | burlap/common.py | def lenv(self):
"""
Returns a version of env filtered to only include the variables in our namespace.
"""
_env = type(env)()
for _k, _v in six.iteritems(env):
if _k.startswith(self.name+'_'):
_env[_k[len(self.name)+1:]] = _v
return _env | def lenv(self):
"""
Returns a version of env filtered to only include the variables in our namespace.
"""
_env = type(env)()
for _k, _v in six.iteritems(env):
if _k.startswith(self.name+'_'):
_env[_k[len(self.name)+1:]] = _v
return _env | [
"Returns",
"a",
"version",
"of",
"env",
"filtered",
"to",
"only",
"include",
"the",
"variables",
"in",
"our",
"namespace",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1084-L1092 | [
"def",
"lenv",
"(",
"self",
")",
":",
"_env",
"=",
"type",
"(",
"env",
")",
"(",
")",
"for",
"_k",
",",
"_v",
"in",
"six",
".",
"iteritems",
"(",
"env",
")",
":",
"if",
"_k",
".",
"startswith",
"(",
"self",
".",
"name",
"+",
"'_'",
")",
":",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | Satchel.param_changed_to | Returns true if the given parameter, with name key, has transitioned to the given value. | burlap/common.py | def param_changed_to(self, key, to_value, from_value=None):
"""
Returns true if the given parameter, with name key, has transitioned to the given value.
"""
last_value = getattr(self.last_manifest, key)
current_value = self.current_manifest.get(key)
if from_value is not N... | def param_changed_to(self, key, to_value, from_value=None):
"""
Returns true if the given parameter, with name key, has transitioned to the given value.
"""
last_value = getattr(self.last_manifest, key)
current_value = self.current_manifest.get(key)
if from_value is not N... | [
"Returns",
"true",
"if",
"the",
"given",
"parameter",
"with",
"name",
"key",
"has",
"transitioned",
"to",
"the",
"given",
"value",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1109-L1117 | [
"def",
"param_changed_to",
"(",
"self",
",",
"key",
",",
"to_value",
",",
"from_value",
"=",
"None",
")",
":",
"last_value",
"=",
"getattr",
"(",
"self",
".",
"last_manifest",
",",
"key",
")",
"current_value",
"=",
"self",
".",
"current_manifest",
".",
"ge... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | Satchel.reboot_or_dryrun | Reboots the server and waits for it to come back. | burlap/common.py | def reboot_or_dryrun(self, *args, **kwargs):
"""
Reboots the server and waits for it to come back.
"""
warnings.warn('Use self.run() instead.', DeprecationWarning, stacklevel=2)
self.reboot(*args, **kwargs) | def reboot_or_dryrun(self, *args, **kwargs):
"""
Reboots the server and waits for it to come back.
"""
warnings.warn('Use self.run() instead.', DeprecationWarning, stacklevel=2)
self.reboot(*args, **kwargs) | [
"Reboots",
"the",
"server",
"and",
"waits",
"for",
"it",
"to",
"come",
"back",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1138-L1143 | [
"def",
"reboot_or_dryrun",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"warnings",
".",
"warn",
"(",
"'Use self.run() instead.'",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"self",
".",
"reboot",
"(",
"*",
"args",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | Satchel.set_site_specifics | Loads settings for the target site. | burlap/common.py | def set_site_specifics(self, site):
"""
Loads settings for the target site.
"""
r = self.local_renderer
site_data = self.genv.sites[site].copy()
r.env.site = site
if self.verbose:
print('set_site_specifics.data:')
pprint(site_data, indent=4... | def set_site_specifics(self, site):
"""
Loads settings for the target site.
"""
r = self.local_renderer
site_data = self.genv.sites[site].copy()
r.env.site = site
if self.verbose:
print('set_site_specifics.data:')
pprint(site_data, indent=4... | [
"Loads",
"settings",
"for",
"the",
"target",
"site",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1176-L1197 | [
"def",
"set_site_specifics",
"(",
"self",
",",
"site",
")",
":",
"r",
"=",
"self",
".",
"local_renderer",
"site_data",
"=",
"self",
".",
"genv",
".",
"sites",
"[",
"site",
"]",
".",
"copy",
"(",
")",
"r",
".",
"env",
".",
"site",
"=",
"site",
"if",... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
valid | Satchel.vprint | When verbose is set, acts like the normal print() function.
Otherwise, does nothing. | burlap/common.py | def vprint(self, *args, **kwargs):
"""
When verbose is set, acts like the normal print() function.
Otherwise, does nothing.
"""
if self.verbose:
curframe = inspect.currentframe()
calframe = inspect.getouterframes(curframe, 2)
caller_name = calf... | def vprint(self, *args, **kwargs):
"""
When verbose is set, acts like the normal print() function.
Otherwise, does nothing.
"""
if self.verbose:
curframe = inspect.currentframe()
calframe = inspect.getouterframes(curframe, 2)
caller_name = calf... | [
"When",
"verbose",
"is",
"set",
"acts",
"like",
"the",
"normal",
"print",
"()",
"function",
".",
"Otherwise",
"does",
"nothing",
"."
] | chrisspen/burlap | python | https://github.com/chrisspen/burlap/blob/a92b0a8e5206850bb777c74af8421ea8b33779bd/burlap/common.py#L1199-L1209 | [
"def",
"vprint",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"verbose",
":",
"curframe",
"=",
"inspect",
".",
"currentframe",
"(",
")",
"calframe",
"=",
"inspect",
".",
"getouterframes",
"(",
"curframe",
",",
... | a92b0a8e5206850bb777c74af8421ea8b33779bd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.