repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 3
values | summary stringlengths 4 350 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
camptocamp/Studio | studio/controllers/layertemplates.py | LayertemplatesController.show | def show(self, id):
"""GET /layertemplates/id: Show a specific item."""
# url('LayerTemplates', id=ID)
lt = meta.Session.query(LayerTemplate).get(id)
# use following query for getting a layertemplate owned by current user
#lt = self._get_lt_from_user_by_id(c.user, id)
if ... | python | def show(self, id):
"""GET /layertemplates/id: Show a specific item."""
# url('LayerTemplates', id=ID)
lt = meta.Session.query(LayerTemplate).get(id)
# use following query for getting a layertemplate owned by current user
#lt = self._get_lt_from_user_by_id(c.user, id)
if ... | [
"def",
"show",
"(",
"self",
",",
"id",
")",
":",
"# url('LayerTemplates', id=ID)",
"lt",
"=",
"meta",
".",
"Session",
".",
"query",
"(",
"LayerTemplate",
")",
".",
"get",
"(",
"id",
")",
"# use following query for getting a layertemplate owned by current user",
"#lt... | GET /layertemplates/id: Show a specific item. | [
"GET",
"/",
"layertemplates",
"/",
"id",
":",
"Show",
"a",
"specific",
"item",
"."
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/controllers/layertemplates.py#L110-L118 | train | GET / layertemplates / id : Show a specific item. |
camptocamp/Studio | studio/controllers/layertemplates.py | LayertemplatesController._get_lts_from_user | def _get_lts_from_user(self, user):
""" Get layertemplates owned by a user from the database. """
req = meta.Session.query(LayerTemplate).select_from(join(LayerTemplate, User))
return req.filter(User.login==user).all() | python | def _get_lts_from_user(self, user):
""" Get layertemplates owned by a user from the database. """
req = meta.Session.query(LayerTemplate).select_from(join(LayerTemplate, User))
return req.filter(User.login==user).all() | [
"def",
"_get_lts_from_user",
"(",
"self",
",",
"user",
")",
":",
"req",
"=",
"meta",
".",
"Session",
".",
"query",
"(",
"LayerTemplate",
")",
".",
"select_from",
"(",
"join",
"(",
"LayerTemplate",
",",
"User",
")",
")",
"return",
"req",
".",
"filter",
... | Get layertemplates owned by a user from the database. | [
"Get",
"layertemplates",
"owned",
"by",
"a",
"user",
"from",
"the",
"database",
"."
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/controllers/layertemplates.py#L121-L124 | train | Get all layertemplates owned by a user from the database. |
camptocamp/Studio | studio/controllers/layertemplates.py | LayertemplatesController._get_lt_from_user_by_id | def _get_lt_from_user_by_id(self, user, lt_id):
""" Get a layertemplate owned by a user from the database by lt_id. """
req = meta.Session.query(LayerTemplate).select_from(join(LayerTemplate, User))
try:
return req.filter(and_(User.login==user, LayerTemplate.id==lt_id)).one()
... | python | def _get_lt_from_user_by_id(self, user, lt_id):
""" Get a layertemplate owned by a user from the database by lt_id. """
req = meta.Session.query(LayerTemplate).select_from(join(LayerTemplate, User))
try:
return req.filter(and_(User.login==user, LayerTemplate.id==lt_id)).one()
... | [
"def",
"_get_lt_from_user_by_id",
"(",
"self",
",",
"user",
",",
"lt_id",
")",
":",
"req",
"=",
"meta",
".",
"Session",
".",
"query",
"(",
"LayerTemplate",
")",
".",
"select_from",
"(",
"join",
"(",
"LayerTemplate",
",",
"User",
")",
")",
"try",
":",
"... | Get a layertemplate owned by a user from the database by lt_id. | [
"Get",
"a",
"layertemplate",
"owned",
"by",
"a",
"user",
"from",
"the",
"database",
"by",
"lt_id",
"."
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/controllers/layertemplates.py#L126-L132 | train | Get a layertemplate owned by a user from the database by lt_id. |
MoseleyBioinformaticsLab/mwtab | mwtab/tokenizer.py | tokenizer | def tokenizer(text):
"""A lexical analyzer for the `mwtab` formatted files.
:param str text: `mwtab` formatted text.
:return: Tuples of data.
:rtype: py:class:`~collections.namedtuple`
"""
stream = deque(text.split("\n"))
while len(stream) > 0:
line = stream.popleft()
if ... | python | def tokenizer(text):
"""A lexical analyzer for the `mwtab` formatted files.
:param str text: `mwtab` formatted text.
:return: Tuples of data.
:rtype: py:class:`~collections.namedtuple`
"""
stream = deque(text.split("\n"))
while len(stream) > 0:
line = stream.popleft()
if ... | [
"def",
"tokenizer",
"(",
"text",
")",
":",
"stream",
"=",
"deque",
"(",
"text",
".",
"split",
"(",
"\"\\n\"",
")",
")",
"while",
"len",
"(",
"stream",
")",
">",
"0",
":",
"line",
"=",
"stream",
".",
"popleft",
"(",
")",
"if",
"line",
".",
"starts... | A lexical analyzer for the `mwtab` formatted files.
:param str text: `mwtab` formatted text.
:return: Tuples of data.
:rtype: py:class:`~collections.namedtuple` | [
"A",
"lexical",
"analyzer",
"for",
"the",
"mwtab",
"formatted",
"files",
"."
] | 8c0ae8ab2aa621662f99589ed41e481cf8b7152b | https://github.com/MoseleyBioinformaticsLab/mwtab/blob/8c0ae8ab2aa621662f99589ed41e481cf8b7152b/mwtab/tokenizer.py#L28-L102 | train | A lexical analyzer for the mwtab formatted files. |
pierre-rouanet/hampy | hampy/hamming.py | encode | def encode(B):
""" Encode data using Hamming(7, 4) code.
E.g.:
encode([0, 0, 1, 1])
encode([[0, 0, 0, 1],
[0, 1, 0, 1]])
:param array B: binary data to encode (must be shaped as (4, ) or (-1, 4)).
"""
B = array(B)
flatten = False
if len(B.shape) == 1:
... | python | def encode(B):
""" Encode data using Hamming(7, 4) code.
E.g.:
encode([0, 0, 1, 1])
encode([[0, 0, 0, 1],
[0, 1, 0, 1]])
:param array B: binary data to encode (must be shaped as (4, ) or (-1, 4)).
"""
B = array(B)
flatten = False
if len(B.shape) == 1:
... | [
"def",
"encode",
"(",
"B",
")",
":",
"B",
"=",
"array",
"(",
"B",
")",
"flatten",
"=",
"False",
"if",
"len",
"(",
"B",
".",
"shape",
")",
"==",
"1",
":",
"flatten",
"=",
"True",
"B",
"=",
"B",
".",
"reshape",
"(",
"1",
",",
"-",
"1",
")",
... | Encode data using Hamming(7, 4) code.
E.g.:
encode([0, 0, 1, 1])
encode([[0, 0, 0, 1],
[0, 1, 0, 1]])
:param array B: binary data to encode (must be shaped as (4, ) or (-1, 4)). | [
"Encode",
"data",
"using",
"Hamming",
"(",
"7",
"4",
")",
"code",
"."
] | bb633a3936f8a3b5f619fb0d92c7448f3dc3c92d | https://github.com/pierre-rouanet/hampy/blob/bb633a3936f8a3b5f619fb0d92c7448f3dc3c92d/hampy/hamming.py#L22-L49 | train | Encode data using Hamming ( 7 4 ) code. |
pierre-rouanet/hampy | hampy/hamming.py | decode | def decode(C):
""" Decode data using Hamming(7, 4) code.
E.g.:
decode([1, 0, 0, 0, 0, 1, 1])
encode([[1, 1, 0, 1, 0, 0, 1],
[0, 1, 0, 0, 1, 0, 1]])
:param array C: binary data to code (must be shaped as (7, ) or (-1, 7)).
"""
C = array(C)
flatten = False
... | python | def decode(C):
""" Decode data using Hamming(7, 4) code.
E.g.:
decode([1, 0, 0, 0, 0, 1, 1])
encode([[1, 1, 0, 1, 0, 0, 1],
[0, 1, 0, 0, 1, 0, 1]])
:param array C: binary data to code (must be shaped as (7, ) or (-1, 7)).
"""
C = array(C)
flatten = False
... | [
"def",
"decode",
"(",
"C",
")",
":",
"C",
"=",
"array",
"(",
"C",
")",
"flatten",
"=",
"False",
"if",
"len",
"(",
"C",
".",
"shape",
")",
"==",
"1",
":",
"flatten",
"=",
"True",
"C",
"=",
"C",
".",
"reshape",
"(",
"1",
",",
"-",
"1",
")",
... | Decode data using Hamming(7, 4) code.
E.g.:
decode([1, 0, 0, 0, 0, 1, 1])
encode([[1, 1, 0, 1, 0, 0, 1],
[0, 1, 0, 0, 1, 0, 1]])
:param array C: binary data to code (must be shaped as (7, ) or (-1, 7)). | [
"Decode",
"data",
"using",
"Hamming",
"(",
"7",
"4",
")",
"code",
"."
] | bb633a3936f8a3b5f619fb0d92c7448f3dc3c92d | https://github.com/pierre-rouanet/hampy/blob/bb633a3936f8a3b5f619fb0d92c7448f3dc3c92d/hampy/hamming.py#L52-L82 | train | Decode binary data using Hamming ( 7 4 ) code. |
camptocamp/Studio | studio/controllers/mapfiles.py | MapfilesController.index | def index(self):
""" GET /mapfiles: Get all mapfiles owned by the current user """
maps = self._get_maps_from_user(c.user)
serialized_maps = []
for m in maps:
serialized_maps.append({
"id": m.id,
"name": m.name,
"href": h.url_fo... | python | def index(self):
""" GET /mapfiles: Get all mapfiles owned by the current user """
maps = self._get_maps_from_user(c.user)
serialized_maps = []
for m in maps:
serialized_maps.append({
"id": m.id,
"name": m.name,
"href": h.url_fo... | [
"def",
"index",
"(",
"self",
")",
":",
"maps",
"=",
"self",
".",
"_get_maps_from_user",
"(",
"c",
".",
"user",
")",
"serialized_maps",
"=",
"[",
"]",
"for",
"m",
"in",
"maps",
":",
"serialized_maps",
".",
"append",
"(",
"{",
"\"id\"",
":",
"m",
".",
... | GET /mapfiles: Get all mapfiles owned by the current user | [
"GET",
"/",
"mapfiles",
":",
"Get",
"all",
"mapfiles",
"owned",
"by",
"the",
"current",
"user"
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/controllers/mapfiles.py#L56-L69 | train | GET / mapfiles : Get all mapfiles owned by the current user |
camptocamp/Studio | studio/controllers/mapfiles.py | MapfilesController.create | def create(self):
"""POST /mapfiles: Create a new item."""
# get json content from POST request
content = request.environ['wsgi.input'].read(int(request.environ['CONTENT_LENGTH']))
#content = content.decode('utf8') mapfile interface don't like unicode strings... bad...
# load ... | python | def create(self):
"""POST /mapfiles: Create a new item."""
# get json content from POST request
content = request.environ['wsgi.input'].read(int(request.environ['CONTENT_LENGTH']))
#content = content.decode('utf8') mapfile interface don't like unicode strings... bad...
# load ... | [
"def",
"create",
"(",
"self",
")",
":",
"# get json content from POST request",
"content",
"=",
"request",
".",
"environ",
"[",
"'wsgi.input'",
"]",
".",
"read",
"(",
"int",
"(",
"request",
".",
"environ",
"[",
"'CONTENT_LENGTH'",
"]",
")",
")",
"#content = co... | POST /mapfiles: Create a new item. | [
"POST",
"/",
"mapfiles",
":",
"Create",
"a",
"new",
"item",
"."
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/controllers/mapfiles.py#L73-L97 | train | POST / mapfiles : Create a new item. |
camptocamp/Studio | studio/controllers/mapfiles.py | MapfilesController.update | def update(self, id):
"""PUT /mapfiles/id: Update an existing item."""
map = self._get_map_from_user_by_id(c.user, id)
if map is None:
abort(404)
# get json content from PUT request
content = request.environ['wsgi.input'].read(int(request.environ['CONTENT_LENGTH']))
... | python | def update(self, id):
"""PUT /mapfiles/id: Update an existing item."""
map = self._get_map_from_user_by_id(c.user, id)
if map is None:
abort(404)
# get json content from PUT request
content = request.environ['wsgi.input'].read(int(request.environ['CONTENT_LENGTH']))
... | [
"def",
"update",
"(",
"self",
",",
"id",
")",
":",
"map",
"=",
"self",
".",
"_get_map_from_user_by_id",
"(",
"c",
".",
"user",
",",
"id",
")",
"if",
"map",
"is",
"None",
":",
"abort",
"(",
"404",
")",
"# get json content from PUT request",
"content",
"="... | PUT /mapfiles/id: Update an existing item. | [
"PUT",
"/",
"mapfiles",
"/",
"id",
":",
"Update",
"an",
"existing",
"item",
"."
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/controllers/mapfiles.py#L100-L119 | train | PUT / mapfiles / id : Update an existing item. |
camptocamp/Studio | studio/controllers/mapfiles.py | MapfilesController.delete | def delete(self, id):
"""DELETE /mapfiles/id: Delete an existing mapfile owned by the current
user. Deletion of the map entry in db and remove mapfile from filesystem. """
map = self._delete_map_from_user_by_id(c.user, id)
if map is None:
abort(404)
if os.path.exists(... | python | def delete(self, id):
"""DELETE /mapfiles/id: Delete an existing mapfile owned by the current
user. Deletion of the map entry in db and remove mapfile from filesystem. """
map = self._delete_map_from_user_by_id(c.user, id)
if map is None:
abort(404)
if os.path.exists(... | [
"def",
"delete",
"(",
"self",
",",
"id",
")",
":",
"map",
"=",
"self",
".",
"_delete_map_from_user_by_id",
"(",
"c",
".",
"user",
",",
"id",
")",
"if",
"map",
"is",
"None",
":",
"abort",
"(",
"404",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(... | DELETE /mapfiles/id: Delete an existing mapfile owned by the current
user. Deletion of the map entry in db and remove mapfile from filesystem. | [
"DELETE",
"/",
"mapfiles",
"/",
"id",
":",
"Delete",
"an",
"existing",
"mapfile",
"owned",
"by",
"the",
"current",
"user",
".",
"Deletion",
"of",
"the",
"map",
"entry",
"in",
"db",
"and",
"remove",
"mapfile",
"from",
"filesystem",
"."
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/controllers/mapfiles.py#L122-L135 | train | DELETE / mapfiles / id |
camptocamp/Studio | studio/controllers/mapfiles.py | MapfilesController.show | def show(self, id):
""" GET /mapfiles/id: Get a specific mapfile owned by the current user. """
map = self._get_map_from_user_by_id(c.user, id)
if map is None:
abort(404)
mapfile = Mapfile()
mapfile.from_file(os.path.join(config['mapfiles_dir'], map.filepath))
... | python | def show(self, id):
""" GET /mapfiles/id: Get a specific mapfile owned by the current user. """
map = self._get_map_from_user_by_id(c.user, id)
if map is None:
abort(404)
mapfile = Mapfile()
mapfile.from_file(os.path.join(config['mapfiles_dir'], map.filepath))
... | [
"def",
"show",
"(",
"self",
",",
"id",
")",
":",
"map",
"=",
"self",
".",
"_get_map_from_user_by_id",
"(",
"c",
".",
"user",
",",
"id",
")",
"if",
"map",
"is",
"None",
":",
"abort",
"(",
"404",
")",
"mapfile",
"=",
"Mapfile",
"(",
")",
"mapfile",
... | GET /mapfiles/id: Get a specific mapfile owned by the current user. | [
"GET",
"/",
"mapfiles",
"/",
"id",
":",
"Get",
"a",
"specific",
"mapfile",
"owned",
"by",
"the",
"current",
"user",
"."
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/controllers/mapfiles.py#L139-L150 | train | GET / mapfiles / id : Get a specific mapfile owned by the current user. |
camptocamp/Studio | studio/controllers/mapfiles.py | MapfilesController._get_map_from_user_by_id | def _get_map_from_user_by_id(self, user, map_id):
""" Get a mapfile owned by a user from the database by
map_id. """
req = Session.query(Map).select_from(join(Map, User))
try:
return req.filter(and_(User.login==user, Map.id==map_id)).one()
except Exception, e:
... | python | def _get_map_from_user_by_id(self, user, map_id):
""" Get a mapfile owned by a user from the database by
map_id. """
req = Session.query(Map).select_from(join(Map, User))
try:
return req.filter(and_(User.login==user, Map.id==map_id)).one()
except Exception, e:
... | [
"def",
"_get_map_from_user_by_id",
"(",
"self",
",",
"user",
",",
"map_id",
")",
":",
"req",
"=",
"Session",
".",
"query",
"(",
"Map",
")",
".",
"select_from",
"(",
"join",
"(",
"Map",
",",
"User",
")",
")",
"try",
":",
"return",
"req",
".",
"filter"... | Get a mapfile owned by a user from the database by
map_id. | [
"Get",
"a",
"mapfile",
"owned",
"by",
"a",
"user",
"from",
"the",
"database",
"by",
"map_id",
"."
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/controllers/mapfiles.py#L197-L204 | train | Get a mapfile owned by a user by a map_id. |
camptocamp/Studio | studio/controllers/mapfiles.py | MapfilesController._get_maps_from_user | def _get_maps_from_user(self, user):
""" Get mapfiles owned by a user from the database. """
req = Session.query(Map).select_from(join(Map, User))
return req.filter(User.login==user).all() | python | def _get_maps_from_user(self, user):
""" Get mapfiles owned by a user from the database. """
req = Session.query(Map).select_from(join(Map, User))
return req.filter(User.login==user).all() | [
"def",
"_get_maps_from_user",
"(",
"self",
",",
"user",
")",
":",
"req",
"=",
"Session",
".",
"query",
"(",
"Map",
")",
".",
"select_from",
"(",
"join",
"(",
"Map",
",",
"User",
")",
")",
"return",
"req",
".",
"filter",
"(",
"User",
".",
"login",
"... | Get mapfiles owned by a user from the database. | [
"Get",
"mapfiles",
"owned",
"by",
"a",
"user",
"from",
"the",
"database",
"."
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/controllers/mapfiles.py#L206-L209 | train | Get all mapfiles owned by a user from the database. |
camptocamp/Studio | studio/controllers/mapfiles.py | MapfilesController._delete_map_from_user_by_id | def _delete_map_from_user_by_id(self, user, map_id):
""" Delete a mapfile entry from database. """
map = self._get_map_from_user_by_id(user, map_id)
if map is None:
return None
Session.delete(map)
Session.commit()
return map | python | def _delete_map_from_user_by_id(self, user, map_id):
""" Delete a mapfile entry from database. """
map = self._get_map_from_user_by_id(user, map_id)
if map is None:
return None
Session.delete(map)
Session.commit()
return map | [
"def",
"_delete_map_from_user_by_id",
"(",
"self",
",",
"user",
",",
"map_id",
")",
":",
"map",
"=",
"self",
".",
"_get_map_from_user_by_id",
"(",
"user",
",",
"map_id",
")",
"if",
"map",
"is",
"None",
":",
"return",
"None",
"Session",
".",
"delete",
"(",
... | Delete a mapfile entry from database. | [
"Delete",
"a",
"mapfile",
"entry",
"from",
"database",
"."
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/controllers/mapfiles.py#L211-L218 | train | Delete a mapfile entry from database. |
camptocamp/Studio | studio/controllers/mapfiles.py | MapfilesController._update_map | def _update_map(self, map, name=None, filepath=None):
""" Delete a mapfile entry from database. """
if name:
map.name = name
if filepath:
map.filepath = filepath
Session.commit() | python | def _update_map(self, map, name=None, filepath=None):
""" Delete a mapfile entry from database. """
if name:
map.name = name
if filepath:
map.filepath = filepath
Session.commit() | [
"def",
"_update_map",
"(",
"self",
",",
"map",
",",
"name",
"=",
"None",
",",
"filepath",
"=",
"None",
")",
":",
"if",
"name",
":",
"map",
".",
"name",
"=",
"name",
"if",
"filepath",
":",
"map",
".",
"filepath",
"=",
"filepath",
"Session",
".",
"co... | Delete a mapfile entry from database. | [
"Delete",
"a",
"mapfile",
"entry",
"from",
"database",
"."
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/controllers/mapfiles.py#L220-L226 | train | Update a mapfile entry in the database. |
camptocamp/Studio | studio/controllers/mapfiles.py | MapfilesController._new_map_from_user | def _new_map_from_user(self, user, name, filepath):
""" Create a new mapfile entry in database. """
map = Map(name, filepath)
map.user = Session.query(User).filter(User.login==user).one()
Session.add(map)
Session.commit()
return map | python | def _new_map_from_user(self, user, name, filepath):
""" Create a new mapfile entry in database. """
map = Map(name, filepath)
map.user = Session.query(User).filter(User.login==user).one()
Session.add(map)
Session.commit()
return map | [
"def",
"_new_map_from_user",
"(",
"self",
",",
"user",
",",
"name",
",",
"filepath",
")",
":",
"map",
"=",
"Map",
"(",
"name",
",",
"filepath",
")",
"map",
".",
"user",
"=",
"Session",
".",
"query",
"(",
"User",
")",
".",
"filter",
"(",
"User",
"."... | Create a new mapfile entry in database. | [
"Create",
"a",
"new",
"mapfile",
"entry",
"in",
"database",
"."
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/controllers/mapfiles.py#L228-L234 | train | Create a new mapfile entry in database. |
camptocamp/Studio | studio/controllers/mapfiles.py | MapfilesController._proxy | def _proxy(self, url, urlparams=None):
"""Do the actual action of proxying the call.
"""
for k,v in request.params.iteritems():
urlparams[k]=v
query = urlencode(urlparams)
full_url = url
if query:
if not full_url.endswith("?"):
full... | python | def _proxy(self, url, urlparams=None):
"""Do the actual action of proxying the call.
"""
for k,v in request.params.iteritems():
urlparams[k]=v
query = urlencode(urlparams)
full_url = url
if query:
if not full_url.endswith("?"):
full... | [
"def",
"_proxy",
"(",
"self",
",",
"url",
",",
"urlparams",
"=",
"None",
")",
":",
"for",
"k",
",",
"v",
"in",
"request",
".",
"params",
".",
"iteritems",
"(",
")",
":",
"urlparams",
"[",
"k",
"]",
"=",
"v",
"query",
"=",
"urlencode",
"(",
"urlpa... | Do the actual action of proxying the call. | [
"Do",
"the",
"actual",
"action",
"of",
"proxying",
"the",
"call",
"."
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/controllers/mapfiles.py#L236-L275 | train | Proxy the request to the url and return the result. |
uw-it-aca/uw-restclients-core | restclients_core/util/mock.py | open_file | def open_file(orig_file_path):
"""
Taking in a file path, attempt to open mock data files with it.
"""
unquoted = unquote(orig_file_path)
paths = [
convert_to_platform_safe(orig_file_path),
"%s/index.html" % (convert_to_platform_safe(orig_file_path)),
orig_file_path,
... | python | def open_file(orig_file_path):
"""
Taking in a file path, attempt to open mock data files with it.
"""
unquoted = unquote(orig_file_path)
paths = [
convert_to_platform_safe(orig_file_path),
"%s/index.html" % (convert_to_platform_safe(orig_file_path)),
orig_file_path,
... | [
"def",
"open_file",
"(",
"orig_file_path",
")",
":",
"unquoted",
"=",
"unquote",
"(",
"orig_file_path",
")",
"paths",
"=",
"[",
"convert_to_platform_safe",
"(",
"orig_file_path",
")",
",",
"\"%s/index.html\"",
"%",
"(",
"convert_to_platform_safe",
"(",
"orig_file_pa... | Taking in a file path, attempt to open mock data files with it. | [
"Taking",
"in",
"a",
"file",
"path",
"attempt",
"to",
"open",
"mock",
"data",
"files",
"with",
"it",
"."
] | fda9380dceb6355ec6a3123e88c9ec66ae992682 | https://github.com/uw-it-aca/uw-restclients-core/blob/fda9380dceb6355ec6a3123e88c9ec66ae992682/restclients_core/util/mock.py#L84-L110 | train | Open a mock data file with the given file path. |
uw-it-aca/uw-restclients-core | restclients_core/util/mock.py | attempt_open_query_permutations | def attempt_open_query_permutations(url, orig_file_path, is_header_file):
"""
Attempt to open a given mock data file with different permutations of the
query parameters
"""
directory = dirname(convert_to_platform_safe(orig_file_path)) + "/"
# get all filenames in directory
try:
file... | python | def attempt_open_query_permutations(url, orig_file_path, is_header_file):
"""
Attempt to open a given mock data file with different permutations of the
query parameters
"""
directory = dirname(convert_to_platform_safe(orig_file_path)) + "/"
# get all filenames in directory
try:
file... | [
"def",
"attempt_open_query_permutations",
"(",
"url",
",",
"orig_file_path",
",",
"is_header_file",
")",
":",
"directory",
"=",
"dirname",
"(",
"convert_to_platform_safe",
"(",
"orig_file_path",
")",
")",
"+",
"\"/\"",
"# get all filenames in directory",
"try",
":",
"... | Attempt to open a given mock data file with different permutations of the
query parameters | [
"Attempt",
"to",
"open",
"a",
"given",
"mock",
"data",
"file",
"with",
"different",
"permutations",
"of",
"the",
"query",
"parameters"
] | fda9380dceb6355ec6a3123e88c9ec66ae992682 | https://github.com/uw-it-aca/uw-restclients-core/blob/fda9380dceb6355ec6a3123e88c9ec66ae992682/restclients_core/util/mock.py#L113-L167 | train | Attempt to open a given mock data file with different permutations of the query parameters. |
camptocamp/Studio | studio/lib/mapscriptutils.py | msConstants.lookup | def lookup(self,value):
""" return the first key in dict where value is name """
for k,v in self.iteritems():
if value == v:
return k
return None | python | def lookup(self,value):
""" return the first key in dict where value is name """
for k,v in self.iteritems():
if value == v:
return k
return None | [
"def",
"lookup",
"(",
"self",
",",
"value",
")",
":",
"for",
"k",
",",
"v",
"in",
"self",
".",
"iteritems",
"(",
")",
":",
"if",
"value",
"==",
"v",
":",
"return",
"k",
"return",
"None"
] | return the first key in dict where value is name | [
"return",
"the",
"first",
"key",
"in",
"dict",
"where",
"value",
"is",
"name"
] | 43cb7298434fb606b15136801b79b03571a2f27e | https://github.com/camptocamp/Studio/blob/43cb7298434fb606b15136801b79b03571a2f27e/studio/lib/mapscriptutils.py#L28-L33 | train | lookup the first key in dict where value is name |
SergeySatskiy/cdm-pythonparser | legacy/src/cdmbriefparser.py | ModuleInfoBase._getLPA | def _getLPA( self ):
" Provides line, pos and absPosition line as string "
return str( self.line ) + ":" + \
str( self.pos ) + ":" + \
str( self.absPosition ) | python | def _getLPA( self ):
" Provides line, pos and absPosition line as string "
return str( self.line ) + ":" + \
str( self.pos ) + ":" + \
str( self.absPosition ) | [
"def",
"_getLPA",
"(",
"self",
")",
":",
"return",
"str",
"(",
"self",
".",
"line",
")",
"+",
"\":\"",
"+",
"str",
"(",
"self",
".",
"pos",
")",
"+",
"\":\"",
"+",
"str",
"(",
"self",
".",
"absPosition",
")"
] | Provides line, pos and absPosition line as string | [
"Provides",
"line",
"pos",
"and",
"absPosition",
"line",
"as",
"string"
] | 7e933aca899b1853d744082313ffc3a8b1154505 | https://github.com/SergeySatskiy/cdm-pythonparser/blob/7e933aca899b1853d744082313ffc3a8b1154505/legacy/src/cdmbriefparser.py#L91-L95 | train | Provides line pos and absPosition line as string |
SergeySatskiy/cdm-pythonparser | legacy/src/cdmbriefparser.py | Class.getDisplayName | def getDisplayName( self ):
" Provides a name for display purpose "
displayName = self.name
if self.base:
displayName += "( " + ", ".join( self.base ) + " )"
return displayName | python | def getDisplayName( self ):
" Provides a name for display purpose "
displayName = self.name
if self.base:
displayName += "( " + ", ".join( self.base ) + " )"
return displayName | [
"def",
"getDisplayName",
"(",
"self",
")",
":",
"displayName",
"=",
"self",
".",
"name",
"if",
"self",
".",
"base",
":",
"displayName",
"+=",
"\"( \"",
"+",
"\", \"",
".",
"join",
"(",
"self",
".",
"base",
")",
"+",
"\" )\"",
"return",
"displayName"
] | Provides a name for display purpose | [
"Provides",
"a",
"name",
"for",
"display",
"purpose"
] | 7e933aca899b1853d744082313ffc3a8b1154505 | https://github.com/SergeySatskiy/cdm-pythonparser/blob/7e933aca899b1853d744082313ffc3a8b1154505/legacy/src/cdmbriefparser.py#L366-L371 | train | Provides a name for display purpose |
SergeySatskiy/cdm-pythonparser | legacy/src/cdmbriefparser.py | BriefModuleInfo.niceStringify | def niceStringify( self ):
" Returns a string representation with new lines and shifts "
out = ""
if self.docstring is not None:
out += str( self.docstring )
if not self.encoding is None:
if out != "":
out += '\n'
out += str( self.enco... | python | def niceStringify( self ):
" Returns a string representation with new lines and shifts "
out = ""
if self.docstring is not None:
out += str( self.docstring )
if not self.encoding is None:
if out != "":
out += '\n'
out += str( self.enco... | [
"def",
"niceStringify",
"(",
"self",
")",
":",
"out",
"=",
"\"\"",
"if",
"self",
".",
"docstring",
"is",
"not",
"None",
":",
"out",
"+=",
"str",
"(",
"self",
".",
"docstring",
")",
"if",
"not",
"self",
".",
"encoding",
"is",
"None",
":",
"if",
"out... | Returns a string representation with new lines and shifts | [
"Returns",
"a",
"string",
"representation",
"with",
"new",
"lines",
"and",
"shifts"
] | 7e933aca899b1853d744082313ffc3a8b1154505 | https://github.com/SergeySatskiy/cdm-pythonparser/blob/7e933aca899b1853d744082313ffc3a8b1154505/legacy/src/cdmbriefparser.py#L397-L423 | train | Returns a string representation with new lines and shifts |
SergeySatskiy/cdm-pythonparser | legacy/src/cdmbriefparser.py | BriefModuleInfo._onFunction | def _onFunction( self, name, line, pos, absPosition,
keywordLine, keywordPos,
colonLine, colonPos, level ):
" Memorizes a function "
self.__flushLevel( level )
self.objectsStack.append( Function( name, line, pos, absPosition,
... | python | def _onFunction( self, name, line, pos, absPosition,
keywordLine, keywordPos,
colonLine, colonPos, level ):
" Memorizes a function "
self.__flushLevel( level )
self.objectsStack.append( Function( name, line, pos, absPosition,
... | [
"def",
"_onFunction",
"(",
"self",
",",
"name",
",",
"line",
",",
"pos",
",",
"absPosition",
",",
"keywordLine",
",",
"keywordPos",
",",
"colonLine",
",",
"colonPos",
",",
"level",
")",
":",
"self",
".",
"__flushLevel",
"(",
"level",
")",
"self",
".",
... | Memorizes a function | [
"Memorizes",
"a",
"function"
] | 7e933aca899b1853d744082313ffc3a8b1154505 | https://github.com/SergeySatskiy/cdm-pythonparser/blob/7e933aca899b1853d744082313ffc3a8b1154505/legacy/src/cdmbriefparser.py#L487-L495 | train | Memorizes a function |
SergeySatskiy/cdm-pythonparser | legacy/src/cdmbriefparser.py | BriefModuleInfo._onImport | def _onImport( self, name, line, pos, absPosition ):
" Memorizes an import "
if self.__lastImport is not None:
self.imports.append( self.__lastImport )
self.__lastImport = Import( name, line, pos, absPosition )
return | python | def _onImport( self, name, line, pos, absPosition ):
" Memorizes an import "
if self.__lastImport is not None:
self.imports.append( self.__lastImport )
self.__lastImport = Import( name, line, pos, absPosition )
return | [
"def",
"_onImport",
"(",
"self",
",",
"name",
",",
"line",
",",
"pos",
",",
"absPosition",
")",
":",
"if",
"self",
".",
"__lastImport",
"is",
"not",
"None",
":",
"self",
".",
"imports",
".",
"append",
"(",
"self",
".",
"__lastImport",
")",
"self",
".... | Memorizes an import | [
"Memorizes",
"an",
"import"
] | 7e933aca899b1853d744082313ffc3a8b1154505 | https://github.com/SergeySatskiy/cdm-pythonparser/blob/7e933aca899b1853d744082313ffc3a8b1154505/legacy/src/cdmbriefparser.py#L497-L502 | train | Memorizes an import |
SergeySatskiy/cdm-pythonparser | legacy/src/cdmbriefparser.py | BriefModuleInfo._onAs | def _onAs( self, name ):
" Memorizes an alias for an import or an imported item "
if self.__lastImport.what:
self.__lastImport.what[ -1 ].alias = name
else:
self.__lastImport.alias = name
return | python | def _onAs( self, name ):
" Memorizes an alias for an import or an imported item "
if self.__lastImport.what:
self.__lastImport.what[ -1 ].alias = name
else:
self.__lastImport.alias = name
return | [
"def",
"_onAs",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"__lastImport",
".",
"what",
":",
"self",
".",
"__lastImport",
".",
"what",
"[",
"-",
"1",
"]",
".",
"alias",
"=",
"name",
"else",
":",
"self",
".",
"__lastImport",
".",
"alias"... | Memorizes an alias for an import or an imported item | [
"Memorizes",
"an",
"alias",
"for",
"an",
"import",
"or",
"an",
"imported",
"item"
] | 7e933aca899b1853d744082313ffc3a8b1154505 | https://github.com/SergeySatskiy/cdm-pythonparser/blob/7e933aca899b1853d744082313ffc3a8b1154505/legacy/src/cdmbriefparser.py#L504-L510 | train | Memorizes an alias for an import or an imported item |
SergeySatskiy/cdm-pythonparser | legacy/src/cdmbriefparser.py | BriefModuleInfo._onDecorator | def _onDecorator( self, name, line, pos, absPosition ):
" Memorizes a function or a class decorator "
# A class or a function must be on the top of the stack
self.objectsStack[ -1 ].decorators.append(
Decorator( name, line, pos,
... | python | def _onDecorator( self, name, line, pos, absPosition ):
" Memorizes a function or a class decorator "
# A class or a function must be on the top of the stack
self.objectsStack[ -1 ].decorators.append(
Decorator( name, line, pos,
... | [
"def",
"_onDecorator",
"(",
"self",
",",
"name",
",",
"line",
",",
"pos",
",",
"absPosition",
")",
":",
"# A class or a function must be on the top of the stack",
"self",
".",
"objectsStack",
"[",
"-",
"1",
"]",
".",
"decorators",
".",
"append",
"(",
"Decorator"... | Memorizes a function or a class decorator | [
"Memorizes",
"a",
"function",
"or",
"a",
"class",
"decorator"
] | 7e933aca899b1853d744082313ffc3a8b1154505 | https://github.com/SergeySatskiy/cdm-pythonparser/blob/7e933aca899b1853d744082313ffc3a8b1154505/legacy/src/cdmbriefparser.py#L540-L546 | train | Memorizes a function or a class decorator |
SergeySatskiy/cdm-pythonparser | legacy/src/cdmbriefparser.py | BriefModuleInfo._onDocstring | def _onDocstring( self, docstr, line ):
" Memorizes a function/class/module docstring "
if self.objectsStack:
self.objectsStack[ -1 ].docstring = \
Docstring( trim_docstring( docstr ), line )
return
self.docstring = Docstring( trim_docstr... | python | def _onDocstring( self, docstr, line ):
" Memorizes a function/class/module docstring "
if self.objectsStack:
self.objectsStack[ -1 ].docstring = \
Docstring( trim_docstring( docstr ), line )
return
self.docstring = Docstring( trim_docstr... | [
"def",
"_onDocstring",
"(",
"self",
",",
"docstr",
",",
"line",
")",
":",
"if",
"self",
".",
"objectsStack",
":",
"self",
".",
"objectsStack",
"[",
"-",
"1",
"]",
".",
"docstring",
"=",
"Docstring",
"(",
"trim_docstring",
"(",
"docstr",
")",
",",
"line... | Memorizes a function/class/module docstring | [
"Memorizes",
"a",
"function",
"/",
"class",
"/",
"module",
"docstring"
] | 7e933aca899b1853d744082313ffc3a8b1154505 | https://github.com/SergeySatskiy/cdm-pythonparser/blob/7e933aca899b1853d744082313ffc3a8b1154505/legacy/src/cdmbriefparser.py#L553-L561 | train | Memorizes a function / class / module docstring |
Radi85/Comment | comment/templatetags/comment_tags.py | comment_count | def comment_count(obj):
""" returns the count of comments of an object """
model_object = type(obj).objects.get(id=obj.id)
return model_object.comments.all().count() | python | def comment_count(obj):
""" returns the count of comments of an object """
model_object = type(obj).objects.get(id=obj.id)
return model_object.comments.all().count() | [
"def",
"comment_count",
"(",
"obj",
")",
":",
"model_object",
"=",
"type",
"(",
"obj",
")",
".",
"objects",
".",
"get",
"(",
"id",
"=",
"obj",
".",
"id",
")",
"return",
"model_object",
".",
"comments",
".",
"all",
"(",
")",
".",
"count",
"(",
")"
] | returns the count of comments of an object | [
"returns",
"the",
"count",
"of",
"comments",
"of",
"an",
"object"
] | c3c46afe51228cd7ee4e04f5e6164fff1be3a5bc | https://github.com/Radi85/Comment/blob/c3c46afe51228cd7ee4e04f5e6164fff1be3a5bc/comment/templatetags/comment_tags.py#L25-L28 | train | returns the count of comments of an object |
Radi85/Comment | comment/templatetags/comment_tags.py | profile_url | def profile_url(obj, profile_app_name, profile_model_name):
""" returns profile url of user """
try:
content_type = ContentType.objects.get(
app_label=profile_app_name,
model=profile_model_name.lower()
)
profile = content_type.get_object_for_this_type(user=obj.use... | python | def profile_url(obj, profile_app_name, profile_model_name):
""" returns profile url of user """
try:
content_type = ContentType.objects.get(
app_label=profile_app_name,
model=profile_model_name.lower()
)
profile = content_type.get_object_for_this_type(user=obj.use... | [
"def",
"profile_url",
"(",
"obj",
",",
"profile_app_name",
",",
"profile_model_name",
")",
":",
"try",
":",
"content_type",
"=",
"ContentType",
".",
"objects",
".",
"get",
"(",
"app_label",
"=",
"profile_app_name",
",",
"model",
"=",
"profile_model_name",
".",
... | returns profile url of user | [
"returns",
"profile",
"url",
"of",
"user"
] | c3c46afe51228cd7ee4e04f5e6164fff1be3a5bc | https://github.com/Radi85/Comment/blob/c3c46afe51228cd7ee4e04f5e6164fff1be3a5bc/comment/templatetags/comment_tags.py#L32-L44 | train | returns profile url of user |
Radi85/Comment | comment/templatetags/comment_tags.py | img_url | def img_url(obj, profile_app_name, profile_model_name):
""" returns url of profile image of a user """
try:
content_type = ContentType.objects.get(
app_label=profile_app_name,
model=profile_model_name.lower()
)
except ContentType.DoesNotExist:
return ""
ex... | python | def img_url(obj, profile_app_name, profile_model_name):
""" returns url of profile image of a user """
try:
content_type = ContentType.objects.get(
app_label=profile_app_name,
model=profile_model_name.lower()
)
except ContentType.DoesNotExist:
return ""
ex... | [
"def",
"img_url",
"(",
"obj",
",",
"profile_app_name",
",",
"profile_model_name",
")",
":",
"try",
":",
"content_type",
"=",
"ContentType",
".",
"objects",
".",
"get",
"(",
"app_label",
"=",
"profile_app_name",
",",
"model",
"=",
"profile_model_name",
".",
"lo... | returns url of profile image of a user | [
"returns",
"url",
"of",
"profile",
"image",
"of",
"a",
"user"
] | c3c46afe51228cd7ee4e04f5e6164fff1be3a5bc | https://github.com/Radi85/Comment/blob/c3c46afe51228cd7ee4e04f5e6164fff1be3a5bc/comment/templatetags/comment_tags.py#L48-L65 | train | returns url of profile image of a user |
Radi85/Comment | comment/templatetags/comment_tags.py | get_comments | def get_comments(obj, request, oauth=False, paginate=False, cpp=10):
"""
Retrieves list of comments related to a certain object and renders
The appropriate template to view it
"""
model_object = type(obj).objects.get(id=obj.id)
comments = Comment.objects.filter_by_object(model_object)
commen... | python | def get_comments(obj, request, oauth=False, paginate=False, cpp=10):
"""
Retrieves list of comments related to a certain object and renders
The appropriate template to view it
"""
model_object = type(obj).objects.get(id=obj.id)
comments = Comment.objects.filter_by_object(model_object)
commen... | [
"def",
"get_comments",
"(",
"obj",
",",
"request",
",",
"oauth",
"=",
"False",
",",
"paginate",
"=",
"False",
",",
"cpp",
"=",
"10",
")",
":",
"model_object",
"=",
"type",
"(",
"obj",
")",
".",
"objects",
".",
"get",
"(",
"id",
"=",
"obj",
".",
"... | Retrieves list of comments related to a certain object and renders
The appropriate template to view it | [
"Retrieves",
"list",
"of",
"comments",
"related",
"to",
"a",
"certain",
"object",
"and",
"renders",
"The",
"appropriate",
"template",
"to",
"view",
"it"
] | c3c46afe51228cd7ee4e04f5e6164fff1be3a5bc | https://github.com/Radi85/Comment/blob/c3c46afe51228cd7ee4e04f5e6164fff1be3a5bc/comment/templatetags/comment_tags.py#L68-L113 | train | Returns a list of comments related to a certain object and renders the appropriate template to view it |
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.save | def save(self):
"""save the instance as a .lcopt file"""
if self.save_option == 'curdir':
model_path = os.path.join(
os.getcwd(),
'{}.lcopt'.format(self.name)
)
else: # default to appdir
model_path = os.path.join(
... | python | def save(self):
"""save the instance as a .lcopt file"""
if self.save_option == 'curdir':
model_path = os.path.join(
os.getcwd(),
'{}.lcopt'.format(self.name)
)
else: # default to appdir
model_path = os.path.join(
... | [
"def",
"save",
"(",
"self",
")",
":",
"if",
"self",
".",
"save_option",
"==",
"'curdir'",
":",
"model_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"getcwd",
"(",
")",
",",
"'{}.lcopt'",
".",
"format",
"(",
"self",
".",
"name",
")",
... | save the instance as a .lcopt file | [
"save",
"the",
"instance",
"as",
"a",
".",
"lcopt",
"file"
] | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L253-L269 | train | save the instance as a. lcopt file |
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.load | def load(self, filename):
"""load data from a saved .lcopt file"""
if filename[-6:] != ".lcopt":
filename += ".lcopt"
try:
savedInstance = pickle.load(open("{}".format(filename), "rb"))
except FileNotFoundError:
savedInstance = pickle.load(open(fix_mac... | python | def load(self, filename):
"""load data from a saved .lcopt file"""
if filename[-6:] != ".lcopt":
filename += ".lcopt"
try:
savedInstance = pickle.load(open("{}".format(filename), "rb"))
except FileNotFoundError:
savedInstance = pickle.load(open(fix_mac... | [
"def",
"load",
"(",
"self",
",",
"filename",
")",
":",
"if",
"filename",
"[",
"-",
"6",
":",
"]",
"!=",
"\".lcopt\"",
":",
"filename",
"+=",
"\".lcopt\"",
"try",
":",
"savedInstance",
"=",
"pickle",
".",
"load",
"(",
"open",
"(",
"\"{}\"",
".",
"form... | load data from a saved .lcopt file | [
"load",
"data",
"from",
"a",
"saved",
".",
"lcopt",
"file"
] | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L271-L334 | train | load data from a saved. lcopt file |
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.create_product | def create_product (self, name, location='GLO', unit='kg', **kwargs):
"""
Create a new product in the model database
"""
new_product = item_factory(name=name, location=location, unit=unit, type='product', **kwargs)
if not self.exists_in_database(new_product['code']):
... | python | def create_product (self, name, location='GLO', unit='kg', **kwargs):
"""
Create a new product in the model database
"""
new_product = item_factory(name=name, location=location, unit=unit, type='product', **kwargs)
if not self.exists_in_database(new_product['code']):
... | [
"def",
"create_product",
"(",
"self",
",",
"name",
",",
"location",
"=",
"'GLO'",
",",
"unit",
"=",
"'kg'",
",",
"*",
"*",
"kwargs",
")",
":",
"new_product",
"=",
"item_factory",
"(",
"name",
"=",
"name",
",",
"location",
"=",
"location",
",",
"unit",
... | Create a new product in the model database | [
"Create",
"a",
"new",
"product",
"in",
"the",
"model",
"database"
] | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L338-L352 | train | Create a new product in the model database |
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.create_process | def create_process(self, name, exchanges, location='GLO', unit='kg'):
"""
Create a new process, including all new exchanges (in brightway2's exchange format) in the model database.
Exchanges must have at least a name, type and unit field
"""
found_exchanges = []
for e i... | python | def create_process(self, name, exchanges, location='GLO', unit='kg'):
"""
Create a new process, including all new exchanges (in brightway2's exchange format) in the model database.
Exchanges must have at least a name, type and unit field
"""
found_exchanges = []
for e i... | [
"def",
"create_process",
"(",
"self",
",",
"name",
",",
"exchanges",
",",
"location",
"=",
"'GLO'",
",",
"unit",
"=",
"'kg'",
")",
":",
"found_exchanges",
"=",
"[",
"]",
"for",
"e",
"in",
"exchanges",
":",
"exc_name",
"=",
"e",
".",
"pop",
"(",
"'nam... | Create a new process, including all new exchanges (in brightway2's exchange format) in the model database.
Exchanges must have at least a name, type and unit field | [
"Create",
"a",
"new",
"process",
"including",
"all",
"new",
"exchanges",
"(",
"in",
"brightway2",
"s",
"exchange",
"format",
")",
"in",
"the",
"model",
"database",
"."
] | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L354-L382 | train | Create a new process in the model database. |
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.remove_input_link | def remove_input_link(self, process_code, input_code):
"""
Remove an input (technosphere or biosphere exchange) from a process, resolving all parameter issues
"""
# 1. find correct process
# 2. find correct exchange
# 3. remove that exchange
# 4. check for parame... | python | def remove_input_link(self, process_code, input_code):
"""
Remove an input (technosphere or biosphere exchange) from a process, resolving all parameter issues
"""
# 1. find correct process
# 2. find correct exchange
# 3. remove that exchange
# 4. check for parame... | [
"def",
"remove_input_link",
"(",
"self",
",",
"process_code",
",",
"input_code",
")",
":",
"# 1. find correct process",
"# 2. find correct exchange",
"# 3. remove that exchange",
"# 4. check for parameter conflicts?",
"# 4. run parameter scan to rebuild matrices?",
"#print(process_code... | Remove an input (technosphere or biosphere exchange) from a process, resolving all parameter issues | [
"Remove",
"an",
"input",
"(",
"technosphere",
"or",
"biosphere",
"exchange",
")",
"from",
"a",
"process",
"resolving",
"all",
"parameter",
"issues"
] | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L396-L438 | train | Remove an input link from a process |
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.unlink_intermediate | def unlink_intermediate(self, sourceId, targetId):
"""
Remove a link between two processes
"""
source = self.database['items'][(self.database.get('name'), sourceId)]
target = self.database['items'][(self.database.get('name'), targetId)]
production_exchange = [x[... | python | def unlink_intermediate(self, sourceId, targetId):
"""
Remove a link between two processes
"""
source = self.database['items'][(self.database.get('name'), sourceId)]
target = self.database['items'][(self.database.get('name'), targetId)]
production_exchange = [x[... | [
"def",
"unlink_intermediate",
"(",
"self",
",",
"sourceId",
",",
"targetId",
")",
":",
"source",
"=",
"self",
".",
"database",
"[",
"'items'",
"]",
"[",
"(",
"self",
".",
"database",
".",
"get",
"(",
"'name'",
")",
",",
"sourceId",
")",
"]",
"target",
... | Remove a link between two processes | [
"Remove",
"a",
"link",
"between",
"two",
"processes"
] | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L440-L456 | train | Remove a link between two processes |
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.parameter_scan | def parameter_scan(self):
"""
Scan the database of the model instance to generate and expose parameters.
This is called by other functions when items are added/removed from the model, but can be run by itself if you like
"""
#self.parameter_map = {}
#sel... | python | def parameter_scan(self):
"""
Scan the database of the model instance to generate and expose parameters.
This is called by other functions when items are added/removed from the model, but can be run by itself if you like
"""
#self.parameter_map = {}
#sel... | [
"def",
"parameter_scan",
"(",
"self",
")",
":",
"#self.parameter_map = {}",
"#self.params = OrderedDict()",
"cr_list",
"=",
"[",
"]",
"items",
"=",
"self",
".",
"database",
"[",
"'items'",
"]",
"#print(items)",
"for",
"key",
"in",
"items",
".",
"keys",
"(",
")... | Scan the database of the model instance to generate and expose parameters.
This is called by other functions when items are added/removed from the model, but can be run by itself if you like | [
"Scan",
"the",
"database",
"of",
"the",
"model",
"instance",
"to",
"generate",
"and",
"expose",
"parameters",
".",
"This",
"is",
"called",
"by",
"other",
"functions",
"when",
"items",
"are",
"added",
"/",
"removed",
"from",
"the",
"model",
"but",
"can",
"b... | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L458-L573 | train | Scan the database of the model instance to generate and expose parameters. |
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.generate_parameter_set_excel_file | def generate_parameter_set_excel_file(self):
"""
Generate an excel file containing the parameter sets in a format you can import into SimaPro Developer.
The file will be called "ParameterSet_<ModelName>_input_file.xlsx"
"""
parameter_sets = self.parameter_sets
... | python | def generate_parameter_set_excel_file(self):
"""
Generate an excel file containing the parameter sets in a format you can import into SimaPro Developer.
The file will be called "ParameterSet_<ModelName>_input_file.xlsx"
"""
parameter_sets = self.parameter_sets
... | [
"def",
"generate_parameter_set_excel_file",
"(",
"self",
")",
":",
"parameter_sets",
"=",
"self",
".",
"parameter_sets",
"p_set",
"=",
"[",
"]",
"filename",
"=",
"\"ParameterSet_{}_input_file.xlsx\"",
".",
"format",
"(",
"self",
".",
"name",
")",
"if",
"self",
"... | Generate an excel file containing the parameter sets in a format you can import into SimaPro Developer.
The file will be called "ParameterSet_<ModelName>_input_file.xlsx" | [
"Generate",
"an",
"excel",
"file",
"containing",
"the",
"parameter",
"sets",
"in",
"a",
"format",
"you",
"can",
"import",
"into",
"SimaPro",
"Developer",
"."
] | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L575-L633 | train | Generate an Excel file containing the parameter sets in a format that can be used to import the simulation. |
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.add_parameter | def add_parameter(self, param_name, description=None, default=0, unit=None):
"""
Add a global parameter to the database that can be accessed by functions
"""
if description is None:
description = "Parameter called {}".format(param_name)
if unit is None:
... | python | def add_parameter(self, param_name, description=None, default=0, unit=None):
"""
Add a global parameter to the database that can be accessed by functions
"""
if description is None:
description = "Parameter called {}".format(param_name)
if unit is None:
... | [
"def",
"add_parameter",
"(",
"self",
",",
"param_name",
",",
"description",
"=",
"None",
",",
"default",
"=",
"0",
",",
"unit",
"=",
"None",
")",
":",
"if",
"description",
"is",
"None",
":",
"description",
"=",
"\"Parameter called {}\"",
".",
"format",
"("... | Add a global parameter to the database that can be accessed by functions | [
"Add",
"a",
"global",
"parameter",
"to",
"the",
"database",
"that",
"can",
"be",
"accessed",
"by",
"functions"
] | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L635-L651 | train | Add a global parameter to the database that can be accessed by functions
|
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.list_parameters_as_df | def list_parameters_as_df(self):
"""
Only really useful when running from a jupyter notebook.
Lists the parameters in the model in a pandas dataframe
Columns: id, matrix coordinates, description, function
"""
to_df = []
for i, e in enumerate(self.ext_params):
... | python | def list_parameters_as_df(self):
"""
Only really useful when running from a jupyter notebook.
Lists the parameters in the model in a pandas dataframe
Columns: id, matrix coordinates, description, function
"""
to_df = []
for i, e in enumerate(self.ext_params):
... | [
"def",
"list_parameters_as_df",
"(",
"self",
")",
":",
"to_df",
"=",
"[",
"]",
"for",
"i",
",",
"e",
"in",
"enumerate",
"(",
"self",
".",
"ext_params",
")",
":",
"row",
"=",
"{",
"}",
"row",
"[",
"'id'",
"]",
"=",
"e",
"[",
"'name'",
"]",
"row",
... | Only really useful when running from a jupyter notebook.
Lists the parameters in the model in a pandas dataframe
Columns: id, matrix coordinates, description, function | [
"Only",
"really",
"useful",
"when",
"running",
"from",
"a",
"jupyter",
"notebook",
"."
] | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L653-L684 | train | Lists the parameters in the model in a pandas dataframe |
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.import_external_db | def import_external_db(self, db_file, db_type=None):
"""
Import an external database for use in lcopt
db_type must be one of ``technosphere`` or ``biosphere``
The best way to 'obtain' an external database is to 'export' it from brightway as a pickle file
e.g.::
im... | python | def import_external_db(self, db_file, db_type=None):
"""
Import an external database for use in lcopt
db_type must be one of ``technosphere`` or ``biosphere``
The best way to 'obtain' an external database is to 'export' it from brightway as a pickle file
e.g.::
im... | [
"def",
"import_external_db",
"(",
"self",
",",
"db_file",
",",
"db_type",
"=",
"None",
")",
":",
"db",
"=",
"pickle",
".",
"load",
"(",
"open",
"(",
"\"{}.pickle\"",
".",
"format",
"(",
"db_file",
")",
",",
"\"rb\"",
")",
")",
"name",
"=",
"list",
"(... | Import an external database for use in lcopt
db_type must be one of ``technosphere`` or ``biosphere``
The best way to 'obtain' an external database is to 'export' it from brightway as a pickle file
e.g.::
import brightway2 as bw
bw.projects.set_current('MyModel')
... | [
"Import",
"an",
"external",
"database",
"for",
"use",
"in",
"lcopt"
] | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L686-L725 | train | Import an external database for use in lcopt |
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.search_databases | def search_databases(self, search_term, location=None, markets_only=False, databases_to_search=None, allow_internal=False):
"""
Search external databases linked to your lcopt model.
To restrict the search to particular databases (e.g. technosphere or biosphere only) use a list of database name... | python | def search_databases(self, search_term, location=None, markets_only=False, databases_to_search=None, allow_internal=False):
"""
Search external databases linked to your lcopt model.
To restrict the search to particular databases (e.g. technosphere or biosphere only) use a list of database name... | [
"def",
"search_databases",
"(",
"self",
",",
"search_term",
",",
"location",
"=",
"None",
",",
"markets_only",
"=",
"False",
",",
"databases_to_search",
"=",
"None",
",",
"allow_internal",
"=",
"False",
")",
":",
"dict_list",
"=",
"[",
"]",
"if",
"allow_inte... | Search external databases linked to your lcopt model.
To restrict the search to particular databases (e.g. technosphere or biosphere only) use a list of database names in the ``database_to_search`` variable | [
"Search",
"external",
"databases",
"linked",
"to",
"your",
"lcopt",
"model",
"."
] | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L727-L770 | train | Search external databases linked to your lcopt model. |
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.database_to_SimaPro_csv | def database_to_SimaPro_csv(self):
"""
Export the lcopt model as a SimaPro csv file.
The file will be called "<ModelName>_database_export.csv"
"""
self.parameter_scan()
csv_args = {}
csv_args['processes'] = []
db = self.database['items']
... | python | def database_to_SimaPro_csv(self):
"""
Export the lcopt model as a SimaPro csv file.
The file will be called "<ModelName>_database_export.csv"
"""
self.parameter_scan()
csv_args = {}
csv_args['processes'] = []
db = self.database['items']
... | [
"def",
"database_to_SimaPro_csv",
"(",
"self",
")",
":",
"self",
".",
"parameter_scan",
"(",
")",
"csv_args",
"=",
"{",
"}",
"csv_args",
"[",
"'processes'",
"]",
"=",
"[",
"]",
"db",
"=",
"self",
".",
"database",
"[",
"'items'",
"]",
"product_filter",
"=... | Export the lcopt model as a SimaPro csv file.
The file will be called "<ModelName>_database_export.csv" | [
"Export",
"the",
"lcopt",
"model",
"as",
"a",
"SimaPro",
"csv",
"file",
"."
] | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L772-L954 | train | Export the database as a SimaPro csv file. |
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.export_to_bw2 | def export_to_bw2(self):
"""
Export the lcopt model in the native brightway 2 format
returns name, database
to use it to export, then import to brightway::
name, db = model.export_to_bw2()
import brightway2 as bw
bw.projects.set_current('MyProject')... | python | def export_to_bw2(self):
"""
Export the lcopt model in the native brightway 2 format
returns name, database
to use it to export, then import to brightway::
name, db = model.export_to_bw2()
import brightway2 as bw
bw.projects.set_current('MyProject')... | [
"def",
"export_to_bw2",
"(",
"self",
")",
":",
"my_exporter",
"=",
"Bw2Exporter",
"(",
"self",
")",
"name",
",",
"bw2db",
"=",
"my_exporter",
".",
"export_to_bw2",
"(",
")",
"return",
"name",
",",
"bw2db"
] | Export the lcopt model in the native brightway 2 format
returns name, database
to use it to export, then import to brightway::
name, db = model.export_to_bw2()
import brightway2 as bw
bw.projects.set_current('MyProject')
new_db = bw.Database(name)
... | [
"Export",
"the",
"lcopt",
"model",
"in",
"the",
"native",
"brightway",
"2",
"format"
] | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L969-L987 | train | Export the lcopt model in the native brightway 2 format returns name database and Bw2Database object |
pjamesjoyce/lcopt | lcopt/model.py | LcoptModel.analyse | def analyse(self, demand_item, demand_item_code):
""" Run the analyis of the model
Doesn't return anything, but creates a new item ``LcoptModel.result_set`` containing the results
"""
my_analysis = Bw2Analysis(self)
self.result_set = my_analysis.run_analyses(demand_item, dema... | python | def analyse(self, demand_item, demand_item_code):
""" Run the analyis of the model
Doesn't return anything, but creates a new item ``LcoptModel.result_set`` containing the results
"""
my_analysis = Bw2Analysis(self)
self.result_set = my_analysis.run_analyses(demand_item, dema... | [
"def",
"analyse",
"(",
"self",
",",
"demand_item",
",",
"demand_item_code",
")",
":",
"my_analysis",
"=",
"Bw2Analysis",
"(",
"self",
")",
"self",
".",
"result_set",
"=",
"my_analysis",
".",
"run_analyses",
"(",
"demand_item",
",",
"demand_item_code",
",",
"*"... | Run the analyis of the model
Doesn't return anything, but creates a new item ``LcoptModel.result_set`` containing the results | [
"Run",
"the",
"analyis",
"of",
"the",
"model",
"Doesn",
"t",
"return",
"anything",
"but",
"creates",
"a",
"new",
"item",
"LcoptModel",
".",
"result_set",
"containing",
"the",
"results"
] | 3f1caca31fece4a3068a384900707e6d21d04597 | https://github.com/pjamesjoyce/lcopt/blob/3f1caca31fece4a3068a384900707e6d21d04597/lcopt/model.py#L989-L996 | train | Run the analyis of the model
Doesn t return anything but creates a new item |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | locate | def locate(name, **kwargs):
"""
Show resolve information about specified service.
"""
ctx = Context(**kwargs)
ctx.execute_action('locate', **{
'name': name,
'locator': ctx.locator,
}) | python | def locate(name, **kwargs):
"""
Show resolve information about specified service.
"""
ctx = Context(**kwargs)
ctx.execute_action('locate', **{
'name': name,
'locator': ctx.locator,
}) | [
"def",
"locate",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'locate'",
",",
"*",
"*",
"{",
"'name'",
":",
"name",
",",
"'locator'",
":",
"ctx",
".",
"lo... | Show resolve information about specified service. | [
"Show",
"resolve",
"information",
"about",
"specified",
"service",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L364-L372 | train | Show resolve information about specified service. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | routing | def routing(name, **kwargs):
"""
Show information about the requested routing group.
"""
ctx = Context(**kwargs)
ctx.execute_action('routing', **{
'name': name,
'locator': ctx.locator,
}) | python | def routing(name, **kwargs):
"""
Show information about the requested routing group.
"""
ctx = Context(**kwargs)
ctx.execute_action('routing', **{
'name': name,
'locator': ctx.locator,
}) | [
"def",
"routing",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'routing'",
",",
"*",
"*",
"{",
"'name'",
":",
"name",
",",
"'locator'",
":",
"ctx",
".",
"... | Show information about the requested routing group. | [
"Show",
"information",
"about",
"the",
"requested",
"routing",
"group",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L378-L386 | train | Show information about the requested routing group. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | cluster | def cluster(resolve, **kwargs):
"""
Show cluster info.
"""
# Actually we have IPs and we need not do anything to resolve them to IPs. So the default
# behavior fits better to this option name.
ctx = Context(**kwargs)
ctx.execute_action('cluster', **{
'locator': ctx.locator,
... | python | def cluster(resolve, **kwargs):
"""
Show cluster info.
"""
# Actually we have IPs and we need not do anything to resolve them to IPs. So the default
# behavior fits better to this option name.
ctx = Context(**kwargs)
ctx.execute_action('cluster', **{
'locator': ctx.locator,
... | [
"def",
"cluster",
"(",
"resolve",
",",
"*",
"*",
"kwargs",
")",
":",
"# Actually we have IPs and we need not do anything to resolve them to IPs. So the default",
"# behavior fits better to this option name.",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
... | Show cluster info. | [
"Show",
"cluster",
"info",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L404-L415 | train | Show cluster info. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | info | def info(name, m, p, b, w, **kwargs):
"""
Show information about cocaine runtime.
Return json-like string with information about cocaine-runtime.
If the name option is not specified, shows information about all applications. Flags can be
specified for fine-grained control of the output verbosity.
... | python | def info(name, m, p, b, w, **kwargs):
"""
Show information about cocaine runtime.
Return json-like string with information about cocaine-runtime.
If the name option is not specified, shows information about all applications. Flags can be
specified for fine-grained control of the output verbosity.
... | [
"def",
"info",
"(",
"name",
",",
"m",
",",
"p",
",",
"b",
",",
"w",
",",
"*",
"*",
"kwargs",
")",
":",
"m",
"=",
"(",
"m",
"<<",
"1",
")",
"&",
"0b010",
"p",
"=",
"(",
"p",
"<<",
"2",
")",
"&",
"0b100",
"# Brief disables all further flags.",
... | Show information about cocaine runtime.
Return json-like string with information about cocaine-runtime.
If the name option is not specified, shows information about all applications. Flags can be
specified for fine-grained control of the output verbosity. | [
"Show",
"information",
"about",
"cocaine",
"runtime",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L425-L451 | train | Show information about the cocaine - runtime. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | metrics | def metrics(ty, query, query_type, **kwargs):
"""
Outputs runtime metrics collected from cocaine-runtime and its services.
This command shows runtime metrics collected from cocaine-runtime and its services during their
lifetime.
There are four kind of metrics available: gauges, counters, meters and... | python | def metrics(ty, query, query_type, **kwargs):
"""
Outputs runtime metrics collected from cocaine-runtime and its services.
This command shows runtime metrics collected from cocaine-runtime and its services during their
lifetime.
There are four kind of metrics available: gauges, counters, meters and... | [
"def",
"metrics",
"(",
"ty",
",",
"query",
",",
"query_type",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'metrics'",
",",
"*",
"*",
"{",
"'metrics'",
":",
"ctx",
".",
... | Outputs runtime metrics collected from cocaine-runtime and its services.
This command shows runtime metrics collected from cocaine-runtime and its services during their
lifetime.
There are four kind of metrics available: gauges, counters, meters and timers.
\b
- Gauges - an instantaneous measure... | [
"Outputs",
"runtime",
"metrics",
"collected",
"from",
"cocaine",
"-",
"runtime",
"and",
"its",
"services",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L579-L645 | train | This command shows the runtime metrics collected from cocaine - runtime and its services during their lifetime. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | app_list | def app_list(**kwargs):
"""
Show uploaded applications.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:list', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | python | def app_list(**kwargs):
"""
Show uploaded applications.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:list', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | [
"def",
"app_list",
"(",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'app:list'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"create_secure_service",
"(",
"... | Show uploaded applications. | [
"Show",
"uploaded",
"applications",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L650-L657 | train | Show uploaded applications. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | app_view | def app_view(name, **kwargs):
"""
Show manifest content for an application.
If application is not uploaded, an error will be displayed.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:view', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | python | def app_view(name, **kwargs):
"""
Show manifest content for an application.
If application is not uploaded, an error will be displayed.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:view', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | [
"def",
"app_view",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'app:view'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"create_secure_ser... | Show manifest content for an application.
If application is not uploaded, an error will be displayed. | [
"Show",
"manifest",
"content",
"for",
"an",
"application",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L663-L673 | train | Show manifest content for an application. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | app_upload | def app_upload(path, name, manifest, package, docker_address, registry, manifest_only, **kwargs):
"""
Upload application with its environment (directory) into the storage.
Application directory or its subdirectories must contain valid manifest file
named `manifest.json` or `manifest` otherwise you must... | python | def app_upload(path, name, manifest, package, docker_address, registry, manifest_only, **kwargs):
"""
Upload application with its environment (directory) into the storage.
Application directory or its subdirectories must contain valid manifest file
named `manifest.json` or `manifest` otherwise you must... | [
"def",
"app_upload",
"(",
"path",
",",
"name",
",",
"manifest",
",",
"package",
",",
"docker_address",
",",
"registry",
",",
"manifest_only",
",",
"*",
"*",
"kwargs",
")",
":",
"lower_limit",
"=",
"120.0",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
... | Upload application with its environment (directory) into the storage.
Application directory or its subdirectories must contain valid manifest file
named `manifest.json` or `manifest` otherwise you must specify it explicitly by
setting `--manifest` option.
You can specify application name. By default, ... | [
"Upload",
"application",
"with",
"its",
"environment",
"(",
"directory",
")",
"into",
"the",
"storage",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L685-L750 | train | Upload an application into the storage. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | app_import | def app_import(path, name, manifest, container_url, docker_address, registry, **kwargs):
"""
Import application Docker container.
"""
lower_limit = 120.0
ctx = Context(**kwargs)
if ctx.timeout < lower_limit:
ctx.timeout = lower_limit
log.info('shifted timeout to the %.2fs', ctx.... | python | def app_import(path, name, manifest, container_url, docker_address, registry, **kwargs):
"""
Import application Docker container.
"""
lower_limit = 120.0
ctx = Context(**kwargs)
if ctx.timeout < lower_limit:
ctx.timeout = lower_limit
log.info('shifted timeout to the %.2fs', ctx.... | [
"def",
"app_import",
"(",
"path",
",",
"name",
",",
"manifest",
",",
"container_url",
",",
"docker_address",
",",
"registry",
",",
"*",
"*",
"kwargs",
")",
":",
"lower_limit",
"=",
"120.0",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"if",
"ct... | Import application Docker container. | [
"Import",
"application",
"Docker",
"container",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L761-L783 | train | Import application Docker container. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | app_remove | def app_remove(name, **kwargs):
"""
Remove application from storage.
No error messages will display if specified application is not uploaded.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:remove', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
... | python | def app_remove(name, **kwargs):
"""
Remove application from storage.
No error messages will display if specified application is not uploaded.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:remove', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
... | [
"def",
"app_remove",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'app:remove'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"create_secure... | Remove application from storage.
No error messages will display if specified application is not uploaded. | [
"Remove",
"application",
"from",
"storage",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L789-L799 | train | Remove application from storage. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | app_start | def app_start(name, profile, **kwargs):
"""
Start an application with specified profile.
Does nothing if application is already running.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:start', **{
'node': ctx.repo.create_secure_service('node'),
'name': name,
'profile... | python | def app_start(name, profile, **kwargs):
"""
Start an application with specified profile.
Does nothing if application is already running.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:start', **{
'node': ctx.repo.create_secure_service('node'),
'name': name,
'profile... | [
"def",
"app_start",
"(",
"name",
",",
"profile",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'app:start'",
",",
"*",
"*",
"{",
"'node'",
":",
"ctx",
".",
"repo",
".",
... | Start an application with specified profile.
Does nothing if application is already running. | [
"Start",
"an",
"application",
"with",
"specified",
"profile",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L806-L817 | train | Start an application with specified profile. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | app_pause | def app_pause(name, **kwargs):
"""
Stop application.
This command is alias for ```cocaine-tool app stop```.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:stop', **{
'node': ctx.repo.create_secure_service('node'),
'name': name,
}) | python | def app_pause(name, **kwargs):
"""
Stop application.
This command is alias for ```cocaine-tool app stop```.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:stop', **{
'node': ctx.repo.create_secure_service('node'),
'name': name,
}) | [
"def",
"app_pause",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'app:stop'",
",",
"*",
"*",
"{",
"'node'",
":",
"ctx",
".",
"repo",
".",
"create_secure_servi... | Stop application.
This command is alias for ```cocaine-tool app stop```. | [
"Stop",
"application",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L823-L833 | train | Pause application. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | app_stop | def app_stop(name, **kwargs):
"""
Stop application.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:stop', **{
'node': ctx.repo.create_secure_service('node'),
'name': name,
}) | python | def app_stop(name, **kwargs):
"""
Stop application.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:stop', **{
'node': ctx.repo.create_secure_service('node'),
'name': name,
}) | [
"def",
"app_stop",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'app:stop'",
",",
"*",
"*",
"{",
"'node'",
":",
"ctx",
".",
"repo",
".",
"create_secure_servic... | Stop application. | [
"Stop",
"application",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L839-L847 | train | Stop application. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | app_restart | def app_restart(name, profile, **kwargs):
"""
Restart application.
Executes ```cocaine-tool app pause``` and ```cocaine-tool app start``` sequentially.
It can be used to quickly change application profile.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:restart', **{
'node': ct... | python | def app_restart(name, profile, **kwargs):
"""
Restart application.
Executes ```cocaine-tool app pause``` and ```cocaine-tool app start``` sequentially.
It can be used to quickly change application profile.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:restart', **{
'node': ct... | [
"def",
"app_restart",
"(",
"name",
",",
"profile",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'app:restart'",
",",
"*",
"*",
"{",
"'node'",
":",
"ctx",
".",
"repo",
".... | Restart application.
Executes ```cocaine-tool app pause``` and ```cocaine-tool app start``` sequentially.
It can be used to quickly change application profile. | [
"Restart",
"application",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L854-L868 | train | Restart application. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | check | def check(name, **kwargs):
"""
Check application status.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:check', **{
'node': ctx.repo.create_secure_service('node'),
'name': name,
}) | python | def check(name, **kwargs):
"""
Check application status.
"""
ctx = Context(**kwargs)
ctx.execute_action('app:check', **{
'node': ctx.repo.create_secure_service('node'),
'name': name,
}) | [
"def",
"check",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'app:check'",
",",
"*",
"*",
"{",
"'node'",
":",
"ctx",
".",
"repo",
".",
"create_secure_service"... | Check application status. | [
"Check",
"application",
"status",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L874-L882 | train | Check application status. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | profile_list | def profile_list(**kwargs):
"""
Show uploaded profiles.
"""
ctx = Context(**kwargs)
ctx.execute_action('profile:list', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | python | def profile_list(**kwargs):
"""
Show uploaded profiles.
"""
ctx = Context(**kwargs)
ctx.execute_action('profile:list', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | [
"def",
"profile_list",
"(",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'profile:list'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"create_secure_service",
... | Show uploaded profiles. | [
"Show",
"uploaded",
"profiles",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L887-L894 | train | Show uploaded profiles. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | profile_view | def profile_view(name, **kwargs):
"""
Show profile configuration content.
"""
ctx = Context(**kwargs)
ctx.execute_action('profile:view', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | python | def profile_view(name, **kwargs):
"""
Show profile configuration content.
"""
ctx = Context(**kwargs)
ctx.execute_action('profile:view', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | [
"def",
"profile_view",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'profile:view'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"create_se... | Show profile configuration content. | [
"Show",
"profile",
"configuration",
"content",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L900-L908 | train | Show profile configuration content. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | profile_remove | def profile_remove(name, **kwargs):
"""
Remove profile from the storage.
"""
ctx = Context(**kwargs)
ctx.execute_action('profile:remove', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | python | def profile_remove(name, **kwargs):
"""
Remove profile from the storage.
"""
ctx = Context(**kwargs)
ctx.execute_action('profile:remove', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | [
"def",
"profile_remove",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'profile:remove'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"creat... | Remove profile from the storage. | [
"Remove",
"profile",
"from",
"the",
"storage",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L945-L953 | train | Remove a profile from the storage. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | runlist_list | def runlist_list(**kwargs):
"""
Show uploaded runlists.
"""
ctx = Context(**kwargs)
ctx.execute_action('runlist:list', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | python | def runlist_list(**kwargs):
"""
Show uploaded runlists.
"""
ctx = Context(**kwargs)
ctx.execute_action('runlist:list', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | [
"def",
"runlist_list",
"(",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'runlist:list'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"create_secure_service",
... | Show uploaded runlists. | [
"Show",
"uploaded",
"runlists",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L990-L997 | train | Show uploaded runlists. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | runlist_view | def runlist_view(name, **kwargs):
"""
Show configuration content for a specified runlist.
"""
ctx = Context(**kwargs)
ctx.execute_action('runlist:view', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name
}) | python | def runlist_view(name, **kwargs):
"""
Show configuration content for a specified runlist.
"""
ctx = Context(**kwargs)
ctx.execute_action('runlist:view', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name
}) | [
"def",
"runlist_view",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'runlist:view'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"create_se... | Show configuration content for a specified runlist. | [
"Show",
"configuration",
"content",
"for",
"a",
"specified",
"runlist",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1003-L1011 | train | Show configuration content for a specified runlist. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | runlist_upload | def runlist_upload(name, runlist, **kwargs):
"""
Upload runlist with context into the storage.
"""
ctx = Context(**kwargs)
ctx.execute_action('runlist:upload', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
'runlist': runlist,
}) | python | def runlist_upload(name, runlist, **kwargs):
"""
Upload runlist with context into the storage.
"""
ctx = Context(**kwargs)
ctx.execute_action('runlist:upload', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
'runlist': runlist,
}) | [
"def",
"runlist_upload",
"(",
"name",
",",
"runlist",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'runlist:upload'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"re... | Upload runlist with context into the storage. | [
"Upload",
"runlist",
"with",
"context",
"into",
"the",
"storage",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1034-L1043 | train | Upload a runlist into the storage. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | runlist_create | def runlist_create(name, **kwargs):
"""
Create runlist and upload it into the storage.
"""
ctx = Context(**kwargs)
ctx.execute_action('runlist:create', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | python | def runlist_create(name, **kwargs):
"""
Create runlist and upload it into the storage.
"""
ctx = Context(**kwargs)
ctx.execute_action('runlist:create', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | [
"def",
"runlist_create",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'runlist:create'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"creat... | Create runlist and upload it into the storage. | [
"Create",
"runlist",
"and",
"upload",
"it",
"into",
"the",
"storage",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1049-L1057 | train | Create runlist and upload it into the storage. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | runlist_remove | def runlist_remove(name, **kwargs):
"""
Remove runlist from the storage.
"""
ctx = Context(**kwargs)
ctx.execute_action('runlist:remove', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | python | def runlist_remove(name, **kwargs):
"""
Remove runlist from the storage.
"""
ctx = Context(**kwargs)
ctx.execute_action('runlist:remove', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | [
"def",
"runlist_remove",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'runlist:remove'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"creat... | Remove runlist from the storage. | [
"Remove",
"runlist",
"from",
"the",
"storage",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1063-L1071 | train | Remove runlist from the storage. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | runlist_add_app | def runlist_add_app(name, app, profile, force, **kwargs):
"""
Add specified application with profile to the specified runlist.
Existence of application or profile is not checked.
"""
ctx = Context(**kwargs)
ctx.execute_action('runlist:add-app', **{
'storage': ctx.repo.create_secure_serv... | python | def runlist_add_app(name, app, profile, force, **kwargs):
"""
Add specified application with profile to the specified runlist.
Existence of application or profile is not checked.
"""
ctx = Context(**kwargs)
ctx.execute_action('runlist:add-app', **{
'storage': ctx.repo.create_secure_serv... | [
"def",
"runlist_add_app",
"(",
"name",
",",
"app",
",",
"profile",
",",
"force",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'runlist:add-app'",
",",
"*",
"*",
"{",
"'sto... | Add specified application with profile to the specified runlist.
Existence of application or profile is not checked. | [
"Add",
"specified",
"application",
"with",
"profile",
"to",
"the",
"specified",
"runlist",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1112-L1125 | train | Adds specified application with profile to the specified runlist. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | crashlog_status | def crashlog_status(**kwargs):
"""
Show crashlogs status.
"""
ctx = Context(**kwargs)
ctx.execute_action('crashlog:status', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | python | def crashlog_status(**kwargs):
"""
Show crashlogs status.
"""
ctx = Context(**kwargs)
ctx.execute_action('crashlog:status', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | [
"def",
"crashlog_status",
"(",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'crashlog:status'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"create_secure_servic... | Show crashlogs status. | [
"Show",
"crashlogs",
"status",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1146-L1153 | train | Show crashlogs status. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | crashlog_list | def crashlog_list(name, day, **kwargs):
"""
Show crashlogs list for application.
Prints crashlog list in "Unix Timestamp - UUID" format.
Filtering by day accepts the following variants: today, yesterday, %d, %d-%m or %d-%m-%Y.
For example given today is a 06-12-2016 crashlogs for yesterday can be ... | python | def crashlog_list(name, day, **kwargs):
"""
Show crashlogs list for application.
Prints crashlog list in "Unix Timestamp - UUID" format.
Filtering by day accepts the following variants: today, yesterday, %d, %d-%m or %d-%m-%Y.
For example given today is a 06-12-2016 crashlogs for yesterday can be ... | [
"def",
"crashlog_list",
"(",
"name",
",",
"day",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'crashlog:list'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
... | Show crashlogs list for application.
Prints crashlog list in "Unix Timestamp - UUID" format.
Filtering by day accepts the following variants: today, yesterday, %d, %d-%m or %d-%m-%Y.
For example given today is a 06-12-2016 crashlogs for yesterday can be listed using:
`--day=yesterday`, `--day=5`, `--d... | [
"Show",
"crashlogs",
"list",
"for",
"application",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1160-L1175 | train | Show crashlogs list for application. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | crashlog_view | def crashlog_view(name, timestamp, **kwargs):
"""
Show crashlog for application with specified timestamp.
Last crashlog for a given application will be displayed unless timestamp option is specified.
"""
ctx = Context(**kwargs)
ctx.execute_action('crashlog:view', **{
'storage': ctx.repo... | python | def crashlog_view(name, timestamp, **kwargs):
"""
Show crashlog for application with specified timestamp.
Last crashlog for a given application will be displayed unless timestamp option is specified.
"""
ctx = Context(**kwargs)
ctx.execute_action('crashlog:view', **{
'storage': ctx.repo... | [
"def",
"crashlog_view",
"(",
"name",
",",
"timestamp",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'crashlog:view'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"re... | Show crashlog for application with specified timestamp.
Last crashlog for a given application will be displayed unless timestamp option is specified. | [
"Show",
"crashlog",
"for",
"application",
"with",
"specified",
"timestamp",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1182-L1193 | train | Show crashlog for a given application with specified timestamp. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | crashlog_removeall | def crashlog_removeall(name, **kwargs):
"""
Remove all crashlogs for application from the storage.
"""
ctx = Context(**kwargs)
ctx.execute_action('crashlog:removeall', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | python | def crashlog_removeall(name, **kwargs):
"""
Remove all crashlogs for application from the storage.
"""
ctx = Context(**kwargs)
ctx.execute_action('crashlog:removeall', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | [
"def",
"crashlog_removeall",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'crashlog:removeall'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
... | Remove all crashlogs for application from the storage. | [
"Remove",
"all",
"crashlogs",
"for",
"application",
"from",
"the",
"storage",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1215-L1223 | train | Remove all crashlogs for application from the storage. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | crashlog_clean | def crashlog_clean(name, timestamp, size, **kwargs):
"""
For application NAME leave SIZE crashlogs or remove all crashlogs with timestamp > TIMESTAMP.
"""
ctx = Context(**kwargs)
ctx.execute_action('crashlog:clean', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': na... | python | def crashlog_clean(name, timestamp, size, **kwargs):
"""
For application NAME leave SIZE crashlogs or remove all crashlogs with timestamp > TIMESTAMP.
"""
ctx = Context(**kwargs)
ctx.execute_action('crashlog:clean', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': na... | [
"def",
"crashlog_clean",
"(",
"name",
",",
"timestamp",
",",
"size",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'crashlog:clean'",
",",
"*",
"*",
"{",
"'storage'",
":",
... | For application NAME leave SIZE crashlogs or remove all crashlogs with timestamp > TIMESTAMP. | [
"For",
"application",
"NAME",
"leave",
"SIZE",
"crashlogs",
"or",
"remove",
"all",
"crashlogs",
"with",
"timestamp",
">",
"TIMESTAMP",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1231-L1241 | train | Remove crashlogs with timestamp > TIMESTAMP. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | crashlog_cleanrange | def crashlog_cleanrange(from_day, up_to_day, **kwargs):
"""
Remove all crashlogs from one date up to another.
The date can be specified as DAY-[MONTH-[YEAR]].
Example:
today, yesterday, 10, 10-09, 10-09-2015
"""
ctx = Context(**kwargs)
ctx.execute_action('crashlog:cleanwhen', **{
... | python | def crashlog_cleanrange(from_day, up_to_day, **kwargs):
"""
Remove all crashlogs from one date up to another.
The date can be specified as DAY-[MONTH-[YEAR]].
Example:
today, yesterday, 10, 10-09, 10-09-2015
"""
ctx = Context(**kwargs)
ctx.execute_action('crashlog:cleanwhen', **{
... | [
"def",
"crashlog_cleanrange",
"(",
"from_day",
",",
"up_to_day",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'crashlog:cleanwhen'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx... | Remove all crashlogs from one date up to another.
The date can be specified as DAY-[MONTH-[YEAR]].
Example:
today, yesterday, 10, 10-09, 10-09-2015 | [
"Remove",
"all",
"crashlogs",
"from",
"one",
"date",
"up",
"to",
"another",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1248-L1262 | train | Remove all crashlogs from one date up to another. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | group_list | def group_list(**kwargs):
"""
Show available routing groups.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:list', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | python | def group_list(**kwargs):
"""
Show available routing groups.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:list', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | [
"def",
"group_list",
"(",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'group:list'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"create_secure_service",
"(",... | Show available routing groups. | [
"Show",
"available",
"routing",
"groups",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1267-L1274 | train | Show available routing groups. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | group_view | def group_view(name, **kwargs):
"""
Show specified routing group.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:view', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | python | def group_view(name, **kwargs):
"""
Show specified routing group.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:view', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | [
"def",
"group_view",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'group:view'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"create_secure... | Show specified routing group. | [
"Show",
"specified",
"routing",
"group",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1280-L1288 | train | Show specified routing group. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | group_create | def group_create(name, content, **kwargs):
"""
Create routing group.
You can optionally specify content for created routing group. It can be either direct JSON
expression in single quotes, or path to the json file with settings. Settings itself must be
key-value list, where `key` represents applica... | python | def group_create(name, content, **kwargs):
"""
Create routing group.
You can optionally specify content for created routing group. It can be either direct JSON
expression in single quotes, or path to the json file with settings. Settings itself must be
key-value list, where `key` represents applica... | [
"def",
"group_create",
"(",
"name",
",",
"content",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'group:create'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",... | Create routing group.
You can optionally specify content for created routing group. It can be either direct JSON
expression in single quotes, or path to the json file with settings. Settings itself must be
key-value list, where `key` represents application name, and `value` represents its weight.
For ... | [
"Create",
"routing",
"group",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1295-L1317 | train | Create routing group. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | group_remove | def group_remove(name, **kwargs):
"""
Remove routing group from the storage.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:remove', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | python | def group_remove(name, **kwargs):
"""
Remove routing group from the storage.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:remove', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | [
"def",
"group_remove",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'group:remove'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"create_se... | Remove routing group from the storage. | [
"Remove",
"routing",
"group",
"from",
"the",
"storage",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1323-L1331 | train | Remove routing group from the storage. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | group_copy | def group_copy(name, copyname, **kwargs):
"""
Copy routing group.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:copy', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
'copyname': copyname,
}) | python | def group_copy(name, copyname, **kwargs):
"""
Copy routing group.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:copy', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
'copyname': copyname,
}) | [
"def",
"group_copy",
"(",
"name",
",",
"copyname",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'group:copy'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
... | Copy routing group. | [
"Copy",
"routing",
"group",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1338-L1347 | train | Copy routing group. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | group_refresh | def group_refresh(name, **kwargs):
"""
Refresh routing group.
If the name option is empty, this command will refresh all groups.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:refresh', **{
'locator': ctx.locator,
'storage': ctx.repo.create_secure_service('storage'),
... | python | def group_refresh(name, **kwargs):
"""
Refresh routing group.
If the name option is empty, this command will refresh all groups.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:refresh', **{
'locator': ctx.locator,
'storage': ctx.repo.create_secure_service('storage'),
... | [
"def",
"group_refresh",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'group:refresh'",
",",
"*",
"*",
"{",
"'locator'",
":",
"ctx",
".",
"locator",
",",
"'sto... | Refresh routing group.
If the name option is empty, this command will refresh all groups. | [
"Refresh",
"routing",
"group",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1369-L1380 | train | Refresh routing group. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | group_push | def group_push(name, app, weight, **kwargs):
"""
Add application with its weight into the routing group.
Warning: application weight must be positive integer.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:app:add', **{
'storage': ctx.repo.create_secure_service('storage'),
... | python | def group_push(name, app, weight, **kwargs):
"""
Add application with its weight into the routing group.
Warning: application weight must be positive integer.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:app:add', **{
'storage': ctx.repo.create_secure_service('storage'),
... | [
"def",
"group_push",
"(",
"name",
",",
"app",
",",
"weight",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'group:app:add'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
... | Add application with its weight into the routing group.
Warning: application weight must be positive integer. | [
"Add",
"application",
"with",
"its",
"weight",
"into",
"the",
"routing",
"group",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1388-L1400 | train | Push application with its weight into routing group. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | group_pop | def group_pop(name, app, **kwargs):
"""
Remove application from the specified routing group.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:app:remove', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
'app': app,
}) | python | def group_pop(name, app, **kwargs):
"""
Remove application from the specified routing group.
"""
ctx = Context(**kwargs)
ctx.execute_action('group:app:remove', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
'app': app,
}) | [
"def",
"group_pop",
"(",
"name",
",",
"app",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'group:app:remove'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
... | Remove application from the specified routing group. | [
"Remove",
"application",
"from",
"the",
"specified",
"routing",
"group",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1407-L1416 | train | Removes application from a routing group. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | unicorn_edit | def unicorn_edit(path, **kwargs):
"""Edit Unicorn node interactively.
"""
ctx = Context(**kwargs)
ctx.timeout = None
ctx.execute_action('unicorn:edit', **{
'unicorn': ctx.repo.create_secure_service('unicorn'),
'path': path,
}) | python | def unicorn_edit(path, **kwargs):
"""Edit Unicorn node interactively.
"""
ctx = Context(**kwargs)
ctx.timeout = None
ctx.execute_action('unicorn:edit', **{
'unicorn': ctx.repo.create_secure_service('unicorn'),
'path': path,
}) | [
"def",
"unicorn_edit",
"(",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"timeout",
"=",
"None",
"ctx",
".",
"execute_action",
"(",
"'unicorn:edit'",
",",
"*",
"*",
"{",
"'unicorn'",
":",... | Edit Unicorn node interactively. | [
"Edit",
"Unicorn",
"node",
"interactively",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1472-L1480 | train | Edit Unicorn node interactively. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | vicodyn_info | def vicodyn_info(**kwargs):
"""Vicodyn info
"""
ctx = Context(**kwargs)
ctx.timeout = None
ctx.execute_action('vicodyn:info', **{
'vicodyn': ctx.repo.create_secure_service('vicodyn'),
}) | python | def vicodyn_info(**kwargs):
"""Vicodyn info
"""
ctx = Context(**kwargs)
ctx.timeout = None
ctx.execute_action('vicodyn:info', **{
'vicodyn': ctx.repo.create_secure_service('vicodyn'),
}) | [
"def",
"vicodyn_info",
"(",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"timeout",
"=",
"None",
"ctx",
".",
"execute_action",
"(",
"'vicodyn:info'",
",",
"*",
"*",
"{",
"'vicodyn'",
":",
"ctx",
".",
... | Vicodyn info | [
"Vicodyn",
"info"
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1485-L1492 | train | Show information about the current Vicodyn application. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | logging_list_loggers | def logging_list_loggers(**kwargs):
"""
List all registered logger names.
"""
ctx = Context(**kwargs)
ctx.execute_action('logging:list_loggers', **{
'logging_service': ctx.repo.create_secure_service('logging'),
}) | python | def logging_list_loggers(**kwargs):
"""
List all registered logger names.
"""
ctx = Context(**kwargs)
ctx.execute_action('logging:list_loggers', **{
'logging_service': ctx.repo.create_secure_service('logging'),
}) | [
"def",
"logging_list_loggers",
"(",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'logging:list_loggers'",
",",
"*",
"*",
"{",
"'logging_service'",
":",
"ctx",
".",
"repo",
".",
"cr... | List all registered logger names. | [
"List",
"all",
"registered",
"logger",
"names",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1579-L1586 | train | List all registered loggers. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | logging_set_filter | def logging_set_filter(name, filter_def, ttl, **kwargs):
"""
Set local filter.
"""
ctx = Context(**kwargs)
ctx.execute_action('logging:set_filter', **{
'logging_service': ctx.repo.create_secure_service('logging'),
'logger_name': name,
'filter_def': filter_def,
'ttl': ... | python | def logging_set_filter(name, filter_def, ttl, **kwargs):
"""
Set local filter.
"""
ctx = Context(**kwargs)
ctx.execute_action('logging:set_filter', **{
'logging_service': ctx.repo.create_secure_service('logging'),
'logger_name': name,
'filter_def': filter_def,
'ttl': ... | [
"def",
"logging_set_filter",
"(",
"name",
",",
"filter_def",
",",
"ttl",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'logging:set_filter'",
",",
"*",
"*",
"{",
"'logging_serv... | Set local filter. | [
"Set",
"local",
"filter",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1594-L1604 | train | Set local filter. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | logging_remove_filter | def logging_remove_filter(filter_id, **kwargs):
"""
Remove filter by filter id.
"""
ctx = Context(**kwargs)
ctx.execute_action('logging:remove_filter', **{
'logging_service': ctx.repo.create_secure_service('logging'),
'filter_id': filter_id,
}) | python | def logging_remove_filter(filter_id, **kwargs):
"""
Remove filter by filter id.
"""
ctx = Context(**kwargs)
ctx.execute_action('logging:remove_filter', **{
'logging_service': ctx.repo.create_secure_service('logging'),
'filter_id': filter_id,
}) | [
"def",
"logging_remove_filter",
"(",
"filter_id",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'logging:remove_filter'",
",",
"*",
"*",
"{",
"'logging_service'",
":",
"ctx",
"."... | Remove filter by filter id. | [
"Remove",
"filter",
"by",
"filter",
"id",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1610-L1618 | train | Remove filter by filter id. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | logging_list_filters | def logging_list_filters(**kwargs):
"""
List all available filters.
"""
ctx = Context(**kwargs)
ctx.execute_action('logging:list_filters', **{
'logging_service': ctx.repo.create_secure_service('logging'),
}) | python | def logging_list_filters(**kwargs):
"""
List all available filters.
"""
ctx = Context(**kwargs)
ctx.execute_action('logging:list_filters', **{
'logging_service': ctx.repo.create_secure_service('logging'),
}) | [
"def",
"logging_list_filters",
"(",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'logging:list_filters'",
",",
"*",
"*",
"{",
"'logging_service'",
":",
"ctx",
".",
"repo",
".",
"cr... | List all available filters. | [
"List",
"all",
"available",
"filters",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1623-L1630 | train | Lists all available filters. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | auth_list | def auth_list(**kwargs):
"""
Shows available authorization groups.
"""
ctx = Context(**kwargs)
ctx.execute_action('auth:group:list', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | python | def auth_list(**kwargs):
"""
Shows available authorization groups.
"""
ctx = Context(**kwargs)
ctx.execute_action('auth:group:list', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | [
"def",
"auth_list",
"(",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'auth:group:list'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"create_secure_service",
... | Shows available authorization groups. | [
"Shows",
"available",
"authorization",
"groups",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1653-L1660 | train | Shows available authorization groups. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | auth_create | def auth_create(name, token, force, **kwargs):
"""
Creates an authorization group.
The group sets a named association between an authorization token and the list of services. This
is useful for group of applications that want to share a single token.
"""
ctx = Context(**kwargs)
ctx.execute_... | python | def auth_create(name, token, force, **kwargs):
"""
Creates an authorization group.
The group sets a named association between an authorization token and the list of services. This
is useful for group of applications that want to share a single token.
"""
ctx = Context(**kwargs)
ctx.execute_... | [
"def",
"auth_create",
"(",
"name",
",",
"token",
",",
"force",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'auth:group:create'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ct... | Creates an authorization group.
The group sets a named association between an authorization token and the list of services. This
is useful for group of applications that want to share a single token. | [
"Creates",
"an",
"authorization",
"group",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1668-L1681 | train | Creates an authorization group. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | auth_edit | def auth_edit(name, **kwargs):
"""
Interactively edits an authorization group.
"""
ctx = Context(**kwargs)
ctx.timeout = None
ctx.execute_action('auth:group:edit', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | python | def auth_edit(name, **kwargs):
"""
Interactively edits an authorization group.
"""
ctx = Context(**kwargs)
ctx.timeout = None
ctx.execute_action('auth:group:edit', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | [
"def",
"auth_edit",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"timeout",
"=",
"None",
"ctx",
".",
"execute_action",
"(",
"'auth:group:edit'",
",",
"*",
"*",
"{",
"'storage'",
":",... | Interactively edits an authorization group. | [
"Interactively",
"edits",
"an",
"authorization",
"group",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1687-L1696 | train | Edit an authorization group. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | auth_remove | def auth_remove(name, drop, **kwargs):
"""
Removes an authorization group.
Removes an authorization group with or without excluding associated members depending on --drop
flag (disabled by default).
"""
ctx = Context(**kwargs)
ctx.execute_action('auth:group:remove', **{
'storage': c... | python | def auth_remove(name, drop, **kwargs):
"""
Removes an authorization group.
Removes an authorization group with or without excluding associated members depending on --drop
flag (disabled by default).
"""
ctx = Context(**kwargs)
ctx.execute_action('auth:group:remove', **{
'storage': c... | [
"def",
"auth_remove",
"(",
"name",
",",
"drop",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'auth:group:remove'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo"... | Removes an authorization group.
Removes an authorization group with or without excluding associated members depending on --drop
flag (disabled by default). | [
"Removes",
"an",
"authorization",
"group",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1703-L1715 | train | Removes an authorization group. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | auth_view | def auth_view(name, **kwargs):
"""
Shows an authorization group's content.
"""
ctx = Context(**kwargs)
ctx.execute_action('auth:group:view', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | python | def auth_view(name, **kwargs):
"""
Shows an authorization group's content.
"""
ctx = Context(**kwargs)
ctx.execute_action('auth:group:view', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | [
"def",
"auth_view",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'auth:group:view'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"create_se... | Shows an authorization group's content. | [
"Shows",
"an",
"authorization",
"group",
"s",
"content",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1721-L1729 | train | Shows an authorization group s content. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | auth_add | def auth_add(name, service, **kwargs):
"""
Adds a member of an authorization group.
"""
ctx = Context(**kwargs)
ctx.execute_action('auth:group:members:add', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
'service': service,
}) | python | def auth_add(name, service, **kwargs):
"""
Adds a member of an authorization group.
"""
ctx = Context(**kwargs)
ctx.execute_action('auth:group:members:add', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
'service': service,
}) | [
"def",
"auth_add",
"(",
"name",
",",
"service",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'auth:group:members:add'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"... | Adds a member of an authorization group. | [
"Adds",
"a",
"member",
"of",
"an",
"authorization",
"group",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1736-L1745 | train | Adds a member of an authorization group. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | access_grant | def access_grant(tp, name, cid, uid, perm, **kwargs):
"""
Add rights to ACL for specified entity (collection, path, etc.).
Creates if necessary.
"""
ctx = Context(**kwargs)
ctx.execute_action('access:edit:grant', **{
'unicat': ctx.repo.create_secure_service('unicat'),
'tp': tp,
... | python | def access_grant(tp, name, cid, uid, perm, **kwargs):
"""
Add rights to ACL for specified entity (collection, path, etc.).
Creates if necessary.
"""
ctx = Context(**kwargs)
ctx.execute_action('access:edit:grant', **{
'unicat': ctx.repo.create_secure_service('unicat'),
'tp': tp,
... | [
"def",
"access_grant",
"(",
"tp",
",",
"name",
",",
"cid",
",",
"uid",
",",
"perm",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'access:edit:grant'",
",",
"*",
"*",
"{"... | Add rights to ACL for specified entity (collection, path, etc.).
Creates if necessary. | [
"Add",
"rights",
"to",
"ACL",
"for",
"specified",
"entity",
"(",
"collection",
"path",
"etc",
".",
")",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1772-L1786 | train | Grant access to a specific entity. |
cocaine/cocaine-tools | cocaine/tools/dispatch.py | access_storage_list | def access_storage_list(**kwargs):
"""
Shows collections with ACL.
"""
ctx = Context(**kwargs)
ctx.execute_action('access:storage:list', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | python | def access_storage_list(**kwargs):
"""
Shows collections with ACL.
"""
ctx = Context(**kwargs)
ctx.execute_action('access:storage:list', **{
'storage': ctx.repo.create_secure_service('storage'),
}) | [
"def",
"access_storage_list",
"(",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'access:storage:list'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
".",
"create_secur... | Shows collections with ACL. | [
"Shows",
"collections",
"with",
"ACL",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1816-L1823 | train | Shows collections with ACL.
Shows collections with ACL.
|
cocaine/cocaine-tools | cocaine/tools/dispatch.py | access_storage_view | def access_storage_view(name, **kwargs):
"""
Shows ACL for the specified collection.
"""
ctx = Context(**kwargs)
ctx.execute_action('access:storage:view', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | python | def access_storage_view(name, **kwargs):
"""
Shows ACL for the specified collection.
"""
ctx = Context(**kwargs)
ctx.execute_action('access:storage:view', **{
'storage': ctx.repo.create_secure_service('storage'),
'name': name,
}) | [
"def",
"access_storage_view",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"ctx",
"=",
"Context",
"(",
"*",
"*",
"kwargs",
")",
"ctx",
".",
"execute_action",
"(",
"'access:storage:view'",
",",
"*",
"*",
"{",
"'storage'",
":",
"ctx",
".",
"repo",
"."... | Shows ACL for the specified collection. | [
"Shows",
"ACL",
"for",
"the",
"specified",
"collection",
"."
] | d8834f8e04ca42817d5f4e368d471484d4b3419f | https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1829-L1837 | train | Shows ACL for the specified collection. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.