repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens listlengths 20 707 | docstring stringlengths 3 17.3k | docstring_tokens listlengths 3 222 | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value | idx int64 0 252k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
lxc/python2-lxc | lxc/__init__.py | Container.create | def create(self, template=None, flags=0, args=()):
"""
Create a new rootfs for the container.
"template" if passed must be a valid template name.
"flags" (optional) is an integer representing the optional
create flags to be passed.
"args" (optional)... | python | def create(self, template=None, flags=0, args=()):
"""
Create a new rootfs for the container.
"template" if passed must be a valid template name.
"flags" (optional) is an integer representing the optional
create flags to be passed.
"args" (optional)... | [
"def",
"create",
"(",
"self",
",",
"template",
"=",
"None",
",",
"flags",
"=",
"0",
",",
"args",
"=",
"(",
")",
")",
":",
"if",
"isinstance",
"(",
"args",
",",
"dict",
")",
":",
"template_args",
"=",
"[",
"]",
"for",
"item",
"in",
"args",
".",
... | Create a new rootfs for the container.
"template" if passed must be a valid template name.
"flags" (optional) is an integer representing the optional
create flags to be passed.
"args" (optional) is a tuple of arguments to pass to the
template. It can also b... | [
"Create",
"a",
"new",
"rootfs",
"for",
"the",
"container",
"."
] | b7ec757d2bea1e5787c3e65b1359b8893491ef90 | https://github.com/lxc/python2-lxc/blob/b7ec757d2bea1e5787c3e65b1359b8893491ef90/lxc/__init__.py#L204-L231 | train | 60,200 |
lxc/python2-lxc | lxc/__init__.py | Container.clone | def clone(self, newname, config_path=None, flags=0, bdevtype=None,
bdevdata=None, newsize=0, hookargs=()):
"""
Clone the current container.
"""
args = {}
args['newname'] = newname
args['flags'] = flags
args['newsize'] = newsize
args['hoo... | python | def clone(self, newname, config_path=None, flags=0, bdevtype=None,
bdevdata=None, newsize=0, hookargs=()):
"""
Clone the current container.
"""
args = {}
args['newname'] = newname
args['flags'] = flags
args['newsize'] = newsize
args['hoo... | [
"def",
"clone",
"(",
"self",
",",
"newname",
",",
"config_path",
"=",
"None",
",",
"flags",
"=",
"0",
",",
"bdevtype",
"=",
"None",
",",
"bdevdata",
"=",
"None",
",",
"newsize",
"=",
"0",
",",
"hookargs",
"=",
"(",
")",
")",
":",
"args",
"=",
"{"... | Clone the current container. | [
"Clone",
"the",
"current",
"container",
"."
] | b7ec757d2bea1e5787c3e65b1359b8893491ef90 | https://github.com/lxc/python2-lxc/blob/b7ec757d2bea1e5787c3e65b1359b8893491ef90/lxc/__init__.py#L233-L254 | train | 60,201 |
lxc/python2-lxc | lxc/__init__.py | Container.get_cgroup_item | def get_cgroup_item(self, key):
"""
Returns the value for a given cgroup entry.
A list is returned when multiple values are set.
"""
value = _lxc.Container.get_cgroup_item(self, key)
if value is False:
return False
else:
return val... | python | def get_cgroup_item(self, key):
"""
Returns the value for a given cgroup entry.
A list is returned when multiple values are set.
"""
value = _lxc.Container.get_cgroup_item(self, key)
if value is False:
return False
else:
return val... | [
"def",
"get_cgroup_item",
"(",
"self",
",",
"key",
")",
":",
"value",
"=",
"_lxc",
".",
"Container",
".",
"get_cgroup_item",
"(",
"self",
",",
"key",
")",
"if",
"value",
"is",
"False",
":",
"return",
"False",
"else",
":",
"return",
"value",
".",
"rstri... | Returns the value for a given cgroup entry.
A list is returned when multiple values are set. | [
"Returns",
"the",
"value",
"for",
"a",
"given",
"cgroup",
"entry",
".",
"A",
"list",
"is",
"returned",
"when",
"multiple",
"values",
"are",
"set",
"."
] | b7ec757d2bea1e5787c3e65b1359b8893491ef90 | https://github.com/lxc/python2-lxc/blob/b7ec757d2bea1e5787c3e65b1359b8893491ef90/lxc/__init__.py#L277-L287 | train | 60,202 |
lxc/python2-lxc | lxc/__init__.py | Container.get_config_item | def get_config_item(self, key):
"""
Returns the value for a given config key.
A list is returned when multiple values are set.
"""
value = _lxc.Container.get_config_item(self, key)
if value is False:
return False
elif value.endswith("\n"):
... | python | def get_config_item(self, key):
"""
Returns the value for a given config key.
A list is returned when multiple values are set.
"""
value = _lxc.Container.get_config_item(self, key)
if value is False:
return False
elif value.endswith("\n"):
... | [
"def",
"get_config_item",
"(",
"self",
",",
"key",
")",
":",
"value",
"=",
"_lxc",
".",
"Container",
".",
"get_config_item",
"(",
"self",
",",
"key",
")",
"if",
"value",
"is",
"False",
":",
"return",
"False",
"elif",
"value",
".",
"endswith",
"(",
"\"\... | Returns the value for a given config key.
A list is returned when multiple values are set. | [
"Returns",
"the",
"value",
"for",
"a",
"given",
"config",
"key",
".",
"A",
"list",
"is",
"returned",
"when",
"multiple",
"values",
"are",
"set",
"."
] | b7ec757d2bea1e5787c3e65b1359b8893491ef90 | https://github.com/lxc/python2-lxc/blob/b7ec757d2bea1e5787c3e65b1359b8893491ef90/lxc/__init__.py#L289-L301 | train | 60,203 |
lxc/python2-lxc | lxc/__init__.py | Container.get_keys | def get_keys(self, key=None):
"""
Returns a list of valid sub-keys.
"""
if key:
value = _lxc.Container.get_keys(self, key)
else:
value = _lxc.Container.get_keys(self)
if value is False:
return False
elif value.endswith("\n"... | python | def get_keys(self, key=None):
"""
Returns a list of valid sub-keys.
"""
if key:
value = _lxc.Container.get_keys(self, key)
else:
value = _lxc.Container.get_keys(self)
if value is False:
return False
elif value.endswith("\n"... | [
"def",
"get_keys",
"(",
"self",
",",
"key",
"=",
"None",
")",
":",
"if",
"key",
":",
"value",
"=",
"_lxc",
".",
"Container",
".",
"get_keys",
"(",
"self",
",",
"key",
")",
"else",
":",
"value",
"=",
"_lxc",
".",
"Container",
".",
"get_keys",
"(",
... | Returns a list of valid sub-keys. | [
"Returns",
"a",
"list",
"of",
"valid",
"sub",
"-",
"keys",
"."
] | b7ec757d2bea1e5787c3e65b1359b8893491ef90 | https://github.com/lxc/python2-lxc/blob/b7ec757d2bea1e5787c3e65b1359b8893491ef90/lxc/__init__.py#L303-L317 | train | 60,204 |
lxc/python2-lxc | lxc/__init__.py | Container.get_ips | def get_ips(self, interface=None, family=None, scope=None, timeout=0):
"""
Get a tuple of IPs for the container.
"""
kwargs = {}
if interface:
kwargs['interface'] = interface
if family:
kwargs['family'] = family
if scope:
k... | python | def get_ips(self, interface=None, family=None, scope=None, timeout=0):
"""
Get a tuple of IPs for the container.
"""
kwargs = {}
if interface:
kwargs['interface'] = interface
if family:
kwargs['family'] = family
if scope:
k... | [
"def",
"get_ips",
"(",
"self",
",",
"interface",
"=",
"None",
",",
"family",
"=",
"None",
",",
"scope",
"=",
"None",
",",
"timeout",
"=",
"0",
")",
":",
"kwargs",
"=",
"{",
"}",
"if",
"interface",
":",
"kwargs",
"[",
"'interface'",
"]",
"=",
"inter... | Get a tuple of IPs for the container. | [
"Get",
"a",
"tuple",
"of",
"IPs",
"for",
"the",
"container",
"."
] | b7ec757d2bea1e5787c3e65b1359b8893491ef90 | https://github.com/lxc/python2-lxc/blob/b7ec757d2bea1e5787c3e65b1359b8893491ef90/lxc/__init__.py#L326-L350 | train | 60,205 |
lxc/python2-lxc | lxc/__init__.py | Container.rename | def rename(self, new_name):
"""
Rename the container.
On success, returns the new Container object.
On failure, returns False.
"""
if _lxc.Container.rename(self, new_name):
return Container(new_name)
return False | python | def rename(self, new_name):
"""
Rename the container.
On success, returns the new Container object.
On failure, returns False.
"""
if _lxc.Container.rename(self, new_name):
return Container(new_name)
return False | [
"def",
"rename",
"(",
"self",
",",
"new_name",
")",
":",
"if",
"_lxc",
".",
"Container",
".",
"rename",
"(",
"self",
",",
"new_name",
")",
":",
"return",
"Container",
"(",
"new_name",
")",
"return",
"False"
] | Rename the container.
On success, returns the new Container object.
On failure, returns False. | [
"Rename",
"the",
"container",
".",
"On",
"success",
"returns",
"the",
"new",
"Container",
"object",
".",
"On",
"failure",
"returns",
"False",
"."
] | b7ec757d2bea1e5787c3e65b1359b8893491ef90 | https://github.com/lxc/python2-lxc/blob/b7ec757d2bea1e5787c3e65b1359b8893491ef90/lxc/__init__.py#L352-L362 | train | 60,206 |
lxc/python2-lxc | lxc/__init__.py | Container.set_config_item | def set_config_item(self, key, value):
"""
Set a config key to a provided value.
The value can be a list for the keys supporting multiple values.
"""
try:
old_value = self.get_config_item(key)
except KeyError:
old_value = None
# Ge... | python | def set_config_item(self, key, value):
"""
Set a config key to a provided value.
The value can be a list for the keys supporting multiple values.
"""
try:
old_value = self.get_config_item(key)
except KeyError:
old_value = None
# Ge... | [
"def",
"set_config_item",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"try",
":",
"old_value",
"=",
"self",
".",
"get_config_item",
"(",
"key",
")",
"except",
"KeyError",
":",
"old_value",
"=",
"None",
"# Get everything to unicode with python2",
"if",
"is... | Set a config key to a provided value.
The value can be a list for the keys supporting multiple values. | [
"Set",
"a",
"config",
"key",
"to",
"a",
"provided",
"value",
".",
"The",
"value",
"can",
"be",
"a",
"list",
"for",
"the",
"keys",
"supporting",
"multiple",
"values",
"."
] | b7ec757d2bea1e5787c3e65b1359b8893491ef90 | https://github.com/lxc/python2-lxc/blob/b7ec757d2bea1e5787c3e65b1359b8893491ef90/lxc/__init__.py#L364-L413 | train | 60,207 |
lxc/python2-lxc | lxc/__init__.py | Container.wait | def wait(self, state, timeout=-1):
"""
Wait for the container to reach a given state or timeout.
"""
if isinstance(state, str):
state = state.upper()
return _lxc.Container.wait(self, state, timeout) | python | def wait(self, state, timeout=-1):
"""
Wait for the container to reach a given state or timeout.
"""
if isinstance(state, str):
state = state.upper()
return _lxc.Container.wait(self, state, timeout) | [
"def",
"wait",
"(",
"self",
",",
"state",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"if",
"isinstance",
"(",
"state",
",",
"str",
")",
":",
"state",
"=",
"state",
".",
"upper",
"(",
")",
"return",
"_lxc",
".",
"Container",
".",
"wait",
"(",
"self"... | Wait for the container to reach a given state or timeout. | [
"Wait",
"for",
"the",
"container",
"to",
"reach",
"a",
"given",
"state",
"or",
"timeout",
"."
] | b7ec757d2bea1e5787c3e65b1359b8893491ef90 | https://github.com/lxc/python2-lxc/blob/b7ec757d2bea1e5787c3e65b1359b8893491ef90/lxc/__init__.py#L415-L423 | train | 60,208 |
dixudx/rtcclient | rtcclient/template.py | Templater.render | def render(self, template, **kwargs):
"""Renders the template
:param template: The template to render.
The template is actually a file, which is usually generated
by :class:`rtcclient.template.Templater.getTemplate`
and can also be modified by user accordingly.
... | python | def render(self, template, **kwargs):
"""Renders the template
:param template: The template to render.
The template is actually a file, which is usually generated
by :class:`rtcclient.template.Templater.getTemplate`
and can also be modified by user accordingly.
... | [
"def",
"render",
"(",
"self",
",",
"template",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"temp",
"=",
"self",
".",
"environment",
".",
"get_template",
"(",
"template",
")",
"return",
"temp",
".",
"render",
"(",
"*",
"*",
"kwargs",
")",
"except",... | Renders the template
:param template: The template to render.
The template is actually a file, which is usually generated
by :class:`rtcclient.template.Templater.getTemplate`
and can also be modified by user accordingly.
:param kwargs: The `kwargs` dict is used to fi... | [
"Renders",
"the",
"template"
] | 1721dd0b047478f5bdd6359b07a2c503cfafd86f | https://github.com/dixudx/rtcclient/blob/1721dd0b047478f5bdd6359b07a2c503cfafd86f/rtcclient/template.py#L43-L81 | train | 60,209 |
dixudx/rtcclient | rtcclient/template.py | Templater.listFields | def listFields(self, template):
"""List all the attributes to be rendered from the template file
:param template: The template to render.
The template is actually a file, which is usually generated
by :class:`rtcclient.template.Templater.getTemplate` and can also
be ... | python | def listFields(self, template):
"""List all the attributes to be rendered from the template file
:param template: The template to render.
The template is actually a file, which is usually generated
by :class:`rtcclient.template.Templater.getTemplate` and can also
be ... | [
"def",
"listFields",
"(",
"self",
",",
"template",
")",
":",
"try",
":",
"temp_source",
"=",
"self",
".",
"environment",
".",
"loader",
".",
"get_source",
"(",
"self",
".",
"environment",
",",
"template",
")",
"return",
"self",
".",
"listFieldsFromSource",
... | List all the attributes to be rendered from the template file
:param template: The template to render.
The template is actually a file, which is usually generated
by :class:`rtcclient.template.Templater.getTemplate` and can also
be modified by user accordingly.
:retu... | [
"List",
"all",
"the",
"attributes",
"to",
"be",
"rendered",
"from",
"the",
"template",
"file"
] | 1721dd0b047478f5bdd6359b07a2c503cfafd86f | https://github.com/dixudx/rtcclient/blob/1721dd0b047478f5bdd6359b07a2c503cfafd86f/rtcclient/template.py#L134-L152 | train | 60,210 |
dixudx/rtcclient | rtcclient/template.py | Templater.listFieldsFromSource | def listFieldsFromSource(self, template_source):
"""List all the attributes to be rendered directly from template
source
:param template_source: the template source (usually represents the
template content in string format)
:return: a :class:`set` contains all the needed att... | python | def listFieldsFromSource(self, template_source):
"""List all the attributes to be rendered directly from template
source
:param template_source: the template source (usually represents the
template content in string format)
:return: a :class:`set` contains all the needed att... | [
"def",
"listFieldsFromSource",
"(",
"self",
",",
"template_source",
")",
":",
"ast",
"=",
"self",
".",
"environment",
".",
"parse",
"(",
"template_source",
")",
"return",
"jinja2",
".",
"meta",
".",
"find_undeclared_variables",
"(",
"ast",
")"
] | List all the attributes to be rendered directly from template
source
:param template_source: the template source (usually represents the
template content in string format)
:return: a :class:`set` contains all the needed attributes
:rtype: set | [
"List",
"all",
"the",
"attributes",
"to",
"be",
"rendered",
"directly",
"from",
"template",
"source"
] | 1721dd0b047478f5bdd6359b07a2c503cfafd86f | https://github.com/dixudx/rtcclient/blob/1721dd0b047478f5bdd6359b07a2c503cfafd86f/rtcclient/template.py#L183-L194 | train | 60,211 |
Jaymon/dump | dump/postgres.py | Postgres._get_file | def _get_file(self):
'''
return an opened tempfile pointer that can be used
http://docs.python.org/2/library/tempfile.html
'''
f = tempfile.NamedTemporaryFile(delete=False)
self.tmp_files.add(f.name)
return f | python | def _get_file(self):
'''
return an opened tempfile pointer that can be used
http://docs.python.org/2/library/tempfile.html
'''
f = tempfile.NamedTemporaryFile(delete=False)
self.tmp_files.add(f.name)
return f | [
"def",
"_get_file",
"(",
"self",
")",
":",
"f",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"delete",
"=",
"False",
")",
"self",
".",
"tmp_files",
".",
"add",
"(",
"f",
".",
"name",
")",
"return",
"f"
] | return an opened tempfile pointer that can be used
http://docs.python.org/2/library/tempfile.html | [
"return",
"an",
"opened",
"tempfile",
"pointer",
"that",
"can",
"be",
"used"
] | 40045669e07cc2676a9fa92afcf5ef18f10f2fcc | https://github.com/Jaymon/dump/blob/40045669e07cc2676a9fa92afcf5ef18f10f2fcc/dump/postgres.py#L117-L125 | train | 60,212 |
Jaymon/dump | dump/postgres.py | Postgres._get_args | def _get_args(self, executable, *args):
"""compile all the executable and the arguments, combining with common arguments
to create a full batch of command args"""
args = list(args)
args.insert(0, executable)
if self.username:
args.append("--username={}".format(self.us... | python | def _get_args(self, executable, *args):
"""compile all the executable and the arguments, combining with common arguments
to create a full batch of command args"""
args = list(args)
args.insert(0, executable)
if self.username:
args.append("--username={}".format(self.us... | [
"def",
"_get_args",
"(",
"self",
",",
"executable",
",",
"*",
"args",
")",
":",
"args",
"=",
"list",
"(",
"args",
")",
"args",
".",
"insert",
"(",
"0",
",",
"executable",
")",
"if",
"self",
".",
"username",
":",
"args",
".",
"append",
"(",
"\"--use... | compile all the executable and the arguments, combining with common arguments
to create a full batch of command args | [
"compile",
"all",
"the",
"executable",
"and",
"the",
"arguments",
"combining",
"with",
"common",
"arguments",
"to",
"create",
"a",
"full",
"batch",
"of",
"command",
"args"
] | 40045669e07cc2676a9fa92afcf5ef18f10f2fcc | https://github.com/Jaymon/dump/blob/40045669e07cc2676a9fa92afcf5ef18f10f2fcc/dump/postgres.py#L127-L141 | train | 60,213 |
Jaymon/dump | dump/postgres.py | Postgres._get_outfile_path | def _get_outfile_path(self, table):
"""return the path for a file we can use to back up the table"""
self.outfile_count += 1
outfile = os.path.join(self.directory, '{:03d}_{}.sql.gz'.format(self.outfile_count, table))
return outfile | python | def _get_outfile_path(self, table):
"""return the path for a file we can use to back up the table"""
self.outfile_count += 1
outfile = os.path.join(self.directory, '{:03d}_{}.sql.gz'.format(self.outfile_count, table))
return outfile | [
"def",
"_get_outfile_path",
"(",
"self",
",",
"table",
")",
":",
"self",
".",
"outfile_count",
"+=",
"1",
"outfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"directory",
",",
"'{:03d}_{}.sql.gz'",
".",
"format",
"(",
"self",
".",
"outfile_... | return the path for a file we can use to back up the table | [
"return",
"the",
"path",
"for",
"a",
"file",
"we",
"can",
"use",
"to",
"back",
"up",
"the",
"table"
] | 40045669e07cc2676a9fa92afcf5ef18f10f2fcc | https://github.com/Jaymon/dump/blob/40045669e07cc2676a9fa92afcf5ef18f10f2fcc/dump/postgres.py#L181-L185 | train | 60,214 |
Jaymon/dump | dump/postgres.py | Postgres._run_queries | def _run_queries(self, queries, *args, **kwargs):
"""run the queries
queries -- list -- the queries to run
return -- string -- the results of the query?
"""
# write out all the commands to a temp file and then have psql run that file
f = self._get_file()
for q in... | python | def _run_queries(self, queries, *args, **kwargs):
"""run the queries
queries -- list -- the queries to run
return -- string -- the results of the query?
"""
# write out all the commands to a temp file and then have psql run that file
f = self._get_file()
for q in... | [
"def",
"_run_queries",
"(",
"self",
",",
"queries",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# write out all the commands to a temp file and then have psql run that file",
"f",
"=",
"self",
".",
"_get_file",
"(",
")",
"for",
"q",
"in",
"queries",
":... | run the queries
queries -- list -- the queries to run
return -- string -- the results of the query? | [
"run",
"the",
"queries"
] | 40045669e07cc2676a9fa92afcf5ef18f10f2fcc | https://github.com/Jaymon/dump/blob/40045669e07cc2676a9fa92afcf5ef18f10f2fcc/dump/postgres.py#L187-L200 | train | 60,215 |
Jaymon/dump | dump/postgres.py | Postgres._restore_auto_increment | def _restore_auto_increment(self, table):
"""restore the auto increment value for the table to what it was previously"""
query, seq_table, seq_column, seq_name = self._get_auto_increment_info(table)
if query:
queries = [query, "select nextval('{}')".format(seq_name)]
retu... | python | def _restore_auto_increment(self, table):
"""restore the auto increment value for the table to what it was previously"""
query, seq_table, seq_column, seq_name = self._get_auto_increment_info(table)
if query:
queries = [query, "select nextval('{}')".format(seq_name)]
retu... | [
"def",
"_restore_auto_increment",
"(",
"self",
",",
"table",
")",
":",
"query",
",",
"seq_table",
",",
"seq_column",
",",
"seq_name",
"=",
"self",
".",
"_get_auto_increment_info",
"(",
"table",
")",
"if",
"query",
":",
"queries",
"=",
"[",
"query",
",",
"\... | restore the auto increment value for the table to what it was previously | [
"restore",
"the",
"auto",
"increment",
"value",
"for",
"the",
"table",
"to",
"what",
"it",
"was",
"previously"
] | 40045669e07cc2676a9fa92afcf5ef18f10f2fcc | https://github.com/Jaymon/dump/blob/40045669e07cc2676a9fa92afcf5ef18f10f2fcc/dump/postgres.py#L202-L207 | train | 60,216 |
Jaymon/dump | dump/postgres.py | Postgres._get_auto_increment_info | def _get_auto_increment_info(self, table):
"""figure out the the autoincrement value for the given table"""
query = ''
seq_table = ''
seq_column = ''
seq_name = ''
find_query = "\n".join([
"SELECT",
" t.relname as related_table,",
" a... | python | def _get_auto_increment_info(self, table):
"""figure out the the autoincrement value for the given table"""
query = ''
seq_table = ''
seq_column = ''
seq_name = ''
find_query = "\n".join([
"SELECT",
" t.relname as related_table,",
" a... | [
"def",
"_get_auto_increment_info",
"(",
"self",
",",
"table",
")",
":",
"query",
"=",
"''",
"seq_table",
"=",
"''",
"seq_column",
"=",
"''",
"seq_name",
"=",
"''",
"find_query",
"=",
"\"\\n\"",
".",
"join",
"(",
"[",
"\"SELECT\"",
",",
"\" t.relname as rela... | figure out the the autoincrement value for the given table | [
"figure",
"out",
"the",
"the",
"autoincrement",
"value",
"for",
"the",
"given",
"table"
] | 40045669e07cc2676a9fa92afcf5ef18f10f2fcc | https://github.com/Jaymon/dump/blob/40045669e07cc2676a9fa92afcf5ef18f10f2fcc/dump/postgres.py#L209-L252 | train | 60,217 |
Jaymon/dump | dump/interface/postgres.py | Postgres.restore | def restore(self):
"""use the self.directory to restore a db
NOTE -- this will only restore a database dumped with one of the methods
of this class
"""
sql_files = []
for root, dirs, files in os.walk(self.directory):
for f in files:
if f.endsw... | python | def restore(self):
"""use the self.directory to restore a db
NOTE -- this will only restore a database dumped with one of the methods
of this class
"""
sql_files = []
for root, dirs, files in os.walk(self.directory):
for f in files:
if f.endsw... | [
"def",
"restore",
"(",
"self",
")",
":",
"sql_files",
"=",
"[",
"]",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"self",
".",
"directory",
")",
":",
"for",
"f",
"in",
"files",
":",
"if",
"f",
".",
"endswith",
"(",
"\... | use the self.directory to restore a db
NOTE -- this will only restore a database dumped with one of the methods
of this class | [
"use",
"the",
"self",
".",
"directory",
"to",
"restore",
"a",
"db"
] | 40045669e07cc2676a9fa92afcf5ef18f10f2fcc | https://github.com/Jaymon/dump/blob/40045669e07cc2676a9fa92afcf5ef18f10f2fcc/dump/interface/postgres.py#L58-L90 | train | 60,218 |
Jaymon/dump | dump/interface/postgres.py | Postgres._get_env | def _get_env(self):
"""this returns an environment dictionary we want to use to run the command
this will also create a fake pgpass file in order to make it possible for
the script to be passwordless"""
if hasattr(self, 'env'): return self.env
# create a temporary pgpass file
... | python | def _get_env(self):
"""this returns an environment dictionary we want to use to run the command
this will also create a fake pgpass file in order to make it possible for
the script to be passwordless"""
if hasattr(self, 'env'): return self.env
# create a temporary pgpass file
... | [
"def",
"_get_env",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'env'",
")",
":",
"return",
"self",
".",
"env",
"# create a temporary pgpass file",
"pgpass",
"=",
"self",
".",
"_get_file",
"(",
")",
"# format: http://www.postgresql.org/docs/9.2/stati... | this returns an environment dictionary we want to use to run the command
this will also create a fake pgpass file in order to make it possible for
the script to be passwordless | [
"this",
"returns",
"an",
"environment",
"dictionary",
"we",
"want",
"to",
"use",
"to",
"run",
"the",
"command"
] | 40045669e07cc2676a9fa92afcf5ef18f10f2fcc | https://github.com/Jaymon/dump/blob/40045669e07cc2676a9fa92afcf5ef18f10f2fcc/dump/interface/postgres.py#L144-L161 | train | 60,219 |
thomwiggers/httpserver | httpserver/httpserver.py | _get_response | def _get_response(**kwargs):
"""Get a template response
Use kwargs to add things to the dictionary
"""
if 'code' not in kwargs:
kwargs['code'] = 200
if 'headers' not in kwargs:
kwargs['headers'] = dict()
if 'version' not in kwargs:
kwargs['version'] = 'HTTP/1.1'
ret... | python | def _get_response(**kwargs):
"""Get a template response
Use kwargs to add things to the dictionary
"""
if 'code' not in kwargs:
kwargs['code'] = 200
if 'headers' not in kwargs:
kwargs['headers'] = dict()
if 'version' not in kwargs:
kwargs['version'] = 'HTTP/1.1'
ret... | [
"def",
"_get_response",
"(",
"*",
"*",
"kwargs",
")",
":",
"if",
"'code'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'code'",
"]",
"=",
"200",
"if",
"'headers'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'headers'",
"]",
"=",
"dict",
"(",
")",
... | Get a template response
Use kwargs to add things to the dictionary | [
"Get",
"a",
"template",
"response"
] | 88a3a35619ce5185347c6764f211878e898e6aad | https://github.com/thomwiggers/httpserver/blob/88a3a35619ce5185347c6764f211878e898e6aad/httpserver/httpserver.py#L16-L28 | train | 60,220 |
thomwiggers/httpserver | httpserver/httpserver.py | HttpProtocol._write_transport | def _write_transport(self, string):
"""Convenience function to write to the transport"""
if isinstance(string, str): # we need to convert to bytes
self.transport.write(string.encode('utf-8'))
else:
self.transport.write(string) | python | def _write_transport(self, string):
"""Convenience function to write to the transport"""
if isinstance(string, str): # we need to convert to bytes
self.transport.write(string.encode('utf-8'))
else:
self.transport.write(string) | [
"def",
"_write_transport",
"(",
"self",
",",
"string",
")",
":",
"if",
"isinstance",
"(",
"string",
",",
"str",
")",
":",
"# we need to convert to bytes",
"self",
".",
"transport",
".",
"write",
"(",
"string",
".",
"encode",
"(",
"'utf-8'",
")",
")",
"else... | Convenience function to write to the transport | [
"Convenience",
"function",
"to",
"write",
"to",
"the",
"transport"
] | 88a3a35619ce5185347c6764f211878e898e6aad | https://github.com/thomwiggers/httpserver/blob/88a3a35619ce5185347c6764f211878e898e6aad/httpserver/httpserver.py#L52-L57 | train | 60,221 |
thomwiggers/httpserver | httpserver/httpserver.py | HttpProtocol._write_response | def _write_response(self, response):
"""Write the response back to the client
Arguments:
response -- the dictionary containing the response.
"""
status = '{} {} {}\r\n'.format(response['version'],
response['code'],
... | python | def _write_response(self, response):
"""Write the response back to the client
Arguments:
response -- the dictionary containing the response.
"""
status = '{} {} {}\r\n'.format(response['version'],
response['code'],
... | [
"def",
"_write_response",
"(",
"self",
",",
"response",
")",
":",
"status",
"=",
"'{} {} {}\\r\\n'",
".",
"format",
"(",
"response",
"[",
"'version'",
"]",
",",
"response",
"[",
"'code'",
"]",
",",
"responses",
"[",
"response",
"[",
"'code'",
"]",
"]",
"... | Write the response back to the client
Arguments:
response -- the dictionary containing the response. | [
"Write",
"the",
"response",
"back",
"to",
"the",
"client"
] | 88a3a35619ce5185347c6764f211878e898e6aad | https://github.com/thomwiggers/httpserver/blob/88a3a35619ce5185347c6764f211878e898e6aad/httpserver/httpserver.py#L59-L83 | train | 60,222 |
thomwiggers/httpserver | httpserver/httpserver.py | HttpProtocol.connection_made | def connection_made(self, transport):
"""Called when the connection is made"""
self.logger.info('Connection made at object %s', id(self))
self.transport = transport
self.keepalive = True
if self._timeout:
self.logger.debug('Registering timeout event')
sel... | python | def connection_made(self, transport):
"""Called when the connection is made"""
self.logger.info('Connection made at object %s', id(self))
self.transport = transport
self.keepalive = True
if self._timeout:
self.logger.debug('Registering timeout event')
sel... | [
"def",
"connection_made",
"(",
"self",
",",
"transport",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'Connection made at object %s'",
",",
"id",
"(",
"self",
")",
")",
"self",
".",
"transport",
"=",
"transport",
"self",
".",
"keepalive",
"=",
"True... | Called when the connection is made | [
"Called",
"when",
"the",
"connection",
"is",
"made"
] | 88a3a35619ce5185347c6764f211878e898e6aad | https://github.com/thomwiggers/httpserver/blob/88a3a35619ce5185347c6764f211878e898e6aad/httpserver/httpserver.py#L85-L94 | train | 60,223 |
thomwiggers/httpserver | httpserver/httpserver.py | HttpProtocol.connection_lost | def connection_lost(self, exception):
"""Called when the connection is lost or closed.
The argument is either an exception object or None. The latter means
a regular EOF is received, or the connection was aborted or closed by
this side of the connection.
"""
if exception... | python | def connection_lost(self, exception):
"""Called when the connection is lost or closed.
The argument is either an exception object or None. The latter means
a regular EOF is received, or the connection was aborted or closed by
this side of the connection.
"""
if exception... | [
"def",
"connection_lost",
"(",
"self",
",",
"exception",
")",
":",
"if",
"exception",
":",
"self",
".",
"logger",
".",
"exception",
"(",
"'Connection lost!'",
")",
"else",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'Connection lost'",
")"
] | Called when the connection is lost or closed.
The argument is either an exception object or None. The latter means
a regular EOF is received, or the connection was aborted or closed by
this side of the connection. | [
"Called",
"when",
"the",
"connection",
"is",
"lost",
"or",
"closed",
"."
] | 88a3a35619ce5185347c6764f211878e898e6aad | https://github.com/thomwiggers/httpserver/blob/88a3a35619ce5185347c6764f211878e898e6aad/httpserver/httpserver.py#L96-L106 | train | 60,224 |
thomwiggers/httpserver | httpserver/httpserver.py | HttpProtocol.data_received | def data_received(self, data):
"""Process received data from the socket
Called when we receive data
"""
self.logger.debug('Received data: %s', repr(data))
try:
request = self._parse_headers(data)
self._handle_request(request)
except InvalidReques... | python | def data_received(self, data):
"""Process received data from the socket
Called when we receive data
"""
self.logger.debug('Received data: %s', repr(data))
try:
request = self._parse_headers(data)
self._handle_request(request)
except InvalidReques... | [
"def",
"data_received",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'Received data: %s'",
",",
"repr",
"(",
"data",
")",
")",
"try",
":",
"request",
"=",
"self",
".",
"_parse_headers",
"(",
"data",
")",
"self",
".",
... | Process received data from the socket
Called when we receive data | [
"Process",
"received",
"data",
"from",
"the",
"socket"
] | 88a3a35619ce5185347c6764f211878e898e6aad | https://github.com/thomwiggers/httpserver/blob/88a3a35619ce5185347c6764f211878e898e6aad/httpserver/httpserver.py#L108-L130 | train | 60,225 |
thomwiggers/httpserver | httpserver/httpserver.py | HttpProtocol._get_request_uri | def _get_request_uri(self, request):
"""Parse the request URI into something useful
Server MUST accept full URIs (5.1.2)"""
request_uri = request['target']
if request_uri.startswith('/'): # eg. GET /index.html
return (request.get('Host', 'localhost').split(':')[0],
... | python | def _get_request_uri(self, request):
"""Parse the request URI into something useful
Server MUST accept full URIs (5.1.2)"""
request_uri = request['target']
if request_uri.startswith('/'): # eg. GET /index.html
return (request.get('Host', 'localhost').split(':')[0],
... | [
"def",
"_get_request_uri",
"(",
"self",
",",
"request",
")",
":",
"request_uri",
"=",
"request",
"[",
"'target'",
"]",
"if",
"request_uri",
".",
"startswith",
"(",
"'/'",
")",
":",
"# eg. GET /index.html",
"return",
"(",
"request",
".",
"get",
"(",
"'Host'",... | Parse the request URI into something useful
Server MUST accept full URIs (5.1.2) | [
"Parse",
"the",
"request",
"URI",
"into",
"something",
"useful"
] | 88a3a35619ce5185347c6764f211878e898e6aad | https://github.com/thomwiggers/httpserver/blob/88a3a35619ce5185347c6764f211878e898e6aad/httpserver/httpserver.py#L173-L184 | train | 60,226 |
thomwiggers/httpserver | httpserver/httpserver.py | HttpProtocol._handle_request | def _handle_request(self, request):
"""Process the headers and get the file"""
# Check if this is a persistent connection.
if request['version'] == 'HTTP/1.1':
self.keepalive = not request.get('Connection') == 'close'
elif request['version'] == 'HTTP/1.0':
self.k... | python | def _handle_request(self, request):
"""Process the headers and get the file"""
# Check if this is a persistent connection.
if request['version'] == 'HTTP/1.1':
self.keepalive = not request.get('Connection') == 'close'
elif request['version'] == 'HTTP/1.0':
self.k... | [
"def",
"_handle_request",
"(",
"self",
",",
"request",
")",
":",
"# Check if this is a persistent connection.",
"if",
"request",
"[",
"'version'",
"]",
"==",
"'HTTP/1.1'",
":",
"self",
".",
"keepalive",
"=",
"not",
"request",
".",
"get",
"(",
"'Connection'",
")"... | Process the headers and get the file | [
"Process",
"the",
"headers",
"and",
"get",
"the",
"file"
] | 88a3a35619ce5185347c6764f211878e898e6aad | https://github.com/thomwiggers/httpserver/blob/88a3a35619ce5185347c6764f211878e898e6aad/httpserver/httpserver.py#L186-L257 | train | 60,227 |
thomwiggers/httpserver | httpserver/httpserver.py | InvalidRequestError.get_http_response | def get_http_response(self):
"""Get this exception as an HTTP response suitable for output"""
return _get_response(
code=self.code,
body=str(self),
headers={
'Content-Type': 'text/plain'
}
) | python | def get_http_response(self):
"""Get this exception as an HTTP response suitable for output"""
return _get_response(
code=self.code,
body=str(self),
headers={
'Content-Type': 'text/plain'
}
) | [
"def",
"get_http_response",
"(",
"self",
")",
":",
"return",
"_get_response",
"(",
"code",
"=",
"self",
".",
"code",
",",
"body",
"=",
"str",
"(",
"self",
")",
",",
"headers",
"=",
"{",
"'Content-Type'",
":",
"'text/plain'",
"}",
")"
] | Get this exception as an HTTP response suitable for output | [
"Get",
"this",
"exception",
"as",
"an",
"HTTP",
"response",
"suitable",
"for",
"output"
] | 88a3a35619ce5185347c6764f211878e898e6aad | https://github.com/thomwiggers/httpserver/blob/88a3a35619ce5185347c6764f211878e898e6aad/httpserver/httpserver.py#L280-L288 | train | 60,228 |
thomwiggers/httpserver | httpserver/__init__.py | _start_server | def _start_server(bindaddr, port, hostname, folder):
"""Starts an asyncio server"""
import asyncio
from .httpserver import HttpProtocol
loop = asyncio.get_event_loop()
coroutine = loop.create_server(lambda: HttpProtocol(hostname, folder),
bindaddr,
... | python | def _start_server(bindaddr, port, hostname, folder):
"""Starts an asyncio server"""
import asyncio
from .httpserver import HttpProtocol
loop = asyncio.get_event_loop()
coroutine = loop.create_server(lambda: HttpProtocol(hostname, folder),
bindaddr,
... | [
"def",
"_start_server",
"(",
"bindaddr",
",",
"port",
",",
"hostname",
",",
"folder",
")",
":",
"import",
"asyncio",
"from",
".",
"httpserver",
"import",
"HttpProtocol",
"loop",
"=",
"asyncio",
".",
"get_event_loop",
"(",
")",
"coroutine",
"=",
"loop",
".",
... | Starts an asyncio server | [
"Starts",
"an",
"asyncio",
"server"
] | 88a3a35619ce5185347c6764f211878e898e6aad | https://github.com/thomwiggers/httpserver/blob/88a3a35619ce5185347c6764f211878e898e6aad/httpserver/__init__.py#L11-L25 | train | 60,229 |
thomwiggers/httpserver | httpserver/__init__.py | run | def run(argv=None): # pragma: no cover
"""Run the HTTP server
Usage:
httpserver [options] [<folder>]
Options::
-h,--host=<hostname> What host name to serve (default localhost)
-a,--bindaddress=<address> Address to bind to (default 127.0.0.1)
-p,--port=<port> ... | python | def run(argv=None): # pragma: no cover
"""Run the HTTP server
Usage:
httpserver [options] [<folder>]
Options::
-h,--host=<hostname> What host name to serve (default localhost)
-a,--bindaddress=<address> Address to bind to (default 127.0.0.1)
-p,--port=<port> ... | [
"def",
"run",
"(",
"argv",
"=",
"None",
")",
":",
"# pragma: no cover",
"import",
"sys",
"import",
"os",
"import",
"docopt",
"import",
"textwrap",
"# Check for the version",
"if",
"not",
"sys",
".",
"version_info",
">=",
"(",
"3",
",",
"4",
")",
":",
"prin... | Run the HTTP server
Usage:
httpserver [options] [<folder>]
Options::
-h,--host=<hostname> What host name to serve (default localhost)
-a,--bindaddress=<address> Address to bind to (default 127.0.0.1)
-p,--port=<port> Port to listen on (default 8080)
... | [
"Run",
"the",
"HTTP",
"server"
] | 88a3a35619ce5185347c6764f211878e898e6aad | https://github.com/thomwiggers/httpserver/blob/88a3a35619ce5185347c6764f211878e898e6aad/httpserver/__init__.py#L28-L85 | train | 60,230 |
dslackw/slpkg | slpkg/url_read.py | URL.reading | def reading(self):
"""Open url and read
"""
try:
# testing proxy
proxies = {}
try:
proxies["http_proxy"] = os.environ['http_proxy']
except KeyError:
pass
try:
proxies["https_proxy"] = os.e... | python | def reading(self):
"""Open url and read
"""
try:
# testing proxy
proxies = {}
try:
proxies["http_proxy"] = os.environ['http_proxy']
except KeyError:
pass
try:
proxies["https_proxy"] = os.e... | [
"def",
"reading",
"(",
"self",
")",
":",
"try",
":",
"# testing proxy",
"proxies",
"=",
"{",
"}",
"try",
":",
"proxies",
"[",
"\"http_proxy\"",
"]",
"=",
"os",
".",
"environ",
"[",
"'http_proxy'",
"]",
"except",
"KeyError",
":",
"pass",
"try",
":",
"pr... | Open url and read | [
"Open",
"url",
"and",
"read"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/url_read.py#L38-L65 | train | 60,231 |
dslackw/slpkg | slpkg/repolist.py | RepoList.repos | def repos(self):
"""View or enabled or disabled repositories
"""
def_cnt, cus_cnt = 0, 0
print("")
self.msg.template(78)
print("{0}{1}{2}{3}{4}{5}{6}".format(
"| Repo id", " " * 2,
"Repo URL", " " * 44,
"Default", " " * 3,
"... | python | def repos(self):
"""View or enabled or disabled repositories
"""
def_cnt, cus_cnt = 0, 0
print("")
self.msg.template(78)
print("{0}{1}{2}{3}{4}{5}{6}".format(
"| Repo id", " " * 2,
"Repo URL", " " * 44,
"Default", " " * 3,
"... | [
"def",
"repos",
"(",
"self",
")",
":",
"def_cnt",
",",
"cus_cnt",
"=",
"0",
",",
"0",
"print",
"(",
"\"\"",
")",
"self",
".",
"msg",
".",
"template",
"(",
"78",
")",
"print",
"(",
"\"{0}{1}{2}{3}{4}{5}{6}\"",
".",
"format",
"(",
"\"| Repo id\"",
",",
... | View or enabled or disabled repositories | [
"View",
"or",
"enabled",
"or",
"disabled",
"repositories"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/repolist.py#L40-L76 | train | 60,232 |
dslackw/slpkg | slpkg/config.py | Config.view | def view(self):
"""View slpkg config file
"""
print("") # new line at start
conf_args = [
"RELEASE",
"SLACKWARE_VERSION",
"COMP_ARCH",
"BUILD_PATH",
"PACKAGES",
"PATCHES",
"CHECKMD5",
"DEL_A... | python | def view(self):
"""View slpkg config file
"""
print("") # new line at start
conf_args = [
"RELEASE",
"SLACKWARE_VERSION",
"COMP_ARCH",
"BUILD_PATH",
"PACKAGES",
"PATCHES",
"CHECKMD5",
"DEL_A... | [
"def",
"view",
"(",
"self",
")",
":",
"print",
"(",
"\"\"",
")",
"# new line at start",
"conf_args",
"=",
"[",
"\"RELEASE\"",
",",
"\"SLACKWARE_VERSION\"",
",",
"\"COMP_ARCH\"",
",",
"\"BUILD_PATH\"",
",",
"\"PACKAGES\"",
",",
"\"PATCHES\"",
",",
"\"CHECKMD5\"",
... | View slpkg config file | [
"View",
"slpkg",
"config",
"file"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/config.py#L40-L77 | train | 60,233 |
dslackw/slpkg | slpkg/config.py | Config.edit | def edit(self):
"""Edit configuration file
"""
subprocess.call("{0} {1}".format(self.meta.editor,
self.config_file), shell=True) | python | def edit(self):
"""Edit configuration file
"""
subprocess.call("{0} {1}".format(self.meta.editor,
self.config_file), shell=True) | [
"def",
"edit",
"(",
"self",
")",
":",
"subprocess",
".",
"call",
"(",
"\"{0} {1}\"",
".",
"format",
"(",
"self",
".",
"meta",
".",
"editor",
",",
"self",
".",
"config_file",
")",
",",
"shell",
"=",
"True",
")"
] | Edit configuration file | [
"Edit",
"configuration",
"file"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/config.py#L79-L83 | train | 60,234 |
dslackw/slpkg | slpkg/config.py | Config.reset | def reset(self):
"""Reset slpkg.conf file with default values
"""
shutil.copy2(self.config_file + ".orig", self.config_file)
if filecmp.cmp(self.config_file + ".orig", self.config_file):
print("{0}The reset was done{1}".format(
self.meta.color["GREEN"], self.m... | python | def reset(self):
"""Reset slpkg.conf file with default values
"""
shutil.copy2(self.config_file + ".orig", self.config_file)
if filecmp.cmp(self.config_file + ".orig", self.config_file):
print("{0}The reset was done{1}".format(
self.meta.color["GREEN"], self.m... | [
"def",
"reset",
"(",
"self",
")",
":",
"shutil",
".",
"copy2",
"(",
"self",
".",
"config_file",
"+",
"\".orig\"",
",",
"self",
".",
"config_file",
")",
"if",
"filecmp",
".",
"cmp",
"(",
"self",
".",
"config_file",
"+",
"\".orig\"",
",",
"self",
".",
... | Reset slpkg.conf file with default values | [
"Reset",
"slpkg",
".",
"conf",
"file",
"with",
"default",
"values"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/config.py#L85-L94 | train | 60,235 |
dslackw/slpkg | slpkg/sbo/sbo_arch.py | SBoArch.get | def get(self):
"""Return sbo arch
"""
if self.arch.startswith("i") and self.arch.endswith("86"):
self.arch = self.x86
elif self.meta.arch.startswith("arm"):
self.arch = self.arm
return self.arch | python | def get(self):
"""Return sbo arch
"""
if self.arch.startswith("i") and self.arch.endswith("86"):
self.arch = self.x86
elif self.meta.arch.startswith("arm"):
self.arch = self.arm
return self.arch | [
"def",
"get",
"(",
"self",
")",
":",
"if",
"self",
".",
"arch",
".",
"startswith",
"(",
"\"i\"",
")",
"and",
"self",
".",
"arch",
".",
"endswith",
"(",
"\"86\"",
")",
":",
"self",
".",
"arch",
"=",
"self",
".",
"x86",
"elif",
"self",
".",
"meta",... | Return sbo arch | [
"Return",
"sbo",
"arch"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/sbo/sbo_arch.py#L38-L45 | train | 60,236 |
dslackw/slpkg | slpkg/utils.py | Utils.case_sensitive | def case_sensitive(self, lst):
"""Create dictionary from list with key in lower case
and value with default
"""
dictionary = {}
for pkg in lst:
dictionary[pkg.lower()] = pkg
return dictionary | python | def case_sensitive(self, lst):
"""Create dictionary from list with key in lower case
and value with default
"""
dictionary = {}
for pkg in lst:
dictionary[pkg.lower()] = pkg
return dictionary | [
"def",
"case_sensitive",
"(",
"self",
",",
"lst",
")",
":",
"dictionary",
"=",
"{",
"}",
"for",
"pkg",
"in",
"lst",
":",
"dictionary",
"[",
"pkg",
".",
"lower",
"(",
")",
"]",
"=",
"pkg",
"return",
"dictionary"
] | Create dictionary from list with key in lower case
and value with default | [
"Create",
"dictionary",
"from",
"list",
"with",
"key",
"in",
"lower",
"case",
"and",
"value",
"with",
"default"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/utils.py#L33-L40 | train | 60,237 |
dslackw/slpkg | slpkg/utils.py | Utils.remove_dbs | def remove_dbs(self, double):
"""Remove double item from list
"""
one = []
for dup in double:
if dup not in one:
one.append(dup)
return one | python | def remove_dbs(self, double):
"""Remove double item from list
"""
one = []
for dup in double:
if dup not in one:
one.append(dup)
return one | [
"def",
"remove_dbs",
"(",
"self",
",",
"double",
")",
":",
"one",
"=",
"[",
"]",
"for",
"dup",
"in",
"double",
":",
"if",
"dup",
"not",
"in",
"one",
":",
"one",
".",
"append",
"(",
"dup",
")",
"return",
"one"
] | Remove double item from list | [
"Remove",
"double",
"item",
"from",
"list"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/utils.py#L50-L57 | train | 60,238 |
dslackw/slpkg | slpkg/utils.py | Utils.read_file | def read_file(self, registry):
"""Returns reading file
"""
with open(registry, "r") as file_txt:
read_file = file_txt.read()
file_txt.close()
return read_file | python | def read_file(self, registry):
"""Returns reading file
"""
with open(registry, "r") as file_txt:
read_file = file_txt.read()
file_txt.close()
return read_file | [
"def",
"read_file",
"(",
"self",
",",
"registry",
")",
":",
"with",
"open",
"(",
"registry",
",",
"\"r\"",
")",
"as",
"file_txt",
":",
"read_file",
"=",
"file_txt",
".",
"read",
"(",
")",
"file_txt",
".",
"close",
"(",
")",
"return",
"read_file"
] | Returns reading file | [
"Returns",
"reading",
"file"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/utils.py#L59-L65 | train | 60,239 |
dslackw/slpkg | slpkg/utils.py | Utils.package_name | def package_name(self, PACKAGES_TXT):
"""Returns list with all the names of packages repository
"""
packages = []
for line in PACKAGES_TXT.splitlines():
if line.startswith("PACKAGE NAME:"):
packages.append(split_package(line[14:].strip())[0])
return pa... | python | def package_name(self, PACKAGES_TXT):
"""Returns list with all the names of packages repository
"""
packages = []
for line in PACKAGES_TXT.splitlines():
if line.startswith("PACKAGE NAME:"):
packages.append(split_package(line[14:].strip())[0])
return pa... | [
"def",
"package_name",
"(",
"self",
",",
"PACKAGES_TXT",
")",
":",
"packages",
"=",
"[",
"]",
"for",
"line",
"in",
"PACKAGES_TXT",
".",
"splitlines",
"(",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"\"PACKAGE NAME:\"",
")",
":",
"packages",
".",
"ap... | Returns list with all the names of packages repository | [
"Returns",
"list",
"with",
"all",
"the",
"names",
"of",
"packages",
"repository"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/utils.py#L67-L74 | train | 60,240 |
dslackw/slpkg | slpkg/utils.py | Utils.check_downloaded | def check_downloaded(self, path, maybe_downloaded):
"""Check if files downloaded and return downloaded
packages
"""
downloaded = []
for pkg in maybe_downloaded:
if os.path.isfile(path + pkg):
downloaded.append(pkg)
return downloaded | python | def check_downloaded(self, path, maybe_downloaded):
"""Check if files downloaded and return downloaded
packages
"""
downloaded = []
for pkg in maybe_downloaded:
if os.path.isfile(path + pkg):
downloaded.append(pkg)
return downloaded | [
"def",
"check_downloaded",
"(",
"self",
",",
"path",
",",
"maybe_downloaded",
")",
":",
"downloaded",
"=",
"[",
"]",
"for",
"pkg",
"in",
"maybe_downloaded",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
"+",
"pkg",
")",
":",
"downloaded",
"... | Check if files downloaded and return downloaded
packages | [
"Check",
"if",
"files",
"downloaded",
"and",
"return",
"downloaded",
"packages"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/utils.py#L76-L84 | train | 60,241 |
dslackw/slpkg | slpkg/graph.py | Graph.dependencies | def dependencies(self, deps_dict):
"""Generate graph file with depenndencies map tree
"""
try:
import pygraphviz as pgv
except ImportError:
graph_easy, comma = "", ""
if (self.image == "ascii" and
not os.path.isfile("/usr/bin/graph-... | python | def dependencies(self, deps_dict):
"""Generate graph file with depenndencies map tree
"""
try:
import pygraphviz as pgv
except ImportError:
graph_easy, comma = "", ""
if (self.image == "ascii" and
not os.path.isfile("/usr/bin/graph-... | [
"def",
"dependencies",
"(",
"self",
",",
"deps_dict",
")",
":",
"try",
":",
"import",
"pygraphviz",
"as",
"pgv",
"except",
"ImportError",
":",
"graph_easy",
",",
"comma",
"=",
"\"\"",
",",
"\"\"",
"if",
"(",
"self",
".",
"image",
"==",
"\"ascii\"",
"and"... | Generate graph file with depenndencies map tree | [
"Generate",
"graph",
"file",
"with",
"depenndencies",
"map",
"tree"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/graph.py#L43-L70 | train | 60,242 |
dslackw/slpkg | slpkg/graph.py | Graph.check_file | def check_file(self):
"""Check for file format and type
"""
try:
image_type = ".{0}".format(self.image.split(".")[1])
if image_type not in self.file_format:
print("Format: '{0}' not recognized. Use one of "
"them:\n{1}".format(self.im... | python | def check_file(self):
"""Check for file format and type
"""
try:
image_type = ".{0}".format(self.image.split(".")[1])
if image_type not in self.file_format:
print("Format: '{0}' not recognized. Use one of "
"them:\n{1}".format(self.im... | [
"def",
"check_file",
"(",
"self",
")",
":",
"try",
":",
"image_type",
"=",
"\".{0}\"",
".",
"format",
"(",
"self",
".",
"image",
".",
"split",
"(",
"\".\"",
")",
"[",
"1",
"]",
")",
"if",
"image_type",
"not",
"in",
"self",
".",
"file_format",
":",
... | Check for file format and type | [
"Check",
"for",
"file",
"format",
"and",
"type"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/graph.py#L72-L84 | train | 60,243 |
dslackw/slpkg | slpkg/graph.py | Graph.graph_easy | def graph_easy(self):
"""Draw ascii diagram. graph-easy perl module require
"""
if not os.path.isfile("/usr/bin/graph-easy"):
print("Require 'graph-easy': Install with 'slpkg -s sbo "
"graph-easy'")
self.remove_dot()
raise SystemExit()
... | python | def graph_easy(self):
"""Draw ascii diagram. graph-easy perl module require
"""
if not os.path.isfile("/usr/bin/graph-easy"):
print("Require 'graph-easy': Install with 'slpkg -s sbo "
"graph-easy'")
self.remove_dot()
raise SystemExit()
... | [
"def",
"graph_easy",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"\"/usr/bin/graph-easy\"",
")",
":",
"print",
"(",
"\"Require 'graph-easy': Install with 'slpkg -s sbo \"",
"\"graph-easy'\"",
")",
"self",
".",
"remove_dot",
"(",
")",... | Draw ascii diagram. graph-easy perl module require | [
"Draw",
"ascii",
"diagram",
".",
"graph",
"-",
"easy",
"perl",
"module",
"require"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/graph.py#L86-L96 | train | 60,244 |
dslackw/slpkg | slpkg/graph.py | Graph.remove_dot | def remove_dot(self):
"""Remove .dot files
"""
if os.path.isfile("{0}.dot".format(self.image)):
os.remove("{0}.dot".format(self.image)) | python | def remove_dot(self):
"""Remove .dot files
"""
if os.path.isfile("{0}.dot".format(self.image)):
os.remove("{0}.dot".format(self.image)) | [
"def",
"remove_dot",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"\"{0}.dot\"",
".",
"format",
"(",
"self",
".",
"image",
")",
")",
":",
"os",
".",
"remove",
"(",
"\"{0}.dot\"",
".",
"format",
"(",
"self",
".",
"image",
")",... | Remove .dot files | [
"Remove",
".",
"dot",
"files"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/graph.py#L98-L102 | train | 60,245 |
dslackw/slpkg | slpkg/pkg/manager.py | alien_filter | def alien_filter(packages, sizes):
"""This filter avoid list double packages from
alien repository
"""
cache, npkg, nsize = [], [], []
for p, s in zip(packages, sizes):
name = split_package(p)[0]
if name not in cache:
cache.append(name)
npkg.append(p)
... | python | def alien_filter(packages, sizes):
"""This filter avoid list double packages from
alien repository
"""
cache, npkg, nsize = [], [], []
for p, s in zip(packages, sizes):
name = split_package(p)[0]
if name not in cache:
cache.append(name)
npkg.append(p)
... | [
"def",
"alien_filter",
"(",
"packages",
",",
"sizes",
")",
":",
"cache",
",",
"npkg",
",",
"nsize",
"=",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
"for",
"p",
",",
"s",
"in",
"zip",
"(",
"packages",
",",
"sizes",
")",
":",
"name",
"=",
"split_pac... | This filter avoid list double packages from
alien repository | [
"This",
"filter",
"avoid",
"list",
"double",
"packages",
"from",
"alien",
"repository"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L570-L581 | train | 60,246 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager.upgrade | def upgrade(self, flag):
"""Upgrade Slackware binary packages with new
"""
for pkg in self.binary:
try:
subprocess.call("upgradepkg {0} {1}".format(flag, pkg),
shell=True)
check = pkg[:-4].split("/")[-1]
... | python | def upgrade(self, flag):
"""Upgrade Slackware binary packages with new
"""
for pkg in self.binary:
try:
subprocess.call("upgradepkg {0} {1}".format(flag, pkg),
shell=True)
check = pkg[:-4].split("/")[-1]
... | [
"def",
"upgrade",
"(",
"self",
",",
"flag",
")",
":",
"for",
"pkg",
"in",
"self",
".",
"binary",
":",
"try",
":",
"subprocess",
".",
"call",
"(",
"\"upgradepkg {0} {1}\"",
".",
"format",
"(",
"flag",
",",
"pkg",
")",
",",
"shell",
"=",
"True",
")",
... | Upgrade Slackware binary packages with new | [
"Upgrade",
"Slackware",
"binary",
"packages",
"with",
"new"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L68-L82 | train | 60,247 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager.remove | def remove(self, flag, extra):
"""Remove Slackware binary packages
"""
self.flag = flag
self.extra = extra
self.dep_path = self.meta.log_path + "dep/"
dependencies, rmv_list = [], []
self.removed = self._view_removed()
if not self.removed:
prin... | python | def remove(self, flag, extra):
"""Remove Slackware binary packages
"""
self.flag = flag
self.extra = extra
self.dep_path = self.meta.log_path + "dep/"
dependencies, rmv_list = [], []
self.removed = self._view_removed()
if not self.removed:
prin... | [
"def",
"remove",
"(",
"self",
",",
"flag",
",",
"extra",
")",
":",
"self",
".",
"flag",
"=",
"flag",
"self",
".",
"extra",
"=",
"extra",
"self",
".",
"dep_path",
"=",
"self",
".",
"meta",
".",
"log_path",
"+",
"\"dep/\"",
"dependencies",
",",
"rmv_li... | Remove Slackware binary packages | [
"Remove",
"Slackware",
"binary",
"packages"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L91-L134 | train | 60,248 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager._rmv_deps_answer | def _rmv_deps_answer(self):
"""Remove dependencies answer
"""
if self.meta.remove_deps_answer in ["y", "Y"]:
remove_dep = self.meta.remove_deps_answer
else:
try:
remove_dep = raw_input(
"\nRemove dependencies (maybe used by "
... | python | def _rmv_deps_answer(self):
"""Remove dependencies answer
"""
if self.meta.remove_deps_answer in ["y", "Y"]:
remove_dep = self.meta.remove_deps_answer
else:
try:
remove_dep = raw_input(
"\nRemove dependencies (maybe used by "
... | [
"def",
"_rmv_deps_answer",
"(",
"self",
")",
":",
"if",
"self",
".",
"meta",
".",
"remove_deps_answer",
"in",
"[",
"\"y\"",
",",
"\"Y\"",
"]",
":",
"remove_dep",
"=",
"self",
".",
"meta",
".",
"remove_deps_answer",
"else",
":",
"try",
":",
"remove_dep",
... | Remove dependencies answer | [
"Remove",
"dependencies",
"answer"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L136-L150 | train | 60,249 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager._get_removed | def _get_removed(self):
"""Manage removed packages by extra options
"""
removed, packages = [], []
if "--tag" in self.extra:
for pkg in find_package("", self.meta.pkg_path):
for tag in self.binary:
if pkg.endswith(tag):
... | python | def _get_removed(self):
"""Manage removed packages by extra options
"""
removed, packages = [], []
if "--tag" in self.extra:
for pkg in find_package("", self.meta.pkg_path):
for tag in self.binary:
if pkg.endswith(tag):
... | [
"def",
"_get_removed",
"(",
"self",
")",
":",
"removed",
",",
"packages",
"=",
"[",
"]",
",",
"[",
"]",
"if",
"\"--tag\"",
"in",
"self",
".",
"extra",
":",
"for",
"pkg",
"in",
"find_package",
"(",
"\"\"",
",",
"self",
".",
"meta",
".",
"pkg_path",
... | Manage removed packages by extra options | [
"Manage",
"removed",
"packages",
"by",
"extra",
"options"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L152-L177 | train | 60,250 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager._view_removed | def _view_removed(self):
"""View packages before removed
"""
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
self.meta.color["CYAN"], ", ".join(self.binary),
self.meta.color["ENDC"]))
removed, packages = self._get_removed()
if packages and "-... | python | def _view_removed(self):
"""View packages before removed
"""
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
self.meta.color["CYAN"], ", ".join(self.binary),
self.meta.color["ENDC"]))
removed, packages = self._get_removed()
if packages and "-... | [
"def",
"_view_removed",
"(",
"self",
")",
":",
"print",
"(",
"\"\\nPackages with name matching [ {0}{1}{2} ]\\n\"",
".",
"format",
"(",
"self",
".",
"meta",
".",
"color",
"[",
"\"CYAN\"",
"]",
",",
"\", \"",
".",
"join",
"(",
"self",
".",
"binary",
")",
",",... | View packages before removed | [
"View",
"packages",
"before",
"removed"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L179-L205 | train | 60,251 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager._calc_sizes | def _calc_sizes(self):
"""Package size calculation
"""
if self.size > 1024:
self.unit = "Mb"
self.size = (self.size / 1024)
if self.size > 1024:
self.unit = "Gb"
self.size = (self.size / 1024) | python | def _calc_sizes(self):
"""Package size calculation
"""
if self.size > 1024:
self.unit = "Mb"
self.size = (self.size / 1024)
if self.size > 1024:
self.unit = "Gb"
self.size = (self.size / 1024) | [
"def",
"_calc_sizes",
"(",
"self",
")",
":",
"if",
"self",
".",
"size",
">",
"1024",
":",
"self",
".",
"unit",
"=",
"\"Mb\"",
"self",
".",
"size",
"=",
"(",
"self",
".",
"size",
"/",
"1024",
")",
"if",
"self",
".",
"size",
">",
"1024",
":",
"se... | Package size calculation | [
"Package",
"size",
"calculation"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L207-L215 | train | 60,252 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager._remove_summary | def _remove_summary(self):
"""Removed packge size summary
"""
if self.size > 0:
print("\nRemoved summary")
print("=" * 79)
print("{0}Size of removed packages {1} {2}.{3}".format(
self.meta.color["GREY"], round(self.size, 2), self.unit,
... | python | def _remove_summary(self):
"""Removed packge size summary
"""
if self.size > 0:
print("\nRemoved summary")
print("=" * 79)
print("{0}Size of removed packages {1} {2}.{3}".format(
self.meta.color["GREY"], round(self.size, 2), self.unit,
... | [
"def",
"_remove_summary",
"(",
"self",
")",
":",
"if",
"self",
".",
"size",
">",
"0",
":",
"print",
"(",
"\"\\nRemoved summary\"",
")",
"print",
"(",
"\"=\"",
"*",
"79",
")",
"print",
"(",
"\"{0}Size of removed packages {1} {2}.{3}\"",
".",
"format",
"(",
"s... | Removed packge size summary | [
"Removed",
"packge",
"size",
"summary"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L217-L225 | train | 60,253 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager._view_deps | def _view_deps(self, path, package):
"""View dependencies before remove
"""
self.size = 0
packages = []
dependencies = (Utils().read_file(path + package)).splitlines()
for dep in dependencies:
if GetFromInstalled(dep).name():
ver = GetFromInsta... | python | def _view_deps(self, path, package):
"""View dependencies before remove
"""
self.size = 0
packages = []
dependencies = (Utils().read_file(path + package)).splitlines()
for dep in dependencies:
if GetFromInstalled(dep).name():
ver = GetFromInsta... | [
"def",
"_view_deps",
"(",
"self",
",",
"path",
",",
"package",
")",
":",
"self",
".",
"size",
"=",
"0",
"packages",
"=",
"[",
"]",
"dependencies",
"=",
"(",
"Utils",
"(",
")",
".",
"read_file",
"(",
"path",
"+",
"package",
")",
")",
".",
"splitline... | View dependencies before remove | [
"View",
"dependencies",
"before",
"remove"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L227-L268 | train | 60,254 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager._removepkg | def _removepkg(self, package):
"""removepkg Slackware command
"""
try:
subprocess.call("removepkg {0} {1}".format(self.flag, package),
shell=True)
if os.path.isfile(self.dep_path + package):
os.remove(self.dep_path + package) #... | python | def _removepkg(self, package):
"""removepkg Slackware command
"""
try:
subprocess.call("removepkg {0} {1}".format(self.flag, package),
shell=True)
if os.path.isfile(self.dep_path + package):
os.remove(self.dep_path + package) #... | [
"def",
"_removepkg",
"(",
"self",
",",
"package",
")",
":",
"try",
":",
"subprocess",
".",
"call",
"(",
"\"removepkg {0} {1}\"",
".",
"format",
"(",
"self",
".",
"flag",
",",
"package",
")",
",",
"shell",
"=",
"True",
")",
"if",
"os",
".",
"path",
".... | removepkg Slackware command | [
"removepkg",
"Slackware",
"command"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L270-L280 | train | 60,255 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager._rmv_pkg | def _rmv_pkg(self, package):
"""Remove one signle package
"""
removes = []
if GetFromInstalled(package).name() and package not in self.skip:
ver = GetFromInstalled(package).version()
removes.append(package + ver)
self._removepkg(package)
return... | python | def _rmv_pkg(self, package):
"""Remove one signle package
"""
removes = []
if GetFromInstalled(package).name() and package not in self.skip:
ver = GetFromInstalled(package).version()
removes.append(package + ver)
self._removepkg(package)
return... | [
"def",
"_rmv_pkg",
"(",
"self",
",",
"package",
")",
":",
"removes",
"=",
"[",
"]",
"if",
"GetFromInstalled",
"(",
"package",
")",
".",
"name",
"(",
")",
"and",
"package",
"not",
"in",
"self",
".",
"skip",
":",
"ver",
"=",
"GetFromInstalled",
"(",
"p... | Remove one signle package | [
"Remove",
"one",
"signle",
"package"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L295-L303 | train | 60,256 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager._skip_remove | def _skip_remove(self):
"""Skip packages from remove
"""
if "--checklist" not in self.extra:
self.msg.template(78)
print("| Insert packages to exception remove:")
self.msg.template(78)
try:
self.skip = raw_input(" > ").split()
... | python | def _skip_remove(self):
"""Skip packages from remove
"""
if "--checklist" not in self.extra:
self.msg.template(78)
print("| Insert packages to exception remove:")
self.msg.template(78)
try:
self.skip = raw_input(" > ").split()
... | [
"def",
"_skip_remove",
"(",
"self",
")",
":",
"if",
"\"--checklist\"",
"not",
"in",
"self",
".",
"extra",
":",
"self",
".",
"msg",
".",
"template",
"(",
"78",
")",
"print",
"(",
"\"| Insert packages to exception remove:\"",
")",
"self",
".",
"msg",
".",
"t... | Skip packages from remove | [
"Skip",
"packages",
"from",
"remove"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L305-L319 | train | 60,257 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager._check_if_used | def _check_if_used(self, removes):
"""Check package if dependencies for another package
before removed"""
if "--check-deps" in self.extra:
package, dependency, pkg_dep = [], [], []
for pkg in find_package("", self.dep_path):
deps = Utils().read_file(self.d... | python | def _check_if_used(self, removes):
"""Check package if dependencies for another package
before removed"""
if "--check-deps" in self.extra:
package, dependency, pkg_dep = [], [], []
for pkg in find_package("", self.dep_path):
deps = Utils().read_file(self.d... | [
"def",
"_check_if_used",
"(",
"self",
",",
"removes",
")",
":",
"if",
"\"--check-deps\"",
"in",
"self",
".",
"extra",
":",
"package",
",",
"dependency",
",",
"pkg_dep",
"=",
"[",
"]",
",",
"[",
"]",
",",
"[",
"]",
"for",
"pkg",
"in",
"find_package",
... | Check package if dependencies for another package
before removed | [
"Check",
"package",
"if",
"dependencies",
"for",
"another",
"package",
"before",
"removed"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L321-L359 | train | 60,258 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager._reference_rmvs | def _reference_rmvs(self, removes):
"""Prints all removed packages
"""
print("")
self.msg.template(78)
msg_pkg = "package"
if len(removes) > 1:
msg_pkg = "packages"
print("| Total {0} {1} removed".format(len(removes), msg_pkg))
self.msg.templat... | python | def _reference_rmvs(self, removes):
"""Prints all removed packages
"""
print("")
self.msg.template(78)
msg_pkg = "package"
if len(removes) > 1:
msg_pkg = "packages"
print("| Total {0} {1} removed".format(len(removes), msg_pkg))
self.msg.templat... | [
"def",
"_reference_rmvs",
"(",
"self",
",",
"removes",
")",
":",
"print",
"(",
"\"\"",
")",
"self",
".",
"msg",
".",
"template",
"(",
"78",
")",
"msg_pkg",
"=",
"\"package\"",
"if",
"len",
"(",
"removes",
")",
">",
"1",
":",
"msg_pkg",
"=",
"\"packag... | Prints all removed packages | [
"Prints",
"all",
"removed",
"packages"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L361-L377 | train | 60,259 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager.find | def find(self, flag):
"""Find installed Slackware packages
"""
matching, pkg_cache, match_cache = 0, "", ""
print("\nPackages with matching name [ {0}{1}{2} ]\n".format(
self.meta.color["CYAN"], ", ".join(self.binary),
self.meta.color["ENDC"]))
for pkg in ... | python | def find(self, flag):
"""Find installed Slackware packages
"""
matching, pkg_cache, match_cache = 0, "", ""
print("\nPackages with matching name [ {0}{1}{2} ]\n".format(
self.meta.color["CYAN"], ", ".join(self.binary),
self.meta.color["ENDC"]))
for pkg in ... | [
"def",
"find",
"(",
"self",
",",
"flag",
")",
":",
"matching",
",",
"pkg_cache",
",",
"match_cache",
"=",
"0",
",",
"\"\"",
",",
"\"\"",
"print",
"(",
"\"\\nPackages with matching name [ {0}{1}{2} ]\\n\"",
".",
"format",
"(",
"self",
".",
"meta",
".",
"color... | Find installed Slackware packages | [
"Find",
"installed",
"Slackware",
"packages"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L379-L412 | train | 60,260 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager._sizes | def _sizes(self, package):
"""Package size summary
"""
data = Utils().read_file(self.meta.pkg_path + package)
for line in data.splitlines():
if line.startswith("UNCOMPRESSED PACKAGE SIZE:"):
digit = float((''.join(re.findall(
"[-+]?\d+[\.]?... | python | def _sizes(self, package):
"""Package size summary
"""
data = Utils().read_file(self.meta.pkg_path + package)
for line in data.splitlines():
if line.startswith("UNCOMPRESSED PACKAGE SIZE:"):
digit = float((''.join(re.findall(
"[-+]?\d+[\.]?... | [
"def",
"_sizes",
"(",
"self",
",",
"package",
")",
":",
"data",
"=",
"Utils",
"(",
")",
".",
"read_file",
"(",
"self",
".",
"meta",
".",
"pkg_path",
"+",
"package",
")",
"for",
"line",
"in",
"data",
".",
"splitlines",
"(",
")",
":",
"if",
"line",
... | Package size summary | [
"Package",
"size",
"summary"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L414-L427 | train | 60,261 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager.display | def display(self):
"""Print the Slackware packages contents
"""
for pkg in self.binary:
name = GetFromInstalled(pkg).name()
ver = GetFromInstalled(pkg).version()
find = find_package("{0}{1}{2}".format(name, ver, self.meta.sp),
s... | python | def display(self):
"""Print the Slackware packages contents
"""
for pkg in self.binary:
name = GetFromInstalled(pkg).name()
ver = GetFromInstalled(pkg).version()
find = find_package("{0}{1}{2}".format(name, ver, self.meta.sp),
s... | [
"def",
"display",
"(",
"self",
")",
":",
"for",
"pkg",
"in",
"self",
".",
"binary",
":",
"name",
"=",
"GetFromInstalled",
"(",
"pkg",
")",
".",
"name",
"(",
")",
"ver",
"=",
"GetFromInstalled",
"(",
"pkg",
")",
".",
"version",
"(",
")",
"find",
"="... | Print the Slackware packages contents | [
"Print",
"the",
"Slackware",
"packages",
"contents"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L429-L448 | train | 60,262 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager.package_list | def package_list(self, repo, name, INDEX, installed):
"""List with the installed packages
"""
tty_size = os.popen("stty size", "r").read().split()
row = int(tty_size[0]) - 2
try:
all_installed_names = []
index, page, pkg_list = 0, row, []
r = s... | python | def package_list(self, repo, name, INDEX, installed):
"""List with the installed packages
"""
tty_size = os.popen("stty size", "r").read().split()
row = int(tty_size[0]) - 2
try:
all_installed_names = []
index, page, pkg_list = 0, row, []
r = s... | [
"def",
"package_list",
"(",
"self",
",",
"repo",
",",
"name",
",",
"INDEX",
",",
"installed",
")",
":",
"tty_size",
"=",
"os",
".",
"popen",
"(",
"\"stty size\"",
",",
"\"r\"",
")",
".",
"read",
"(",
")",
".",
"split",
"(",
")",
"row",
"=",
"int",
... | List with the installed packages | [
"List",
"with",
"the",
"installed",
"packages"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L450-L495 | train | 60,263 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager._splitting_packages | def _splitting_packages(self, pkg, repo, name):
"""Return package name from repositories
"""
if name and repo != "sbo":
pkg = split_package(pkg)[0]
elif not name and repo != "sbo":
pkg = pkg[:-4]
return pkg | python | def _splitting_packages(self, pkg, repo, name):
"""Return package name from repositories
"""
if name and repo != "sbo":
pkg = split_package(pkg)[0]
elif not name and repo != "sbo":
pkg = pkg[:-4]
return pkg | [
"def",
"_splitting_packages",
"(",
"self",
",",
"pkg",
",",
"repo",
",",
"name",
")",
":",
"if",
"name",
"and",
"repo",
"!=",
"\"sbo\"",
":",
"pkg",
"=",
"split_package",
"(",
"pkg",
")",
"[",
"0",
"]",
"elif",
"not",
"name",
"and",
"repo",
"!=",
"... | Return package name from repositories | [
"Return",
"package",
"name",
"from",
"repositories"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L497-L504 | train | 60,264 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager.list_lib | def list_lib(self, repo):
"""Return package lists
"""
packages = ""
if repo == "sbo":
if (os.path.isfile(
self.meta.lib_path + "{0}_repo/SLACKBUILDS.TXT".format(
repo))):
packages = Utils().read_file(self.meta.lib_pa... | python | def list_lib(self, repo):
"""Return package lists
"""
packages = ""
if repo == "sbo":
if (os.path.isfile(
self.meta.lib_path + "{0}_repo/SLACKBUILDS.TXT".format(
repo))):
packages = Utils().read_file(self.meta.lib_pa... | [
"def",
"list_lib",
"(",
"self",
",",
"repo",
")",
":",
"packages",
"=",
"\"\"",
"if",
"repo",
"==",
"\"sbo\"",
":",
"if",
"(",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"meta",
".",
"lib_path",
"+",
"\"{0}_repo/SLACKBUILDS.TXT\"",
".",
"forma... | Return package lists | [
"Return",
"package",
"lists"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L524-L539 | train | 60,265 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager.list_color_tag | def list_color_tag(self, pkg):
"""Tag with color installed packages
"""
name = GetFromInstalled(pkg).name()
find = name + self.meta.sp
if pkg.endswith(".txz") or pkg.endswith(".tgz"):
find = pkg[:-4]
if find_package(find, self.meta.pkg_path):
pkg =... | python | def list_color_tag(self, pkg):
"""Tag with color installed packages
"""
name = GetFromInstalled(pkg).name()
find = name + self.meta.sp
if pkg.endswith(".txz") or pkg.endswith(".tgz"):
find = pkg[:-4]
if find_package(find, self.meta.pkg_path):
pkg =... | [
"def",
"list_color_tag",
"(",
"self",
",",
"pkg",
")",
":",
"name",
"=",
"GetFromInstalled",
"(",
"pkg",
")",
".",
"name",
"(",
")",
"find",
"=",
"name",
"+",
"self",
".",
"meta",
".",
"sp",
"if",
"pkg",
".",
"endswith",
"(",
"\".txz\"",
")",
"or",... | Tag with color installed packages | [
"Tag",
"with",
"color",
"installed",
"packages"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L541-L551 | train | 60,266 |
dslackw/slpkg | slpkg/pkg/manager.py | PackageManager.list_of_installed | def list_of_installed(self, repo, name):
"""Return installed packages
"""
all_installed_names = []
all_installed_packages = find_package("", self.meta.pkg_path)
for inst in all_installed_packages:
if repo == "sbo" and inst.endswith("_SBo"):
name = spli... | python | def list_of_installed(self, repo, name):
"""Return installed packages
"""
all_installed_names = []
all_installed_packages = find_package("", self.meta.pkg_path)
for inst in all_installed_packages:
if repo == "sbo" and inst.endswith("_SBo"):
name = spli... | [
"def",
"list_of_installed",
"(",
"self",
",",
"repo",
",",
"name",
")",
":",
"all_installed_names",
"=",
"[",
"]",
"all_installed_packages",
"=",
"find_package",
"(",
"\"\"",
",",
"self",
".",
"meta",
".",
"pkg_path",
")",
"for",
"inst",
"in",
"all_installed... | Return installed packages | [
"Return",
"installed",
"packages"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/manager.py#L553-L567 | train | 60,267 |
dslackw/slpkg | slpkg/binary/greps.py | rlw_filter | def rlw_filter(name, location, size, unsize):
"""Filter rlw repository data
"""
arch = _meta_.arch
if arch.startswith("i") and arch.endswith("86"):
arch = "i486"
(fname, flocation, fsize, funsize) = ([] for i in range(4))
for n, l, s, u in zip(name, location, size, unsize):
loc =... | python | def rlw_filter(name, location, size, unsize):
"""Filter rlw repository data
"""
arch = _meta_.arch
if arch.startswith("i") and arch.endswith("86"):
arch = "i486"
(fname, flocation, fsize, funsize) = ([] for i in range(4))
for n, l, s, u in zip(name, location, size, unsize):
loc =... | [
"def",
"rlw_filter",
"(",
"name",
",",
"location",
",",
"size",
",",
"unsize",
")",
":",
"arch",
"=",
"_meta_",
".",
"arch",
"if",
"arch",
".",
"startswith",
"(",
"\"i\"",
")",
"and",
"arch",
".",
"endswith",
"(",
"\"86\"",
")",
":",
"arch",
"=",
"... | Filter rlw repository data | [
"Filter",
"rlw",
"repository",
"data"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/greps.py#L78-L92 | train | 60,268 |
dslackw/slpkg | slpkg/binary/greps.py | alien_filter | def alien_filter(name, location, size, unsize):
"""Fix to avoid packages include in slackbuilds folder
"""
(fname, flocation, fsize, funsize) = ([] for i in range(4))
for n, l, s, u in zip(name, location, size, unsize):
if "slackbuilds" != l:
fname.append(n)
flocation.app... | python | def alien_filter(name, location, size, unsize):
"""Fix to avoid packages include in slackbuilds folder
"""
(fname, flocation, fsize, funsize) = ([] for i in range(4))
for n, l, s, u in zip(name, location, size, unsize):
if "slackbuilds" != l:
fname.append(n)
flocation.app... | [
"def",
"alien_filter",
"(",
"name",
",",
"location",
",",
"size",
",",
"unsize",
")",
":",
"(",
"fname",
",",
"flocation",
",",
"fsize",
",",
"funsize",
")",
"=",
"(",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"4",
")",
")",
"for",
"n",
",",
"l... | Fix to avoid packages include in slackbuilds folder | [
"Fix",
"to",
"avoid",
"packages",
"include",
"in",
"slackbuilds",
"folder"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/greps.py#L95-L105 | train | 60,269 |
dslackw/slpkg | slpkg/binary/greps.py | rested_filter | def rested_filter(name, location, size, unsize):
"""Filter Alien"s repository data
"""
ver = slack_ver()
if _meta_.slack_rel == "current":
ver = "current"
path_pkg = "pkg"
if _meta_.arch == "x86_64":
path_pkg = "pkg64"
(fname, flocation, fsize, funsize) = ([] for i in range(4... | python | def rested_filter(name, location, size, unsize):
"""Filter Alien"s repository data
"""
ver = slack_ver()
if _meta_.slack_rel == "current":
ver = "current"
path_pkg = "pkg"
if _meta_.arch == "x86_64":
path_pkg = "pkg64"
(fname, flocation, fsize, funsize) = ([] for i in range(4... | [
"def",
"rested_filter",
"(",
"name",
",",
"location",
",",
"size",
",",
"unsize",
")",
":",
"ver",
"=",
"slack_ver",
"(",
")",
"if",
"_meta_",
".",
"slack_rel",
"==",
"\"current\"",
":",
"ver",
"=",
"\"current\"",
"path_pkg",
"=",
"\"pkg\"",
"if",
"_meta... | Filter Alien"s repository data | [
"Filter",
"Alien",
"s",
"repository",
"data"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/greps.py#L108-L124 | train | 60,270 |
dslackw/slpkg | slpkg/binary/greps.py | Requires.get_deps | def get_deps(self):
"""Grap package requirements from repositories
"""
if self.repo == "rlw":
dependencies = {}
rlw_deps = Utils().read_file(_meta_.conf_path + "rlworkman.deps")
for line in rlw_deps.splitlines():
if line and not line.startswith... | python | def get_deps(self):
"""Grap package requirements from repositories
"""
if self.repo == "rlw":
dependencies = {}
rlw_deps = Utils().read_file(_meta_.conf_path + "rlworkman.deps")
for line in rlw_deps.splitlines():
if line and not line.startswith... | [
"def",
"get_deps",
"(",
"self",
")",
":",
"if",
"self",
".",
"repo",
"==",
"\"rlw\"",
":",
"dependencies",
"=",
"{",
"}",
"rlw_deps",
"=",
"Utils",
"(",
")",
".",
"read_file",
"(",
"_meta_",
".",
"conf_path",
"+",
"\"rlworkman.deps\"",
")",
"for",
"lin... | Grap package requirements from repositories | [
"Grap",
"package",
"requirements",
"from",
"repositories"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/greps.py#L153-L176 | train | 60,271 |
dslackw/slpkg | slpkg/binary/greps.py | Requires._req_fix | def _req_fix(self, line):
"""Fix slacky and salix requirements because many dependencies splitting
with "," and others with "|"
"""
deps = []
for dep in line[18:].strip().split(","):
dep = dep.split("|")
if self.repo == "slacky":
if len(dep... | python | def _req_fix(self, line):
"""Fix slacky and salix requirements because many dependencies splitting
with "," and others with "|"
"""
deps = []
for dep in line[18:].strip().split(","):
dep = dep.split("|")
if self.repo == "slacky":
if len(dep... | [
"def",
"_req_fix",
"(",
"self",
",",
"line",
")",
":",
"deps",
"=",
"[",
"]",
"for",
"dep",
"in",
"line",
"[",
"18",
":",
"]",
".",
"strip",
"(",
")",
".",
"split",
"(",
"\",\"",
")",
":",
"dep",
"=",
"dep",
".",
"split",
"(",
"\"|\"",
")",
... | Fix slacky and salix requirements because many dependencies splitting
with "," and others with "|" | [
"Fix",
"slacky",
"and",
"salix",
"requirements",
"because",
"many",
"dependencies",
"splitting",
"with",
"and",
"others",
"with",
"|"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/greps.py#L178-L196 | train | 60,272 |
dslackw/slpkg | slpkg/new_config.py | NewConfig.run | def run(self):
"""print .new configuration files
"""
self.find_new()
for n in self.news:
print("{0}".format(n))
print("")
self.msg.template(78)
print("| Installed {0} new configuration files:".format(
len(self.news)))
self.msg.templ... | python | def run(self):
"""print .new configuration files
"""
self.find_new()
for n in self.news:
print("{0}".format(n))
print("")
self.msg.template(78)
print("| Installed {0} new configuration files:".format(
len(self.news)))
self.msg.templ... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"find_new",
"(",
")",
"for",
"n",
"in",
"self",
".",
"news",
":",
"print",
"(",
"\"{0}\"",
".",
"format",
"(",
"n",
")",
")",
"print",
"(",
"\"\"",
")",
"self",
".",
"msg",
".",
"template",
"(",... | print .new configuration files | [
"print",
".",
"new",
"configuration",
"files"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/new_config.py#L49-L60 | train | 60,273 |
dslackw/slpkg | slpkg/new_config.py | NewConfig.choices | def choices(self):
"""Menu options for new configuration files
"""
print("| {0}K{1}{2}eep the old and .new files, no changes".format(
self.red, self.endc, self.br))
print("| {0}O{1}{2}verwrite all old configuration files with new "
"ones".format(self.red, self.e... | python | def choices(self):
"""Menu options for new configuration files
"""
print("| {0}K{1}{2}eep the old and .new files, no changes".format(
self.red, self.endc, self.br))
print("| {0}O{1}{2}verwrite all old configuration files with new "
"ones".format(self.red, self.e... | [
"def",
"choices",
"(",
"self",
")",
":",
"print",
"(",
"\"| {0}K{1}{2}eep the old and .new files, no changes\"",
".",
"format",
"(",
"self",
".",
"red",
",",
"self",
".",
"endc",
",",
"self",
".",
"br",
")",
")",
"print",
"(",
"\"| {0}O{1}{2}verwrite all old con... | Menu options for new configuration files | [
"Menu",
"options",
"for",
"new",
"configuration",
"files"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/new_config.py#L76-L103 | train | 60,274 |
dslackw/slpkg | slpkg/new_config.py | NewConfig.question | def question(self, n):
"""Choose what do to file by file
"""
print("")
prompt_ask = raw_input("{0} [K/O/R/D/M/Q]? ".format(n))
print("")
if prompt_ask in ("K", "k"):
self.keep()
elif prompt_ask in ("O", "o"):
self._overwrite(n)
elif... | python | def question(self, n):
"""Choose what do to file by file
"""
print("")
prompt_ask = raw_input("{0} [K/O/R/D/M/Q]? ".format(n))
print("")
if prompt_ask in ("K", "k"):
self.keep()
elif prompt_ask in ("O", "o"):
self._overwrite(n)
elif... | [
"def",
"question",
"(",
"self",
",",
"n",
")",
":",
"print",
"(",
"\"\"",
")",
"prompt_ask",
"=",
"raw_input",
"(",
"\"{0} [K/O/R/D/M/Q]? \"",
".",
"format",
"(",
"n",
")",
")",
"print",
"(",
"\"\"",
")",
"if",
"prompt_ask",
"in",
"(",
"\"K\"",
",",
... | Choose what do to file by file | [
"Choose",
"what",
"do",
"to",
"file",
"by",
"file"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/new_config.py#L140-L158 | train | 60,275 |
dslackw/slpkg | slpkg/new_config.py | NewConfig._remove | def _remove(self, n):
"""Remove one single file
"""
if os.path.isfile(n):
os.remove(n)
if not os.path.isfile(n):
print("File '{0}' removed".format(n)) | python | def _remove(self, n):
"""Remove one single file
"""
if os.path.isfile(n):
os.remove(n)
if not os.path.isfile(n):
print("File '{0}' removed".format(n)) | [
"def",
"_remove",
"(",
"self",
",",
"n",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"n",
")",
":",
"os",
".",
"remove",
"(",
"n",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"n",
")",
":",
"print",
"(",
"\"File '{0}' ... | Remove one single file | [
"Remove",
"one",
"single",
"file"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/new_config.py#L160-L166 | train | 60,276 |
dslackw/slpkg | slpkg/new_config.py | NewConfig._overwrite | def _overwrite(self, n):
"""Overwrite old file with new and keep file with suffix .old
"""
if os.path.isfile(n[:-4]):
shutil.copy2(n[:-4], n[:-4] + ".old")
print("Old file {0} saved as {1}.old".format(
n[:-4].split("/")[-1], n[:-4].split("/")[-1]))
... | python | def _overwrite(self, n):
"""Overwrite old file with new and keep file with suffix .old
"""
if os.path.isfile(n[:-4]):
shutil.copy2(n[:-4], n[:-4] + ".old")
print("Old file {0} saved as {1}.old".format(
n[:-4].split("/")[-1], n[:-4].split("/")[-1]))
... | [
"def",
"_overwrite",
"(",
"self",
",",
"n",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"n",
"[",
":",
"-",
"4",
"]",
")",
":",
"shutil",
".",
"copy2",
"(",
"n",
"[",
":",
"-",
"4",
"]",
",",
"n",
"[",
":",
"-",
"4",
"]",
"+"... | Overwrite old file with new and keep file with suffix .old | [
"Overwrite",
"old",
"file",
"with",
"new",
"and",
"keep",
"file",
"with",
"suffix",
".",
"old"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/new_config.py#L168-L178 | train | 60,277 |
dslackw/slpkg | slpkg/new_config.py | NewConfig.diff | def diff(self, n):
"""Print the differences between the two files
"""
if os.path.isfile(n[:-4]):
diff1 = Utils().read_file(n[:-4]).splitlines()
if os.path.isfile(n):
diff2 = Utils().read_file(n).splitlines()
lines, l, c = [], 0, 0
for a, b in itert... | python | def diff(self, n):
"""Print the differences between the two files
"""
if os.path.isfile(n[:-4]):
diff1 = Utils().read_file(n[:-4]).splitlines()
if os.path.isfile(n):
diff2 = Utils().read_file(n).splitlines()
lines, l, c = [], 0, 0
for a, b in itert... | [
"def",
"diff",
"(",
"self",
",",
"n",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"n",
"[",
":",
"-",
"4",
"]",
")",
":",
"diff1",
"=",
"Utils",
"(",
")",
".",
"read_file",
"(",
"n",
"[",
":",
"-",
"4",
"]",
")",
".",
"splitlin... | Print the differences between the two files | [
"Print",
"the",
"differences",
"between",
"the",
"two",
"files"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/new_config.py#L183-L210 | train | 60,278 |
dslackw/slpkg | slpkg/new_config.py | NewConfig.merge | def merge(self, n):
"""Merge new file into old
"""
if os.path.isfile(n[:-4]):
old = Utils().read_file(n[:-4]).splitlines()
if os.path.isfile(n):
new = Utils().read_file(n).splitlines()
with open(n[:-4], "w") as out:
for l1, l2 in itertools.izip... | python | def merge(self, n):
"""Merge new file into old
"""
if os.path.isfile(n[:-4]):
old = Utils().read_file(n[:-4]).splitlines()
if os.path.isfile(n):
new = Utils().read_file(n).splitlines()
with open(n[:-4], "w") as out:
for l1, l2 in itertools.izip... | [
"def",
"merge",
"(",
"self",
",",
"n",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"n",
"[",
":",
"-",
"4",
"]",
")",
":",
"old",
"=",
"Utils",
"(",
")",
".",
"read_file",
"(",
"n",
"[",
":",
"-",
"4",
"]",
")",
".",
"splitline... | Merge new file into old | [
"Merge",
"new",
"file",
"into",
"old"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/new_config.py#L212-L230 | train | 60,279 |
dslackw/slpkg | slpkg/checks.py | Updates.status_bar | def status_bar(self):
"""Top view bar status
"""
print("")
self.msg.template(78)
print("| Repository Status")
self.msg.template(78) | python | def status_bar(self):
"""Top view bar status
"""
print("")
self.msg.template(78)
print("| Repository Status")
self.msg.template(78) | [
"def",
"status_bar",
"(",
"self",
")",
":",
"print",
"(",
"\"\"",
")",
"self",
".",
"msg",
".",
"template",
"(",
"78",
")",
"print",
"(",
"\"| Repository Status\"",
")",
"self",
".",
"msg",
".",
"template",
"(",
"78",
")"
] | Top view bar status | [
"Top",
"view",
"bar",
"status"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/checks.py#L63-L69 | train | 60,280 |
dslackw/slpkg | slpkg/checks.py | Updates.run | def run(self):
"""Run and check if new in ChangeLog.txt
"""
if (self.repo in self.meta.default_repositories and
self.repo in self.meta.repositories):
try:
self.check = self.all_repos[self.repo]()
except OSError:
usage(self.r... | python | def run(self):
"""Run and check if new in ChangeLog.txt
"""
if (self.repo in self.meta.default_repositories and
self.repo in self.meta.repositories):
try:
self.check = self.all_repos[self.repo]()
except OSError:
usage(self.r... | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"repo",
"in",
"self",
".",
"meta",
".",
"default_repositories",
"and",
"self",
".",
"repo",
"in",
"self",
".",
"meta",
".",
"repositories",
")",
":",
"try",
":",
"self",
".",
"check",
"="... | Run and check if new in ChangeLog.txt | [
"Run",
"and",
"check",
"if",
"new",
"in",
"ChangeLog",
".",
"txt"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/checks.py#L71-L89 | train | 60,281 |
dslackw/slpkg | slpkg/md5sum.py | md5 | def md5(source):
"""Return MD5 Checksum
"""
# fix passing char '+' from source
source = source.replace("%2B", "+")
with open(source) as file_to_check:
data = file_to_check.read()
return hashlib.md5(data).hexdigest() | python | def md5(source):
"""Return MD5 Checksum
"""
# fix passing char '+' from source
source = source.replace("%2B", "+")
with open(source) as file_to_check:
data = file_to_check.read()
return hashlib.md5(data).hexdigest() | [
"def",
"md5",
"(",
"source",
")",
":",
"# fix passing char '+' from source",
"source",
"=",
"source",
".",
"replace",
"(",
"\"%2B\"",
",",
"\"+\"",
")",
"with",
"open",
"(",
"source",
")",
"as",
"file_to_check",
":",
"data",
"=",
"file_to_check",
".",
"read"... | Return MD5 Checksum | [
"Return",
"MD5",
"Checksum"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/md5sum.py#L28-L35 | train | 60,282 |
dslackw/slpkg | slpkg/tracking.py | TrackingDeps.run | def run(self):
"""Run tracking dependencies
"""
self.msg.resolving()
self.repositories()
if self.find_pkg:
self.dependencies_list.reverse()
self.requires = Utils().dimensional_list(self.dependencies_list)
self.dependencies = Utils().remove_dbs(... | python | def run(self):
"""Run tracking dependencies
"""
self.msg.resolving()
self.repositories()
if self.find_pkg:
self.dependencies_list.reverse()
self.requires = Utils().dimensional_list(self.dependencies_list)
self.dependencies = Utils().remove_dbs(... | [
"def",
"run",
"(",
"self",
")",
":",
"self",
".",
"msg",
".",
"resolving",
"(",
")",
"self",
".",
"repositories",
"(",
")",
"if",
"self",
".",
"find_pkg",
":",
"self",
".",
"dependencies_list",
".",
"reverse",
"(",
")",
"self",
".",
"requires",
"=",
... | Run tracking dependencies | [
"Run",
"tracking",
"dependencies"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/tracking.py#L67-L123 | train | 60,283 |
dslackw/slpkg | slpkg/tracking.py | TrackingDeps.repositories | def repositories(self):
"""Get dependencies by repositories
"""
if self.repo == "sbo":
self.sbo_case_insensitive()
self.find_pkg = sbo_search_pkg(self.name)
if self.find_pkg:
self.dependencies_list = Requires(self.flag).sbo(self.name)
e... | python | def repositories(self):
"""Get dependencies by repositories
"""
if self.repo == "sbo":
self.sbo_case_insensitive()
self.find_pkg = sbo_search_pkg(self.name)
if self.find_pkg:
self.dependencies_list = Requires(self.flag).sbo(self.name)
e... | [
"def",
"repositories",
"(",
"self",
")",
":",
"if",
"self",
".",
"repo",
"==",
"\"sbo\"",
":",
"self",
".",
"sbo_case_insensitive",
"(",
")",
"self",
".",
"find_pkg",
"=",
"sbo_search_pkg",
"(",
"self",
".",
"name",
")",
"if",
"self",
".",
"find_pkg",
... | Get dependencies by repositories | [
"Get",
"dependencies",
"by",
"repositories"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/tracking.py#L125-L142 | train | 60,284 |
dslackw/slpkg | slpkg/tracking.py | TrackingDeps.sbo_case_insensitive | def sbo_case_insensitive(self):
"""Matching packages distinguish between uppercase and
lowercase for sbo repository
"""
if "--case-ins" in self.flag:
data = SBoGrep(name="").names()
data_dict = Utils().case_sensitive(data)
for key, value in data_dict.i... | python | def sbo_case_insensitive(self):
"""Matching packages distinguish between uppercase and
lowercase for sbo repository
"""
if "--case-ins" in self.flag:
data = SBoGrep(name="").names()
data_dict = Utils().case_sensitive(data)
for key, value in data_dict.i... | [
"def",
"sbo_case_insensitive",
"(",
"self",
")",
":",
"if",
"\"--case-ins\"",
"in",
"self",
".",
"flag",
":",
"data",
"=",
"SBoGrep",
"(",
"name",
"=",
"\"\"",
")",
".",
"names",
"(",
")",
"data_dict",
"=",
"Utils",
"(",
")",
".",
"case_sensitive",
"("... | Matching packages distinguish between uppercase and
lowercase for sbo repository | [
"Matching",
"packages",
"distinguish",
"between",
"uppercase",
"and",
"lowercase",
"for",
"sbo",
"repository"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/tracking.py#L144-L153 | train | 60,285 |
dslackw/slpkg | slpkg/tracking.py | TrackingDeps.check_used | def check_used(self, pkg):
"""Check if dependencies used
"""
used = []
dep_path = self.meta.log_path + "dep/"
logs = find_package("", dep_path)
for log in logs:
deps = Utils().read_file(dep_path + log)
for dep in deps.splitlines():
... | python | def check_used(self, pkg):
"""Check if dependencies used
"""
used = []
dep_path = self.meta.log_path + "dep/"
logs = find_package("", dep_path)
for log in logs:
deps = Utils().read_file(dep_path + log)
for dep in deps.splitlines():
... | [
"def",
"check_used",
"(",
"self",
",",
"pkg",
")",
":",
"used",
"=",
"[",
"]",
"dep_path",
"=",
"self",
".",
"meta",
".",
"log_path",
"+",
"\"dep/\"",
"logs",
"=",
"find_package",
"(",
"\"\"",
",",
"dep_path",
")",
"for",
"log",
"in",
"logs",
":",
... | Check if dependencies used | [
"Check",
"if",
"dependencies",
"used"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/tracking.py#L170-L181 | train | 60,286 |
dslackw/slpkg | slpkg/tracking.py | TrackingDeps.deps_tree | def deps_tree(self):
"""Package dependencies image map file
"""
dependencies = self.dependencies + [self.name]
if self.repo == "sbo":
for dep in dependencies:
deps = Requires(flag="").sbo(dep)
if dep not in self.deps_dict.values():
... | python | def deps_tree(self):
"""Package dependencies image map file
"""
dependencies = self.dependencies + [self.name]
if self.repo == "sbo":
for dep in dependencies:
deps = Requires(flag="").sbo(dep)
if dep not in self.deps_dict.values():
... | [
"def",
"deps_tree",
"(",
"self",
")",
":",
"dependencies",
"=",
"self",
".",
"dependencies",
"+",
"[",
"self",
".",
"name",
"]",
"if",
"self",
".",
"repo",
"==",
"\"sbo\"",
":",
"for",
"dep",
"in",
"dependencies",
":",
"deps",
"=",
"Requires",
"(",
"... | Package dependencies image map file | [
"Package",
"dependencies",
"image",
"map",
"file"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/tracking.py#L183-L196 | train | 60,287 |
dslackw/slpkg | slpkg/tracking.py | TrackingDeps.deps_used | def deps_used(self, pkg, used):
"""Create dependencies dictionary
"""
if find_package(pkg + self.meta.sp, self.meta.pkg_path):
if pkg not in self.deps_dict.values():
self.deps_dict[pkg] = used
else:
self.deps_dict[pkg] += used | python | def deps_used(self, pkg, used):
"""Create dependencies dictionary
"""
if find_package(pkg + self.meta.sp, self.meta.pkg_path):
if pkg not in self.deps_dict.values():
self.deps_dict[pkg] = used
else:
self.deps_dict[pkg] += used | [
"def",
"deps_used",
"(",
"self",
",",
"pkg",
",",
"used",
")",
":",
"if",
"find_package",
"(",
"pkg",
"+",
"self",
".",
"meta",
".",
"sp",
",",
"self",
".",
"meta",
".",
"pkg_path",
")",
":",
"if",
"pkg",
"not",
"in",
"self",
".",
"deps_dict",
".... | Create dependencies dictionary | [
"Create",
"dependencies",
"dictionary"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/tracking.py#L198-L205 | train | 60,288 |
dslackw/slpkg | slpkg/pkg/installed.py | GetFromInstalled.version | def version(self):
"""Return version from installed packages
"""
if self.find:
return self.meta.sp + split_package(self.find)[1]
return "" | python | def version(self):
"""Return version from installed packages
"""
if self.find:
return self.meta.sp + split_package(self.find)[1]
return "" | [
"def",
"version",
"(",
"self",
")",
":",
"if",
"self",
".",
"find",
":",
"return",
"self",
".",
"meta",
".",
"sp",
"+",
"split_package",
"(",
"self",
".",
"find",
")",
"[",
"1",
"]",
"return",
"\"\""
] | Return version from installed packages | [
"Return",
"version",
"from",
"installed",
"packages"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/pkg/installed.py#L45-L50 | train | 60,289 |
dslackw/slpkg | slpkg/slpkg_update.py | it_self_update | def it_self_update():
"""Check from GitHub slpkg repository if new version is available
download and update itself
"""
__new_version__ = ""
repository = "gitlab"
branch = "master"
ver_link = ("https://raw.{0}usercontent.com/{1}/{2}/"
"{3}/{4}/__metadata__.py".format(repositor... | python | def it_self_update():
"""Check from GitHub slpkg repository if new version is available
download and update itself
"""
__new_version__ = ""
repository = "gitlab"
branch = "master"
ver_link = ("https://raw.{0}usercontent.com/{1}/{2}/"
"{3}/{4}/__metadata__.py".format(repositor... | [
"def",
"it_self_update",
"(",
")",
":",
"__new_version__",
"=",
"\"\"",
"repository",
"=",
"\"gitlab\"",
"branch",
"=",
"\"master\"",
"ver_link",
"=",
"(",
"\"https://raw.{0}usercontent.com/{1}/{2}/\"",
"\"{3}/{4}/__metadata__.py\"",
".",
"format",
"(",
"repository",
",... | Check from GitHub slpkg repository if new version is available
download and update itself | [
"Check",
"from",
"GitHub",
"slpkg",
"repository",
"if",
"new",
"version",
"is",
"available",
"download",
"and",
"update",
"itself"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/slpkg_update.py#L37-L91 | train | 60,290 |
dslackw/slpkg | slpkg/binary/install.py | BinaryInstall.if_all_installed | def if_all_installed(self):
"""Check if all packages is already installed
"""
count_inst = 0
for inst in (self.dep_install + self.install):
if (os.path.isfile(self.meta.pkg_path + inst[:-4]) and
"--download-only" not in self.flag):
count_in... | python | def if_all_installed(self):
"""Check if all packages is already installed
"""
count_inst = 0
for inst in (self.dep_install + self.install):
if (os.path.isfile(self.meta.pkg_path + inst[:-4]) and
"--download-only" not in self.flag):
count_in... | [
"def",
"if_all_installed",
"(",
"self",
")",
":",
"count_inst",
"=",
"0",
"for",
"inst",
"in",
"(",
"self",
".",
"dep_install",
"+",
"self",
".",
"install",
")",
":",
"if",
"(",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"meta",
".",
"pkg_... | Check if all packages is already installed | [
"Check",
"if",
"all",
"packages",
"is",
"already",
"installed"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/install.py#L173-L183 | train | 60,291 |
dslackw/slpkg | slpkg/binary/install.py | BinaryInstall.clear_masters | def clear_masters(self):
"""Clear master packages if already exist in dependencies
or if added to install two or more times
"""
packages = []
for mas in Utils().remove_dbs(self.packages):
if mas not in self.dependencies:
packages.append(mas)
se... | python | def clear_masters(self):
"""Clear master packages if already exist in dependencies
or if added to install two or more times
"""
packages = []
for mas in Utils().remove_dbs(self.packages):
if mas not in self.dependencies:
packages.append(mas)
se... | [
"def",
"clear_masters",
"(",
"self",
")",
":",
"packages",
"=",
"[",
"]",
"for",
"mas",
"in",
"Utils",
"(",
")",
".",
"remove_dbs",
"(",
"self",
".",
"packages",
")",
":",
"if",
"mas",
"not",
"in",
"self",
".",
"dependencies",
":",
"packages",
".",
... | Clear master packages if already exist in dependencies
or if added to install two or more times | [
"Clear",
"master",
"packages",
"if",
"already",
"exist",
"in",
"dependencies",
"or",
"if",
"added",
"to",
"install",
"two",
"or",
"more",
"times"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/install.py#L208-L216 | train | 60,292 |
dslackw/slpkg | slpkg/binary/install.py | BinaryInstall.install_packages | def install_packages(self):
"""Install or upgrade packages
"""
installs, upgraded = [], []
for inst in (self.dep_install + self.install):
package = (self.tmp_path + inst).split()
pkg_ver = "{0}-{1}".format(split_package(inst)[0],
... | python | def install_packages(self):
"""Install or upgrade packages
"""
installs, upgraded = [], []
for inst in (self.dep_install + self.install):
package = (self.tmp_path + inst).split()
pkg_ver = "{0}-{1}".format(split_package(inst)[0],
... | [
"def",
"install_packages",
"(",
"self",
")",
":",
"installs",
",",
"upgraded",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"inst",
"in",
"(",
"self",
".",
"dep_install",
"+",
"self",
".",
"install",
")",
":",
"package",
"=",
"(",
"self",
".",
"tmp_path",
... | Install or upgrade packages | [
"Install",
"or",
"upgrade",
"packages"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/install.py#L218-L240 | train | 60,293 |
dslackw/slpkg | slpkg/binary/install.py | BinaryInstall.not_downgrade | def not_downgrade(self, package):
"""Don't downgrade packages if repository version is lower than
installed"""
name = split_package(package)[0]
rep_ver = split_package(package)[1]
ins_ver = GetFromInstalled(name).version()[1:]
if not ins_ver:
ins_ver = "0"
... | python | def not_downgrade(self, package):
"""Don't downgrade packages if repository version is lower than
installed"""
name = split_package(package)[0]
rep_ver = split_package(package)[1]
ins_ver = GetFromInstalled(name).version()[1:]
if not ins_ver:
ins_ver = "0"
... | [
"def",
"not_downgrade",
"(",
"self",
",",
"package",
")",
":",
"name",
"=",
"split_package",
"(",
"package",
")",
"[",
"0",
"]",
"rep_ver",
"=",
"split_package",
"(",
"package",
")",
"[",
"1",
"]",
"ins_ver",
"=",
"GetFromInstalled",
"(",
"name",
")",
... | Don't downgrade packages if repository version is lower than
installed | [
"Don",
"t",
"downgrade",
"packages",
"if",
"repository",
"version",
"is",
"lower",
"than",
"installed"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/install.py#L242-L255 | train | 60,294 |
dslackw/slpkg | slpkg/binary/install.py | BinaryInstall.checksums | def checksums(self, install):
"""Checksums before install
"""
check_md5(pkg_checksum(install, self.repo), self.tmp_path + install) | python | def checksums(self, install):
"""Checksums before install
"""
check_md5(pkg_checksum(install, self.repo), self.tmp_path + install) | [
"def",
"checksums",
"(",
"self",
",",
"install",
")",
":",
"check_md5",
"(",
"pkg_checksum",
"(",
"install",
",",
"self",
".",
"repo",
")",
",",
"self",
".",
"tmp_path",
"+",
"install",
")"
] | Checksums before install | [
"Checksums",
"before",
"install"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/install.py#L257-L260 | train | 60,295 |
dslackw/slpkg | slpkg/binary/install.py | BinaryInstall.resolving_deps | def resolving_deps(self):
"""Return package dependencies
"""
requires = []
if (self.meta.rsl_deps in ["on", "ON"] and
self.flag != "--resolve-off"):
self.msg.resolving()
for dep in self.packages:
status(0.05)
dependencies = []
... | python | def resolving_deps(self):
"""Return package dependencies
"""
requires = []
if (self.meta.rsl_deps in ["on", "ON"] and
self.flag != "--resolve-off"):
self.msg.resolving()
for dep in self.packages:
status(0.05)
dependencies = []
... | [
"def",
"resolving_deps",
"(",
"self",
")",
":",
"requires",
"=",
"[",
"]",
"if",
"(",
"self",
".",
"meta",
".",
"rsl_deps",
"in",
"[",
"\"on\"",
",",
"\"ON\"",
"]",
"and",
"self",
".",
"flag",
"!=",
"\"--resolve-off\"",
")",
":",
"self",
".",
"msg",
... | Return package dependencies | [
"Return",
"package",
"dependencies"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/install.py#L262-L276 | train | 60,296 |
dslackw/slpkg | slpkg/binary/install.py | BinaryInstall._fix_deps_repos | def _fix_deps_repos(self, dependencies):
"""Fix store deps include in repository
"""
requires = []
for dep in dependencies:
if dep in self.repo_pkg_names:
requires.append(dep)
return requires | python | def _fix_deps_repos(self, dependencies):
"""Fix store deps include in repository
"""
requires = []
for dep in dependencies:
if dep in self.repo_pkg_names:
requires.append(dep)
return requires | [
"def",
"_fix_deps_repos",
"(",
"self",
",",
"dependencies",
")",
":",
"requires",
"=",
"[",
"]",
"for",
"dep",
"in",
"dependencies",
":",
"if",
"dep",
"in",
"self",
".",
"repo_pkg_names",
":",
"requires",
".",
"append",
"(",
"dep",
")",
"return",
"requir... | Fix store deps include in repository | [
"Fix",
"store",
"deps",
"include",
"in",
"repository"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/install.py#L278-L285 | train | 60,297 |
dslackw/slpkg | slpkg/binary/install.py | BinaryInstall.top_view | def top_view(self):
"""Print packages status bar
"""
self.msg.template(78)
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
"| Package", " " * 17,
"New Version", " " * 8,
"Arch", " " * 4,
"Build", " " * 2,
"Repos", " " * 10,
... | python | def top_view(self):
"""Print packages status bar
"""
self.msg.template(78)
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
"| Package", " " * 17,
"New Version", " " * 8,
"Arch", " " * 4,
"Build", " " * 2,
"Repos", " " * 10,
... | [
"def",
"top_view",
"(",
"self",
")",
":",
"self",
".",
"msg",
".",
"template",
"(",
"78",
")",
"print",
"(",
"\"{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}\"",
".",
"format",
"(",
"\"| Package\"",
",",
"\" \"",
"*",
"17",
",",
"\"New Version\"",
",",
"\" \"",
"*",
... | Print packages status bar | [
"Print",
"packages",
"status",
"bar"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/install.py#L314-L325 | train | 60,298 |
dslackw/slpkg | slpkg/binary/install.py | BinaryInstall.store | def store(self, packages):
"""Store and return packages for install
"""
dwn, install, comp_sum, uncomp_sum = ([] for i in range(4))
# name = data[0]
# location = data[1]
# size = data[2]
# unsize = data[3]
for pkg in packages:
for pk, loc, comp... | python | def store(self, packages):
"""Store and return packages for install
"""
dwn, install, comp_sum, uncomp_sum = ([] for i in range(4))
# name = data[0]
# location = data[1]
# size = data[2]
# unsize = data[3]
for pkg in packages:
for pk, loc, comp... | [
"def",
"store",
"(",
"self",
",",
"packages",
")",
":",
"dwn",
",",
"install",
",",
"comp_sum",
",",
"uncomp_sum",
"=",
"(",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"4",
")",
")",
"# name = data[0]",
"# location = data[1]",
"# size = data[2]",
"# unsize ... | Store and return packages for install | [
"Store",
"and",
"return",
"packages",
"for",
"install"
] | dd2e08a80e944d337d157b992167ba631a4343de | https://github.com/dslackw/slpkg/blob/dd2e08a80e944d337d157b992167ba631a4343de/slpkg/binary/install.py#L327-L364 | train | 60,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.