id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
244,900 | dossier/dossier.models | dossier/models/etl/interface.py | add_sip_to_fc | def add_sip_to_fc(fc, tfidf, limit=40):
'''add "bowNP_sip" to `fc` using `tfidf` data
'''
if 'bowNP' not in fc:
return
if tfidf is None:
return
sips = features.sip_noun_phrases(tfidf, fc['bowNP'].keys(), limit=limit)
fc[u'bowNP_sip'] = StringCounter(sips) | python | def add_sip_to_fc(fc, tfidf, limit=40):
'''add "bowNP_sip" to `fc` using `tfidf` data
'''
if 'bowNP' not in fc:
return
if tfidf is None:
return
sips = features.sip_noun_phrases(tfidf, fc['bowNP'].keys(), limit=limit)
fc[u'bowNP_sip'] = StringCounter(sips) | [
"def",
"add_sip_to_fc",
"(",
"fc",
",",
"tfidf",
",",
"limit",
"=",
"40",
")",
":",
"if",
"'bowNP'",
"not",
"in",
"fc",
":",
"return",
"if",
"tfidf",
"is",
"None",
":",
"return",
"sips",
"=",
"features",
".",
"sip_noun_phrases",
"(",
"tfidf",
",",
"f... | add "bowNP_sip" to `fc` using `tfidf` data | [
"add",
"bowNP_sip",
"to",
"fc",
"using",
"tfidf",
"data"
] | c9e282f690eab72963926329efe1600709e48b13 | https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/etl/interface.py#L234-L242 |
244,901 | collectiveacuity/labPack | labpack/location/find.py | findClient.get_password | def get_password(self):
'''
a method to retrieve the password for the group mosquitto server
:return: string with group mosquitto server password
NOTE: result is added to self.password property
'''
import requests
url = '%s/mqtt' % self.endpoint
... | python | def get_password(self):
'''
a method to retrieve the password for the group mosquitto server
:return: string with group mosquitto server password
NOTE: result is added to self.password property
'''
import requests
url = '%s/mqtt' % self.endpoint
... | [
"def",
"get_password",
"(",
"self",
")",
":",
"import",
"requests",
"url",
"=",
"'%s/mqtt'",
"%",
"self",
".",
"endpoint",
"params",
"=",
"{",
"'group'",
":",
"self",
".",
"group_name",
"}",
"response",
"=",
"requests",
".",
"put",
"(",
"url",
",",
"pa... | a method to retrieve the password for the group mosquitto server
:return: string with group mosquitto server password
NOTE: result is added to self.password property | [
"a",
"method",
"to",
"retrieve",
"the",
"password",
"for",
"the",
"group",
"mosquitto",
"server"
] | 52949ece35e72e3cc308f54d9ffa6bfbd96805b8 | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/location/find.py#L83-L102 |
244,902 | collectiveacuity/labPack | labpack/location/find.py | findClient.get_position | def get_position(self, user_id, track=False, confidence=False):
'''
a method to retrieve the latest position of a user
:param user_id: string with id of user
:param track: [optional] boolean to add user to self.positions
:param confidence: [optional] boolean to include the ... | python | def get_position(self, user_id, track=False, confidence=False):
'''
a method to retrieve the latest position of a user
:param user_id: string with id of user
:param track: [optional] boolean to add user to self.positions
:param confidence: [optional] boolean to include the ... | [
"def",
"get_position",
"(",
"self",
",",
"user_id",
",",
"track",
"=",
"False",
",",
"confidence",
"=",
"False",
")",
":",
"title",
"=",
"'%s.get_position'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs",
"input_fields",
"=",
"{",
"'use... | a method to retrieve the latest position of a user
:param user_id: string with id of user
:param track: [optional] boolean to add user to self.positions
:param confidence: [optional] boolean to include the data model confidence scores
:return: dictionaries with position details
... | [
"a",
"method",
"to",
"retrieve",
"the",
"latest",
"position",
"of",
"a",
"user"
] | 52949ece35e72e3cc308f54d9ffa6bfbd96805b8 | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/location/find.py#L150-L227 |
244,903 | OlivierB/Bashutils | bashutils/logmsg.py | log_begin_message | def log_begin_message(message):
"""
Create and print a new log message
waiting for an end log message
"""
global MESSAGE
MESSAGE = message
sys.stdout.write("[....] ")
sys.stdout.write(message)
sys.stdout.flush() | python | def log_begin_message(message):
"""
Create and print a new log message
waiting for an end log message
"""
global MESSAGE
MESSAGE = message
sys.stdout.write("[....] ")
sys.stdout.write(message)
sys.stdout.flush() | [
"def",
"log_begin_message",
"(",
"message",
")",
":",
"global",
"MESSAGE",
"MESSAGE",
"=",
"message",
"sys",
".",
"stdout",
".",
"write",
"(",
"\"[....] \"",
")",
"sys",
".",
"stdout",
".",
"write",
"(",
"message",
")",
"sys",
".",
"stdout",
".",
"flush"... | Create and print a new log message
waiting for an end log message | [
"Create",
"and",
"print",
"a",
"new",
"log",
"message",
"waiting",
"for",
"an",
"end",
"log",
"message"
] | 487762049f5d09f14f8a6c764bc0a823f332d8a1 | https://github.com/OlivierB/Bashutils/blob/487762049f5d09f14f8a6c764bc0a823f332d8a1/bashutils/logmsg.py#L80-L89 |
244,904 | OlivierB/Bashutils | bashutils/logmsg.py | log_end_message | def log_end_message(log):
"""
End a log message with a status
defined by log
"""
if not log in MESSAGE_LOG.keys():
log = -1
res = colors.color_text(*MESSAGE_LOG[log][1])
sys.stdout.write("\r[" + res + "] " + MESSAGE + "\n") | python | def log_end_message(log):
"""
End a log message with a status
defined by log
"""
if not log in MESSAGE_LOG.keys():
log = -1
res = colors.color_text(*MESSAGE_LOG[log][1])
sys.stdout.write("\r[" + res + "] " + MESSAGE + "\n") | [
"def",
"log_end_message",
"(",
"log",
")",
":",
"if",
"not",
"log",
"in",
"MESSAGE_LOG",
".",
"keys",
"(",
")",
":",
"log",
"=",
"-",
"1",
"res",
"=",
"colors",
".",
"color_text",
"(",
"*",
"MESSAGE_LOG",
"[",
"log",
"]",
"[",
"1",
"]",
")",
"sys... | End a log message with a status
defined by log | [
"End",
"a",
"log",
"message",
"with",
"a",
"status",
"defined",
"by",
"log"
] | 487762049f5d09f14f8a6c764bc0a823f332d8a1 | https://github.com/OlivierB/Bashutils/blob/487762049f5d09f14f8a6c764bc0a823f332d8a1/bashutils/logmsg.py#L92-L102 |
244,905 | deifyed/vault | libconman/vault.py | Vault._fetchFilesFromFolder | def _fetchFilesFromFolder(self, target, recursive):
'''
Fetches files from the target directory, and - if recursive
mode is on, all subdirectories.
Returns a list of all found files
'''
directory_items = os.walk(target)
# If recursive is false, fetch... | python | def _fetchFilesFromFolder(self, target, recursive):
'''
Fetches files from the target directory, and - if recursive
mode is on, all subdirectories.
Returns a list of all found files
'''
directory_items = os.walk(target)
# If recursive is false, fetch... | [
"def",
"_fetchFilesFromFolder",
"(",
"self",
",",
"target",
",",
"recursive",
")",
":",
"directory_items",
"=",
"os",
".",
"walk",
"(",
"target",
")",
"# If recursive is false, fetch only the first tuple",
"if",
"not",
"recursive",
":",
"directory_items",
"=",
"[",
... | Fetches files from the target directory, and - if recursive
mode is on, all subdirectories.
Returns a list of all found files | [
"Fetches",
"files",
"from",
"the",
"target",
"directory",
"and",
"-",
"if",
"recursive",
"mode",
"is",
"on",
"all",
"subdirectories",
"."
] | e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97 | https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/vault.py#L26-L44 |
244,906 | deifyed/vault | libconman/vault.py | Vault.remove | def remove(self, iid):
'''
Deletes file from vault and removes database information
'''
for index in iid:
target = Target.getTarget(index)
target.delete() | python | def remove(self, iid):
'''
Deletes file from vault and removes database information
'''
for index in iid:
target = Target.getTarget(index)
target.delete() | [
"def",
"remove",
"(",
"self",
",",
"iid",
")",
":",
"for",
"index",
"in",
"iid",
":",
"target",
"=",
"Target",
".",
"getTarget",
"(",
"index",
")",
"target",
".",
"delete",
"(",
")"
] | Deletes file from vault and removes database information | [
"Deletes",
"file",
"from",
"vault",
"and",
"removes",
"database",
"information"
] | e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97 | https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/vault.py#L60-L67 |
244,907 | deifyed/vault | libconman/vault.py | Vault.deploy | def deploy(self, iid):
'''
Links an item from the vault to the original path
'''
for index in iid:
target = Target.getTarget(index)
if target:
verbose('Deploying id {} from {} to {} with the name {}'
.format(index, targ... | python | def deploy(self, iid):
'''
Links an item from the vault to the original path
'''
for index in iid:
target = Target.getTarget(index)
if target:
verbose('Deploying id {} from {} to {} with the name {}'
.format(index, targ... | [
"def",
"deploy",
"(",
"self",
",",
"iid",
")",
":",
"for",
"index",
"in",
"iid",
":",
"target",
"=",
"Target",
".",
"getTarget",
"(",
"index",
")",
"if",
"target",
":",
"verbose",
"(",
"'Deploying id {} from {} to {} with the name {}'",
".",
"format",
"(",
... | Links an item from the vault to the original path | [
"Links",
"an",
"item",
"from",
"the",
"vault",
"to",
"the",
"original",
"path"
] | e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97 | https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/vault.py#L69-L81 |
244,908 | deifyed/vault | libconman/vault.py | Vault.deployAll | def deployAll(self):
'''
Deploys all the items from the vault. Useful after a format
'''
targets = [Target.getTarget(iid) for iid, n, p in self.db.listTargets()]
for target in targets:
target.deploy()
verbose('Deploy all complete') | python | def deployAll(self):
'''
Deploys all the items from the vault. Useful after a format
'''
targets = [Target.getTarget(iid) for iid, n, p in self.db.listTargets()]
for target in targets:
target.deploy()
verbose('Deploy all complete') | [
"def",
"deployAll",
"(",
"self",
")",
":",
"targets",
"=",
"[",
"Target",
".",
"getTarget",
"(",
"iid",
")",
"for",
"iid",
",",
"n",
",",
"p",
"in",
"self",
".",
"db",
".",
"listTargets",
"(",
")",
"]",
"for",
"target",
"in",
"targets",
":",
"tar... | Deploys all the items from the vault. Useful after a format | [
"Deploys",
"all",
"the",
"items",
"from",
"the",
"vault",
".",
"Useful",
"after",
"a",
"format"
] | e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97 | https://github.com/deifyed/vault/blob/e3c37ade6c3e6b61a76ec6cd2ba98881c7401d97/libconman/vault.py#L83-L92 |
244,909 | sassoo/goldman | goldman/resources/model.py | on_delete | def on_delete(resc, req, resp, rid): # pylint: disable=unused-argument
""" Delete the single item
Upon a successful deletion an empty bodied 204
is returned.
"""
signals.pre_req.send(resc.model)
signals.pre_req_delete.send(resc.model)
model = find(resc.model, rid)
goldman.sess.store.... | python | def on_delete(resc, req, resp, rid): # pylint: disable=unused-argument
""" Delete the single item
Upon a successful deletion an empty bodied 204
is returned.
"""
signals.pre_req.send(resc.model)
signals.pre_req_delete.send(resc.model)
model = find(resc.model, rid)
goldman.sess.store.... | [
"def",
"on_delete",
"(",
"resc",
",",
"req",
",",
"resp",
",",
"rid",
")",
":",
"# pylint: disable=unused-argument",
"signals",
".",
"pre_req",
".",
"send",
"(",
"resc",
".",
"model",
")",
"signals",
".",
"pre_req_delete",
".",
"send",
"(",
"resc",
".",
... | Delete the single item
Upon a successful deletion an empty bodied 204
is returned. | [
"Delete",
"the",
"single",
"item"
] | b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2 | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/resources/model.py#L23-L39 |
244,910 | sassoo/goldman | goldman/resources/model.py | on_get | def on_get(resc, req, resp, rid):
""" Find the model by id & serialize it back """
signals.pre_req.send(resc.model)
signals.pre_req_find.send(resc.model)
model = find(resc.model, rid)
props = to_rest_model(model, includes=req.includes)
resp.last_modified = model.updated
resp.serialize(pro... | python | def on_get(resc, req, resp, rid):
""" Find the model by id & serialize it back """
signals.pre_req.send(resc.model)
signals.pre_req_find.send(resc.model)
model = find(resc.model, rid)
props = to_rest_model(model, includes=req.includes)
resp.last_modified = model.updated
resp.serialize(pro... | [
"def",
"on_get",
"(",
"resc",
",",
"req",
",",
"resp",
",",
"rid",
")",
":",
"signals",
".",
"pre_req",
".",
"send",
"(",
"resc",
".",
"model",
")",
"signals",
".",
"pre_req_find",
".",
"send",
"(",
"resc",
".",
"model",
")",
"model",
"=",
"find",
... | Find the model by id & serialize it back | [
"Find",
"the",
"model",
"by",
"id",
"&",
"serialize",
"it",
"back"
] | b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2 | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/resources/model.py#L42-L55 |
244,911 | sassoo/goldman | goldman/resources/model.py | on_patch | def on_patch(resc, req, resp, rid):
""" Deserialize the payload & update the single item """
signals.pre_req.send(resc.model)
signals.pre_req_update.send(resc.model)
props = req.deserialize()
model = find(resc.model, rid)
from_rest(model, props)
goldman.sess.store.update(model)
props... | python | def on_patch(resc, req, resp, rid):
""" Deserialize the payload & update the single item """
signals.pre_req.send(resc.model)
signals.pre_req_update.send(resc.model)
props = req.deserialize()
model = find(resc.model, rid)
from_rest(model, props)
goldman.sess.store.update(model)
props... | [
"def",
"on_patch",
"(",
"resc",
",",
"req",
",",
"resp",
",",
"rid",
")",
":",
"signals",
".",
"pre_req",
".",
"send",
"(",
"resc",
".",
"model",
")",
"signals",
".",
"pre_req_update",
".",
"send",
"(",
"resc",
".",
"model",
")",
"props",
"=",
"req... | Deserialize the payload & update the single item | [
"Deserialize",
"the",
"payload",
"&",
"update",
"the",
"single",
"item"
] | b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2 | https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/resources/model.py#L58-L75 |
244,912 | edeposit/edeposit.amqp.ftp | src/edeposit/amqp/ftp/decoders/parser_xml.py | decode | def decode(data):
"""
Handles decoding of the XML `data`.
Args:
data (str): Data which will be decoded.
Returns:
dict: Dictionary with decoded data.
"""
dom = None
try:
dom = dhtmlparser.parseString(data)
except Exception, e:
raise MetaParsingException("... | python | def decode(data):
"""
Handles decoding of the XML `data`.
Args:
data (str): Data which will be decoded.
Returns:
dict: Dictionary with decoded data.
"""
dom = None
try:
dom = dhtmlparser.parseString(data)
except Exception, e:
raise MetaParsingException("... | [
"def",
"decode",
"(",
"data",
")",
":",
"dom",
"=",
"None",
"try",
":",
"dom",
"=",
"dhtmlparser",
".",
"parseString",
"(",
"data",
")",
"except",
"Exception",
",",
"e",
":",
"raise",
"MetaParsingException",
"(",
"\"Can't parse your XML data: %s\"",
"%",
"e"... | Handles decoding of the XML `data`.
Args:
data (str): Data which will be decoded.
Returns:
dict: Dictionary with decoded data. | [
"Handles",
"decoding",
"of",
"the",
"XML",
"data",
"."
] | fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71 | https://github.com/edeposit/edeposit.amqp.ftp/blob/fcdcbffb6e5d194e1bb4f85f0b8eaa9dbb08aa71/src/edeposit/amqp/ftp/decoders/parser_xml.py#L41-L87 |
244,913 | SergeySatskiy/cdm-gc-plugin | cdmplugins/gc/__init__.py | GCPlugin.activate | def activate(self, ideSettings, ideGlobalData):
"""Activates the plugin.
The plugin may override the method to do specific
plugin activation handling.
ideSettings - reference to the IDE Settings singleton
see codimension/src/utils/settings.py
ideGlobalData... | python | def activate(self, ideSettings, ideGlobalData):
"""Activates the plugin.
The plugin may override the method to do specific
plugin activation handling.
ideSettings - reference to the IDE Settings singleton
see codimension/src/utils/settings.py
ideGlobalData... | [
"def",
"activate",
"(",
"self",
",",
"ideSettings",
",",
"ideGlobalData",
")",
":",
"WizardInterface",
".",
"activate",
"(",
"self",
",",
"ideSettings",
",",
"ideGlobalData",
")",
"self",
".",
"__where",
"=",
"self",
".",
"__getConfiguredWhere",
"(",
")",
"s... | Activates the plugin.
The plugin may override the method to do specific
plugin activation handling.
ideSettings - reference to the IDE Settings singleton
see codimension/src/utils/settings.py
ideGlobalData - reference to the IDE global settings
... | [
"Activates",
"the",
"plugin",
"."
] | f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df | https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/__init__.py#L51-L70 |
244,914 | SergeySatskiy/cdm-gc-plugin | cdmplugins/gc/__init__.py | GCPlugin.deactivate | def deactivate(self):
"""Deactivates the plugin.
The plugin may override the method to do specific
plugin deactivation handling.
Note: if overriden do not forget to call the
base class deactivate()
"""
self.ide.project.sigProjectChanged.disconnect(self.__co... | python | def deactivate(self):
"""Deactivates the plugin.
The plugin may override the method to do specific
plugin deactivation handling.
Note: if overriden do not forget to call the
base class deactivate()
"""
self.ide.project.sigProjectChanged.disconnect(self.__co... | [
"def",
"deactivate",
"(",
"self",
")",
":",
"self",
".",
"ide",
".",
"project",
".",
"sigProjectChanged",
".",
"disconnect",
"(",
"self",
".",
"__collectGarbage",
")",
"self",
".",
"ide",
".",
"editorsManager",
".",
"sigTabClosed",
".",
"disconnect",
"(",
... | Deactivates the plugin.
The plugin may override the method to do specific
plugin deactivation handling.
Note: if overriden do not forget to call the
base class deactivate() | [
"Deactivates",
"the",
"plugin",
"."
] | f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df | https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/__init__.py#L72-L83 |
244,915 | SergeySatskiy/cdm-gc-plugin | cdmplugins/gc/__init__.py | GCPlugin.populateMainMenu | def populateMainMenu(self, parentMenu):
"""Populates the main menu.
The main menu looks as follows:
Plugins
- Plugin manager (fixed item)
- Separator (fixed item)
- <Plugin #1 name> (this is the parentMenu passed)
...
If no items were popu... | python | def populateMainMenu(self, parentMenu):
"""Populates the main menu.
The main menu looks as follows:
Plugins
- Plugin manager (fixed item)
- Separator (fixed item)
- <Plugin #1 name> (this is the parentMenu passed)
...
If no items were popu... | [
"def",
"populateMainMenu",
"(",
"self",
",",
"parentMenu",
")",
":",
"parentMenu",
".",
"addAction",
"(",
"\"Configure\"",
",",
"self",
".",
"configure",
")",
"parentMenu",
".",
"addAction",
"(",
"\"Collect garbage\"",
",",
"self",
".",
"__collectGarbage",
")"
] | Populates the main menu.
The main menu looks as follows:
Plugins
- Plugin manager (fixed item)
- Separator (fixed item)
- <Plugin #1 name> (this is the parentMenu passed)
...
If no items were populated by the plugin then there will be no
<... | [
"Populates",
"the",
"main",
"menu",
"."
] | f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df | https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/__init__.py#L96-L110 |
244,916 | SergeySatskiy/cdm-gc-plugin | cdmplugins/gc/__init__.py | GCPlugin.populateBufferContextMenu | def populateBufferContextMenu(self, parentMenu):
"""Populates the editing buffer context menu.
The buffer context menu shown for the current edited/viewed file
will have an item with a plugin name and subitems which are
populated here. If no items were populated then the plugin menu
... | python | def populateBufferContextMenu(self, parentMenu):
"""Populates the editing buffer context menu.
The buffer context menu shown for the current edited/viewed file
will have an item with a plugin name and subitems which are
populated here. If no items were populated then the plugin menu
... | [
"def",
"populateBufferContextMenu",
"(",
"self",
",",
"parentMenu",
")",
":",
"parentMenu",
".",
"addAction",
"(",
"\"Configure\"",
",",
"self",
".",
"configure",
")",
"parentMenu",
".",
"addAction",
"(",
"\"Collect garbage\"",
",",
"self",
".",
"__collectGarbage"... | Populates the editing buffer context menu.
The buffer context menu shown for the current edited/viewed file
will have an item with a plugin name and subitems which are
populated here. If no items were populated then the plugin menu
item will not be shown.
Note: when a buffer co... | [
"Populates",
"the",
"editing",
"buffer",
"context",
"menu",
"."
] | f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df | https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/__init__.py#L140-L161 |
244,917 | SergeySatskiy/cdm-gc-plugin | cdmplugins/gc/__init__.py | GCPlugin.configure | def configure(self):
"""Configures the garbage collector plugin"""
dlg = GCPluginConfigDialog(self.__where)
if dlg.exec_() == QDialog.Accepted:
newWhere = dlg.getCheckedOption()
if newWhere != self.__where:
self.__where = newWhere
self.__sa... | python | def configure(self):
"""Configures the garbage collector plugin"""
dlg = GCPluginConfigDialog(self.__where)
if dlg.exec_() == QDialog.Accepted:
newWhere = dlg.getCheckedOption()
if newWhere != self.__where:
self.__where = newWhere
self.__sa... | [
"def",
"configure",
"(",
"self",
")",
":",
"dlg",
"=",
"GCPluginConfigDialog",
"(",
"self",
".",
"__where",
")",
"if",
"dlg",
".",
"exec_",
"(",
")",
"==",
"QDialog",
".",
"Accepted",
":",
"newWhere",
"=",
"dlg",
".",
"getCheckedOption",
"(",
")",
"if"... | Configures the garbage collector plugin | [
"Configures",
"the",
"garbage",
"collector",
"plugin"
] | f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df | https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/__init__.py#L163-L170 |
244,918 | SergeySatskiy/cdm-gc-plugin | cdmplugins/gc/__init__.py | GCPlugin.__getConfiguredWhere | def __getConfiguredWhere(self):
"""Provides the saved configured value"""
defaultSettings = {'where': GCPluginConfigDialog.SILENT}
configFile = self.__getConfigFile()
if not os.path.exists(configFile):
values = defaultSettings
else:
values = loadJSON(confi... | python | def __getConfiguredWhere(self):
"""Provides the saved configured value"""
defaultSettings = {'where': GCPluginConfigDialog.SILENT}
configFile = self.__getConfigFile()
if not os.path.exists(configFile):
values = defaultSettings
else:
values = loadJSON(confi... | [
"def",
"__getConfiguredWhere",
"(",
"self",
")",
":",
"defaultSettings",
"=",
"{",
"'where'",
":",
"GCPluginConfigDialog",
".",
"SILENT",
"}",
"configFile",
"=",
"self",
".",
"__getConfigFile",
"(",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
... | Provides the saved configured value | [
"Provides",
"the",
"saved",
"configured",
"value"
] | f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df | https://github.com/SergeySatskiy/cdm-gc-plugin/blob/f6dd59d5dc80d3f8f5ca5bcf49bad86c88be38df/cdmplugins/gc/__init__.py#L176-L193 |
244,919 | ronaldguillen/wave | wave/renderers.py | JSONRenderer.render | def render(self, data, accepted_media_type=None, renderer_context=None):
"""
Render `data` into JSON, returning a bytestring.
"""
if data is None:
return bytes()
renderer_context = renderer_context or {}
indent = self.get_indent(accepted_media_type, renderer_... | python | def render(self, data, accepted_media_type=None, renderer_context=None):
"""
Render `data` into JSON, returning a bytestring.
"""
if data is None:
return bytes()
renderer_context = renderer_context or {}
indent = self.get_indent(accepted_media_type, renderer_... | [
"def",
"render",
"(",
"self",
",",
"data",
",",
"accepted_media_type",
"=",
"None",
",",
"renderer_context",
"=",
"None",
")",
":",
"if",
"data",
"is",
"None",
":",
"return",
"bytes",
"(",
")",
"renderer_context",
"=",
"renderer_context",
"or",
"{",
"}",
... | Render `data` into JSON, returning a bytestring. | [
"Render",
"data",
"into",
"JSON",
"returning",
"a",
"bytestring",
"."
] | 20bb979c917f7634d8257992e6d449dc751256a9 | https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L86-L118 |
244,920 | ronaldguillen/wave | wave/renderers.py | HTMLFormRenderer.render | def render(self, data, accepted_media_type=None, renderer_context=None):
"""
Render serializer data and return an HTML form, as a string.
"""
form = data.serializer
style = renderer_context.get('style', {})
if 'template_pack' not in style:
style['template_pac... | python | def render(self, data, accepted_media_type=None, renderer_context=None):
"""
Render serializer data and return an HTML form, as a string.
"""
form = data.serializer
style = renderer_context.get('style', {})
if 'template_pack' not in style:
style['template_pac... | [
"def",
"render",
"(",
"self",
",",
"data",
",",
"accepted_media_type",
"=",
"None",
",",
"renderer_context",
"=",
"None",
")",
":",
"form",
"=",
"data",
".",
"serializer",
"style",
"=",
"renderer_context",
".",
"get",
"(",
"'style'",
",",
"{",
"}",
")",
... | Render serializer data and return an HTML form, as a string. | [
"Render",
"serializer",
"data",
"and",
"return",
"an",
"HTML",
"form",
"as",
"a",
"string",
"."
] | 20bb979c917f7634d8257992e6d449dc751256a9 | https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L340-L358 |
244,921 | ronaldguillen/wave | wave/renderers.py | BrowsableAPIRenderer.get_content | def get_content(self, renderer, data,
accepted_media_type, renderer_context):
"""
Get the content as if it had been rendered by the default
non-documenting renderer.
"""
if not renderer:
return '[No renderers were found]'
renderer_context[... | python | def get_content(self, renderer, data,
accepted_media_type, renderer_context):
"""
Get the content as if it had been rendered by the default
non-documenting renderer.
"""
if not renderer:
return '[No renderers were found]'
renderer_context[... | [
"def",
"get_content",
"(",
"self",
",",
"renderer",
",",
"data",
",",
"accepted_media_type",
",",
"renderer_context",
")",
":",
"if",
"not",
"renderer",
":",
"return",
"'[No renderers were found]'",
"renderer_context",
"[",
"'indent'",
"]",
"=",
"4",
"content",
... | Get the content as if it had been rendered by the default
non-documenting renderer. | [
"Get",
"the",
"content",
"as",
"if",
"it",
"had",
"been",
"rendered",
"by",
"the",
"default",
"non",
"-",
"documenting",
"renderer",
"."
] | 20bb979c917f7634d8257992e6d449dc751256a9 | https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L388-L406 |
244,922 | ronaldguillen/wave | wave/renderers.py | BrowsableAPIRenderer.show_form_for_method | def show_form_for_method(self, view, method, request, obj):
"""
Returns True if a form should be shown for this method.
"""
if method not in view.allowed_methods:
return # Not a valid method
try:
view.check_permissions(request)
if obj is not ... | python | def show_form_for_method(self, view, method, request, obj):
"""
Returns True if a form should be shown for this method.
"""
if method not in view.allowed_methods:
return # Not a valid method
try:
view.check_permissions(request)
if obj is not ... | [
"def",
"show_form_for_method",
"(",
"self",
",",
"view",
",",
"method",
",",
"request",
",",
"obj",
")",
":",
"if",
"method",
"not",
"in",
"view",
".",
"allowed_methods",
":",
"return",
"# Not a valid method",
"try",
":",
"view",
".",
"check_permissions",
"(... | Returns True if a form should be shown for this method. | [
"Returns",
"True",
"if",
"a",
"form",
"should",
"be",
"shown",
"for",
"this",
"method",
"."
] | 20bb979c917f7634d8257992e6d449dc751256a9 | https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L408-L421 |
244,923 | ronaldguillen/wave | wave/renderers.py | BrowsableAPIRenderer.get_rendered_html_form | def get_rendered_html_form(self, data, view, method, request):
"""
Return a string representing a rendered HTML form, possibly bound to
either the input or output data.
In the absence of the View having an associated form then return None.
"""
# See issue #2089 for refac... | python | def get_rendered_html_form(self, data, view, method, request):
"""
Return a string representing a rendered HTML form, possibly bound to
either the input or output data.
In the absence of the View having an associated form then return None.
"""
# See issue #2089 for refac... | [
"def",
"get_rendered_html_form",
"(",
"self",
",",
"data",
",",
"view",
",",
"method",
",",
"request",
")",
":",
"# See issue #2089 for refactoring this.",
"serializer",
"=",
"getattr",
"(",
"data",
",",
"'serializer'",
",",
"None",
")",
"if",
"serializer",
"and... | Return a string representing a rendered HTML form, possibly bound to
either the input or output data.
In the absence of the View having an associated form then return None. | [
"Return",
"a",
"string",
"representing",
"a",
"rendered",
"HTML",
"form",
"possibly",
"bound",
"to",
"either",
"the",
"input",
"or",
"output",
"data",
"."
] | 20bb979c917f7634d8257992e6d449dc751256a9 | https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L431-L501 |
244,924 | ronaldguillen/wave | wave/renderers.py | BrowsableAPIRenderer.get_context | def get_context(self, data, accepted_media_type, renderer_context):
"""
Returns the context used to render.
"""
view = renderer_context['view']
request = renderer_context['request']
response = renderer_context['response']
renderer = self.get_default_renderer(view... | python | def get_context(self, data, accepted_media_type, renderer_context):
"""
Returns the context used to render.
"""
view = renderer_context['view']
request = renderer_context['request']
response = renderer_context['response']
renderer = self.get_default_renderer(view... | [
"def",
"get_context",
"(",
"self",
",",
"data",
",",
"accepted_media_type",
",",
"renderer_context",
")",
":",
"view",
"=",
"renderer_context",
"[",
"'view'",
"]",
"request",
"=",
"renderer_context",
"[",
"'request'",
"]",
"response",
"=",
"renderer_context",
"[... | Returns the context used to render. | [
"Returns",
"the",
"context",
"used",
"to",
"render",
"."
] | 20bb979c917f7634d8257992e6d449dc751256a9 | https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/renderers.py#L607-L665 |
244,925 | radjkarl/fancyTools | fancytools/os/setup.py | setup | def setup(package, **kwargs):
"""a template for the python setup.py installer routine
* take setup information from the packages __init__.py file
* this way these informations, like...
- __email__
- __version__
- __depencies__
... | python | def setup(package, **kwargs):
"""a template for the python setup.py installer routine
* take setup information from the packages __init__.py file
* this way these informations, like...
- __email__
- __version__
- __depencies__
... | [
"def",
"setup",
"(",
"package",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"read",
"(",
"*",
"paths",
")",
":",
"\"\"\"Build a file path from *paths* and return the contents.\"\"\"",
"p",
"=",
"os",
".",
"path",
".",
"join",
"(",
"*",
"paths",
")",
"if",
"o... | a template for the python setup.py installer routine
* take setup information from the packages __init__.py file
* this way these informations, like...
- __email__
- __version__
- __depencies__
are still available after instal... | [
"a",
"template",
"for",
"the",
"python",
"setup",
".",
"py",
"installer",
"routine"
] | 4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b | https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/os/setup.py#L9-L62 |
244,926 | pip-services3-python/pip-services3-components-python | pip_services3_components/config/YamlConfigReader.py | YamlConfigReader._read_object | def _read_object(self, correlation_id, parameters):
"""
Reads configuration file, parameterizes its content and converts it into JSON object.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param parameters: values to parameters the configuratio... | python | def _read_object(self, correlation_id, parameters):
"""
Reads configuration file, parameterizes its content and converts it into JSON object.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param parameters: values to parameters the configuratio... | [
"def",
"_read_object",
"(",
"self",
",",
"correlation_id",
",",
"parameters",
")",
":",
"path",
"=",
"self",
".",
"get_path",
"(",
")",
"if",
"path",
"==",
"None",
":",
"raise",
"ConfigException",
"(",
"correlation_id",
",",
"\"NO_PATH\"",
",",
"\"Missing co... | Reads configuration file, parameterizes its content and converts it into JSON object.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param parameters: values to parameters the configuration.
:return: a JSON object with configuration. | [
"Reads",
"configuration",
"file",
"parameterizes",
"its",
"content",
"and",
"converts",
"it",
"into",
"JSON",
"object",
"."
] | 1de9c1bb544cf1891111e9a5f5d67653f62c9b52 | https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/config/YamlConfigReader.py#L48-L76 |
244,927 | pip-services3-python/pip-services3-components-python | pip_services3_components/config/YamlConfigReader.py | YamlConfigReader.read_config | def read_config(self, correlation_id, parameters):
"""
Reads configuration and parameterize it with given values.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param parameters: values to parameters the configuration or null to skip parameteri... | python | def read_config(self, correlation_id, parameters):
"""
Reads configuration and parameterize it with given values.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param parameters: values to parameters the configuration or null to skip parameteri... | [
"def",
"read_config",
"(",
"self",
",",
"correlation_id",
",",
"parameters",
")",
":",
"value",
"=",
"self",
".",
"_read_object",
"(",
"correlation_id",
",",
"parameters",
")",
"return",
"ConfigParams",
".",
"from_value",
"(",
"value",
")"
] | Reads configuration and parameterize it with given values.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param parameters: values to parameters the configuration or null to skip parameterization.
:return: ConfigParams configuration. | [
"Reads",
"configuration",
"and",
"parameterize",
"it",
"with",
"given",
"values",
"."
] | 1de9c1bb544cf1891111e9a5f5d67653f62c9b52 | https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/config/YamlConfigReader.py#L78-L89 |
244,928 | pip-services3-python/pip-services3-components-python | pip_services3_components/config/YamlConfigReader.py | YamlConfigReader._read_config | def _read_config(correlation_id, path, parameters):
"""
Reads configuration from a file, parameterize it with given values and returns a new ConfigParams object.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param path: a path to configuration... | python | def _read_config(correlation_id, path, parameters):
"""
Reads configuration from a file, parameterize it with given values and returns a new ConfigParams object.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param path: a path to configuration... | [
"def",
"_read_config",
"(",
"correlation_id",
",",
"path",
",",
"parameters",
")",
":",
"value",
"=",
"YamlConfigReader",
"(",
"path",
")",
".",
"_read_object",
"(",
"correlation_id",
",",
"parameters",
")",
"return",
"ConfigParams",
".",
"from_value",
"(",
"v... | Reads configuration from a file, parameterize it with given values and returns a new ConfigParams object.
:param correlation_id: (optional) transaction id to trace execution through call chain.
:param path: a path to configuration file.
:param parameters: values to parameters the configuratio... | [
"Reads",
"configuration",
"from",
"a",
"file",
"parameterize",
"it",
"with",
"given",
"values",
"and",
"returns",
"a",
"new",
"ConfigParams",
"object",
"."
] | 1de9c1bb544cf1891111e9a5f5d67653f62c9b52 | https://github.com/pip-services3-python/pip-services3-components-python/blob/1de9c1bb544cf1891111e9a5f5d67653f62c9b52/pip_services3_components/config/YamlConfigReader.py#L107-L120 |
244,929 | itsnauman/jumprun | jumprun.py | JumpRun.run | def run(self):
"""
Perform the specified action
"""
if self.args['add']:
self.action_add()
elif self.args['rm']:
self.action_rm()
elif self.args['show']:
self.action_show()
elif self.args['rename']:
self.action_r... | python | def run(self):
"""
Perform the specified action
"""
if self.args['add']:
self.action_add()
elif self.args['rm']:
self.action_rm()
elif self.args['show']:
self.action_show()
elif self.args['rename']:
self.action_r... | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"self",
".",
"args",
"[",
"'add'",
"]",
":",
"self",
".",
"action_add",
"(",
")",
"elif",
"self",
".",
"args",
"[",
"'rm'",
"]",
":",
"self",
".",
"action_rm",
"(",
")",
"elif",
"self",
".",
"args",
"[... | Perform the specified action | [
"Perform",
"the",
"specified",
"action"
] | 469436720533e9a601226ec1414f294d94d68a53 | https://github.com/itsnauman/jumprun/blob/469436720533e9a601226ec1414f294d94d68a53/jumprun.py#L95-L113 |
244,930 | itsnauman/jumprun | jumprun.py | JumpRun.init_db | def init_db(self):
"""
Init database and prepare tables
"""
# database file
db_path = self.get_data_file("data.sqlite")
# comect and create cursor
self.db = sqlite3.connect(db_path)
self.cursor = self.db.cursor()
# prep tables
self.db_ex... | python | def init_db(self):
"""
Init database and prepare tables
"""
# database file
db_path = self.get_data_file("data.sqlite")
# comect and create cursor
self.db = sqlite3.connect(db_path)
self.cursor = self.db.cursor()
# prep tables
self.db_ex... | [
"def",
"init_db",
"(",
"self",
")",
":",
"# database file",
"db_path",
"=",
"self",
".",
"get_data_file",
"(",
"\"data.sqlite\"",
")",
"# comect and create cursor",
"self",
".",
"db",
"=",
"sqlite3",
".",
"connect",
"(",
"db_path",
")",
"self",
".",
"cursor",
... | Init database and prepare tables | [
"Init",
"database",
"and",
"prepare",
"tables"
] | 469436720533e9a601226ec1414f294d94d68a53 | https://github.com/itsnauman/jumprun/blob/469436720533e9a601226ec1414f294d94d68a53/jumprun.py#L121-L141 |
244,931 | itsnauman/jumprun | jumprun.py | JumpRun.shortcut_str | def shortcut_str(self, path, cmd):
"""
Get a string with colors describing a shortcut
"""
s = colored('| path = ', 'cyan') + colored(path, 'yellow') + '\n' \
+ colored('| cmd = ', 'cyan') + \
colored(cmd, 'green', attrs=['bold'])
return s | python | def shortcut_str(self, path, cmd):
"""
Get a string with colors describing a shortcut
"""
s = colored('| path = ', 'cyan') + colored(path, 'yellow') + '\n' \
+ colored('| cmd = ', 'cyan') + \
colored(cmd, 'green', attrs=['bold'])
return s | [
"def",
"shortcut_str",
"(",
"self",
",",
"path",
",",
"cmd",
")",
":",
"s",
"=",
"colored",
"(",
"'| path = '",
",",
"'cyan'",
")",
"+",
"colored",
"(",
"path",
",",
"'yellow'",
")",
"+",
"'\\n'",
"+",
"colored",
"(",
"'| cmd = '",
",",
"'cyan'",
")... | Get a string with colors describing a shortcut | [
"Get",
"a",
"string",
"with",
"colors",
"describing",
"a",
"shortcut"
] | 469436720533e9a601226ec1414f294d94d68a53 | https://github.com/itsnauman/jumprun/blob/469436720533e9a601226ec1414f294d94d68a53/jumprun.py#L191-L200 |
244,932 | fogcitymarathoner/s3_mysql_backup | s3_mysql_backup/scripts/delete_bucket.py | delete_bucket | def delete_bucket():
"""
Delete S3 Bucket
"""
args = parser.parse_args
s3_bucket(args.aws_access_key_id, args.aws_secret_access_key, args.bucket_name)().delete() | python | def delete_bucket():
"""
Delete S3 Bucket
"""
args = parser.parse_args
s3_bucket(args.aws_access_key_id, args.aws_secret_access_key, args.bucket_name)().delete() | [
"def",
"delete_bucket",
"(",
")",
":",
"args",
"=",
"parser",
".",
"parse_args",
"s3_bucket",
"(",
"args",
".",
"aws_access_key_id",
",",
"args",
".",
"aws_secret_access_key",
",",
"args",
".",
"bucket_name",
")",
"(",
")",
".",
"delete",
"(",
")"
] | Delete S3 Bucket | [
"Delete",
"S3",
"Bucket"
] | 8a0fb3e51a7b873eb4287d4954548a0dbab0e734 | https://github.com/fogcitymarathoner/s3_mysql_backup/blob/8a0fb3e51a7b873eb4287d4954548a0dbab0e734/s3_mysql_backup/scripts/delete_bucket.py#L13-L18 |
244,933 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | ec2Client.check_instance_status | def check_instance_status(self, instance_id, wait=True):
'''
a method to wait until AWS instance reports an OK status
:param instance_id: string of instance id on AWS
:param wait: [optional] boolean to wait for instance while initializing
:return: True
'''
... | python | def check_instance_status(self, instance_id, wait=True):
'''
a method to wait until AWS instance reports an OK status
:param instance_id: string of instance id on AWS
:param wait: [optional] boolean to wait for instance while initializing
:return: True
'''
... | [
"def",
"check_instance_status",
"(",
"self",
",",
"instance_id",
",",
"wait",
"=",
"True",
")",
":",
"title",
"=",
"'%s.check_instance_status'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs",
"input_fields",
"=",
"{",
"'instance_id'",
":",
... | a method to wait until AWS instance reports an OK status
:param instance_id: string of instance id on AWS
:param wait: [optional] boolean to wait for instance while initializing
:return: True | [
"a",
"method",
"to",
"wait",
"until",
"AWS",
"instance",
"reports",
"an",
"OK",
"status"
] | 52949ece35e72e3cc308f54d9ffa6bfbd96805b8 | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L162-L233 |
244,934 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | ec2Client.list_instances | def list_instances(self, tag_values=None):
'''
a method to retrieve the list of instances on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of strings with instance AWS ids
'''
title = '%s.list_instances' % self.__class__.__name__
# val... | python | def list_instances(self, tag_values=None):
'''
a method to retrieve the list of instances on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of strings with instance AWS ids
'''
title = '%s.list_instances' % self.__class__.__name__
# val... | [
"def",
"list_instances",
"(",
"self",
",",
"tag_values",
"=",
"None",
")",
":",
"title",
"=",
"'%s.list_instances'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs",
"input_fields",
"=",
"{",
"'tag_values'",
":",
"tag_values",
"}",
"for",
"... | a method to retrieve the list of instances on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of strings with instance AWS ids | [
"a",
"method",
"to",
"retrieve",
"the",
"list",
"of",
"instances",
"on",
"AWS",
"EC2"
] | 52949ece35e72e3cc308f54d9ffa6bfbd96805b8 | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L235-L312 |
244,935 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | ec2Client.read_instance | def read_instance(self, instance_id):
'''
a method to retrieving the details of a single instances on AWS EC2
:param instance_id: string of instance id on AWS
:return: dictionary with instance attributes
relevant fields:
'instance_id': '',
'image_i... | python | def read_instance(self, instance_id):
'''
a method to retrieving the details of a single instances on AWS EC2
:param instance_id: string of instance id on AWS
:return: dictionary with instance attributes
relevant fields:
'instance_id': '',
'image_i... | [
"def",
"read_instance",
"(",
"self",
",",
"instance_id",
")",
":",
"title",
"=",
"'%s.read_instance'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs",
"input_fields",
"=",
"{",
"'instance_id'",
":",
"instance_id",
"}",
"for",
"key",
",",
"... | a method to retrieving the details of a single instances on AWS EC2
:param instance_id: string of instance id on AWS
:return: dictionary with instance attributes
relevant fields:
'instance_id': '',
'image_id': '',
'instance_type': '',
'region': '',
... | [
"a",
"method",
"to",
"retrieving",
"the",
"details",
"of",
"a",
"single",
"instances",
"on",
"AWS",
"EC2"
] | 52949ece35e72e3cc308f54d9ffa6bfbd96805b8 | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L314-L387 |
244,936 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | ec2Client.delete_instance | def delete_instance(self, instance_id):
'''
method for removing an instance from AWS EC2
:param instance_id: string of instance id on AWS
:return: string reporting state of instance
'''
title = '%s.delete_instance' % self.__class__.__name__
# validate inputs
... | python | def delete_instance(self, instance_id):
'''
method for removing an instance from AWS EC2
:param instance_id: string of instance id on AWS
:return: string reporting state of instance
'''
title = '%s.delete_instance' % self.__class__.__name__
# validate inputs
... | [
"def",
"delete_instance",
"(",
"self",
",",
"instance_id",
")",
":",
"title",
"=",
"'%s.delete_instance'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs",
"input_fields",
"=",
"{",
"'instance_id'",
":",
"instance_id",
"}",
"for",
"key",
",",... | method for removing an instance from AWS EC2
:param instance_id: string of instance id on AWS
:return: string reporting state of instance | [
"method",
"for",
"removing",
"an",
"instance",
"from",
"AWS",
"EC2"
] | 52949ece35e72e3cc308f54d9ffa6bfbd96805b8 | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L613-L685 |
244,937 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | ec2Client.list_images | def list_images(self, tag_values=None):
'''
a method to retrieve the list of images of account on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of image AWS ids
'''
title = '%s.list_images' % self.__class__.__name__
# validate inputs
... | python | def list_images(self, tag_values=None):
'''
a method to retrieve the list of images of account on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of image AWS ids
'''
title = '%s.list_images' % self.__class__.__name__
# validate inputs
... | [
"def",
"list_images",
"(",
"self",
",",
"tag_values",
"=",
"None",
")",
":",
"title",
"=",
"'%s.list_images'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs",
"input_fields",
"=",
"{",
"'tag_values'",
":",
"tag_values",
"}",
"for",
"key",
... | a method to retrieve the list of images of account on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of image AWS ids | [
"a",
"method",
"to",
"retrieve",
"the",
"list",
"of",
"images",
"of",
"account",
"on",
"AWS",
"EC2"
] | 52949ece35e72e3cc308f54d9ffa6bfbd96805b8 | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L918-L1000 |
244,938 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | ec2Client.read_image | def read_image(self, image_id):
'''
a method to retrieve the details of a single image on AWS EC2
:param image_id: string with AWS id of image
:return: dictionary of image attributes
relevant fields:
'image_id': '',
'snapshot_id': '',
'regi... | python | def read_image(self, image_id):
'''
a method to retrieve the details of a single image on AWS EC2
:param image_id: string with AWS id of image
:return: dictionary of image attributes
relevant fields:
'image_id': '',
'snapshot_id': '',
'regi... | [
"def",
"read_image",
"(",
"self",
",",
"image_id",
")",
":",
"title",
"=",
"'%s.read_image'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs",
"input_fields",
"=",
"{",
"'image_id'",
":",
"image_id",
"}",
"for",
"key",
",",
"value",
"in",... | a method to retrieve the details of a single image on AWS EC2
:param image_id: string with AWS id of image
:return: dictionary of image attributes
relevant fields:
'image_id': '',
'snapshot_id': '',
'region': '',
'state': '',
'tags': [] | [
"a",
"method",
"to",
"retrieve",
"the",
"details",
"of",
"a",
"single",
"image",
"on",
"AWS",
"EC2"
] | 52949ece35e72e3cc308f54d9ffa6bfbd96805b8 | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1002-L1055 |
244,939 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | ec2Client.delete_image | def delete_image(self, image_id):
'''
method for removing an image from AWS EC2
:param image_id: string with AWS id of instance
:return: string with AWS response from snapshot delete
'''
title = '%s.delete_image' % self.__class__.__name__
# validate inputs
... | python | def delete_image(self, image_id):
'''
method for removing an image from AWS EC2
:param image_id: string with AWS id of instance
:return: string with AWS response from snapshot delete
'''
title = '%s.delete_image' % self.__class__.__name__
# validate inputs
... | [
"def",
"delete_image",
"(",
"self",
",",
"image_id",
")",
":",
"title",
"=",
"'%s.delete_image'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs",
"input_fields",
"=",
"{",
"'image_id'",
":",
"image_id",
"}",
"for",
"key",
",",
"value",
"... | method for removing an image from AWS EC2
:param image_id: string with AWS id of instance
:return: string with AWS response from snapshot delete | [
"method",
"for",
"removing",
"an",
"image",
"from",
"AWS",
"EC2"
] | 52949ece35e72e3cc308f54d9ffa6bfbd96805b8 | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1239-L1298 |
244,940 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | ec2Client.list_keypairs | def list_keypairs(self):
'''
a method to discover the list of key pairs on AWS
:return: list of key pairs
'''
title = '%s.list_keypairs' % self.__class__.__name__
# request subnet list from AWS
self.iam.printer('Querying AWS region %s for key pairs.' % self.ia... | python | def list_keypairs(self):
'''
a method to discover the list of key pairs on AWS
:return: list of key pairs
'''
title = '%s.list_keypairs' % self.__class__.__name__
# request subnet list from AWS
self.iam.printer('Querying AWS region %s for key pairs.' % self.ia... | [
"def",
"list_keypairs",
"(",
"self",
")",
":",
"title",
"=",
"'%s.list_keypairs'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# request subnet list from AWS",
"self",
".",
"iam",
".",
"printer",
"(",
"'Querying AWS region %s for key pairs.'",
"%",
"self",
".",... | a method to discover the list of key pairs on AWS
:return: list of key pairs | [
"a",
"method",
"to",
"discover",
"the",
"list",
"of",
"key",
"pairs",
"on",
"AWS"
] | 52949ece35e72e3cc308f54d9ffa6bfbd96805b8 | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1564-L1600 |
244,941 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | ec2Client.list_subnets | def list_subnets(self, tag_values=None):
'''
a method to discover the list of subnets on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of strings with subnet ids
'''
title = '%s.list_subnets' % self.__class__.__name__
# validate inputs... | python | def list_subnets(self, tag_values=None):
'''
a method to discover the list of subnets on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of strings with subnet ids
'''
title = '%s.list_subnets' % self.__class__.__name__
# validate inputs... | [
"def",
"list_subnets",
"(",
"self",
",",
"tag_values",
"=",
"None",
")",
":",
"title",
"=",
"'%s.list_subnets'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs",
"input_fields",
"=",
"{",
"'tag_values'",
":",
"tag_values",
"}",
"for",
"key"... | a method to discover the list of subnets on AWS EC2
:param tag_values: [optional] list of tag values
:return: list of strings with subnet ids | [
"a",
"method",
"to",
"discover",
"the",
"list",
"of",
"subnets",
"on",
"AWS",
"EC2"
] | 52949ece35e72e3cc308f54d9ffa6bfbd96805b8 | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1602-L1664 |
244,942 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | ec2Client.read_subnet | def read_subnet(self, subnet_id):
'''
a method to retrieve the details about a subnet
:param subnet_id: string with AWS id of subnet
:return: dictionary with subnet details
relevant fields:
'subnet_id': '',
'vpc_id': '',
'availability_zone'... | python | def read_subnet(self, subnet_id):
'''
a method to retrieve the details about a subnet
:param subnet_id: string with AWS id of subnet
:return: dictionary with subnet details
relevant fields:
'subnet_id': '',
'vpc_id': '',
'availability_zone'... | [
"def",
"read_subnet",
"(",
"self",
",",
"subnet_id",
")",
":",
"title",
"=",
"'%s.read_subnet'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs",
"input_fields",
"=",
"{",
"'subnet_id'",
":",
"subnet_id",
"}",
"for",
"key",
",",
"value",
... | a method to retrieve the details about a subnet
:param subnet_id: string with AWS id of subnet
:return: dictionary with subnet details
relevant fields:
'subnet_id': '',
'vpc_id': '',
'availability_zone': '',
'state': '',
'tags': [{'key': '', 'va... | [
"a",
"method",
"to",
"retrieve",
"the",
"details",
"about",
"a",
"subnet"
] | 52949ece35e72e3cc308f54d9ffa6bfbd96805b8 | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1666-L1716 |
244,943 | collectiveacuity/labPack | labpack/platforms/aws/ec2.py | ec2Client.read_security_group | def read_security_group(self, group_id):
'''
a method to retrieve the details about a security group
:param group_id: string with AWS id of security group
:return: dictionary with security group details
relevant fields:
'group_id: '',
'vpc_id': '',... | python | def read_security_group(self, group_id):
'''
a method to retrieve the details about a security group
:param group_id: string with AWS id of security group
:return: dictionary with security group details
relevant fields:
'group_id: '',
'vpc_id': '',... | [
"def",
"read_security_group",
"(",
"self",
",",
"group_id",
")",
":",
"title",
"=",
"'%s.read_security_group'",
"%",
"self",
".",
"__class__",
".",
"__name__",
"# validate inputs",
"input_fields",
"=",
"{",
"'group_id'",
":",
"group_id",
"}",
"for",
"key",
",",
... | a method to retrieve the details about a security group
:param group_id: string with AWS id of security group
:return: dictionary with security group details
relevant fields:
'group_id: '',
'vpc_id': '',
'group_name': '',
'tags': [{'key': '', 'value': '... | [
"a",
"method",
"to",
"retrieve",
"the",
"details",
"about",
"a",
"security",
"group"
] | 52949ece35e72e3cc308f54d9ffa6bfbd96805b8 | https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/platforms/aws/ec2.py#L1782-L1835 |
244,944 | neumark/microcli | microcli.py | GlobalOptionParser.print_help | def print_help(self, file=None):
""" recursively call all command parsers' helps """
output = file or self.stderr
CustomStderrOptionParser.print_help(self, output)
output.write("\nCommands:\n")
for command_def in self.command_definitions.values():
command_def.opt_pars... | python | def print_help(self, file=None):
""" recursively call all command parsers' helps """
output = file or self.stderr
CustomStderrOptionParser.print_help(self, output)
output.write("\nCommands:\n")
for command_def in self.command_definitions.values():
command_def.opt_pars... | [
"def",
"print_help",
"(",
"self",
",",
"file",
"=",
"None",
")",
":",
"output",
"=",
"file",
"or",
"self",
".",
"stderr",
"CustomStderrOptionParser",
".",
"print_help",
"(",
"self",
",",
"output",
")",
"output",
".",
"write",
"(",
"\"\\nCommands:\\n\"",
")... | recursively call all command parsers' helps | [
"recursively",
"call",
"all",
"command",
"parsers",
"helps"
] | fa31a35a95f63593ca12d246a5a84e2dff522dd6 | https://github.com/neumark/microcli/blob/fa31a35a95f63593ca12d246a5a84e2dff522dd6/microcli.py#L151-L158 |
244,945 | theirc/rapidsms-multitenancy | multitenancy/auth.py | get_user_groups | def get_user_groups(user):
"""Return the set of associated TenantGroups for the given user."""
if user.is_active and user.is_authenticated():
if user.is_superuser:
return TenantGroup.objects.all()
else:
return TenantGroup.objects.filter(tenantrole__user=user).distinct()
... | python | def get_user_groups(user):
"""Return the set of associated TenantGroups for the given user."""
if user.is_active and user.is_authenticated():
if user.is_superuser:
return TenantGroup.objects.all()
else:
return TenantGroup.objects.filter(tenantrole__user=user).distinct()
... | [
"def",
"get_user_groups",
"(",
"user",
")",
":",
"if",
"user",
".",
"is_active",
"and",
"user",
".",
"is_authenticated",
"(",
")",
":",
"if",
"user",
".",
"is_superuser",
":",
"return",
"TenantGroup",
".",
"objects",
".",
"all",
"(",
")",
"else",
":",
... | Return the set of associated TenantGroups for the given user. | [
"Return",
"the",
"set",
"of",
"associated",
"TenantGroups",
"for",
"the",
"given",
"user",
"."
] | 121bd0a628e691a88aade2e10045cba43af2dfcb | https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/auth.py#L7-L15 |
244,946 | theirc/rapidsms-multitenancy | multitenancy/auth.py | get_user_tenants | def get_user_tenants(user, group):
"""Return the set of associated Tenants for the given user and group."""
if user.is_active and user.is_authenticated():
if user.is_superuser or is_group_manager(user, group.pk):
return Tenant.objects.filter(group=group)
else:
return Tena... | python | def get_user_tenants(user, group):
"""Return the set of associated Tenants for the given user and group."""
if user.is_active and user.is_authenticated():
if user.is_superuser or is_group_manager(user, group.pk):
return Tenant.objects.filter(group=group)
else:
return Tena... | [
"def",
"get_user_tenants",
"(",
"user",
",",
"group",
")",
":",
"if",
"user",
".",
"is_active",
"and",
"user",
".",
"is_authenticated",
"(",
")",
":",
"if",
"user",
".",
"is_superuser",
"or",
"is_group_manager",
"(",
"user",
",",
"group",
".",
"pk",
")",... | Return the set of associated Tenants for the given user and group. | [
"Return",
"the",
"set",
"of",
"associated",
"Tenants",
"for",
"the",
"given",
"user",
"and",
"group",
"."
] | 121bd0a628e691a88aade2e10045cba43af2dfcb | https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/auth.py#L18-L26 |
244,947 | theirc/rapidsms-multitenancy | multitenancy/auth.py | get_user_roles | def get_user_roles(user):
"""Return a list of all of the user's roles."""
if not hasattr(user, '_role_cache'):
user._role_cache = list(TenantRole.objects.filter(user=user).values_list(
'group', 'role', 'tenant'))
return user._role_cache | python | def get_user_roles(user):
"""Return a list of all of the user's roles."""
if not hasattr(user, '_role_cache'):
user._role_cache = list(TenantRole.objects.filter(user=user).values_list(
'group', 'role', 'tenant'))
return user._role_cache | [
"def",
"get_user_roles",
"(",
"user",
")",
":",
"if",
"not",
"hasattr",
"(",
"user",
",",
"'_role_cache'",
")",
":",
"user",
".",
"_role_cache",
"=",
"list",
"(",
"TenantRole",
".",
"objects",
".",
"filter",
"(",
"user",
"=",
"user",
")",
".",
"values_... | Return a list of all of the user's roles. | [
"Return",
"a",
"list",
"of",
"all",
"of",
"the",
"user",
"s",
"roles",
"."
] | 121bd0a628e691a88aade2e10045cba43af2dfcb | https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/auth.py#L29-L34 |
244,948 | theirc/rapidsms-multitenancy | multitenancy/auth.py | is_group_manager | def is_group_manager(user, group=None):
"""Returns True if user is a group manager either for the group or any group."""
roles = get_user_roles(user)
return any(x[1] == TenantRole.ROLE_GROUP_MANAGER and (not group or x[0] == group) for x in roles) | python | def is_group_manager(user, group=None):
"""Returns True if user is a group manager either for the group or any group."""
roles = get_user_roles(user)
return any(x[1] == TenantRole.ROLE_GROUP_MANAGER and (not group or x[0] == group) for x in roles) | [
"def",
"is_group_manager",
"(",
"user",
",",
"group",
"=",
"None",
")",
":",
"roles",
"=",
"get_user_roles",
"(",
"user",
")",
"return",
"any",
"(",
"x",
"[",
"1",
"]",
"==",
"TenantRole",
".",
"ROLE_GROUP_MANAGER",
"and",
"(",
"not",
"group",
"or",
"x... | Returns True if user is a group manager either for the group or any group. | [
"Returns",
"True",
"if",
"user",
"is",
"a",
"group",
"manager",
"either",
"for",
"the",
"group",
"or",
"any",
"group",
"."
] | 121bd0a628e691a88aade2e10045cba43af2dfcb | https://github.com/theirc/rapidsms-multitenancy/blob/121bd0a628e691a88aade2e10045cba43af2dfcb/multitenancy/auth.py#L37-L40 |
244,949 | nefarioustim/parker | parker/consumepage.py | get_instance | def get_instance(page_to_consume):
"""Return an instance of ConsumePage."""
global _instances
if isinstance(page_to_consume, basestring):
uri = page_to_consume
page_to_consume = page.get_instance(uri)
elif isinstance(page_to_consume, page.Page):
uri = page_to_consume.uri
else... | python | def get_instance(page_to_consume):
"""Return an instance of ConsumePage."""
global _instances
if isinstance(page_to_consume, basestring):
uri = page_to_consume
page_to_consume = page.get_instance(uri)
elif isinstance(page_to_consume, page.Page):
uri = page_to_consume.uri
else... | [
"def",
"get_instance",
"(",
"page_to_consume",
")",
":",
"global",
"_instances",
"if",
"isinstance",
"(",
"page_to_consume",
",",
"basestring",
")",
":",
"uri",
"=",
"page_to_consume",
"page_to_consume",
"=",
"page",
".",
"get_instance",
"(",
"uri",
")",
"elif",... | Return an instance of ConsumePage. | [
"Return",
"an",
"instance",
"of",
"ConsumePage",
"."
] | ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6 | https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/consumepage.py#L12-L36 |
244,950 | nefarioustim/parker | parker/consumepage.py | ConsumePage.get_key_value_dict_by_selectors | def get_key_value_dict_by_selectors(
self, key_selector, value_selector, value_sub_selector=None
):
"""Return a dictionary of key value data."""
key_nodes = self.parsedpage.get_nodes_by_selector(key_selector)
keys = [
self.parsedpage.get_text_from_node(node)
f... | python | def get_key_value_dict_by_selectors(
self, key_selector, value_selector, value_sub_selector=None
):
"""Return a dictionary of key value data."""
key_nodes = self.parsedpage.get_nodes_by_selector(key_selector)
keys = [
self.parsedpage.get_text_from_node(node)
f... | [
"def",
"get_key_value_dict_by_selectors",
"(",
"self",
",",
"key_selector",
",",
"value_selector",
",",
"value_sub_selector",
"=",
"None",
")",
":",
"key_nodes",
"=",
"self",
".",
"parsedpage",
".",
"get_nodes_by_selector",
"(",
"key_selector",
")",
"keys",
"=",
"... | Return a dictionary of key value data. | [
"Return",
"a",
"dictionary",
"of",
"key",
"value",
"data",
"."
] | ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6 | https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/consumepage.py#L53-L78 |
244,951 | nefarioustim/parker | parker/consumepage.py | ConsumePage.get_crumb_list_by_selector | def get_crumb_list_by_selector(self, crumb_selector):
"""Return a list of crumbs."""
return [
self.parsedpage.get_text_from_node(crumb)
for crumb in self.parsedpage.get_nodes_by_selector(crumb_selector)
] | python | def get_crumb_list_by_selector(self, crumb_selector):
"""Return a list of crumbs."""
return [
self.parsedpage.get_text_from_node(crumb)
for crumb in self.parsedpage.get_nodes_by_selector(crumb_selector)
] | [
"def",
"get_crumb_list_by_selector",
"(",
"self",
",",
"crumb_selector",
")",
":",
"return",
"[",
"self",
".",
"parsedpage",
".",
"get_text_from_node",
"(",
"crumb",
")",
"for",
"crumb",
"in",
"self",
".",
"parsedpage",
".",
"get_nodes_by_selector",
"(",
"crumb_... | Return a list of crumbs. | [
"Return",
"a",
"list",
"of",
"crumbs",
"."
] | ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6 | https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/consumepage.py#L80-L85 |
244,952 | nefarioustim/parker | parker/consumepage.py | ConsumePage.get_media_list_by_selector | def get_media_list_by_selector(
self, media_selector, media_attribute="src"
):
"""Return a list of media."""
page_url = urlparse.urlparse(self.uri)
return [
mediafile.get_instance(
urlparse.urljoin(
"%s://%s" % (
... | python | def get_media_list_by_selector(
self, media_selector, media_attribute="src"
):
"""Return a list of media."""
page_url = urlparse.urlparse(self.uri)
return [
mediafile.get_instance(
urlparse.urljoin(
"%s://%s" % (
... | [
"def",
"get_media_list_by_selector",
"(",
"self",
",",
"media_selector",
",",
"media_attribute",
"=",
"\"src\"",
")",
":",
"page_url",
"=",
"urlparse",
".",
"urlparse",
"(",
"self",
".",
"uri",
")",
"return",
"[",
"mediafile",
".",
"get_instance",
"(",
"urlpar... | Return a list of media. | [
"Return",
"a",
"list",
"of",
"media",
"."
] | ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6 | https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/consumepage.py#L87-L106 |
244,953 | nefarioustim/parker | parker/consumepage.py | ConsumePage.get_data_dict_from_config | def get_data_dict_from_config(self, config_dict):
"""Return a dictionary of data inferred from config_dict."""
return {
key: self.parsedpage.get_filtered_values_by_selector(
item_dict['selector'],
item_dict.get('regex_filter', None),
item_dict.... | python | def get_data_dict_from_config(self, config_dict):
"""Return a dictionary of data inferred from config_dict."""
return {
key: self.parsedpage.get_filtered_values_by_selector(
item_dict['selector'],
item_dict.get('regex_filter', None),
item_dict.... | [
"def",
"get_data_dict_from_config",
"(",
"self",
",",
"config_dict",
")",
":",
"return",
"{",
"key",
":",
"self",
".",
"parsedpage",
".",
"get_filtered_values_by_selector",
"(",
"item_dict",
"[",
"'selector'",
"]",
",",
"item_dict",
".",
"get",
"(",
"'regex_filt... | Return a dictionary of data inferred from config_dict. | [
"Return",
"a",
"dictionary",
"of",
"data",
"inferred",
"from",
"config_dict",
"."
] | ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6 | https://github.com/nefarioustim/parker/blob/ccc1de1ac6bfb5e0a8cfa4fdebb2f38f2ee027d6/parker/consumepage.py#L108-L118 |
244,954 | edwards-lab/MVtest | scripts/mvmany.py | generate_jobs | def generate_jobs(args, job_list, argument_string):
"""Generate actual scripts to be submitted to the cluster
:param args: argparse argument collection
:param job_list: dictionary containing each each job to be submitted
:param argument_string: string containing general arguments to be used by mvtest.p... | python | def generate_jobs(args, job_list, argument_string):
"""Generate actual scripts to be submitted to the cluster
:param args: argparse argument collection
:param job_list: dictionary containing each each job to be submitted
:param argument_string: string containing general arguments to be used by mvtest.p... | [
"def",
"generate_jobs",
"(",
"args",
",",
"job_list",
",",
"argument_string",
")",
":",
"mvtest_path",
"=",
"args",
".",
"mvpath",
"template",
"=",
"\"\"",
".",
"join",
"(",
"args",
".",
"template",
".",
"readlines",
"(",
")",
")",
"logpath",
"=",
"os",
... | Generate actual scripts to be submitted to the cluster
:param args: argparse argument collection
:param job_list: dictionary containing each each job to be submitted
:param argument_string: string containing general arguments to be used by mvtest.py during execution
:return: None | [
"Generate",
"actual",
"scripts",
"to",
"be",
"submitted",
"to",
"the",
"cluster"
] | fe8cf627464ef59d68b7eda628a19840d033882f | https://github.com/edwards-lab/MVtest/blob/fe8cf627464ef59d68b7eda628a19840d033882f/scripts/mvmany.py#L45-L73 |
244,955 | edwards-lab/MVtest | scripts/mvmany.py | get_template_file | def get_template_file(args):
"""Returns valid template file, generating the default template file if it doesn't exist and one wasn't
specified on command line.
:param args: Argument collection as generated by parseargs
:return file"""
if args.template is None:
template_filename = os.geten... | python | def get_template_file(args):
"""Returns valid template file, generating the default template file if it doesn't exist and one wasn't
specified on command line.
:param args: Argument collection as generated by parseargs
:return file"""
if args.template is None:
template_filename = os.geten... | [
"def",
"get_template_file",
"(",
"args",
")",
":",
"if",
"args",
".",
"template",
"is",
"None",
":",
"template_filename",
"=",
"os",
".",
"getenv",
"(",
"\"HOME\"",
")",
"+",
"\"/.mvmany.template\"",
"try",
":",
"template_filename",
"=",
"open",
"(",
"templa... | Returns valid template file, generating the default template file if it doesn't exist and one wasn't
specified on command line.
:param args: Argument collection as generated by parseargs
:return file | [
"Returns",
"valid",
"template",
"file",
"generating",
"the",
"default",
"template",
"file",
"if",
"it",
"doesn",
"t",
"exist",
"and",
"one",
"wasn",
"t",
"specified",
"on",
"command",
"line",
"."
] | fe8cf627464ef59d68b7eda628a19840d033882f | https://github.com/edwards-lab/MVtest/blob/fe8cf627464ef59d68b7eda628a19840d033882f/scripts/mvmany.py#L81-L111 |
244,956 | edwards-lab/MVtest | scripts/mvmany.py | split_mach_jobs | def split_mach_jobs(args, filename):
"""Parse the MACH file and generate the list of jobs.
:param args: Arguments from parseargs
:param filename: name of file containing list of mach dosage files
:return jobs to be run
"""
max_snp_count = args.snps_per_job
job_list = {}
cur = None
... | python | def split_mach_jobs(args, filename):
"""Parse the MACH file and generate the list of jobs.
:param args: Arguments from parseargs
:param filename: name of file containing list of mach dosage files
:return jobs to be run
"""
max_snp_count = args.snps_per_job
job_list = {}
cur = None
... | [
"def",
"split_mach_jobs",
"(",
"args",
",",
"filename",
")",
":",
"max_snp_count",
"=",
"args",
".",
"snps_per_job",
"job_list",
"=",
"{",
"}",
"cur",
"=",
"None",
"last_pos",
"=",
"None",
"job_string",
"=",
"\"\"",
"job_name",
"=",
"\"\"",
"mach_count",
"... | Parse the MACH file and generate the list of jobs.
:param args: Arguments from parseargs
:param filename: name of file containing list of mach dosage files
:return jobs to be run | [
"Parse",
"the",
"MACH",
"file",
"and",
"generate",
"the",
"list",
"of",
"jobs",
"."
] | fe8cf627464ef59d68b7eda628a19840d033882f | https://github.com/edwards-lab/MVtest/blob/fe8cf627464ef59d68b7eda628a19840d033882f/scripts/mvmany.py#L113-L148 |
244,957 | edwards-lab/MVtest | scripts/mvmany.py | split_impute_jobs | def split_impute_jobs(args, filename):
"""Parse the IMPUTE file and generate the list of jobs.
:param args: parsearg object containing command line arguments
:filename args: file containing the IMPUTE gen files and chromosome numbers
"""
max_snp_count = args.snps_per_job
if args.impute_coun... | python | def split_impute_jobs(args, filename):
"""Parse the IMPUTE file and generate the list of jobs.
:param args: parsearg object containing command line arguments
:filename args: file containing the IMPUTE gen files and chromosome numbers
"""
max_snp_count = args.snps_per_job
if args.impute_coun... | [
"def",
"split_impute_jobs",
"(",
"args",
",",
"filename",
")",
":",
"max_snp_count",
"=",
"args",
".",
"snps_per_job",
"if",
"args",
".",
"impute_count",
":",
"impute_count",
"=",
"args",
".",
"impute_count",
"else",
":",
"impute_count",
"=",
"1",
"ExitIf",
... | Parse the IMPUTE file and generate the list of jobs.
:param args: parsearg object containing command line arguments
:filename args: file containing the IMPUTE gen files and chromosome numbers | [
"Parse",
"the",
"IMPUTE",
"file",
"and",
"generate",
"the",
"list",
"of",
"jobs",
"."
] | fe8cf627464ef59d68b7eda628a19840d033882f | https://github.com/edwards-lab/MVtest/blob/fe8cf627464ef59d68b7eda628a19840d033882f/scripts/mvmany.py#L150-L241 |
244,958 | edwards-lab/MVtest | scripts/mvmany.py | split_chrom_jobs | def split_chrom_jobs(args, chrom_file):
"""Split up GWAS jobs based on portions of a chromosome
:param args: arguments from parseargs
:param chrom_file: marker info file
:return dictionary name=>job_details
"""
max_snp_count = args.snps_per_job
poscol = 3
if args.map3:
poscol ... | python | def split_chrom_jobs(args, chrom_file):
"""Split up GWAS jobs based on portions of a chromosome
:param args: arguments from parseargs
:param chrom_file: marker info file
:return dictionary name=>job_details
"""
max_snp_count = args.snps_per_job
poscol = 3
if args.map3:
poscol ... | [
"def",
"split_chrom_jobs",
"(",
"args",
",",
"chrom_file",
")",
":",
"max_snp_count",
"=",
"args",
".",
"snps_per_job",
"poscol",
"=",
"3",
"if",
"args",
".",
"map3",
":",
"poscol",
"=",
"2",
"job_list",
"=",
"{",
"}",
"cur",
"=",
"None",
"last_pos",
"... | Split up GWAS jobs based on portions of a chromosome
:param args: arguments from parseargs
:param chrom_file: marker info file
:return dictionary name=>job_details | [
"Split",
"up",
"GWAS",
"jobs",
"based",
"on",
"portions",
"of",
"a",
"chromosome"
] | fe8cf627464ef59d68b7eda628a19840d033882f | https://github.com/edwards-lab/MVtest/blob/fe8cf627464ef59d68b7eda628a19840d033882f/scripts/mvmany.py#L243-L300 |
244,959 | CS207-Final-Project-Group-10/cs207-FinalProject | fluxions/fluxion_node.py | Fluxion.diff | def diff(self, *args):
"""Call forward_mode; discard value, only keep the derivative."""
arg_dicts = self._parse_args_forward_mode(*args)
val, diff = self._forward_mode(*arg_dicts)
return diff | python | def diff(self, *args):
"""Call forward_mode; discard value, only keep the derivative."""
arg_dicts = self._parse_args_forward_mode(*args)
val, diff = self._forward_mode(*arg_dicts)
return diff | [
"def",
"diff",
"(",
"self",
",",
"*",
"args",
")",
":",
"arg_dicts",
"=",
"self",
".",
"_parse_args_forward_mode",
"(",
"*",
"args",
")",
"val",
",",
"diff",
"=",
"self",
".",
"_forward_mode",
"(",
"*",
"arg_dicts",
")",
"return",
"diff"
] | Call forward_mode; discard value, only keep the derivative. | [
"Call",
"forward_mode",
";",
"discard",
"value",
"only",
"keep",
"the",
"derivative",
"."
] | 842e9c2d3ca1490cef18c086dfde81856d8d3a82 | https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/fluxions/fluxion_node.py#L58-L62 |
244,960 | CS207-Final-Project-Group-10/cs207-FinalProject | fluxions/fluxion_node.py | Fluxion._check_forward_mode_input_dict | def _check_forward_mode_input_dict(self, var_tbl: dict) -> int:
"""
Check whether one forward mode input dict has elements of valid shape
Returns inferred value of T
"""
T: int = 1
for var_name in var_tbl:
# The bound value to this variable name
va... | python | def _check_forward_mode_input_dict(self, var_tbl: dict) -> int:
"""
Check whether one forward mode input dict has elements of valid shape
Returns inferred value of T
"""
T: int = 1
for var_name in var_tbl:
# The bound value to this variable name
va... | [
"def",
"_check_forward_mode_input_dict",
"(",
"self",
",",
"var_tbl",
":",
"dict",
")",
"->",
"int",
":",
"T",
":",
"int",
"=",
"1",
"for",
"var_name",
"in",
"var_tbl",
":",
"# The bound value to this variable name",
"val",
"=",
"var_tbl",
"[",
"var_name",
"]"... | Check whether one forward mode input dict has elements of valid shape
Returns inferred value of T | [
"Check",
"whether",
"one",
"forward",
"mode",
"input",
"dict",
"has",
"elements",
"of",
"valid",
"shape",
"Returns",
"inferred",
"value",
"of",
"T"
] | 842e9c2d3ca1490cef18c086dfde81856d8d3a82 | https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/fluxions/fluxion_node.py#L250-L273 |
244,961 | CS207-Final-Project-Group-10/cs207-FinalProject | fluxions/fluxion_node.py | Fluxion._check_forward_mode_input_array | def _check_forward_mode_input_array(self, X: np.ndarray) -> int:
"""
Check whether one forward mode input array is of valid shape
Returns inferred value of T
"""
# Find the length of each variable to infer T
if not isinstance(X, np.ndarray):
raise ValueError('... | python | def _check_forward_mode_input_array(self, X: np.ndarray) -> int:
"""
Check whether one forward mode input array is of valid shape
Returns inferred value of T
"""
# Find the length of each variable to infer T
if not isinstance(X, np.ndarray):
raise ValueError('... | [
"def",
"_check_forward_mode_input_array",
"(",
"self",
",",
"X",
":",
"np",
".",
"ndarray",
")",
"->",
"int",
":",
"# Find the length of each variable to infer T",
"if",
"not",
"isinstance",
"(",
"X",
",",
"np",
".",
"ndarray",
")",
":",
"raise",
"ValueError",
... | Check whether one forward mode input array is of valid shape
Returns inferred value of T | [
"Check",
"whether",
"one",
"forward",
"mode",
"input",
"array",
"is",
"of",
"valid",
"shape",
"Returns",
"inferred",
"value",
"of",
"T"
] | 842e9c2d3ca1490cef18c086dfde81856d8d3a82 | https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/fluxions/fluxion_node.py#L275-L305 |
244,962 | CS207-Final-Project-Group-10/cs207-FinalProject | fluxions/fluxion_node.py | Fluxion._calc_T_var | def _calc_T_var(self,X) -> int:
"""Calculate the number of samples, T, from the shape of X"""
shape = X.shape
tensor_rank: int = len(shape)
if tensor_rank == 0:
return 1
if tensor_rank == 1:
return shape[0]
if tensor_rank == 2:
if shape... | python | def _calc_T_var(self,X) -> int:
"""Calculate the number of samples, T, from the shape of X"""
shape = X.shape
tensor_rank: int = len(shape)
if tensor_rank == 0:
return 1
if tensor_rank == 1:
return shape[0]
if tensor_rank == 2:
if shape... | [
"def",
"_calc_T_var",
"(",
"self",
",",
"X",
")",
"->",
"int",
":",
"shape",
"=",
"X",
".",
"shape",
"tensor_rank",
":",
"int",
"=",
"len",
"(",
"shape",
")",
"if",
"tensor_rank",
"==",
"0",
":",
"return",
"1",
"if",
"tensor_rank",
"==",
"1",
":",
... | Calculate the number of samples, T, from the shape of X | [
"Calculate",
"the",
"number",
"of",
"samples",
"T",
"from",
"the",
"shape",
"of",
"X"
] | 842e9c2d3ca1490cef18c086dfde81856d8d3a82 | https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/fluxions/fluxion_node.py#L307-L318 |
244,963 | CS207-Final-Project-Group-10/cs207-FinalProject | fluxions/fluxion_node.py | Addition._forward_mode | def _forward_mode(self, *args):
"""Forward mode differentiation for a sum"""
# (f+g)(x) = f(x) + g(x)
f_val, f_diff = self.f._forward_mode(*args)
g_val, g_diff = self.g._forward_mode(*args)
# The function value and derivative is the sum of f and g
val = f_val + g_val
... | python | def _forward_mode(self, *args):
"""Forward mode differentiation for a sum"""
# (f+g)(x) = f(x) + g(x)
f_val, f_diff = self.f._forward_mode(*args)
g_val, g_diff = self.g._forward_mode(*args)
# The function value and derivative is the sum of f and g
val = f_val + g_val
... | [
"def",
"_forward_mode",
"(",
"self",
",",
"*",
"args",
")",
":",
"# (f+g)(x) = f(x) + g(x)",
"f_val",
",",
"f_diff",
"=",
"self",
".",
"f",
".",
"_forward_mode",
"(",
"*",
"args",
")",
"g_val",
",",
"g_diff",
"=",
"self",
".",
"g",
".",
"_forward_mode",
... | Forward mode differentiation for a sum | [
"Forward",
"mode",
"differentiation",
"for",
"a",
"sum"
] | 842e9c2d3ca1490cef18c086dfde81856d8d3a82 | https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/fluxions/fluxion_node.py#L473-L481 |
244,964 | CS207-Final-Project-Group-10/cs207-FinalProject | fluxions/fluxion_node.py | Var._forward_mode | def _forward_mode(self, *args):
"""Forward mode differentiation for variables"""
# Parse arguments into two numpy arrays
X: np.ndarray
dX: np.ndarray
X, dX = self._parse_dicts(*args)
# The value is X
if X is not None:
val = X
else:
... | python | def _forward_mode(self, *args):
"""Forward mode differentiation for variables"""
# Parse arguments into two numpy arrays
X: np.ndarray
dX: np.ndarray
X, dX = self._parse_dicts(*args)
# The value is X
if X is not None:
val = X
else:
... | [
"def",
"_forward_mode",
"(",
"self",
",",
"*",
"args",
")",
":",
"# Parse arguments into two numpy arrays",
"X",
":",
"np",
".",
"ndarray",
"dX",
":",
"np",
".",
"ndarray",
"X",
",",
"dX",
"=",
"self",
".",
"_parse_dicts",
"(",
"*",
"args",
")",
"# The v... | Forward mode differentiation for variables | [
"Forward",
"mode",
"differentiation",
"for",
"variables"
] | 842e9c2d3ca1490cef18c086dfde81856d8d3a82 | https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/fluxions/fluxion_node.py#L580-L597 |
244,965 | inveniosoftware-attic/invenio-upgrader | invenio_upgrader/cli.py | run | def run():
"""Command for applying upgrades."""
logfilename = os.path.join(current_app.config['CFG_LOGDIR'],
'invenio_upgrader.log')
upgrader = InvenioUpgrader()
logger = upgrader.get_logger(logfilename=logfilename)
try:
upgrades = upgrader.get_upgrades()
... | python | def run():
"""Command for applying upgrades."""
logfilename = os.path.join(current_app.config['CFG_LOGDIR'],
'invenio_upgrader.log')
upgrader = InvenioUpgrader()
logger = upgrader.get_logger(logfilename=logfilename)
try:
upgrades = upgrader.get_upgrades()
... | [
"def",
"run",
"(",
")",
":",
"logfilename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"current_app",
".",
"config",
"[",
"'CFG_LOGDIR'",
"]",
",",
"'invenio_upgrader.log'",
")",
"upgrader",
"=",
"InvenioUpgrader",
"(",
")",
"logger",
"=",
"upgrader",
".",
... | Command for applying upgrades. | [
"Command",
"for",
"applying",
"upgrades",
"."
] | cee4bcb118515463ecf6de1421642007f79a9fcd | https://github.com/inveniosoftware-attic/invenio-upgrader/blob/cee4bcb118515463ecf6de1421642007f79a9fcd/invenio_upgrader/cli.py#L99-L146 |
244,966 | inveniosoftware-attic/invenio-upgrader | invenio_upgrader/cli.py | check | def check():
"""Command for checking upgrades."""
upgrader = InvenioUpgrader()
logger = upgrader.get_logger()
try:
# Run upgrade pre-checks
upgrades = upgrader.get_upgrades()
# Check if there's anything to upgrade
if not upgrades:
logger.info("All upgrades h... | python | def check():
"""Command for checking upgrades."""
upgrader = InvenioUpgrader()
logger = upgrader.get_logger()
try:
# Run upgrade pre-checks
upgrades = upgrader.get_upgrades()
# Check if there's anything to upgrade
if not upgrades:
logger.info("All upgrades h... | [
"def",
"check",
"(",
")",
":",
"upgrader",
"=",
"InvenioUpgrader",
"(",
")",
"logger",
"=",
"upgrader",
".",
"get_logger",
"(",
")",
"try",
":",
"# Run upgrade pre-checks",
"upgrades",
"=",
"upgrader",
".",
"get_upgrades",
"(",
")",
"# Check if there's anything ... | Command for checking upgrades. | [
"Command",
"for",
"checking",
"upgrades",
"."
] | cee4bcb118515463ecf6de1421642007f79a9fcd | https://github.com/inveniosoftware-attic/invenio-upgrader/blob/cee4bcb118515463ecf6de1421642007f79a9fcd/invenio_upgrader/cli.py#L151-L178 |
244,967 | inveniosoftware-attic/invenio-upgrader | invenio_upgrader/cli.py | pending | def pending():
"""Command for showing upgrades ready to be applied."""
upgrader = InvenioUpgrader()
logger = upgrader.get_logger()
try:
upgrades = upgrader.get_upgrades()
if not upgrades:
logger.info("All upgrades have been applied.")
return
logger.info... | python | def pending():
"""Command for showing upgrades ready to be applied."""
upgrader = InvenioUpgrader()
logger = upgrader.get_logger()
try:
upgrades = upgrader.get_upgrades()
if not upgrades:
logger.info("All upgrades have been applied.")
return
logger.info... | [
"def",
"pending",
"(",
")",
":",
"upgrader",
"=",
"InvenioUpgrader",
"(",
")",
"logger",
"=",
"upgrader",
".",
"get_logger",
"(",
")",
"try",
":",
"upgrades",
"=",
"upgrader",
".",
"get_upgrades",
"(",
")",
"if",
"not",
"upgrades",
":",
"logger",
".",
... | Command for showing upgrades ready to be applied. | [
"Command",
"for",
"showing",
"upgrades",
"ready",
"to",
"be",
"applied",
"."
] | cee4bcb118515463ecf6de1421642007f79a9fcd | https://github.com/inveniosoftware-attic/invenio-upgrader/blob/cee4bcb118515463ecf6de1421642007f79a9fcd/invenio_upgrader/cli.py#L183-L203 |
244,968 | inveniosoftware-attic/invenio-upgrader | invenio_upgrader/cli.py | applied | def applied():
"""Command for showing all upgrades already applied."""
upgrader = InvenioUpgrader()
logger = upgrader.get_logger()
try:
upgrades = upgrader.get_history()
if not upgrades:
logger.info("No upgrades have been applied.")
return
logger.info("... | python | def applied():
"""Command for showing all upgrades already applied."""
upgrader = InvenioUpgrader()
logger = upgrader.get_logger()
try:
upgrades = upgrader.get_history()
if not upgrades:
logger.info("No upgrades have been applied.")
return
logger.info("... | [
"def",
"applied",
"(",
")",
":",
"upgrader",
"=",
"InvenioUpgrader",
"(",
")",
"logger",
"=",
"upgrader",
".",
"get_logger",
"(",
")",
"try",
":",
"upgrades",
"=",
"upgrader",
".",
"get_history",
"(",
")",
"if",
"not",
"upgrades",
":",
"logger",
".",
"... | Command for showing all upgrades already applied. | [
"Command",
"for",
"showing",
"all",
"upgrades",
"already",
"applied",
"."
] | cee4bcb118515463ecf6de1421642007f79a9fcd | https://github.com/inveniosoftware-attic/invenio-upgrader/blob/cee4bcb118515463ecf6de1421642007f79a9fcd/invenio_upgrader/cli.py#L208-L227 |
244,969 | inveniosoftware-attic/invenio-upgrader | invenio_upgrader/cli.py | release | def release(path, repository):
"""Create a new release upgrade recipe, for developers."""
upgrader = InvenioUpgrader()
logger = upgrader.get_logger()
try:
endpoints = upgrader.find_endpoints()
if not endpoints:
logger.error("No upgrades found.")
click.Abort()
... | python | def release(path, repository):
"""Create a new release upgrade recipe, for developers."""
upgrader = InvenioUpgrader()
logger = upgrader.get_logger()
try:
endpoints = upgrader.find_endpoints()
if not endpoints:
logger.error("No upgrades found.")
click.Abort()
... | [
"def",
"release",
"(",
"path",
",",
"repository",
")",
":",
"upgrader",
"=",
"InvenioUpgrader",
"(",
")",
"logger",
"=",
"upgrader",
".",
"get_logger",
"(",
")",
"try",
":",
"endpoints",
"=",
"upgrader",
".",
"find_endpoints",
"(",
")",
"if",
"not",
"end... | Create a new release upgrade recipe, for developers. | [
"Create",
"a",
"new",
"release",
"upgrade",
"recipe",
"for",
"developers",
"."
] | cee4bcb118515463ecf6de1421642007f79a9fcd | https://github.com/inveniosoftware-attic/invenio-upgrader/blob/cee4bcb118515463ecf6de1421642007f79a9fcd/invenio_upgrader/cli.py#L234-L259 |
244,970 | inveniosoftware-attic/invenio-upgrader | invenio_upgrader/cli.py | recipe | def recipe(package, repository=None, depends_on=None, release=False,
output_path=None, auto=False, overwrite=False, name=None):
"""Create a new upgrade recipe, for developers."""
upgrader = InvenioUpgrader()
logger = upgrader.get_logger()
try:
path, found_repository = _upgrade_recipe... | python | def recipe(package, repository=None, depends_on=None, release=False,
output_path=None, auto=False, overwrite=False, name=None):
"""Create a new upgrade recipe, for developers."""
upgrader = InvenioUpgrader()
logger = upgrader.get_logger()
try:
path, found_repository = _upgrade_recipe... | [
"def",
"recipe",
"(",
"package",
",",
"repository",
"=",
"None",
",",
"depends_on",
"=",
"None",
",",
"release",
"=",
"False",
",",
"output_path",
"=",
"None",
",",
"auto",
"=",
"False",
",",
"overwrite",
"=",
"False",
",",
"name",
"=",
"None",
")",
... | Create a new upgrade recipe, for developers. | [
"Create",
"a",
"new",
"upgrade",
"recipe",
"for",
"developers",
"."
] | cee4bcb118515463ecf6de1421642007f79a9fcd | https://github.com/inveniosoftware-attic/invenio-upgrader/blob/cee4bcb118515463ecf6de1421642007f79a9fcd/invenio_upgrader/cli.py#L274-L335 |
244,971 | inveniosoftware-attic/invenio-upgrader | invenio_upgrader/cli.py | _write_template | def _write_template(upgrade_file, name, depends_on, repository, auto=False):
"""Write template to upgrade file."""
if auto:
# Ensure all models are loaded
from invenio_db import models
list(models)
template_args = produce_upgrade_operations()
operations_str = template_arg... | python | def _write_template(upgrade_file, name, depends_on, repository, auto=False):
"""Write template to upgrade file."""
if auto:
# Ensure all models are loaded
from invenio_db import models
list(models)
template_args = produce_upgrade_operations()
operations_str = template_arg... | [
"def",
"_write_template",
"(",
"upgrade_file",
",",
"name",
",",
"depends_on",
",",
"repository",
",",
"auto",
"=",
"False",
")",
":",
"if",
"auto",
":",
"# Ensure all models are loaded",
"from",
"invenio_db",
"import",
"models",
"list",
"(",
"models",
")",
"t... | Write template to upgrade file. | [
"Write",
"template",
"to",
"upgrade",
"file",
"."
] | cee4bcb118515463ecf6de1421642007f79a9fcd | https://github.com/inveniosoftware-attic/invenio-upgrader/blob/cee4bcb118515463ecf6de1421642007f79a9fcd/invenio_upgrader/cli.py#L341-L362 |
244,972 | inveniosoftware-attic/invenio-upgrader | invenio_upgrader/cli.py | _upgrade_recipe_find_path | def _upgrade_recipe_find_path(import_str, create=True):
"""Determine repository name and path for new upgrade.
It is based on package import path.
"""
try:
# Import package
m = import_string(import_str)
# Check if package or module
if m.__package__ is not None and m.__p... | python | def _upgrade_recipe_find_path(import_str, create=True):
"""Determine repository name and path for new upgrade.
It is based on package import path.
"""
try:
# Import package
m = import_string(import_str)
# Check if package or module
if m.__package__ is not None and m.__p... | [
"def",
"_upgrade_recipe_find_path",
"(",
"import_str",
",",
"create",
"=",
"True",
")",
":",
"try",
":",
"# Import package",
"m",
"=",
"import_string",
"(",
"import_str",
")",
"# Check if package or module",
"if",
"m",
".",
"__package__",
"is",
"not",
"None",
"a... | Determine repository name and path for new upgrade.
It is based on package import path. | [
"Determine",
"repository",
"name",
"and",
"path",
"for",
"new",
"upgrade",
"."
] | cee4bcb118515463ecf6de1421642007f79a9fcd | https://github.com/inveniosoftware-attic/invenio-upgrader/blob/cee4bcb118515463ecf6de1421642007f79a9fcd/invenio_upgrader/cli.py#L365-L396 |
244,973 | narfman0/helga-youtube-metadata | helga_youtube_meta/plugin.py | youtube_meta | def youtube_meta(client, channel, nick, message, match):
""" Return meta information about a video """
if not API_KEY:
return 'You must set YOUTUBE_DATA_API_KEY in settings!'
identifier = match[0]
params = {
'id': identifier,
'key': API_KEY,
'part': 'snippet,statistics,co... | python | def youtube_meta(client, channel, nick, message, match):
""" Return meta information about a video """
if not API_KEY:
return 'You must set YOUTUBE_DATA_API_KEY in settings!'
identifier = match[0]
params = {
'id': identifier,
'key': API_KEY,
'part': 'snippet,statistics,co... | [
"def",
"youtube_meta",
"(",
"client",
",",
"channel",
",",
"nick",
",",
"message",
",",
"match",
")",
":",
"if",
"not",
"API_KEY",
":",
"return",
"'You must set YOUTUBE_DATA_API_KEY in settings!'",
"identifier",
"=",
"match",
"[",
"0",
"]",
"params",
"=",
"{",... | Return meta information about a video | [
"Return",
"meta",
"information",
"about",
"a",
"video"
] | 1babc2e6404864a344cb173e8a03fa5de957059a | https://github.com/narfman0/helga-youtube-metadata/blob/1babc2e6404864a344cb173e8a03fa5de957059a/helga_youtube_meta/plugin.py#L26-L56 |
244,974 | narfman0/helga-youtube-metadata | helga_youtube_meta/plugin.py | parse_duration | def parse_duration(duration):
""" Parse and prettify duration from youtube duration format """
duration_dict = re.search(DURATION_REGEX, duration).groupdict()
converted_dict = {}
# convert all values to ints, remove nones
for a, x in duration_dict.iteritems():
if x is not None:
c... | python | def parse_duration(duration):
""" Parse and prettify duration from youtube duration format """
duration_dict = re.search(DURATION_REGEX, duration).groupdict()
converted_dict = {}
# convert all values to ints, remove nones
for a, x in duration_dict.iteritems():
if x is not None:
c... | [
"def",
"parse_duration",
"(",
"duration",
")",
":",
"duration_dict",
"=",
"re",
".",
"search",
"(",
"DURATION_REGEX",
",",
"duration",
")",
".",
"groupdict",
"(",
")",
"converted_dict",
"=",
"{",
"}",
"# convert all values to ints, remove nones",
"for",
"a",
","... | Parse and prettify duration from youtube duration format | [
"Parse",
"and",
"prettify",
"duration",
"from",
"youtube",
"duration",
"format"
] | 1babc2e6404864a344cb173e8a03fa5de957059a | https://github.com/narfman0/helga-youtube-metadata/blob/1babc2e6404864a344cb173e8a03fa5de957059a/helga_youtube_meta/plugin.py#L59-L67 |
244,975 | uw-it-aca/uw-restclients-mailman | uw_mailman/course_list.py | exists_course_list | def exists_course_list(curriculum_abbr, course_number, section_id,
quarter, year, joint=False):
"""
Return True if the corresponding mailman list exists for the course
"""
return exists(get_course_list_name(curriculum_abbr, course_number,
sec... | python | def exists_course_list(curriculum_abbr, course_number, section_id,
quarter, year, joint=False):
"""
Return True if the corresponding mailman list exists for the course
"""
return exists(get_course_list_name(curriculum_abbr, course_number,
sec... | [
"def",
"exists_course_list",
"(",
"curriculum_abbr",
",",
"course_number",
",",
"section_id",
",",
"quarter",
",",
"year",
",",
"joint",
"=",
"False",
")",
":",
"return",
"exists",
"(",
"get_course_list_name",
"(",
"curriculum_abbr",
",",
"course_number",
",",
"... | Return True if the corresponding mailman list exists for the course | [
"Return",
"True",
"if",
"the",
"corresponding",
"mailman",
"list",
"exists",
"for",
"the",
"course"
] | ef077f2cc945871422fcd66391e82264e2384b2c | https://github.com/uw-it-aca/uw-restclients-mailman/blob/ef077f2cc945871422fcd66391e82264e2384b2c/uw_mailman/course_list.py#L32-L38 |
244,976 | ludeeus/pylaunches | pylaunches/api.py | Launches.get_launches | async def get_launches(self):
"""Get launch information."""
from .common import CommonFunctions
common = CommonFunctions(self.loop, self.session)
all_launches = []
launches = {}
data = await common.api_call(BASE_URL)
if data is None:
LOGGER.error('Erro... | python | async def get_launches(self):
"""Get launch information."""
from .common import CommonFunctions
common = CommonFunctions(self.loop, self.session)
all_launches = []
launches = {}
data = await common.api_call(BASE_URL)
if data is None:
LOGGER.error('Erro... | [
"async",
"def",
"get_launches",
"(",
"self",
")",
":",
"from",
".",
"common",
"import",
"CommonFunctions",
"common",
"=",
"CommonFunctions",
"(",
"self",
".",
"loop",
",",
"self",
".",
"session",
")",
"all_launches",
"=",
"[",
"]",
"launches",
"=",
"{",
... | Get launch information. | [
"Get",
"launch",
"information",
"."
] | 6cc449a9f734cbf789e561564b500a5dca93fe82 | https://github.com/ludeeus/pylaunches/blob/6cc449a9f734cbf789e561564b500a5dca93fe82/pylaunches/api.py#L20-L67 |
244,977 | dossier/dossier.models | dossier/models/openquery/google.py | Google.web_search | def web_search(self, query, start=0, limit=100, max_tries=3):
'''
encapsulates urllib retrieval for fetching JSON results from
Google's Custom Search API. Returns a deserialized result set.
'''
tries = 0
if isinstance(query, unicode):
query = query.encode('ut... | python | def web_search(self, query, start=0, limit=100, max_tries=3):
'''
encapsulates urllib retrieval for fetching JSON results from
Google's Custom Search API. Returns a deserialized result set.
'''
tries = 0
if isinstance(query, unicode):
query = query.encode('ut... | [
"def",
"web_search",
"(",
"self",
",",
"query",
",",
"start",
"=",
"0",
",",
"limit",
"=",
"100",
",",
"max_tries",
"=",
"3",
")",
":",
"tries",
"=",
"0",
"if",
"isinstance",
"(",
"query",
",",
"unicode",
")",
":",
"query",
"=",
"query",
".",
"en... | encapsulates urllib retrieval for fetching JSON results from
Google's Custom Search API. Returns a deserialized result set. | [
"encapsulates",
"urllib",
"retrieval",
"for",
"fetching",
"JSON",
"results",
"from",
"Google",
"s",
"Custom",
"Search",
"API",
".",
"Returns",
"a",
"deserialized",
"result",
"set",
"."
] | c9e282f690eab72963926329efe1600709e48b13 | https://github.com/dossier/dossier.models/blob/c9e282f690eab72963926329efe1600709e48b13/dossier/models/openquery/google.py#L57-L93 |
244,978 | twidi/py-dataql | dataql/solvers/filters.py | Solver.can_solve | def can_solve(cls, filter_):
"""Tells if the solver is able to resolve the given filter.
Arguments
---------
filter_ : subclass of dataql.resources.BaseFilter
The subclass or ``BaseFilter`` to check if it is solvable by the current solver class.
Returns
----... | python | def can_solve(cls, filter_):
"""Tells if the solver is able to resolve the given filter.
Arguments
---------
filter_ : subclass of dataql.resources.BaseFilter
The subclass or ``BaseFilter`` to check if it is solvable by the current solver class.
Returns
----... | [
"def",
"can_solve",
"(",
"cls",
",",
"filter_",
")",
":",
"for",
"solvable_filter",
"in",
"cls",
".",
"solvable_filters",
":",
"if",
"isinstance",
"(",
"filter_",
",",
"solvable_filter",
")",
":",
"return",
"True",
"return",
"False"
] | Tells if the solver is able to resolve the given filter.
Arguments
---------
filter_ : subclass of dataql.resources.BaseFilter
The subclass or ``BaseFilter`` to check if it is solvable by the current solver class.
Returns
-------
boolean
``True``... | [
"Tells",
"if",
"the",
"solver",
"is",
"able",
"to",
"resolve",
"the",
"given",
"filter",
"."
] | 5841a3fd559829193ed709c255166085bdde1c52 | https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/solvers/filters.py#L103-L131 |
244,979 | twidi/py-dataql | dataql/solvers/filters.py | FilterSolver.solve | def solve(self, value, filter_):
"""Returns the value of an attribute of the value, or the result of a call to a function.
Arguments
---------
value : ?
A value to solve in combination with the given filter.
filter_ : dataql.resource.Filter
An instance of... | python | def solve(self, value, filter_):
"""Returns the value of an attribute of the value, or the result of a call to a function.
Arguments
---------
value : ?
A value to solve in combination with the given filter.
filter_ : dataql.resource.Filter
An instance of... | [
"def",
"solve",
"(",
"self",
",",
"value",
",",
"filter_",
")",
":",
"args",
",",
"kwargs",
"=",
"filter_",
".",
"get_args_and_kwargs",
"(",
")",
"source",
"=",
"self",
".",
"registry",
"[",
"value",
"]",
"return",
"source",
".",
"solve",
"(",
"value",... | Returns the value of an attribute of the value, or the result of a call to a function.
Arguments
---------
value : ?
A value to solve in combination with the given filter.
filter_ : dataql.resource.Filter
An instance of ``Filter`` to solve with the given value.
... | [
"Returns",
"the",
"value",
"of",
"an",
"attribute",
"of",
"the",
"value",
"or",
"the",
"result",
"of",
"a",
"call",
"to",
"a",
"function",
"."
] | 5841a3fd559829193ed709c255166085bdde1c52 | https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/solvers/filters.py#L153-L187 |
244,980 | twidi/py-dataql | dataql/solvers/filters.py | SliceSolver.solve | def solve(self, value, filter_):
"""Get slice or entry defined by an index from the given value.
Arguments
---------
value : ?
A value to solve in combination with the given filter.
filter_ : dataql.resource.SliceFilter
An instance of ``SliceFilter``to so... | python | def solve(self, value, filter_):
"""Get slice or entry defined by an index from the given value.
Arguments
---------
value : ?
A value to solve in combination with the given filter.
filter_ : dataql.resource.SliceFilter
An instance of ``SliceFilter``to so... | [
"def",
"solve",
"(",
"self",
",",
"value",
",",
"filter_",
")",
":",
"try",
":",
"return",
"value",
"[",
"filter_",
".",
"slice",
"or",
"filter_",
".",
"index",
"]",
"except",
"IndexError",
":",
"return",
"None"
] | Get slice or entry defined by an index from the given value.
Arguments
---------
value : ?
A value to solve in combination with the given filter.
filter_ : dataql.resource.SliceFilter
An instance of ``SliceFilter``to solve with the given value.
Example
... | [
"Get",
"slice",
"or",
"entry",
"defined",
"by",
"an",
"index",
"from",
"the",
"given",
"value",
"."
] | 5841a3fd559829193ed709c255166085bdde1c52 | https://github.com/twidi/py-dataql/blob/5841a3fd559829193ed709c255166085bdde1c52/dataql/solvers/filters.py#L209-L238 |
244,981 | RazerM/bucketcache | bucketcache/utilities.py | normalize_args | def normalize_args(f, *args, **kwargs):
"""Normalize call arguments into keyword form and varargs.
args can only be non-empty if there is *args in the argument specification.
"""
callargs = inspect.getcallargs(f, *args, **kwargs)
original_callargs = callargs.copy()
try:
argspec = inspec... | python | def normalize_args(f, *args, **kwargs):
"""Normalize call arguments into keyword form and varargs.
args can only be non-empty if there is *args in the argument specification.
"""
callargs = inspect.getcallargs(f, *args, **kwargs)
original_callargs = callargs.copy()
try:
argspec = inspec... | [
"def",
"normalize_args",
"(",
"f",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"callargs",
"=",
"inspect",
".",
"getcallargs",
"(",
"f",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"original_callargs",
"=",
"callargs",
".",
"copy",
"(",
... | Normalize call arguments into keyword form and varargs.
args can only be non-empty if there is *args in the argument specification. | [
"Normalize",
"call",
"arguments",
"into",
"keyword",
"form",
"and",
"varargs",
"."
] | 8d9b163b73da8c498793cce2f22f6a7cbe524d94 | https://github.com/RazerM/bucketcache/blob/8d9b163b73da8c498793cce2f22f6a7cbe524d94/bucketcache/utilities.py#L233-L261 |
244,982 | Who8MyLunch/OrderedNamespace | ordered_namespace/core.py | Struct.update | def update(self, *args, **kwargs):
"""Update self with new content
"""
d = {}
d.update(*args, **kwargs)
for key, value in d.items():
self[key] = value | python | def update(self, *args, **kwargs):
"""Update self with new content
"""
d = {}
d.update(*args, **kwargs)
for key, value in d.items():
self[key] = value | [
"def",
"update",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"d",
"=",
"{",
"}",
"d",
".",
"update",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"for",
"key",
",",
"value",
"in",
"d",
".",
"items",
"(",
")",
":",
... | Update self with new content | [
"Update",
"self",
"with",
"new",
"content"
] | f14b7e76afe3379f1696c96e8d06ef6fbf923f00 | https://github.com/Who8MyLunch/OrderedNamespace/blob/f14b7e76afe3379f1696c96e8d06ef6fbf923f00/ordered_namespace/core.py#L46-L52 |
244,983 | Who8MyLunch/OrderedNamespace | ordered_namespace/core.py | Struct.asdict | def asdict(self):
"""Return a recursive dict representation of self
"""
d = dict(self._odict)
for k,v in d.items():
if isinstance(v, Struct):
d[k] = v.asdict()
return d | python | def asdict(self):
"""Return a recursive dict representation of self
"""
d = dict(self._odict)
for k,v in d.items():
if isinstance(v, Struct):
d[k] = v.asdict()
return d | [
"def",
"asdict",
"(",
"self",
")",
":",
"d",
"=",
"dict",
"(",
"self",
".",
"_odict",
")",
"for",
"k",
",",
"v",
"in",
"d",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"Struct",
")",
":",
"d",
"[",
"k",
"]",
"=",
"v",
... | Return a recursive dict representation of self | [
"Return",
"a",
"recursive",
"dict",
"representation",
"of",
"self"
] | f14b7e76afe3379f1696c96e8d06ef6fbf923f00 | https://github.com/Who8MyLunch/OrderedNamespace/blob/f14b7e76afe3379f1696c96e8d06ef6fbf923f00/ordered_namespace/core.py#L68-L77 |
244,984 | lsst-sqre/BitlyOAuth2ProxySession | BitlyOAuth2ProxySession/Session.py | _extract_authenticity_token | def _extract_authenticity_token(data):
"""Don't look, I'm hideous!"""
# Super-cheap Python3 hack.
if not isinstance(data, str):
data = str(data, 'utf-8')
pos = data.find("authenticity_token")
# Super-gross.
authtok = str(data[pos + 41:pos + 41 + 88])
return authtok | python | def _extract_authenticity_token(data):
"""Don't look, I'm hideous!"""
# Super-cheap Python3 hack.
if not isinstance(data, str):
data = str(data, 'utf-8')
pos = data.find("authenticity_token")
# Super-gross.
authtok = str(data[pos + 41:pos + 41 + 88])
return authtok | [
"def",
"_extract_authenticity_token",
"(",
"data",
")",
":",
"# Super-cheap Python3 hack.",
"if",
"not",
"isinstance",
"(",
"data",
",",
"str",
")",
":",
"data",
"=",
"str",
"(",
"data",
",",
"'utf-8'",
")",
"pos",
"=",
"data",
".",
"find",
"(",
"\"authent... | Don't look, I'm hideous! | [
"Don",
"t",
"look",
"I",
"m",
"hideous!"
] | 4d3839cfb9b897f46cffc41a5f6ff7c645a5f202 | https://github.com/lsst-sqre/BitlyOAuth2ProxySession/blob/4d3839cfb9b897f46cffc41a5f6ff7c645a5f202/BitlyOAuth2ProxySession/Session.py#L87-L95 |
244,985 | lsst-sqre/BitlyOAuth2ProxySession | BitlyOAuth2ProxySession/Session.py | Session.authenticate | def authenticate(self):
"""Authenticate the session"""
postdata = self.authentication_postdata
jar = requests.cookies.cookielib.CookieJar()
self.cookies = jar
resp = self.get(self.authentication_base_url)
authtok = _extract_authenticity_token(resp.content)
if post... | python | def authenticate(self):
"""Authenticate the session"""
postdata = self.authentication_postdata
jar = requests.cookies.cookielib.CookieJar()
self.cookies = jar
resp = self.get(self.authentication_base_url)
authtok = _extract_authenticity_token(resp.content)
if post... | [
"def",
"authenticate",
"(",
"self",
")",
":",
"postdata",
"=",
"self",
".",
"authentication_postdata",
"jar",
"=",
"requests",
".",
"cookies",
".",
"cookielib",
".",
"CookieJar",
"(",
")",
"self",
".",
"cookies",
"=",
"jar",
"resp",
"=",
"self",
".",
"ge... | Authenticate the session | [
"Authenticate",
"the",
"session"
] | 4d3839cfb9b897f46cffc41a5f6ff7c645a5f202 | https://github.com/lsst-sqre/BitlyOAuth2ProxySession/blob/4d3839cfb9b897f46cffc41a5f6ff7c645a5f202/BitlyOAuth2ProxySession/Session.py#L64-L84 |
244,986 | opieters/SnakeTeX | snaketex/stex.py | cli | def cli(ctx, config, debug):
"""SnakTeX command line interface - write LaTeX faster through templating."""
ctx.obj['config'] = config
ctx.obj['engine'] = stex.SnakeTeX(config_file=config, debug=debug) | python | def cli(ctx, config, debug):
"""SnakTeX command line interface - write LaTeX faster through templating."""
ctx.obj['config'] = config
ctx.obj['engine'] = stex.SnakeTeX(config_file=config, debug=debug) | [
"def",
"cli",
"(",
"ctx",
",",
"config",
",",
"debug",
")",
":",
"ctx",
".",
"obj",
"[",
"'config'",
"]",
"=",
"config",
"ctx",
".",
"obj",
"[",
"'engine'",
"]",
"=",
"stex",
".",
"SnakeTeX",
"(",
"config_file",
"=",
"config",
",",
"debug",
"=",
... | SnakTeX command line interface - write LaTeX faster through templating. | [
"SnakTeX",
"command",
"line",
"interface",
"-",
"write",
"LaTeX",
"faster",
"through",
"templating",
"."
] | 0ceba577a5bf2ff6bb686c426a6f5b1393b99471 | https://github.com/opieters/SnakeTeX/blob/0ceba577a5bf2ff6bb686c426a6f5b1393b99471/snaketex/stex.py#L10-L13 |
244,987 | etcher-be/emiz | emiz/miz.py | Miz.zip | def zip(self, destination: typing.Union[str, Path] = None, encode: bool = True) -> str:
"""
Write mission, dictionary etc. to a MIZ file
Args:
destination: target MIZ file (if none, defaults to source MIZ + "_EMIZ"
Returns: destination file
"""
if encode:
... | python | def zip(self, destination: typing.Union[str, Path] = None, encode: bool = True) -> str:
"""
Write mission, dictionary etc. to a MIZ file
Args:
destination: target MIZ file (if none, defaults to source MIZ + "_EMIZ"
Returns: destination file
"""
if encode:
... | [
"def",
"zip",
"(",
"self",
",",
"destination",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"Path",
"]",
"=",
"None",
",",
"encode",
":",
"bool",
"=",
"True",
")",
"->",
"str",
":",
"if",
"encode",
":",
"self",
".",
"_encode",
"(",
")",
"if",
... | Write mission, dictionary etc. to a MIZ file
Args:
destination: target MIZ file (if none, defaults to source MIZ + "_EMIZ"
Returns: destination file | [
"Write",
"mission",
"dictionary",
"etc",
".",
"to",
"a",
"MIZ",
"file"
] | 1c3e32711921d7e600e85558ffe5d337956372de | https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/miz.py#L334-L364 |
244,988 | universalcore/springboard | springboard/utils.py | config_dict | def config_dict(data):
"""
A function that takes a string of pair values, indicated by '=', separated
by newline characters and returns a dict of those value pairs
:param func context_func:
A function which takes one argument, a string of value pairs with
'= between them' separated by n... | python | def config_dict(data):
"""
A function that takes a string of pair values, indicated by '=', separated
by newline characters and returns a dict of those value pairs
:param func context_func:
A function which takes one argument, a string of value pairs with
'= between them' separated by n... | [
"def",
"config_dict",
"(",
"data",
")",
":",
"lines",
"=",
"config_list",
"(",
"data",
")",
"return",
"dict",
"(",
"re",
".",
"split",
"(",
"'\\s*=\\s*'",
",",
"value",
")",
"for",
"value",
"in",
"lines",
")"
] | A function that takes a string of pair values, indicated by '=', separated
by newline characters and returns a dict of those value pairs
:param func context_func:
A function which takes one argument, a string of value pairs with
'= between them' separated by newline characters
:returns:
... | [
"A",
"function",
"that",
"takes",
"a",
"string",
"of",
"pair",
"values",
"indicated",
"by",
"=",
"separated",
"by",
"newline",
"characters",
"and",
"returns",
"a",
"dict",
"of",
"those",
"value",
"pairs"
] | 9f0393d310a1d2219613e8cd30cc52c75fb4dd61 | https://github.com/universalcore/springboard/blob/9f0393d310a1d2219613e8cd30cc52c75fb4dd61/springboard/utils.py#L94-L108 |
244,989 | rameshg87/pyremotevbox | pyremotevbox/ZSI/writer.py | SoapWriter.Forget | def Forget(self, obj):
'''Forget we've seen this object.
'''
obj = _get_idstr(obj)
try:
self.memo.remove(obj)
except ValueError:
pass | python | def Forget(self, obj):
'''Forget we've seen this object.
'''
obj = _get_idstr(obj)
try:
self.memo.remove(obj)
except ValueError:
pass | [
"def",
"Forget",
"(",
"self",
",",
"obj",
")",
":",
"obj",
"=",
"_get_idstr",
"(",
"obj",
")",
"try",
":",
"self",
".",
"memo",
".",
"remove",
"(",
"obj",
")",
"except",
"ValueError",
":",
"pass"
] | Forget we've seen this object. | [
"Forget",
"we",
"ve",
"seen",
"this",
"object",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/writer.py#L163-L170 |
244,990 | rameshg87/pyremotevbox | pyremotevbox/ZSI/writer.py | SoapWriter.close | def close(self):
'''Invoke all the callbacks, and close off the SOAP message.
'''
if self.closed: return
for func,arglist in self.callbacks:
apply(func, arglist)
self.closed = True | python | def close(self):
'''Invoke all the callbacks, and close off the SOAP message.
'''
if self.closed: return
for func,arglist in self.callbacks:
apply(func, arglist)
self.closed = True | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"closed",
":",
"return",
"for",
"func",
",",
"arglist",
"in",
"self",
".",
"callbacks",
":",
"apply",
"(",
"func",
",",
"arglist",
")",
"self",
".",
"closed",
"=",
"True"
] | Invoke all the callbacks, and close off the SOAP message. | [
"Invoke",
"all",
"the",
"callbacks",
"and",
"close",
"off",
"the",
"SOAP",
"message",
"."
] | 123dffff27da57c8faa3ac1dd4c68b1cf4558b1a | https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/writer.py#L178-L184 |
244,991 | spotify/gordon-janitor | gordon_janitor/main.py | setup | def setup(config_root=''):
"""
Service configuration and logging setup.
Configuration defined in ``gordon-janitor-user.toml`` will overwrite
``gordon-janitor.toml``.
Args:
config_root (str): where configuration should load from,
defaults to current working directory.
Return... | python | def setup(config_root=''):
"""
Service configuration and logging setup.
Configuration defined in ``gordon-janitor-user.toml`` will overwrite
``gordon-janitor.toml``.
Args:
config_root (str): where configuration should load from,
defaults to current working directory.
Return... | [
"def",
"setup",
"(",
"config_root",
"=",
"''",
")",
":",
"config",
"=",
"_load_config",
"(",
"root",
"=",
"config_root",
")",
"logging_config",
"=",
"config",
".",
"get",
"(",
"'core'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'logging'",
",",
"{",
"}",... | Service configuration and logging setup.
Configuration defined in ``gordon-janitor-user.toml`` will overwrite
``gordon-janitor.toml``.
Args:
config_root (str): where configuration should load from,
defaults to current working directory.
Returns:
A dict for Gordon service co... | [
"Service",
"configuration",
"and",
"logging",
"setup",
"."
] | e0df2002caf3aac528818743d8d0717790957044 | https://github.com/spotify/gordon-janitor/blob/e0df2002caf3aac528818743d8d0717790957044/gordon_janitor/main.py#L76-L98 |
244,992 | limpyd/redis-limpyd-jobs | limpyd_jobs/__init__.py | STATUSES.by_value | def by_value(self, value, default=None):
"""
Returns the key for the given value
"""
try:
return [k for k, v in self.items() if v == value][0]
except IndexError:
if default is not None:
return default
raise ValueError('%s' % val... | python | def by_value(self, value, default=None):
"""
Returns the key for the given value
"""
try:
return [k for k, v in self.items() if v == value][0]
except IndexError:
if default is not None:
return default
raise ValueError('%s' % val... | [
"def",
"by_value",
"(",
"self",
",",
"value",
",",
"default",
"=",
"None",
")",
":",
"try",
":",
"return",
"[",
"k",
"for",
"k",
",",
"v",
"in",
"self",
".",
"items",
"(",
")",
"if",
"v",
"==",
"value",
"]",
"[",
"0",
"]",
"except",
"IndexError... | Returns the key for the given value | [
"Returns",
"the",
"key",
"for",
"the",
"given",
"value"
] | 264c71029bad4377d6132bf8bb9c55c44f3b03a2 | https://github.com/limpyd/redis-limpyd-jobs/blob/264c71029bad4377d6132bf8bb9c55c44f3b03a2/limpyd_jobs/__init__.py#L21-L30 |
244,993 | RonenNess/Fileter | fileter/files_iterator.py | FilesIterator.add_pattern | def add_pattern(self, pattern, root=".", depth=None, source_type=DefaultSourceType):
"""
Add a recursive folder scan using a linux-style patterns.
:param pattern: pattern or list of patterns to match.
:param root: root to start from (default to '.')
:param depth: if provided wil... | python | def add_pattern(self, pattern, root=".", depth=None, source_type=DefaultSourceType):
"""
Add a recursive folder scan using a linux-style patterns.
:param pattern: pattern or list of patterns to match.
:param root: root to start from (default to '.')
:param depth: if provided wil... | [
"def",
"add_pattern",
"(",
"self",
",",
"pattern",
",",
"root",
"=",
"\".\"",
",",
"depth",
"=",
"None",
",",
"source_type",
"=",
"DefaultSourceType",
")",
":",
"self",
".",
"add_source",
"(",
"PatternSource",
"(",
"pattern",
",",
"root",
",",
"depth",
"... | Add a recursive folder scan using a linux-style patterns.
:param pattern: pattern or list of patterns to match.
:param root: root to start from (default to '.')
:param depth: if provided will be depth limit. 0 = first level only.
:param source_type: what to return; files only, folders o... | [
"Add",
"a",
"recursive",
"folder",
"scan",
"using",
"a",
"linux",
"-",
"style",
"patterns",
"."
] | 5372221b4049d5d46a9926573b91af17681c81f3 | https://github.com/RonenNess/Fileter/blob/5372221b4049d5d46a9926573b91af17681c81f3/fileter/files_iterator.py#L98-L108 |
244,994 | RonenNess/Fileter | fileter/files_iterator.py | FilesIterator.add_filtered_folder | def add_filtered_folder(self, path, regex, depth=None, source_type=DefaultSourceType):
"""
Add a folder source to scan recursively, with a regex filter on directories.
:param regex: regex string to filter folders by.
:param depth: if provided will be depth limit. 0 = first level only.
... | python | def add_filtered_folder(self, path, regex, depth=None, source_type=DefaultSourceType):
"""
Add a folder source to scan recursively, with a regex filter on directories.
:param regex: regex string to filter folders by.
:param depth: if provided will be depth limit. 0 = first level only.
... | [
"def",
"add_filtered_folder",
"(",
"self",
",",
"path",
",",
"regex",
",",
"depth",
"=",
"None",
",",
"source_type",
"=",
"DefaultSourceType",
")",
":",
"self",
".",
"add_source",
"(",
"FilteredFolderSource",
"(",
"path",
",",
"regex",
",",
"depth",
",",
"... | Add a folder source to scan recursively, with a regex filter on directories.
:param regex: regex string to filter folders by.
:param depth: if provided will be depth limit. 0 = first level only.
:param source_type: what to return; files only, folders only, or both. | [
"Add",
"a",
"folder",
"source",
"to",
"scan",
"recursively",
"with",
"a",
"regex",
"filter",
"on",
"directories",
"."
] | 5372221b4049d5d46a9926573b91af17681c81f3 | https://github.com/RonenNess/Fileter/blob/5372221b4049d5d46a9926573b91af17681c81f3/fileter/files_iterator.py#L110-L119 |
244,995 | RonenNess/Fileter | fileter/files_iterator.py | FilesIterator.add_filter | def add_filter(self, files_filter, filter_type=DefaultFilterType):
"""
Add a files filter to this iterator.
For a file to be processed, it must match ALL filters, eg they are added with ADD, not OR.
:param files_filter: filter to apply, must be an object inheriting from filters.FilterAP... | python | def add_filter(self, files_filter, filter_type=DefaultFilterType):
"""
Add a files filter to this iterator.
For a file to be processed, it must match ALL filters, eg they are added with ADD, not OR.
:param files_filter: filter to apply, must be an object inheriting from filters.FilterAP... | [
"def",
"add_filter",
"(",
"self",
",",
"files_filter",
",",
"filter_type",
"=",
"DefaultFilterType",
")",
":",
"self",
".",
"__filters",
".",
"append",
"(",
"(",
"files_filter",
",",
"filter_type",
")",
")",
"return",
"self"
] | Add a files filter to this iterator.
For a file to be processed, it must match ALL filters, eg they are added with ADD, not OR.
:param files_filter: filter to apply, must be an object inheriting from filters.FilterAPI.
:param filter_type: filter behavior, see FilterType for details. | [
"Add",
"a",
"files",
"filter",
"to",
"this",
"iterator",
".",
"For",
"a",
"file",
"to",
"be",
"processed",
"it",
"must",
"match",
"ALL",
"filters",
"eg",
"they",
"are",
"added",
"with",
"ADD",
"not",
"OR",
"."
] | 5372221b4049d5d46a9926573b91af17681c81f3 | https://github.com/RonenNess/Fileter/blob/5372221b4049d5d46a9926573b91af17681c81f3/fileter/files_iterator.py#L121-L130 |
244,996 | RonenNess/Fileter | fileter/files_iterator.py | FilesIterator.add_filter_by_pattern | def add_filter_by_pattern(self, pattern, filter_type=DefaultFilterType):
"""
Add a files filter by linux-style pattern to this iterator.
:param pattern: linux-style files pattern (or list of patterns)
"""
self.add_filter(FilterPattern(pattern), filter_type)
return self | python | def add_filter_by_pattern(self, pattern, filter_type=DefaultFilterType):
"""
Add a files filter by linux-style pattern to this iterator.
:param pattern: linux-style files pattern (or list of patterns)
"""
self.add_filter(FilterPattern(pattern), filter_type)
return self | [
"def",
"add_filter_by_pattern",
"(",
"self",
",",
"pattern",
",",
"filter_type",
"=",
"DefaultFilterType",
")",
":",
"self",
".",
"add_filter",
"(",
"FilterPattern",
"(",
"pattern",
")",
",",
"filter_type",
")",
"return",
"self"
] | Add a files filter by linux-style pattern to this iterator.
:param pattern: linux-style files pattern (or list of patterns) | [
"Add",
"a",
"files",
"filter",
"by",
"linux",
"-",
"style",
"pattern",
"to",
"this",
"iterator",
"."
] | 5372221b4049d5d46a9926573b91af17681c81f3 | https://github.com/RonenNess/Fileter/blob/5372221b4049d5d46a9926573b91af17681c81f3/fileter/files_iterator.py#L132-L139 |
244,997 | RonenNess/Fileter | fileter/files_iterator.py | FilesIterator.add_filter_by_regex | def add_filter_by_regex(self, regex_expression, filter_type=DefaultFilterType):
"""
Add a files filter by regex to this iterator.
:param regex_expression: regex string to apply.
"""
self.add_filter(FilterRegex(regex_expression), filter_type)
return self | python | def add_filter_by_regex(self, regex_expression, filter_type=DefaultFilterType):
"""
Add a files filter by regex to this iterator.
:param regex_expression: regex string to apply.
"""
self.add_filter(FilterRegex(regex_expression), filter_type)
return self | [
"def",
"add_filter_by_regex",
"(",
"self",
",",
"regex_expression",
",",
"filter_type",
"=",
"DefaultFilterType",
")",
":",
"self",
".",
"add_filter",
"(",
"FilterRegex",
"(",
"regex_expression",
")",
",",
"filter_type",
")",
"return",
"self"
] | Add a files filter by regex to this iterator.
:param regex_expression: regex string to apply. | [
"Add",
"a",
"files",
"filter",
"by",
"regex",
"to",
"this",
"iterator",
"."
] | 5372221b4049d5d46a9926573b91af17681c81f3 | https://github.com/RonenNess/Fileter/blob/5372221b4049d5d46a9926573b91af17681c81f3/fileter/files_iterator.py#L141-L148 |
244,998 | RonenNess/Fileter | fileter/files_iterator.py | FilesIterator.add_filter_by_extension | def add_filter_by_extension(self, extensions, filter_type=DefaultFilterType):
"""
Add a files filter by extensions to this iterator.
:param extensions: single extension or list of extensions to filter by.
for example: ["py", "js", "cpp", ...]
"""
self... | python | def add_filter_by_extension(self, extensions, filter_type=DefaultFilterType):
"""
Add a files filter by extensions to this iterator.
:param extensions: single extension or list of extensions to filter by.
for example: ["py", "js", "cpp", ...]
"""
self... | [
"def",
"add_filter_by_extension",
"(",
"self",
",",
"extensions",
",",
"filter_type",
"=",
"DefaultFilterType",
")",
":",
"self",
".",
"add_filter",
"(",
"FilterExtension",
"(",
"extensions",
")",
",",
"filter_type",
")",
"return",
"self"
] | Add a files filter by extensions to this iterator.
:param extensions: single extension or list of extensions to filter by.
for example: ["py", "js", "cpp", ...] | [
"Add",
"a",
"files",
"filter",
"by",
"extensions",
"to",
"this",
"iterator",
"."
] | 5372221b4049d5d46a9926573b91af17681c81f3 | https://github.com/RonenNess/Fileter/blob/5372221b4049d5d46a9926573b91af17681c81f3/fileter/files_iterator.py#L150-L158 |
244,999 | RonenNess/Fileter | fileter/files_iterator.py | FilesIterator.next | def next(self, dryrun=False):
"""
Iterate over files in all sources.
Use this if you want to iterate files externally.
:param dryrun: if true, will only return all filenames instead of processing them, eg will not
call "process_file" at all, and just show all the... | python | def next(self, dryrun=False):
"""
Iterate over files in all sources.
Use this if you want to iterate files externally.
:param dryrun: if true, will only return all filenames instead of processing them, eg will not
call "process_file" at all, and just show all the... | [
"def",
"next",
"(",
"self",
",",
"dryrun",
"=",
"False",
")",
":",
"# call the start hook",
"self",
".",
"on_start",
"(",
"dryrun",
")",
"# store current dir",
"curr_dir",
"=",
"\"\"",
"# iterate over sources",
"for",
"src",
"in",
"self",
".",
"__sources",
":"... | Iterate over files in all sources.
Use this if you want to iterate files externally.
:param dryrun: if true, will only return all filenames instead of processing them, eg will not
call "process_file" at all, and just show all the files it will scan. | [
"Iterate",
"over",
"files",
"in",
"all",
"sources",
".",
"Use",
"this",
"if",
"you",
"want",
"to",
"iterate",
"files",
"externally",
"."
] | 5372221b4049d5d46a9926573b91af17681c81f3 | https://github.com/RonenNess/Fileter/blob/5372221b4049d5d46a9926573b91af17681c81f3/fileter/files_iterator.py#L190-L236 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.