repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
PmagPy/PmagPy
pmagpy/pmag.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L10678-L10699
def doeqdi(x, y, UP=False): """ Takes digitized x,y, data and returns the dec,inc, assuming an equal area projection Parameters __________________ x : array of digitized x from point on equal area projection y : array of igitized y from point on equal area projection UP : if...
[ "def", "doeqdi", "(", "x", ",", "y", ",", "UP", "=", "False", ")", ":", "xp", ",", "yp", "=", "y", ",", "x", "# need to switch into geographic convention", "r", "=", "np", ".", "sqrt", "(", "xp", "**", "2", "+", "yp", "**", "2", ")", "z", "=", ...
Takes digitized x,y, data and returns the dec,inc, assuming an equal area projection Parameters __________________ x : array of digitized x from point on equal area projection y : array of igitized y from point on equal area projection UP : if True, is an upper hemisphere projection...
[ "Takes", "digitized", "x", "y", "data", "and", "returns", "the", "dec", "inc", "assuming", "an", "equal", "area", "projection", "Parameters", "__________________", "x", ":", "array", "of", "digitized", "x", "from", "point", "on", "equal", "area", "projection",...
python
train
solvebio/solvebio-python
solvebio/cli/ipython.py
https://github.com/solvebio/solvebio-python/blob/b29614643043afd19c1d8074e8f25c6700d51a73/solvebio/cli/ipython.py#L14-L29
def launch_ipython_shell(args): # pylint: disable=unused-argument """Open the SolveBio shell (IPython wrapper)""" try: import IPython # noqa except ImportError: _print("The SolveBio Python shell requires IPython.\n" "To install, type: 'pip install ipython'") return F...
[ "def", "launch_ipython_shell", "(", "args", ")", ":", "# pylint: disable=unused-argument", "try", ":", "import", "IPython", "# noqa", "except", "ImportError", ":", "_print", "(", "\"The SolveBio Python shell requires IPython.\\n\"", "\"To install, type: 'pip install ipython'\"", ...
Open the SolveBio shell (IPython wrapper)
[ "Open", "the", "SolveBio", "shell", "(", "IPython", "wrapper", ")" ]
python
test
nickmckay/LiPD-utilities
Python/lipd/lpd_noaa.py
https://github.com/nickmckay/LiPD-utilities/blob/5dab6bbeffc5effd68e3a6beaca6b76aa928e860/Python/lipd/lpd_noaa.py#L554-L578
def __reorganize_geo(self): """ Concat geo value and units, and reorganize the rest References geo data from self.noaa_data_sorted Places new data into self.noaa_geo temporarily, and then back into self.noaa_data_sorted. :return: """ logger_lpd_noaa.info("enter re...
[ "def", "__reorganize_geo", "(", "self", ")", ":", "logger_lpd_noaa", ".", "info", "(", "\"enter reorganize_geo\"", ")", "try", ":", "# Geo -> Properties", "for", "k", ",", "v", "in", "self", ".", "noaa_data_sorted", "[", "\"Site_Information\"", "]", "[", "'prope...
Concat geo value and units, and reorganize the rest References geo data from self.noaa_data_sorted Places new data into self.noaa_geo temporarily, and then back into self.noaa_data_sorted. :return:
[ "Concat", "geo", "value", "and", "units", "and", "reorganize", "the", "rest", "References", "geo", "data", "from", "self", ".", "noaa_data_sorted", "Places", "new", "data", "into", "self", ".", "noaa_geo", "temporarily", "and", "then", "back", "into", "self", ...
python
train
ozgurgunes/django-manifest
manifest/accounts/forms.py
https://github.com/ozgurgunes/django-manifest/blob/9873bbf2a475b76284ad7e36b2b26c92131e72dd/manifest/accounts/forms.py#L181-L198
def clean(self): """ Checks for the identification and password. If the combination can't be found will raise an invalid sign in error. """ identification = self.cleaned_data.get('identification') password = self.cleaned_data.get('password') if identification a...
[ "def", "clean", "(", "self", ")", ":", "identification", "=", "self", ".", "cleaned_data", ".", "get", "(", "'identification'", ")", "password", "=", "self", ".", "cleaned_data", ".", "get", "(", "'password'", ")", "if", "identification", "and", "password", ...
Checks for the identification and password. If the combination can't be found will raise an invalid sign in error.
[ "Checks", "for", "the", "identification", "and", "password", "." ]
python
train
pybel/pybel-tools
src/pybel_tools/assembler/html/assembler.py
https://github.com/pybel/pybel-tools/blob/3491adea0ac4ee60f57275ef72f9b73da6dbfe0c/src/pybel_tools/assembler/html/assembler.py#L45-L98
def to_html(graph: BELGraph) -> str: """Render the graph as an HTML string. Common usage may involve writing to a file like: >>> from pybel.examples import sialic_acid_graph >>> with open('html_output.html', 'w') as file: ... print(to_html(sialic_acid_graph), file=file) """ context = g...
[ "def", "to_html", "(", "graph", ":", "BELGraph", ")", "->", "str", ":", "context", "=", "get_network_summary_dict", "(", "graph", ")", "summary_dict", "=", "graph", ".", "summary_dict", "(", ")", "citation_years", "=", "context", "[", "'citation_years'", "]", ...
Render the graph as an HTML string. Common usage may involve writing to a file like: >>> from pybel.examples import sialic_acid_graph >>> with open('html_output.html', 'w') as file: ... print(to_html(sialic_acid_graph), file=file)
[ "Render", "the", "graph", "as", "an", "HTML", "string", "." ]
python
valid
SBRG/ssbio
ssbio/pipeline/atlas3.py
https://github.com/SBRG/ssbio/blob/e9449e64ffc1a1f5ad07e5849aa12a650095f8a2/ssbio/pipeline/atlas3.py#L1000-L1093
def run_all2(protgroup, memornot, subsequences, base_outdir, protgroup_dict, protein_feathers_dir, date, errfile, impute_counts=True, cutoff_num_proteins=0, core_only_genes=None, length_filter_pid=.8, remove_correlated_feats=True, force_rerun_counts=False, force_rerun_per...
[ "def", "run_all2", "(", "protgroup", ",", "memornot", ",", "subsequences", ",", "base_outdir", ",", "protgroup_dict", ",", "protein_feathers_dir", ",", "date", ",", "errfile", ",", "impute_counts", "=", "True", ",", "cutoff_num_proteins", "=", "0", ",", "core_on...
run_all but ignoring observations before pca
[ "run_all", "but", "ignoring", "observations", "before", "pca" ]
python
train
whyscream/dspam-milter
dspam/client.py
https://github.com/whyscream/dspam-milter/blob/f9939b718eed02cb7e56f8c5b921db4cfe1cd85a/dspam/client.py#L241-L293
def mailfrom(self, sender=None, client_args=None): """ Send LMTP MAIL FROM command, and process the server response. In DLMTP mode, the server expects the client to identify itself. Because the envelope sender is of no importance to DSPAM, the client is expected to send an ident...
[ "def", "mailfrom", "(", "self", ",", "sender", "=", "None", ",", "client_args", "=", "None", ")", ":", "if", "sender", "and", "client_args", ":", "raise", "DspamClientError", "(", "'Arguments are mutually exclusive'", ")", "if", "client_args", "and", "not", "s...
Send LMTP MAIL FROM command, and process the server response. In DLMTP mode, the server expects the client to identify itself. Because the envelope sender is of no importance to DSPAM, the client is expected to send an identity and a password (dspam.conf: ServerPass.<ident>="<password>"...
[ "Send", "LMTP", "MAIL", "FROM", "command", "and", "process", "the", "server", "response", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/layers/latent_layers.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/layers/latent_layers.py#L422-L462
def transformer_image_decoder(targets, encoder_output, ed_attention_bias, hparams, name=None): """Transformer image decoder over targets with local attention. Args: targets: Tensor of shape [...
[ "def", "transformer_image_decoder", "(", "targets", ",", "encoder_output", ",", "ed_attention_bias", ",", "hparams", ",", "name", "=", "None", ")", ":", "with", "tf", ".", "variable_scope", "(", "name", ",", "default_name", "=", "\"transformer_dec\"", ")", ":", ...
Transformer image decoder over targets with local attention. Args: targets: Tensor of shape [batch, ...], and whose size is batch * height * width * hparams.num_channels * hparams.hidden_size. encoder_output: Tensor of shape [batch, length_kv, hparams.hidden_size]. ed_attention_bias: Tensor which b...
[ "Transformer", "image", "decoder", "over", "targets", "with", "local", "attention", "." ]
python
train
Loudr/asana-hub
asana_hub/actions/pull_request.py
https://github.com/Loudr/asana-hub/blob/af996ce890ed23d8ede5bf68dcd318e3438829cb/asana_hub/actions/pull_request.py#L19-L55
def add_arguments(cls, parser): """Add arguments to the parser for collection in app.args. Args: parser: `argparse.ArgumentParser`. Parser. Arguments added here are server on self.args. """ parser.add_argument( '-i...
[ "def", "add_arguments", "(", "cls", ",", "parser", ")", ":", "parser", ".", "add_argument", "(", "'-i'", ",", "'--issue'", ",", "action", "=", "'store'", ",", "nargs", "=", "'?'", ",", "const", "=", "''", ",", "dest", "=", "'issue'", ",", "help", "="...
Add arguments to the parser for collection in app.args. Args: parser: `argparse.ArgumentParser`. Parser. Arguments added here are server on self.args.
[ "Add", "arguments", "to", "the", "parser", "for", "collection", "in", "app", ".", "args", "." ]
python
test
a1ezzz/wasp-general
wasp_general/network/clients/virtual_dir.py
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/clients/virtual_dir.py#L77-L85
def join_path(self, *path): """ Unite entries to generate a single path :param path: path items to unite :return: str """ path = self.directory_sep().join(path) return self.normalize_path(path)
[ "def", "join_path", "(", "self", ",", "*", "path", ")", ":", "path", "=", "self", ".", "directory_sep", "(", ")", ".", "join", "(", "path", ")", "return", "self", ".", "normalize_path", "(", "path", ")" ]
Unite entries to generate a single path :param path: path items to unite :return: str
[ "Unite", "entries", "to", "generate", "a", "single", "path" ]
python
train
treycucco/bidon
bidon/data_table.py
https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/data_table.py#L171-L176
def clean_value(self, value): """Cleans a value, using either the user provided clean_value, or cls.reduce_value.""" if self._clean_value: return self._clean_value(value) else: return self.reduce_value(value)
[ "def", "clean_value", "(", "self", ",", "value", ")", ":", "if", "self", ".", "_clean_value", ":", "return", "self", ".", "_clean_value", "(", "value", ")", "else", ":", "return", "self", ".", "reduce_value", "(", "value", ")" ]
Cleans a value, using either the user provided clean_value, or cls.reduce_value.
[ "Cleans", "a", "value", "using", "either", "the", "user", "provided", "clean_value", "or", "cls", ".", "reduce_value", "." ]
python
train
shoebot/shoebot
shoebot/gui/var_window.py
https://github.com/shoebot/shoebot/blob/d554c1765c1899fa25727c9fc6805d221585562b/shoebot/gui/var_window.py#L197-L212
def var_deleted(self, v): """ var was added in the bot :param v: :return: """ widget = self.widgets[v.name] # widgets are all in a single container .. parent = widget.get_parent() self.container.remove(parent) del self.widgets[v.name] ...
[ "def", "var_deleted", "(", "self", ",", "v", ")", ":", "widget", "=", "self", ".", "widgets", "[", "v", ".", "name", "]", "# widgets are all in a single container ..", "parent", "=", "widget", ".", "get_parent", "(", ")", "self", ".", "container", ".", "re...
var was added in the bot :param v: :return:
[ "var", "was", "added", "in", "the", "bot" ]
python
valid
tomasbasham/dominos
dominos/api.py
https://github.com/tomasbasham/dominos/blob/59729a8bdca0ae30a84115a0e93e9b1f259faf0e/dominos/api.py#L102-L117
def get_menu(self, store): ''' Retrieve the menu from the selected store. :param Store store: A store. :return: The store menu. :rtype: Menu ''' params = { 'collectionOnly': not store.delivery_available, 'menuVersion': store.menu_version, ...
[ "def", "get_menu", "(", "self", ",", "store", ")", ":", "params", "=", "{", "'collectionOnly'", ":", "not", "store", ".", "delivery_available", ",", "'menuVersion'", ":", "store", ".", "menu_version", ",", "'storeId'", ":", "store", ".", "store_id", ",", "...
Retrieve the menu from the selected store. :param Store store: A store. :return: The store menu. :rtype: Menu
[ "Retrieve", "the", "menu", "from", "the", "selected", "store", "." ]
python
test
dpranke/pyjson5
json5/lib.py
https://github.com/dpranke/pyjson5/blob/94e2ddee6988ec09de48cdb9aad8f6ce10d7fc05/json5/lib.py#L120-L148
def dumps(obj, **kwargs): """Serialize ``obj`` to a JSON5-formatted ``str``.""" t = type(obj) if obj is True: return u'true' elif obj is False: return u'false' elif obj == None: return u'null' elif t == type('') or t == type(u''): single = "'" in obj doub...
[ "def", "dumps", "(", "obj", ",", "*", "*", "kwargs", ")", ":", "t", "=", "type", "(", "obj", ")", "if", "obj", "is", "True", ":", "return", "u'true'", "elif", "obj", "is", "False", ":", "return", "u'false'", "elif", "obj", "==", "None", ":", "ret...
Serialize ``obj`` to a JSON5-formatted ``str``.
[ "Serialize", "obj", "to", "a", "JSON5", "-", "formatted", "str", "." ]
python
train
Gandi/gandi.cli
gandi/cli/commands/record.py
https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/record.py#L101-L118
def create(gandi, domain, zone_id, name, type, value, ttl): """Create new DNS zone record entry for a domain.""" if not zone_id: result = gandi.domain.info(domain) zone_id = result['zone_id'] if not zone_id: gandi.echo('No zone records found, domain %s doesn\'t seems to be ' ...
[ "def", "create", "(", "gandi", ",", "domain", ",", "zone_id", ",", "name", ",", "type", ",", "value", ",", "ttl", ")", ":", "if", "not", "zone_id", ":", "result", "=", "gandi", ".", "domain", ".", "info", "(", "domain", ")", "zone_id", "=", "result...
Create new DNS zone record entry for a domain.
[ "Create", "new", "DNS", "zone", "record", "entry", "for", "a", "domain", "." ]
python
train
ARMmbed/mbed-cloud-sdk-python
src/mbed_cloud/_backends/iam/apis/aggregator_account_admin_api.py
https://github.com/ARMmbed/mbed-cloud-sdk-python/blob/c0af86fb2cdd4dc7ed26f236139241067d293509/src/mbed_cloud/_backends/iam/apis/aggregator_account_admin_api.py#L4619-L4640
def validate_account_user_email(self, account_id, user_id, **kwargs): # noqa: E501 """Validate the user email. # noqa: E501 An endpoint for validating the user email. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/accounts/{accountID}/users/{user-id}/validate-email -H 'Auth...
[ "def", "validate_account_user_email", "(", "self", ",", "account_id", ",", "user_id", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'asynchronous'", ")", ":", ...
Validate the user email. # noqa: E501 An endpoint for validating the user email. **Example usage:** `curl -X POST https://api.us-east-1.mbedcloud.com/v3/accounts/{accountID}/users/{user-id}/validate-email -H 'Authorization: Bearer API_KEY'` # noqa: E501 This method makes a synchronous HTTP request ...
[ "Validate", "the", "user", "email", ".", "#", "noqa", ":", "E501" ]
python
train
praekelt/django-livechat
livechat/models.py
https://github.com/praekelt/django-livechat/blob/22d86fb4219e5af6c83e0542aa30e5ea54e71d26/livechat/models.py#L54-L62
def get_current_live_chat(self): """ Check if there is a live chat on the go, so that we should take over the AskMAMA page with the live chat. """ now = datetime.now() chat = self.upcoming_live_chat() if chat and chat.is_in_progress(): return chat ...
[ "def", "get_current_live_chat", "(", "self", ")", ":", "now", "=", "datetime", ".", "now", "(", ")", "chat", "=", "self", ".", "upcoming_live_chat", "(", ")", "if", "chat", "and", "chat", ".", "is_in_progress", "(", ")", ":", "return", "chat", "return", ...
Check if there is a live chat on the go, so that we should take over the AskMAMA page with the live chat.
[ "Check", "if", "there", "is", "a", "live", "chat", "on", "the", "go", "so", "that", "we", "should", "take", "over", "the", "AskMAMA", "page", "with", "the", "live", "chat", "." ]
python
train
dmwm/DBS
Server/Python/src/dbs/web/DBSMigrateModel.py
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/web/DBSMigrateModel.py#L68-L93
def submit(self): """ Interface for submitting a migration request. Required input keys: MIGRATION_URL: The source DBS url for migration. MIGRATION_INPUT: The block or dataset names to be migrated. """ body = request.body.read() indata = cjson.decode(body)...
[ "def", "submit", "(", "self", ")", ":", "body", "=", "request", ".", "body", ".", "read", "(", ")", "indata", "=", "cjson", ".", "decode", "(", "body", ")", "try", ":", "indata", "=", "validateJSONInputNoCopy", "(", "\"migration_rqst\"", ",", "indata", ...
Interface for submitting a migration request. Required input keys: MIGRATION_URL: The source DBS url for migration. MIGRATION_INPUT: The block or dataset names to be migrated.
[ "Interface", "for", "submitting", "a", "migration", "request", ".", "Required", "input", "keys", ":", "MIGRATION_URL", ":", "The", "source", "DBS", "url", "for", "migration", ".", "MIGRATION_INPUT", ":", "The", "block", "or", "dataset", "names", "to", "be", ...
python
train
PMEAL/OpenPNM
openpnm/models/geometry/throat_vector.py
https://github.com/PMEAL/OpenPNM/blob/0547b5724ffedc0a593aae48639d36fe10e0baed/openpnm/models/geometry/throat_vector.py#L10-L34
def pore_to_pore(target): r""" Calculates throat vector as straight path between connected pores. Parameters ---------- geometry : OpenPNM Geometry object The object containing the geometrical properties of the throats Notes ----- There is an important impicit assumption here: ...
[ "def", "pore_to_pore", "(", "target", ")", ":", "network", "=", "target", ".", "project", ".", "network", "throats", "=", "network", ".", "throats", "(", "target", ".", "name", ")", "conns", "=", "network", "[", "'throat.conns'", "]", "P1", "=", "conns",...
r""" Calculates throat vector as straight path between connected pores. Parameters ---------- geometry : OpenPNM Geometry object The object containing the geometrical properties of the throats Notes ----- There is an important impicit assumption here: the positive direction is ...
[ "r", "Calculates", "throat", "vector", "as", "straight", "path", "between", "connected", "pores", "." ]
python
train
twilio/twilio-python
twilio/rest/taskrouter/v1/workspace/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/taskrouter/v1/workspace/__init__.py#L405-L414
def statistics(self): """ Access the statistics :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList """ if self._statistics is None: ...
[ "def", "statistics", "(", "self", ")", ":", "if", "self", ".", "_statistics", "is", "None", ":", "self", ".", "_statistics", "=", "WorkspaceStatisticsList", "(", "self", ".", "_version", ",", "workspace_sid", "=", "self", ".", "_solution", "[", "'sid'", "]...
Access the statistics :returns: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList :rtype: twilio.rest.taskrouter.v1.workspace.workspace_statistics.WorkspaceStatisticsList
[ "Access", "the", "statistics" ]
python
train
woolfson-group/isambard
isambard/ampal/base_ampal.py
https://github.com/woolfson-group/isambard/blob/ebc33b48a28ad217e18f93b910dfba46e6e71e07/isambard/ampal/base_ampal.py#L326-L350
def rmsd(self, other, backbone=False): """Calculates the RMSD between two AMPAL objects. Notes ----- No fitting operation is performs and both AMPAL objects must have the same number of atoms. Parameters ---------- other : AMPAL Object Any AM...
[ "def", "rmsd", "(", "self", ",", "other", ",", "backbone", "=", "False", ")", ":", "assert", "type", "(", "self", ")", "==", "type", "(", "other", ")", "if", "backbone", "and", "hasattr", "(", "self", ",", "'backbone'", ")", ":", "points1", "=", "s...
Calculates the RMSD between two AMPAL objects. Notes ----- No fitting operation is performs and both AMPAL objects must have the same number of atoms. Parameters ---------- other : AMPAL Object Any AMPAL object with `get_atoms` method. backbo...
[ "Calculates", "the", "RMSD", "between", "two", "AMPAL", "objects", "." ]
python
train
tornadoweb/tornado
demos/blog/blog.py
https://github.com/tornadoweb/tornado/blob/b8b481770bcdb333a69afde5cce7eaa449128326/demos/blog/blog.py#L99-L112
async def query(self, stmt, *args): """Query for a list of results. Typical usage:: results = await self.query(...) Or:: for row in await self.query(...) """ with (await self.application.db.cursor()) as cur: await cur.execute(stmt, args) ...
[ "async", "def", "query", "(", "self", ",", "stmt", ",", "*", "args", ")", ":", "with", "(", "await", "self", ".", "application", ".", "db", ".", "cursor", "(", ")", ")", "as", "cur", ":", "await", "cur", ".", "execute", "(", "stmt", ",", "args", ...
Query for a list of results. Typical usage:: results = await self.query(...) Or:: for row in await self.query(...)
[ "Query", "for", "a", "list", "of", "results", "." ]
python
train
stxnext/mappet
mappet/mappet.py
https://github.com/stxnext/mappet/blob/ac7468ac28ed82e45065b1e348cf865c8f73f0db/mappet/mappet.py#L90-L104
def setattr(self, key, value): u"""Sets an attribute on a node. >>> xml = etree.Element('root') >>> Node(xml).setattr('text', 'text2') >>> Node(xml).getattr('text') 'text2' >>> Node(xml).setattr('attr', 'val') >>> Node(xml).getattr('attr') 'val' "...
[ "def", "setattr", "(", "self", ",", "key", ",", "value", ")", ":", "if", "key", "==", "'text'", ":", "self", ".", "_xml", ".", "text", "=", "str", "(", "value", ")", "else", ":", "self", ".", "_xml", ".", "set", "(", "key", ",", "str", "(", "...
u"""Sets an attribute on a node. >>> xml = etree.Element('root') >>> Node(xml).setattr('text', 'text2') >>> Node(xml).getattr('text') 'text2' >>> Node(xml).setattr('attr', 'val') >>> Node(xml).getattr('attr') 'val'
[ "u", "Sets", "an", "attribute", "on", "a", "node", "." ]
python
train
pokerregion/poker
poker/room/pokerstars.py
https://github.com/pokerregion/poker/blob/2d8cf208fdf2b26bdc935972dcbe7a983a9e9768/poker/room/pokerstars.py#L417-L430
def add_label(self, name, color): """Add a new label. It's id will automatically be calculated.""" color_upper = color.upper() if not self._color_re.match(color_upper): raise ValueError('Invalid color: {}'.format(color)) labels_tag = self.root[0] last_id = int(labels...
[ "def", "add_label", "(", "self", ",", "name", ",", "color", ")", ":", "color_upper", "=", "color", ".", "upper", "(", ")", "if", "not", "self", ".", "_color_re", ".", "match", "(", "color_upper", ")", ":", "raise", "ValueError", "(", "'Invalid color: {}'...
Add a new label. It's id will automatically be calculated.
[ "Add", "a", "new", "label", ".", "It", "s", "id", "will", "automatically", "be", "calculated", "." ]
python
train
ArduPilot/MAVProxy
MAVProxy/modules/mavproxy_adsb.py
https://github.com/ArduPilot/MAVProxy/blob/f50bdeff33064876f7dc8dc4683d278ff47f75d5/MAVProxy/modules/mavproxy_adsb.py#L178-L218
def mavlink_packet(self, m): '''handle an incoming mavlink packet''' if m.get_type() == "ADSB_VEHICLE": id = 'ADSB-' + str(m.ICAO_address) if id not in self.threat_vehicles.keys(): # check to see if the vehicle is in the dict # if not then add it ...
[ "def", "mavlink_packet", "(", "self", ",", "m", ")", ":", "if", "m", ".", "get_type", "(", ")", "==", "\"ADSB_VEHICLE\"", ":", "id", "=", "'ADSB-'", "+", "str", "(", "m", ".", "ICAO_address", ")", "if", "id", "not", "in", "self", ".", "threat_vehicle...
handle an incoming mavlink packet
[ "handle", "an", "incoming", "mavlink", "packet" ]
python
train
Yelp/kafka-utils
kafka_utils/util/monitoring.py
https://github.com/Yelp/kafka-utils/blob/cdb4d64308f3079ee0873250bf7b34d0d94eca50/kafka_utils/util/monitoring.py#L150-L165
def merge_offsets_metadata(topics, *offsets_responses): """Merge the offset metadata dictionaries from multiple responses. :param topics: list of topics :param offsets_responses: list of dict topic: partition: offset :returns: dict topic: partition: offset """ result = dict() for topic in t...
[ "def", "merge_offsets_metadata", "(", "topics", ",", "*", "offsets_responses", ")", ":", "result", "=", "dict", "(", ")", "for", "topic", "in", "topics", ":", "partition_offsets", "=", "[", "response", "[", "topic", "]", "for", "response", "in", "offsets_res...
Merge the offset metadata dictionaries from multiple responses. :param topics: list of topics :param offsets_responses: list of dict topic: partition: offset :returns: dict topic: partition: offset
[ "Merge", "the", "offset", "metadata", "dictionaries", "from", "multiple", "responses", "." ]
python
train
vanheeringen-lab/gimmemotifs
gimmemotifs/stats.py
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/stats.py#L16-L82
def calc_stats_iterator(motifs, fg_file, bg_file, genome=None, stats=None, ncpus=None): """Calculate motif enrichment metrics. Parameters ---------- motifs : str, list or Motif instance A file with motifs in pwm format, a list of Motif instances or a single Motif instance. fg_file...
[ "def", "calc_stats_iterator", "(", "motifs", ",", "fg_file", ",", "bg_file", ",", "genome", "=", "None", ",", "stats", "=", "None", ",", "ncpus", "=", "None", ")", ":", "if", "not", "stats", ":", "stats", "=", "rocmetrics", ".", "__all__", "if", "isins...
Calculate motif enrichment metrics. Parameters ---------- motifs : str, list or Motif instance A file with motifs in pwm format, a list of Motif instances or a single Motif instance. fg_file : str Filename of a FASTA, BED or region file with positive sequences. bg_file : ...
[ "Calculate", "motif", "enrichment", "metrics", "." ]
python
train
kivy/python-for-android
pythonforandroid/graph.py
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/graph.py#L127-L143
def find_order(graph): ''' Do a topological sort on the dependency graph dict. ''' while graph: # Find all items without a parent leftmost = [l for l, s in graph.items() if not s] if not leftmost: raise ValueError('Dependency cycle detected! %s' % graph) # If ...
[ "def", "find_order", "(", "graph", ")", ":", "while", "graph", ":", "# Find all items without a parent", "leftmost", "=", "[", "l", "for", "l", ",", "s", "in", "graph", ".", "items", "(", ")", "if", "not", "s", "]", "if", "not", "leftmost", ":", "raise...
Do a topological sort on the dependency graph dict.
[ "Do", "a", "topological", "sort", "on", "the", "dependency", "graph", "dict", "." ]
python
train
thecynic/pylutron
pylutron/__init__.py
https://github.com/thecynic/pylutron/blob/4d9222c96ef7ac7ac458031c058ad93ec31cebbf/pylutron/__init__.py#L362-L383
def _recv(self, line): """Invoked by the connection manager to process incoming data.""" if line == '': return # Only handle query response messages, which are also sent on remote status # updates (e.g. user manually pressed a keypad button) if line[0] != Lutron.OP_RESPONSE: _LOGGER.debu...
[ "def", "_recv", "(", "self", ",", "line", ")", ":", "if", "line", "==", "''", ":", "return", "# Only handle query response messages, which are also sent on remote status", "# updates (e.g. user manually pressed a keypad button)", "if", "line", "[", "0", "]", "!=", "Lutron...
Invoked by the connection manager to process incoming data.
[ "Invoked", "by", "the", "connection", "manager", "to", "process", "incoming", "data", "." ]
python
train
uogbuji/versa
tools/py/util.py
https://github.com/uogbuji/versa/blob/f092ffc7ed363a5b170890955168500f32de0dd5/tools/py/util.py#L147-L164
def jsonload(model, fp): ''' Load Versa model dumped into JSON form, either raw or canonical ''' dumped_list = json.load(fp) for link in dumped_list: if len(link) == 2: sid, (s, p, o, a) = link elif len(link) == 4: #canonical (s, p, o, a) = link tt...
[ "def", "jsonload", "(", "model", ",", "fp", ")", ":", "dumped_list", "=", "json", ".", "load", "(", "fp", ")", "for", "link", "in", "dumped_list", ":", "if", "len", "(", "link", ")", "==", "2", ":", "sid", ",", "(", "s", ",", "p", ",", "o", "...
Load Versa model dumped into JSON form, either raw or canonical
[ "Load", "Versa", "model", "dumped", "into", "JSON", "form", "either", "raw", "or", "canonical" ]
python
train
i3visio/osrframework
osrframework/thirdparties/pipl_com/lib/containers.py
https://github.com/i3visio/osrframework/blob/83437f4c14c9c08cb80a896bd9834c77f6567871/osrframework/thirdparties/pipl_com/lib/containers.py#L78-L85
def fields_to_dict(self): """Transform the object to a dict and return the dict.""" d = {} for container in FieldsContainer.class_container.values(): fields = getattr(self, container) if fields: d[container] = [field.to_dict() for field in fields] ...
[ "def", "fields_to_dict", "(", "self", ")", ":", "d", "=", "{", "}", "for", "container", "in", "FieldsContainer", ".", "class_container", ".", "values", "(", ")", ":", "fields", "=", "getattr", "(", "self", ",", "container", ")", "if", "fields", ":", "d...
Transform the object to a dict and return the dict.
[ "Transform", "the", "object", "to", "a", "dict", "and", "return", "the", "dict", "." ]
python
train
iotile/coretools
iotilecore/iotile/core/hw/transport/virtualadapter.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/virtualadapter.py#L219-L245
async def connect(self, conn_id, connection_string): """Asynchronously connect to a device Args: conn_id (int): A unique identifer that will refer to this connection connection_string (string): A DeviceAdapter specific string that can be used to connect to a devi...
[ "async", "def", "connect", "(", "self", ",", "conn_id", ",", "connection_string", ")", ":", "id_number", "=", "int", "(", "connection_string", ")", "if", "id_number", "not", "in", "self", ".", "devices", ":", "raise", "DeviceAdapterError", "(", "conn_id", ",...
Asynchronously connect to a device Args: conn_id (int): A unique identifer that will refer to this connection connection_string (string): A DeviceAdapter specific string that can be used to connect to a device using this DeviceAdapter. callback (callable): A ...
[ "Asynchronously", "connect", "to", "a", "device" ]
python
train
casacore/python-casacore
casacore/measures/__init__.py
https://github.com/casacore/python-casacore/blob/975510861ea005f7919dd9e438b5f98a1682eebe/casacore/measures/__init__.py#L618-L634
def getvalue(self, v): """ Return a list of quantities making up the measures' value. :param v: a measure """ if not is_measure(v): raise TypeError('Incorrect input type for getvalue()') import re rx = re.compile("m\d+") out = [] keys ...
[ "def", "getvalue", "(", "self", ",", "v", ")", ":", "if", "not", "is_measure", "(", "v", ")", ":", "raise", "TypeError", "(", "'Incorrect input type for getvalue()'", ")", "import", "re", "rx", "=", "re", ".", "compile", "(", "\"m\\d+\"", ")", "out", "="...
Return a list of quantities making up the measures' value. :param v: a measure
[ "Return", "a", "list", "of", "quantities", "making", "up", "the", "measures", "value", "." ]
python
train
Microsoft/knack
knack/output.py
https://github.com/Microsoft/knack/blob/5f1a480a33f103e2688c46eef59fb2d9eaf2baad/knack/output.py#L113-L142
def out(self, obj, formatter=None, out_file=None): # pylint: disable=no-self-use """ Produces the output using the command result. The method does not return a result as the output is written straight to the output file. :param obj: The command result :type obj: knack.util.CommandR...
[ "def", "out", "(", "self", ",", "obj", ",", "formatter", "=", "None", ",", "out_file", "=", "None", ")", ":", "# pylint: disable=no-self-use", "if", "not", "isinstance", "(", "obj", ",", "CommandResultItem", ")", ":", "raise", "TypeError", "(", "'Expected {}...
Produces the output using the command result. The method does not return a result as the output is written straight to the output file. :param obj: The command result :type obj: knack.util.CommandResultItem :param formatter: The formatter we should use for the command result ...
[ "Produces", "the", "output", "using", "the", "command", "result", ".", "The", "method", "does", "not", "return", "a", "result", "as", "the", "output", "is", "written", "straight", "to", "the", "output", "file", "." ]
python
train
orbingol/NURBS-Python
geomdl/trimming.py
https://github.com/orbingol/NURBS-Python/blob/b1c6a8b51cf143ff58761438e93ba6baef470627/geomdl/trimming.py#L137-L171
def fix_trim_curves(obj): """ Fixes direction, connectivity and similar issues of the trim curves. This function works for surface trim curves consisting of a single curve. :param obj: input surface :type obj: abstract.Surface """ # Validate input if obj.pdimension != 2: raise Geom...
[ "def", "fix_trim_curves", "(", "obj", ")", ":", "# Validate input", "if", "obj", ".", "pdimension", "!=", "2", ":", "raise", "GeomdlException", "(", "\"Input geometry must be a surface\"", ")", "# Get trims of the surface", "for", "o", "in", "obj", ":", "trims", "...
Fixes direction, connectivity and similar issues of the trim curves. This function works for surface trim curves consisting of a single curve. :param obj: input surface :type obj: abstract.Surface
[ "Fixes", "direction", "connectivity", "and", "similar", "issues", "of", "the", "trim", "curves", "." ]
python
train
apache/incubator-heron
heron/executor/src/python/heron_executor.py
https://github.com/apache/incubator-heron/blob/ad10325a0febe89ad337e561ebcbe37ec5d9a5ac/heron/executor/src/python/heron_executor.py#L774-L841
def _get_streaming_processes(self): ''' Returns the processes to handle streams, including the stream-mgr and the user code containing the stream logic of the topology ''' retval = {} instance_plans = self._get_instance_plans(self.packing_plan, self.shard) instance_info = [] for instance...
[ "def", "_get_streaming_processes", "(", "self", ")", ":", "retval", "=", "{", "}", "instance_plans", "=", "self", ".", "_get_instance_plans", "(", "self", ".", "packing_plan", ",", "self", ".", "shard", ")", "instance_info", "=", "[", "]", "for", "instance_p...
Returns the processes to handle streams, including the stream-mgr and the user code containing the stream logic of the topology
[ "Returns", "the", "processes", "to", "handle", "streams", "including", "the", "stream", "-", "mgr", "and", "the", "user", "code", "containing", "the", "stream", "logic", "of", "the", "topology" ]
python
valid
tensorflow/tensor2tensor
tensor2tensor/models/research/glow_ops.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/research/glow_ops.py#L867-L925
def latent_to_dist(name, x, hparams, output_channels=None): """Map latent to the mean and log-scale of a Gaussian. Args: name: variable scope. x: 4-D Tensor of shape (NHWC) hparams: HParams. latent_architecture - can be "single_conv", "glow_nn" or "glow_resnet", defaul...
[ "def", "latent_to_dist", "(", "name", ",", "x", ",", "hparams", ",", "output_channels", "=", "None", ")", ":", "architecture", "=", "hparams", ".", "get", "(", "\"latent_architecture\"", ",", "\"single_conv\"", ")", "depth", "=", "hparams", ".", "get", "(", ...
Map latent to the mean and log-scale of a Gaussian. Args: name: variable scope. x: 4-D Tensor of shape (NHWC) hparams: HParams. latent_architecture - can be "single_conv", "glow_nn" or "glow_resnet", default = single_conv latent_encoder_depth - int, depth of archit...
[ "Map", "latent", "to", "the", "mean", "and", "log", "-", "scale", "of", "a", "Gaussian", "." ]
python
train
loli/medpy
medpy/filter/IntensityRangeStandardization.py
https://github.com/loli/medpy/blob/95216b9e22e7ce301f0edf953ee2a2f1b6c6aee5/medpy/filter/IntensityRangeStandardization.py#L497-L506
def is_in_interval(n, l, r, border = 'included'): """ Checks whether a number is inside the interval l, r. """ if 'included' == border: return (n >= l) and (n <= r) elif 'excluded' == border: return (n > l) and (n < r) else: raise Value...
[ "def", "is_in_interval", "(", "n", ",", "l", ",", "r", ",", "border", "=", "'included'", ")", ":", "if", "'included'", "==", "border", ":", "return", "(", "n", ">=", "l", ")", "and", "(", "n", "<=", "r", ")", "elif", "'excluded'", "==", "border", ...
Checks whether a number is inside the interval l, r.
[ "Checks", "whether", "a", "number", "is", "inside", "the", "interval", "l", "r", "." ]
python
train
googlefonts/fontbakery
Lib/fontbakery/profiles/name.py
https://github.com/googlefonts/fontbakery/blob/b355aea2e619a4477769e060d24c32448aa65399/Lib/fontbakery/profiles/name.py#L66-L177
def com_google_fonts_check_monospace(ttFont, glyph_metrics_stats): """Checking correctness of monospaced metadata. There are various metadata in the OpenType spec to specify if a font is monospaced or not. If the font is not trully monospaced, then no monospaced metadata should be set (as sometimes they mist...
[ "def", "com_google_fonts_check_monospace", "(", "ttFont", ",", "glyph_metrics_stats", ")", ":", "from", "fontbakery", ".", "constants", "import", "(", "IsFixedWidth", ",", "PANOSE_Proportion", ")", "failed", "=", "False", "# Note: These values are read from the dict here on...
Checking correctness of monospaced metadata. There are various metadata in the OpenType spec to specify if a font is monospaced or not. If the font is not trully monospaced, then no monospaced metadata should be set (as sometimes they mistakenly are...) Monospace fonts must: * post.isFixedWidth "Set to 0...
[ "Checking", "correctness", "of", "monospaced", "metadata", "." ]
python
train
cpenv/cpenv
cpenv/api.py
https://github.com/cpenv/cpenv/blob/afbb569ae04002743db041d3629a5be8c290bd89/cpenv/api.py#L127-L136
def launch(module_name, *args, **kwargs): '''Activates and launches a module :param module_name: name of module to launch ''' r = resolve(module_name) r.activate() mod = r.resolved[0] mod.launch(*args, **kwargs)
[ "def", "launch", "(", "module_name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "r", "=", "resolve", "(", "module_name", ")", "r", ".", "activate", "(", ")", "mod", "=", "r", ".", "resolved", "[", "0", "]", "mod", ".", "launch", "(", ...
Activates and launches a module :param module_name: name of module to launch
[ "Activates", "and", "launches", "a", "module" ]
python
valid
bigchaindb/bigchaindb
bigchaindb/fastquery.py
https://github.com/bigchaindb/bigchaindb/blob/835fdfcf598918f76139e3b88ee33dd157acaaa7/bigchaindb/fastquery.py#L25-L36
def filter_spent_outputs(self, outputs): """Remove outputs that have been spent Args: outputs: list of TransactionLink """ links = [o.to_dict() for o in outputs] txs = list(query.get_spending_transactions(self.connection, links)) spends = {TransactionLink.fro...
[ "def", "filter_spent_outputs", "(", "self", ",", "outputs", ")", ":", "links", "=", "[", "o", ".", "to_dict", "(", ")", "for", "o", "in", "outputs", "]", "txs", "=", "list", "(", "query", ".", "get_spending_transactions", "(", "self", ".", "connection", ...
Remove outputs that have been spent Args: outputs: list of TransactionLink
[ "Remove", "outputs", "that", "have", "been", "spent" ]
python
train
saulpw/visidata
visidata/vdtui.py
https://github.com/saulpw/visidata/blob/32771e0cea6c24fc7902683d14558391395c591f/visidata/vdtui.py#L822-L829
def rightStatus(self, sheet): 'Compose right side of status bar.' if sheet.currentThreads: gerund = (' '+sheet.progresses[0].gerund) if sheet.progresses else '' status = '%9d %2d%%%s' % (len(sheet), sheet.progressPct, gerund) else: status = '%9d %s' % (len(sh...
[ "def", "rightStatus", "(", "self", ",", "sheet", ")", ":", "if", "sheet", ".", "currentThreads", ":", "gerund", "=", "(", "' '", "+", "sheet", ".", "progresses", "[", "0", "]", ".", "gerund", ")", "if", "sheet", ".", "progresses", "else", "''", "stat...
Compose right side of status bar.
[ "Compose", "right", "side", "of", "status", "bar", "." ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/utils/frame.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/utils/frame.py#L88-L93
def extract_module_locals(depth=0): """Returns (module, locals) of the funciton `depth` frames away from the caller""" f = sys._getframe(depth + 1) global_ns = f.f_globals module = sys.modules[global_ns['__name__']] return (module, f.f_locals)
[ "def", "extract_module_locals", "(", "depth", "=", "0", ")", ":", "f", "=", "sys", ".", "_getframe", "(", "depth", "+", "1", ")", "global_ns", "=", "f", ".", "f_globals", "module", "=", "sys", ".", "modules", "[", "global_ns", "[", "'__name__'", "]", ...
Returns (module, locals) of the funciton `depth` frames away from the caller
[ "Returns", "(", "module", "locals", ")", "of", "the", "funciton", "depth", "frames", "away", "from", "the", "caller" ]
python
test
geertj/gruvi
lib/gruvi/futures.py
https://github.com/geertj/gruvi/blob/1d77ca439600b6ea7a19aa1ee85dca0f3be3f3f8/lib/gruvi/futures.py#L506-L526
def as_completed(objects, count=None, timeout=None): """Wait for one or more waitable objects, yielding them as they become ready. This is the iterator/generator version of :func:`wait`. """ for obj in objects: if not hasattr(obj, 'add_done_callback'): raise TypeError('Expecting...
[ "def", "as_completed", "(", "objects", ",", "count", "=", "None", ",", "timeout", "=", "None", ")", ":", "for", "obj", "in", "objects", ":", "if", "not", "hasattr", "(", "obj", ",", "'add_done_callback'", ")", ":", "raise", "TypeError", "(", "'Expecting ...
Wait for one or more waitable objects, yielding them as they become ready. This is the iterator/generator version of :func:`wait`.
[ "Wait", "for", "one", "or", "more", "waitable", "objects", "yielding", "them", "as", "they", "become", "ready", "." ]
python
train
ask/carrot
carrot/messaging.py
https://github.com/ask/carrot/blob/5889a25cd2e274642071c9bba39772f4b3e3d9da/carrot/messaging.py#L451-L476
def iterqueue(self, limit=None, infinite=False): """Infinite iterator yielding pending messages, by using synchronous direct access to the queue (``basic_get``). :meth:`iterqueue` is used where synchronous functionality is more important than performance. If you can, use :meth:`itercons...
[ "def", "iterqueue", "(", "self", ",", "limit", "=", "None", ",", "infinite", "=", "False", ")", ":", "for", "items_since_start", "in", "count", "(", ")", ":", "item", "=", "self", ".", "fetch", "(", ")", "if", "(", "not", "infinite", "and", "item", ...
Infinite iterator yielding pending messages, by using synchronous direct access to the queue (``basic_get``). :meth:`iterqueue` is used where synchronous functionality is more important than performance. If you can, use :meth:`iterconsume` instead. :keyword limit: If set, the i...
[ "Infinite", "iterator", "yielding", "pending", "messages", "by", "using", "synchronous", "direct", "access", "to", "the", "queue", "(", "basic_get", ")", "." ]
python
train
sam-cox/pytides
pytides/tide.py
https://github.com/sam-cox/pytides/blob/63a2507299002f1979ea55a17a82561158d685f7/pytides/tide.py#L242-L254
def _times(t0, hours): """ Return a (list of) datetime(s) given an initial time and an (list of) hourly offset(s). Arguments: t0 -- initial time hours -- hourly offsets from t0 """ if not isinstance(hours, Iterable): return Tide._times(t0, [hours])[0] elif not isinstance(hours[0], datetime): retur...
[ "def", "_times", "(", "t0", ",", "hours", ")", ":", "if", "not", "isinstance", "(", "hours", ",", "Iterable", ")", ":", "return", "Tide", ".", "_times", "(", "t0", ",", "[", "hours", "]", ")", "[", "0", "]", "elif", "not", "isinstance", "(", "hou...
Return a (list of) datetime(s) given an initial time and an (list of) hourly offset(s). Arguments: t0 -- initial time hours -- hourly offsets from t0
[ "Return", "a", "(", "list", "of", ")", "datetime", "(", "s", ")", "given", "an", "initial", "time", "and", "an", "(", "list", "of", ")", "hourly", "offset", "(", "s", ")", ".", "Arguments", ":", "t0", "--", "initial", "time", "hours", "--", "hourly...
python
train
pricingassistant/mrq
mrq/scheduler.py
https://github.com/pricingassistant/mrq/blob/d0a5a34de9cba38afa94fb7c9e17f9b570b79a50/mrq/scheduler.py#L29-L43
def check_config_integrity(self): """ Make sure the scheduler config is valid """ tasks_by_hash = {_hash_task(t): t for t in self.config_tasks} if len(tasks_by_hash) != len(self.config_tasks): raise Exception("Fatal error: there was a hash duplicate in the scheduled tasks config.") ...
[ "def", "check_config_integrity", "(", "self", ")", ":", "tasks_by_hash", "=", "{", "_hash_task", "(", "t", ")", ":", "t", "for", "t", "in", "self", ".", "config_tasks", "}", "if", "len", "(", "tasks_by_hash", ")", "!=", "len", "(", "self", ".", "config...
Make sure the scheduler config is valid
[ "Make", "sure", "the", "scheduler", "config", "is", "valid" ]
python
train
openvax/isovar
isovar/reference_context.py
https://github.com/openvax/isovar/blob/b39b684920e3f6b344851d6598a1a1c67bce913b/isovar/reference_context.py#L141-L168
def reference_contexts_for_variants( variants, context_size, transcript_id_whitelist=None): """ Extract a set of reference contexts for each variant in the collection. Parameters ---------- variants : varcode.VariantCollection context_size : int Max of nucleotid...
[ "def", "reference_contexts_for_variants", "(", "variants", ",", "context_size", ",", "transcript_id_whitelist", "=", "None", ")", ":", "result", "=", "OrderedDict", "(", ")", "for", "variant", "in", "variants", ":", "result", "[", "variant", "]", "=", "reference...
Extract a set of reference contexts for each variant in the collection. Parameters ---------- variants : varcode.VariantCollection context_size : int Max of nucleotides to include to the left and right of the variant in the context sequence. transcript_id_whitelist : set, optional...
[ "Extract", "a", "set", "of", "reference", "contexts", "for", "each", "variant", "in", "the", "collection", "." ]
python
train
saltstack/salt
salt/state.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/state.py#L1056-L1096
def check_refresh(self, data, ret): ''' Check to see if the modules for this state instance need to be updated, only update if the state is a file or a package and if it changed something. If the file function is managed check to see if the file is a possible module type, e.g. a ...
[ "def", "check_refresh", "(", "self", ",", "data", ",", "ret", ")", ":", "_reload_modules", "=", "False", "if", "data", ".", "get", "(", "'reload_grains'", ",", "False", ")", ":", "log", ".", "debug", "(", "'Refreshing grains...'", ")", "self", ".", "opts...
Check to see if the modules for this state instance need to be updated, only update if the state is a file or a package and if it changed something. If the file function is managed check to see if the file is a possible module type, e.g. a python, pyx, or .so. Always refresh if the funct...
[ "Check", "to", "see", "if", "the", "modules", "for", "this", "state", "instance", "need", "to", "be", "updated", "only", "update", "if", "the", "state", "is", "a", "file", "or", "a", "package", "and", "if", "it", "changed", "something", ".", "If", "the...
python
train
PolyJIT/benchbuild
benchbuild/utils/compiler.py
https://github.com/PolyJIT/benchbuild/blob/9ad2ec54d96e97b642b1f06eddcbad9ba7aeaf58/benchbuild/utils/compiler.py#L27-L49
def cc(project, detect_project=False): """ Return a clang that hides CFLAGS and LDFLAGS. This will generate a wrapper script in the current directory and return a complete plumbum command to it. Args: cflags: The CFLAGS we want to hide. ldflags: The LDFLAGS we want to hide. ...
[ "def", "cc", "(", "project", ",", "detect_project", "=", "False", ")", ":", "from", "benchbuild", ".", "utils", "import", "cmd", "cc_name", "=", "str", "(", "CFG", "[", "\"compiler\"", "]", "[", "\"c\"", "]", ")", "wrap_cc", "(", "cc_name", ",", "compi...
Return a clang that hides CFLAGS and LDFLAGS. This will generate a wrapper script in the current directory and return a complete plumbum command to it. Args: cflags: The CFLAGS we want to hide. ldflags: The LDFLAGS we want to hide. func (optional): A function that will be pickled a...
[ "Return", "a", "clang", "that", "hides", "CFLAGS", "and", "LDFLAGS", "." ]
python
train
balloob/pychromecast
pychromecast/controllers/media.py
https://github.com/balloob/pychromecast/blob/831b09c4fed185a7bffe0ea330b7849d5f4e36b6/pychromecast/controllers/media.py#L350-L360
def _send_command(self, command): """ Send a command to the Chromecast on media channel. """ if self.status is None or self.status.media_session_id is None: self.logger.warning( "%s command requested but no session is active.", command[MESSAGE_TYPE]) ...
[ "def", "_send_command", "(", "self", ",", "command", ")", ":", "if", "self", ".", "status", "is", "None", "or", "self", ".", "status", ".", "media_session_id", "is", "None", ":", "self", ".", "logger", ".", "warning", "(", "\"%s command requested but no sess...
Send a command to the Chromecast on media channel.
[ "Send", "a", "command", "to", "the", "Chromecast", "on", "media", "channel", "." ]
python
train
ic-labs/django-icekit
icekit/response_pages/views.py
https://github.com/ic-labs/django-icekit/blob/c507ea5b1864303732c53ad7c5800571fca5fa94/icekit/response_pages/views.py#L44-L69
def page_not_found(request, template_name='404.html'): """ Custom page not found (404) handler. Don't raise a Http404 or anything like that in here otherwise you will cause an infinite loop. That would be bad. If no ResponsePage exists for with type ``RESPONSE_HTTP404`` then the default templa...
[ "def", "page_not_found", "(", "request", ",", "template_name", "=", "'404.html'", ")", ":", "rendered_page", "=", "get_response_page", "(", "request", ",", "http", ".", "HttpResponseNotFound", ",", "'icekit/response_pages/404.html'", ",", "abstract_models", ".", "RESP...
Custom page not found (404) handler. Don't raise a Http404 or anything like that in here otherwise you will cause an infinite loop. That would be bad. If no ResponsePage exists for with type ``RESPONSE_HTTP404`` then the default template render view will be used. Templates: :template:`404.html` ...
[ "Custom", "page", "not", "found", "(", "404", ")", "handler", "." ]
python
train
klmitch/tendril
tendril/framers.py
https://github.com/klmitch/tendril/blob/207102c83e88f8f1fa7ba605ef0aab2ae9078b36/tendril/framers.py#L101-L119
def _reset(self, framer): """ Reset the state for the framer. It is safe to call this method multiple times with the same framer; the ID of the framer object will be saved and the state only reset if the IDs are different. After resetting the state, the framer's ``init_...
[ "def", "_reset", "(", "self", ",", "framer", ")", ":", "# Do nothing if we're already properly initialized", "if", "id", "(", "framer", ")", "==", "self", ".", "_framer_id", ":", "return", "# Reset the state", "self", ".", "_other", "=", "{", "}", "# Initialize ...
Reset the state for the framer. It is safe to call this method multiple times with the same framer; the ID of the framer object will be saved and the state only reset if the IDs are different. After resetting the state, the framer's ``init_state()`` method will be called.
[ "Reset", "the", "state", "for", "the", "framer", ".", "It", "is", "safe", "to", "call", "this", "method", "multiple", "times", "with", "the", "same", "framer", ";", "the", "ID", "of", "the", "framer", "object", "will", "be", "saved", "and", "the", "sta...
python
train
jmoiron/speedparser
speedparser/speedparser.py
https://github.com/jmoiron/speedparser/blob/e7e8d79daf73b35c9259695ad1e379476e1dfc77/speedparser/speedparser.py#L189-L196
def innertext(node): """Return the inner text of a node. If a node has no sub elements, this is just node.text. Otherwise, it's node.text + sub-element-text + node.tail.""" if not len(node): return node.text return (node.text or '') + ''.join([etree.tostring(c) for c in node]) + (node.tai...
[ "def", "innertext", "(", "node", ")", ":", "if", "not", "len", "(", "node", ")", ":", "return", "node", ".", "text", "return", "(", "node", ".", "text", "or", "''", ")", "+", "''", ".", "join", "(", "[", "etree", ".", "tostring", "(", "c", ")",...
Return the inner text of a node. If a node has no sub elements, this is just node.text. Otherwise, it's node.text + sub-element-text + node.tail.
[ "Return", "the", "inner", "text", "of", "a", "node", ".", "If", "a", "node", "has", "no", "sub", "elements", "this", "is", "just", "node", ".", "text", ".", "Otherwise", "it", "s", "node", ".", "text", "+", "sub", "-", "element", "-", "text", "+", ...
python
train
Microsoft/nni
tools/nni_cmd/nnictl_utils.py
https://github.com/Microsoft/nni/blob/c7cc8db32da8d2ec77a382a55089f4e17247ce41/tools/nni_cmd/nnictl_utils.py#L407-L434
def show_experiment_info(): '''show experiment information in monitor''' experiment_config = Experiments() experiment_dict = experiment_config.get_all_experiments() if not experiment_dict: print('There is no experiment running...') exit(1) update_experiment() experiment_id_list =...
[ "def", "show_experiment_info", "(", ")", ":", "experiment_config", "=", "Experiments", "(", ")", "experiment_dict", "=", "experiment_config", ".", "get_all_experiments", "(", ")", "if", "not", "experiment_dict", ":", "print", "(", "'There is no experiment running...'", ...
show experiment information in monitor
[ "show", "experiment", "information", "in", "monitor" ]
python
train
hugapi/hug
hug/api.py
https://github.com/hugapi/hug/blob/080901c81576657f82e2432fd4a82f1d0d2f370c/hug/api.py#L150-L158
def add_exception_handler(self, exception_type, error_handler, versions=(None, )): """Adds a error handler to the hug api""" versions = (versions, ) if not isinstance(versions, (tuple, list)) else versions if not hasattr(self, '_exception_handlers'): self._exception_handlers = {} ...
[ "def", "add_exception_handler", "(", "self", ",", "exception_type", ",", "error_handler", ",", "versions", "=", "(", "None", ",", ")", ")", ":", "versions", "=", "(", "versions", ",", ")", "if", "not", "isinstance", "(", "versions", ",", "(", "tuple", ",...
Adds a error handler to the hug api
[ "Adds", "a", "error", "handler", "to", "the", "hug", "api" ]
python
train
saltstack/salt
salt/modules/zfs.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/zfs.py#L1158-L1264
def get(*dataset, **kwargs): ''' Displays properties for the given datasets. dataset : string name of snapshot(s), filesystem(s), or volume(s) properties : string comma-separated list of properties to list, defaults to all recursive : boolean recursively list children de...
[ "def", "get", "(", "*", "dataset", ",", "*", "*", "kwargs", ")", ":", "## Configure command", "# NOTE: initialize the defaults", "flags", "=", "[", "'-H'", "]", "opts", "=", "{", "}", "# NOTE: set extra config from kwargs", "if", "kwargs", ".", "get", "(", "'d...
Displays properties for the given datasets. dataset : string name of snapshot(s), filesystem(s), or volume(s) properties : string comma-separated list of properties to list, defaults to all recursive : boolean recursively list children depth : int recursively list childr...
[ "Displays", "properties", "for", "the", "given", "datasets", "." ]
python
train
jaywink/federation
federation/utils/diaspora.py
https://github.com/jaywink/federation/blob/59d31bb37e662891dbea72c1dee05dc53146c78b/federation/utils/diaspora.py#L70-L94
def retrieve_and_parse_diaspora_webfinger(handle): """ Retrieve a and parse a remote Diaspora webfinger document. :arg handle: Remote handle to retrieve :returns: dict """ try: host = handle.split("@")[1] except AttributeError: logger.warning("retrieve_and_parse_diaspora_web...
[ "def", "retrieve_and_parse_diaspora_webfinger", "(", "handle", ")", ":", "try", ":", "host", "=", "handle", ".", "split", "(", "\"@\"", ")", "[", "1", "]", "except", "AttributeError", ":", "logger", ".", "warning", "(", "\"retrieve_and_parse_diaspora_webfinger: in...
Retrieve a and parse a remote Diaspora webfinger document. :arg handle: Remote handle to retrieve :returns: dict
[ "Retrieve", "a", "and", "parse", "a", "remote", "Diaspora", "webfinger", "document", "." ]
python
train
CivicSpleen/ambry
ambry/orm/file.py
https://github.com/CivicSpleen/ambry/blob/d7f2be4bf1f7ffd086f3fadd4fcae60c32473e42/ambry/orm/file.py#L180-L193
def dict(self): """A dict that holds key/values for all of the properties in the object. :return: """ d = {p.key: getattr(self, p.key) for p in self.__mapper__.attrs if p.key not in ('contents', 'dataset')} d['modified_datetime'] = self.modified_datetime ...
[ "def", "dict", "(", "self", ")", ":", "d", "=", "{", "p", ".", "key", ":", "getattr", "(", "self", ",", "p", ".", "key", ")", "for", "p", "in", "self", ".", "__mapper__", ".", "attrs", "if", "p", ".", "key", "not", "in", "(", "'contents'", ",...
A dict that holds key/values for all of the properties in the object. :return:
[ "A", "dict", "that", "holds", "key", "/", "values", "for", "all", "of", "the", "properties", "in", "the", "object", "." ]
python
train
christophercrouzet/nani
nani.py
https://github.com/christophercrouzet/nani/blob/296ae50c0cdcfd3ed0cba23a4d2edea0d124bcb1/nani.py#L1051-L1059
def _get_mixin_attributes(mixins): """Retrieve the attributes for a given set of mixin classes. The attributes of each mixin class are being merged into a single dictionary. """ return {attribute: mixin.__dict__[attribute] for mixin in mixins for attribute in _MIXIN_ATTRIBUT...
[ "def", "_get_mixin_attributes", "(", "mixins", ")", ":", "return", "{", "attribute", ":", "mixin", ".", "__dict__", "[", "attribute", "]", "for", "mixin", "in", "mixins", "for", "attribute", "in", "_MIXIN_ATTRIBUTES", "[", "mixin", "]", "}" ]
Retrieve the attributes for a given set of mixin classes. The attributes of each mixin class are being merged into a single dictionary.
[ "Retrieve", "the", "attributes", "for", "a", "given", "set", "of", "mixin", "classes", "." ]
python
train
inveniosoftware/invenio-records
invenio_records/api.py
https://github.com/inveniosoftware/invenio-records/blob/b0b1481d04012e45cb71b5ae4019e91dde88d1e2/invenio_records/api.py#L322-L355
def revert(self, revision_id): """Revert the record to a specific revision. #. Send a signal :data:`invenio_records.signals.before_record_revert` with the current record as parameter. #. Revert the record to the revision id passed as parameter. #. Send a signal :data:`inven...
[ "def", "revert", "(", "self", ",", "revision_id", ")", ":", "if", "self", ".", "model", "is", "None", ":", "raise", "MissingModelError", "(", ")", "revision", "=", "self", ".", "revisions", "[", "revision_id", "]", "with", "db", ".", "session", ".", "b...
Revert the record to a specific revision. #. Send a signal :data:`invenio_records.signals.before_record_revert` with the current record as parameter. #. Revert the record to the revision id passed as parameter. #. Send a signal :data:`invenio_records.signals.after_record_revert` ...
[ "Revert", "the", "record", "to", "a", "specific", "revision", "." ]
python
train
rflamary/POT
ot/optim.py
https://github.com/rflamary/POT/blob/c5108efc7b6702e1af3928bef1032e6b37734d1c/ot/optim.py#L207-L341
def gcg(a, b, M, reg1, reg2, f, df, G0=None, numItermax=10, numInnerItermax=200, stopThr=1e-9, verbose=False, log=False): """ Solve the general regularized OT problem with the generalized conditional gradient The function solves the following optimization problem: .. math:: \gamma ...
[ "def", "gcg", "(", "a", ",", "b", ",", "M", ",", "reg1", ",", "reg2", ",", "f", ",", "df", ",", "G0", "=", "None", ",", "numItermax", "=", "10", ",", "numInnerItermax", "=", "200", ",", "stopThr", "=", "1e-9", ",", "verbose", "=", "False", ",",...
Solve the general regularized OT problem with the generalized conditional gradient The function solves the following optimization problem: .. math:: \gamma = arg\min_\gamma <\gamma,M>_F + reg1\cdot\Omega(\gamma) + reg2\cdot f(\gamma) s.t. \gamma 1 = a \gamma^T 1= b ...
[ "Solve", "the", "general", "regularized", "OT", "problem", "with", "the", "generalized", "conditional", "gradient" ]
python
train
pandas-dev/pandas
pandas/core/common.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/common.py#L333-L348
def apply_if_callable(maybe_callable, obj, **kwargs): """ Evaluate possibly callable input using obj and kwargs if it is callable, otherwise return as it is. Parameters ---------- maybe_callable : possibly a callable obj : NDFrame **kwargs """ if callable(maybe_callable): ...
[ "def", "apply_if_callable", "(", "maybe_callable", ",", "obj", ",", "*", "*", "kwargs", ")", ":", "if", "callable", "(", "maybe_callable", ")", ":", "return", "maybe_callable", "(", "obj", ",", "*", "*", "kwargs", ")", "return", "maybe_callable" ]
Evaluate possibly callable input using obj and kwargs if it is callable, otherwise return as it is. Parameters ---------- maybe_callable : possibly a callable obj : NDFrame **kwargs
[ "Evaluate", "possibly", "callable", "input", "using", "obj", "and", "kwargs", "if", "it", "is", "callable", "otherwise", "return", "as", "it", "is", "." ]
python
train
zomux/deepy
examples/attention_models/baseline_model.py
https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/examples/attention_models/baseline_model.py#L64-L81
def _refined_glimpse_sensor(self, x_t, l_p): """ Parameters: x_t - 28x28 image l_p - 2x1 focus vector Returns: 7*14 matrix """ # Turn l_p to the left-top point of rectangle l_p = l_p * 14 + 14 - 4 l_p = T.cast(T.round(l_p), "int...
[ "def", "_refined_glimpse_sensor", "(", "self", ",", "x_t", ",", "l_p", ")", ":", "# Turn l_p to the left-top point of rectangle", "l_p", "=", "l_p", "*", "14", "+", "14", "-", "4", "l_p", "=", "T", ".", "cast", "(", "T", ".", "round", "(", "l_p", ")", ...
Parameters: x_t - 28x28 image l_p - 2x1 focus vector Returns: 7*14 matrix
[ "Parameters", ":", "x_t", "-", "28x28", "image", "l_p", "-", "2x1", "focus", "vector", "Returns", ":", "7", "*", "14", "matrix" ]
python
test
newville/wxmplot
wxmplot/stackedplotframe.py
https://github.com/newville/wxmplot/blob/8e0dc037453e5cdf18c968dc5a3d29efd761edee/wxmplot/stackedplotframe.py#L56-L60
def unzoom_all(self, event=None): """ zoom out full data range """ for p in (self.panel, self.panel_bot): p.conf.zoom_lims = [] p.conf.unzoom(full=True)
[ "def", "unzoom_all", "(", "self", ",", "event", "=", "None", ")", ":", "for", "p", "in", "(", "self", ".", "panel", ",", "self", ".", "panel_bot", ")", ":", "p", ".", "conf", ".", "zoom_lims", "=", "[", "]", "p", ".", "conf", ".", "unzoom", "("...
zoom out full data range
[ "zoom", "out", "full", "data", "range" ]
python
train
iotile/coretools
iotilesensorgraph/iotile/sg/walker.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/walker.py#L351-L363
def pop(self): """Pop a reading off of this virtual stream and return it.""" if self.reading is None: raise StreamEmptyError("Pop called on virtual stream walker without any data", selector=self.selector) reading = self.reading # If we're not a constant stream, we just exh...
[ "def", "pop", "(", "self", ")", ":", "if", "self", ".", "reading", "is", "None", ":", "raise", "StreamEmptyError", "(", "\"Pop called on virtual stream walker without any data\"", ",", "selector", "=", "self", ".", "selector", ")", "reading", "=", "self", ".", ...
Pop a reading off of this virtual stream and return it.
[ "Pop", "a", "reading", "off", "of", "this", "virtual", "stream", "and", "return", "it", "." ]
python
train
saltstack/salt
salt/modules/jenkinsmod.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/jenkinsmod.py#L69-L92
def _connect(): ''' Return server object used to interact with Jenkins. :return: server object used to interact with Jenkins ''' jenkins_url = __salt__['config.get']('jenkins.url') or \ __salt__['config.get']('jenkins:url') or \ __salt__['pillar.get']('jenkins.url') jenkins_use...
[ "def", "_connect", "(", ")", ":", "jenkins_url", "=", "__salt__", "[", "'config.get'", "]", "(", "'jenkins.url'", ")", "or", "__salt__", "[", "'config.get'", "]", "(", "'jenkins:url'", ")", "or", "__salt__", "[", "'pillar.get'", "]", "(", "'jenkins.url'", ")...
Return server object used to interact with Jenkins. :return: server object used to interact with Jenkins
[ "Return", "server", "object", "used", "to", "interact", "with", "Jenkins", "." ]
python
train
zomux/deepy
deepy/layers/block.py
https://github.com/zomux/deepy/blob/090fbad22a08a809b12951cd0d4984f5bd432698/deepy/layers/block.py#L51-L58
def register_layer(self, layer): """ Register one connected layer. :type layer: NeuralLayer """ if self.fixed: raise Exception("After a block is fixed, no more layers can be registered.") self.layers.append(layer)
[ "def", "register_layer", "(", "self", ",", "layer", ")", ":", "if", "self", ".", "fixed", ":", "raise", "Exception", "(", "\"After a block is fixed, no more layers can be registered.\"", ")", "self", ".", "layers", ".", "append", "(", "layer", ")" ]
Register one connected layer. :type layer: NeuralLayer
[ "Register", "one", "connected", "layer", ".", ":", "type", "layer", ":", "NeuralLayer" ]
python
test
ArchiveTeam/wpull
wpull/pipeline/session.py
https://github.com/ArchiveTeam/wpull/blob/ddf051aa3322479325ba20aa778cb2cb97606bf5/wpull/pipeline/session.py#L150-L169
def child_url_record(self, url: str, inline: bool=False, link_type: Optional[LinkType]=None, post_data: Optional[str]=None, level: Optional[int]=None): '''Return a child URLRecord. This function is useful for testing filters bef...
[ "def", "child_url_record", "(", "self", ",", "url", ":", "str", ",", "inline", ":", "bool", "=", "False", ",", "link_type", ":", "Optional", "[", "LinkType", "]", "=", "None", ",", "post_data", ":", "Optional", "[", "str", "]", "=", "None", ",", "lev...
Return a child URLRecord. This function is useful for testing filters before adding to table.
[ "Return", "a", "child", "URLRecord", "." ]
python
train
ejeschke/ginga
ginga/cmap.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/cmap.py#L13288-L13295
def ginga_to_matplotlib_cmap(cm, name=None): """Convert Ginga colormap to matplotlib's.""" if name is None: name = cm.name from matplotlib.colors import ListedColormap carr = np.asarray(cm.clst) mpl_cm = ListedColormap(carr, name=name, N=len(carr)) return mpl_cm
[ "def", "ginga_to_matplotlib_cmap", "(", "cm", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "name", "=", "cm", ".", "name", "from", "matplotlib", ".", "colors", "import", "ListedColormap", "carr", "=", "np", ".", "asarray", "(", ...
Convert Ginga colormap to matplotlib's.
[ "Convert", "Ginga", "colormap", "to", "matplotlib", "s", "." ]
python
train
uber/tchannel-python
tchannel/messages/common.py
https://github.com/uber/tchannel-python/blob/ee08cce6234f24fd2373774988186dd374306c43/tchannel/messages/common.py#L138-L153
def generate_checksum(message, previous_csum=0): """Generate checksum for messages with CALL_REQ, CALL_REQ_CONTINUE, CALL_RES,CALL_RES_CONTINUE types. :param message: outgoing message :param previous_csum: accumulated checksum value """ if message.message_type in CHECKSUM_MSG_TYPES:...
[ "def", "generate_checksum", "(", "message", ",", "previous_csum", "=", "0", ")", ":", "if", "message", ".", "message_type", "in", "CHECKSUM_MSG_TYPES", ":", "csum", "=", "compute_checksum", "(", "message", ".", "checksum", "[", "0", "]", ",", "message", ".",...
Generate checksum for messages with CALL_REQ, CALL_REQ_CONTINUE, CALL_RES,CALL_RES_CONTINUE types. :param message: outgoing message :param previous_csum: accumulated checksum value
[ "Generate", "checksum", "for", "messages", "with", "CALL_REQ", "CALL_REQ_CONTINUE", "CALL_RES", "CALL_RES_CONTINUE", "types", "." ]
python
train
mtien/PeptideBuilder
PeptideBuilder/PeptideBuilder.py
https://github.com/mtien/PeptideBuilder/blob/7b1ddab5199432c1aabc371a34ec42dd386dfa6f/PeptideBuilder/PeptideBuilder.py#L656-L708
def makeHis(segID, N, CA, C, O, geo): '''Creates a Histidine residue''' ##R-Group CA_CB_length=geo.CA_CB_length C_CA_CB_angle=geo.C_CA_CB_angle N_C_CA_CB_diangle=geo.N_C_CA_CB_diangle CB_CG_length=geo.CB_CG_length CA_CB_CG_angle=geo.CA_CB_CG_angle N_CA_CB_CG_diangle=geo.N_CA_CB_CG_diang...
[ "def", "makeHis", "(", "segID", ",", "N", ",", "CA", ",", "C", ",", "O", ",", "geo", ")", ":", "##R-Group", "CA_CB_length", "=", "geo", ".", "CA_CB_length", "C_CA_CB_angle", "=", "geo", ".", "C_CA_CB_angle", "N_C_CA_CB_diangle", "=", "geo", ".", "N_C_CA_...
Creates a Histidine residue
[ "Creates", "a", "Histidine", "residue" ]
python
train
twilio/twilio-python
twilio/rest/serverless/v1/service/function/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/serverless/v1/service/function/__init__.py#L260-L282
def update(self, friendly_name): """ Update the FunctionInstance :param unicode friendly_name: The friendly_name :returns: Updated FunctionInstance :rtype: twilio.rest.serverless.v1.service.function.FunctionInstance """ data = values.of({'FriendlyName': friendly...
[ "def", "update", "(", "self", ",", "friendly_name", ")", ":", "data", "=", "values", ".", "of", "(", "{", "'FriendlyName'", ":", "friendly_name", ",", "}", ")", "payload", "=", "self", ".", "_version", ".", "update", "(", "'POST'", ",", "self", ".", ...
Update the FunctionInstance :param unicode friendly_name: The friendly_name :returns: Updated FunctionInstance :rtype: twilio.rest.serverless.v1.service.function.FunctionInstance
[ "Update", "the", "FunctionInstance" ]
python
train
saltstack/salt
salt/utils/schema.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/schema.py#L1506-L1533
def get_definition(self): '''Returns the definition of the complex item''' serialized = super(ComplexSchemaItem, self).serialize() # Adjust entries in the serialization del serialized['definition_name'] serialized['title'] = self.definition_name properties = {} ...
[ "def", "get_definition", "(", "self", ")", ":", "serialized", "=", "super", "(", "ComplexSchemaItem", ",", "self", ")", ".", "serialize", "(", ")", "# Adjust entries in the serialization", "del", "serialized", "[", "'definition_name'", "]", "serialized", "[", "'ti...
Returns the definition of the complex item
[ "Returns", "the", "definition", "of", "the", "complex", "item" ]
python
train
annoviko/pyclustering
pyclustering/cluster/bang.py
https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/bang.py#L538-L550
def __build_directory_levels(self): """! @brief Build levels of direction if amount of level is greater than one. """ previous_level_blocks = [ self.__root ] for level in range(1, self.__levels): previous_level_blocks = self.__build_level(previous_level_bl...
[ "def", "__build_directory_levels", "(", "self", ")", ":", "previous_level_blocks", "=", "[", "self", ".", "__root", "]", "for", "level", "in", "range", "(", "1", ",", "self", ".", "__levels", ")", ":", "previous_level_blocks", "=", "self", ".", "__build_leve...
! @brief Build levels of direction if amount of level is greater than one.
[ "!" ]
python
valid
cronofy/pycronofy
pycronofy/client.py
https://github.com/cronofy/pycronofy/blob/3d807603029478fa9387a9dfb6c3acd9faa4f08e/pycronofy/client.py#L412-L435
def availability(self, participants=(), required_duration=(), available_periods=(), start_interval=None, buffer=()): """ Performs an availability query. :param list participants: An Array of participant groups or a dict for a single participant group. :param dict or int required_duration - An In...
[ "def", "availability", "(", "self", ",", "participants", "=", "(", ")", ",", "required_duration", "=", "(", ")", ",", "available_periods", "=", "(", ")", ",", "start_interval", "=", "None", ",", "buffer", "=", "(", ")", ")", ":", "options", "=", "{", ...
Performs an availability query. :param list participants: An Array of participant groups or a dict for a single participant group. :param dict or int required_duration - An Integer representing the minimum number of minutes of availability required. :param list available_periods - An Array of av...
[ "Performs", "an", "availability", "query", ".", ":", "param", "list", "participants", ":", "An", "Array", "of", "participant", "groups", "or", "a", "dict", "for", "a", "single", "participant", "group", ".", ":", "param", "dict", "or", "int", "required_durati...
python
train
dourvaris/nano-python
src/nano/rpc.py
https://github.com/dourvaris/nano-python/blob/f26b8bc895b997067780f925049a70e82c0c2479/src/nano/rpc.py#L2460-L2479
def wallet_key_valid(self, wallet): """ Returns if a **wallet** key is valid :param wallet: Wallet to check key is valid :type wallet: str >>> rpc.wallet_key_valid( ... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F" ... ) T...
[ "def", "wallet_key_valid", "(", "self", ",", "wallet", ")", ":", "wallet", "=", "self", ".", "_process_value", "(", "wallet", ",", "'wallet'", ")", "payload", "=", "{", "\"wallet\"", ":", "wallet", "}", "resp", "=", "self", ".", "call", "(", "'wallet_key...
Returns if a **wallet** key is valid :param wallet: Wallet to check key is valid :type wallet: str >>> rpc.wallet_key_valid( ... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D81789F3F" ... ) True
[ "Returns", "if", "a", "**", "wallet", "**", "key", "is", "valid" ]
python
train
pyviz/holoviews
holoviews/plotting/mpl/element.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/mpl/element.py#L108-L193
def _finalize_axis(self, key, element=None, title=None, dimensions=None, ranges=None, xticks=None, yticks=None, zticks=None, xlabel=None, ylabel=None, zlabel=None): """ Applies all the axis settings before the axis or figure is returned. Only plots with zorder 0 get to app...
[ "def", "_finalize_axis", "(", "self", ",", "key", ",", "element", "=", "None", ",", "title", "=", "None", ",", "dimensions", "=", "None", ",", "ranges", "=", "None", ",", "xticks", "=", "None", ",", "yticks", "=", "None", ",", "zticks", "=", "None", ...
Applies all the axis settings before the axis or figure is returned. Only plots with zorder 0 get to apply their settings. When the number of the frame is supplied as n, this method looks up and computes the appropriate title, axis labels and axis bounds.
[ "Applies", "all", "the", "axis", "settings", "before", "the", "axis", "or", "figure", "is", "returned", ".", "Only", "plots", "with", "zorder", "0", "get", "to", "apply", "their", "settings", "." ]
python
train
gitpython-developers/GitPython
git/util.py
https://github.com/gitpython-developers/GitPython/blob/1f66e25c25cde2423917ee18c4704fff83b837d1/git/util.py#L774-L786
def _release_lock(self): """Release our lock if we have one""" if not self._has_lock(): return # if someone removed our file beforhand, lets just flag this issue # instead of failing, to make it more usable. lfp = self._lock_file_path() try: rmfil...
[ "def", "_release_lock", "(", "self", ")", ":", "if", "not", "self", ".", "_has_lock", "(", ")", ":", "return", "# if someone removed our file beforhand, lets just flag this issue", "# instead of failing, to make it more usable.", "lfp", "=", "self", ".", "_lock_file_path", ...
Release our lock if we have one
[ "Release", "our", "lock", "if", "we", "have", "one" ]
python
train
nickmckay/LiPD-utilities
Python/lipd/__init__.py
https://github.com/nickmckay/LiPD-utilities/blob/5dab6bbeffc5effd68e3a6beaca6b76aa928e860/Python/lipd/__init__.py#L683-L709
def showDfs(d): """ Display the available data frame names in a given data frame collection :param dict d: Dataframe collection :return none: """ if "metadata" in d: print("metadata") if "paleoData" in d: try: for k, v in d["paleoData"].items(): p...
[ "def", "showDfs", "(", "d", ")", ":", "if", "\"metadata\"", "in", "d", ":", "print", "(", "\"metadata\"", ")", "if", "\"paleoData\"", "in", "d", ":", "try", ":", "for", "k", ",", "v", "in", "d", "[", "\"paleoData\"", "]", ".", "items", "(", ")", ...
Display the available data frame names in a given data frame collection :param dict d: Dataframe collection :return none:
[ "Display", "the", "available", "data", "frame", "names", "in", "a", "given", "data", "frame", "collection" ]
python
train
clalancette/pycdlib
pycdlib/utils.py
https://github.com/clalancette/pycdlib/blob/1e7b77a809e905d67dc71e12d70e850be26b6233/pycdlib/utils.py#L304-L322
def file_object_supports_binary(fp): # type: (BinaryIO) -> bool ''' A function to check whether a file-like object supports binary mode. Parameters: fp - The file-like object to check for binary mode support. Returns: True if the file-like object supports binary mode, False otherwise. ...
[ "def", "file_object_supports_binary", "(", "fp", ")", ":", "# type: (BinaryIO) -> bool", "if", "hasattr", "(", "fp", ",", "'mode'", ")", ":", "return", "'b'", "in", "fp", ".", "mode", "# Python 3", "if", "sys", ".", "version_info", ">=", "(", "3", ",", "0"...
A function to check whether a file-like object supports binary mode. Parameters: fp - The file-like object to check for binary mode support. Returns: True if the file-like object supports binary mode, False otherwise.
[ "A", "function", "to", "check", "whether", "a", "file", "-", "like", "object", "supports", "binary", "mode", "." ]
python
train
pyout/pyout
pyout/field.py
https://github.com/pyout/pyout/blob/d9ff954bdedb6fc70f21f4fe77ad4bf926b201b0/pyout/field.py#L414-L447
def post_from_style(self, column_style): """Yield post-format processors based on `column_style`. Parameters ---------- column_style : dict A style where the top-level keys correspond to style attributes such as "bold" or "color". Returns -------...
[ "def", "post_from_style", "(", "self", ",", "column_style", ")", ":", "flanks", "=", "Flanks", "(", ")", "yield", "flanks", ".", "split_flanks", "fns", "=", "{", "\"simple\"", ":", "self", ".", "by_key", ",", "\"lookup\"", ":", "self", ".", "by_lookup", ...
Yield post-format processors based on `column_style`. Parameters ---------- column_style : dict A style where the top-level keys correspond to style attributes such as "bold" or "color". Returns ------- A generator object.
[ "Yield", "post", "-", "format", "processors", "based", "on", "column_style", "." ]
python
train
BerkeleyAutomation/perception
perception/phoxi_sensor.py
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/phoxi_sensor.py#L225-L236
def _color_im_callback(self, msg): """Callback for handling textures (greyscale images). """ try: data = self._bridge.imgmsg_to_cv2(msg) if np.max(data) > 255.0: data = 255.0 * data / 1200.0 # Experimentally set value for white data = np.clip(d...
[ "def", "_color_im_callback", "(", "self", ",", "msg", ")", ":", "try", ":", "data", "=", "self", ".", "_bridge", ".", "imgmsg_to_cv2", "(", "msg", ")", "if", "np", ".", "max", "(", "data", ")", ">", "255.0", ":", "data", "=", "255.0", "*", "data", ...
Callback for handling textures (greyscale images).
[ "Callback", "for", "handling", "textures", "(", "greyscale", "images", ")", "." ]
python
train
ampl/amplpy
amplpy/dataframe.py
https://github.com/ampl/amplpy/blob/39df6954049a11a8f666aed26853259b4687099a/amplpy/dataframe.py#L335-L356
def fromPandas(cls, df): """ Create a :class:`~amplpy.DataFrame` from a pandas DataFrame. """ assert pd is not None if isinstance(df, pd.Series): df = pd.DataFrame(df) else: assert isinstance(df, pd.DataFrame) keys = [ key if is...
[ "def", "fromPandas", "(", "cls", ",", "df", ")", ":", "assert", "pd", "is", "not", "None", "if", "isinstance", "(", "df", ",", "pd", ".", "Series", ")", ":", "df", "=", "pd", ".", "DataFrame", "(", "df", ")", "else", ":", "assert", "isinstance", ...
Create a :class:`~amplpy.DataFrame` from a pandas DataFrame.
[ "Create", "a", ":", "class", ":", "~amplpy", ".", "DataFrame", "from", "a", "pandas", "DataFrame", "." ]
python
train
Gandi/gandi.cli
gandi/cli/commands/certificate.py
https://github.com/Gandi/gandi.cli/blob/6ee5b8fc8ec44b0a6c232043ca610606ad8f693d/gandi/cli/commands/certificate.py#L520-L540
def delete(gandi, resource, background, force): """ Revoke the certificate. Resource can be a CN or an ID """ ids = gandi.certificate.usable_ids(resource) if len(ids) > 1: gandi.echo('Will not delete, %s is not precise enough.' % resource) gandi.echo(' * cert : ' + ...
[ "def", "delete", "(", "gandi", ",", "resource", ",", "background", ",", "force", ")", ":", "ids", "=", "gandi", ".", "certificate", ".", "usable_ids", "(", "resource", ")", "if", "len", "(", "ids", ")", ">", "1", ":", "gandi", ".", "echo", "(", "'W...
Revoke the certificate. Resource can be a CN or an ID
[ "Revoke", "the", "certificate", "." ]
python
train
gbowerman/azurerm
azurerm/restfns.py
https://github.com/gbowerman/azurerm/blob/79d40431d3b13f8a36aadbff5029888383d72674/azurerm/restfns.py#L214-L249
def do_ams_post(endpoint, path, body, access_token, rformat="json", ds_min_version="3.0;NetFx"): '''Do a AMS HTTP POST request and return JSON. Args: endpoint (str): Azure Media Services Initial Endpoint. path (str): Azure Media Services Endpoint Path. body (str): Azure Media Services C...
[ "def", "do_ams_post", "(", "endpoint", ",", "path", ",", "body", ",", "access_token", ",", "rformat", "=", "\"json\"", ",", "ds_min_version", "=", "\"3.0;NetFx\"", ")", ":", "min_ds", "=", "dsversion_min", "content_acceptformat", "=", "json_acceptformat", "acceptf...
Do a AMS HTTP POST request and return JSON. Args: endpoint (str): Azure Media Services Initial Endpoint. path (str): Azure Media Services Endpoint Path. body (str): Azure Media Services Content Body. access_token (str): A valid Azure authentication token. rformat (str): A re...
[ "Do", "a", "AMS", "HTTP", "POST", "request", "and", "return", "JSON", ".", "Args", ":", "endpoint", "(", "str", ")", ":", "Azure", "Media", "Services", "Initial", "Endpoint", ".", "path", "(", "str", ")", ":", "Azure", "Media", "Services", "Endpoint", ...
python
train
neurosynth/neurosynth
neurosynth/base/dataset.py
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/base/dataset.py#L683-L720
def get_ids(self, features, threshold=0.0, func=np.sum, get_weights=False): """ Returns a list of all studies in the table that meet the desired feature-based criteria. Will most commonly be used to retrieve studies that use one or more features with some minimum frequency; e.g.,: ...
[ "def", "get_ids", "(", "self", ",", "features", ",", "threshold", "=", "0.0", ",", "func", "=", "np", ".", "sum", ",", "get_weights", "=", "False", ")", ":", "if", "isinstance", "(", "features", ",", "str", ")", ":", "features", "=", "[", "features",...
Returns a list of all studies in the table that meet the desired feature-based criteria. Will most commonly be used to retrieve studies that use one or more features with some minimum frequency; e.g.,: get_ids(['fear', 'anxiety'], threshold=0.001) Args: feature...
[ "Returns", "a", "list", "of", "all", "studies", "in", "the", "table", "that", "meet", "the", "desired", "feature", "-", "based", "criteria", "." ]
python
test
taxjar/taxjar-python
taxjar/client.py
https://github.com/taxjar/taxjar-python/blob/be9b30d7dc968d24e066c7c133849fee180f8d95/taxjar/client.py#L86-L89
def delete_refund(self, refund_id): """Deletes an existing refund transaction.""" request = self._delete('transactions/refunds/' + str(refund_id)) return self.responder(request)
[ "def", "delete_refund", "(", "self", ",", "refund_id", ")", ":", "request", "=", "self", ".", "_delete", "(", "'transactions/refunds/'", "+", "str", "(", "refund_id", ")", ")", "return", "self", ".", "responder", "(", "request", ")" ]
Deletes an existing refund transaction.
[ "Deletes", "an", "existing", "refund", "transaction", "." ]
python
train
Azure/azure-sdk-for-python
azure-servicemanagement-legacy/azure/servicemanagement/_serialization.py
https://github.com/Azure/azure-sdk-for-python/blob/d7306fde32f60a293a7567678692bdad31e4b667/azure-servicemanagement-legacy/azure/servicemanagement/_serialization.py#L1285-L1293
def doc_from_xml(document_element_name, inner_xml): '''Wraps the specified xml in an xml root element with default azure namespaces''' xml = ''.join(['<', document_element_name, ' xmlns:i="http://www.w3.org/2001/XMLSchema-instance"', ' xmlns="http://sc...
[ "def", "doc_from_xml", "(", "document_element_name", ",", "inner_xml", ")", ":", "xml", "=", "''", ".", "join", "(", "[", "'<'", ",", "document_element_name", ",", "' xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"'", ",", "' xmlns=\"http://schemas.microsoft.com/windo...
Wraps the specified xml in an xml root element with default azure namespaces
[ "Wraps", "the", "specified", "xml", "in", "an", "xml", "root", "element", "with", "default", "azure", "namespaces" ]
python
test
xoolive/traffic
traffic/data/adsb/opensky_impala.py
https://github.com/xoolive/traffic/blob/d1a8878098f16759f6b6e0e8d8b8f32e34a680a8/traffic/data/adsb/opensky_impala.py#L526-L568
def within_bounds( self, start: timelike, stop: timelike, bounds: Union[BaseGeometry, Tuple[float, float, float, float]], ) -> Optional[pd.DataFrame]: """EXPERIMENTAL.""" start = to_datetime(start) stop = to_datetime(stop) before_hour = round_time(st...
[ "def", "within_bounds", "(", "self", ",", "start", ":", "timelike", ",", "stop", ":", "timelike", ",", "bounds", ":", "Union", "[", "BaseGeometry", ",", "Tuple", "[", "float", ",", "float", ",", "float", ",", "float", "]", "]", ",", ")", "->", "Optio...
EXPERIMENTAL.
[ "EXPERIMENTAL", "." ]
python
train
dmlc/xgboost
python-package/xgboost/core.py
https://github.com/dmlc/xgboost/blob/253fdd8a42d5ec6b819788199584d27bf9ea6253/python-package/xgboost/core.py#L1477-L1578
def get_score(self, fmap='', importance_type='weight'): """Get feature importance of each feature. Importance type can be defined as: * 'weight': the number of times a feature is used to split the data across all trees. * 'gain': the average gain across all splits the feature is used in...
[ "def", "get_score", "(", "self", ",", "fmap", "=", "''", ",", "importance_type", "=", "'weight'", ")", ":", "if", "getattr", "(", "self", ",", "'booster'", ",", "None", ")", "is", "not", "None", "and", "self", ".", "booster", "not", "in", "{", "'gbtr...
Get feature importance of each feature. Importance type can be defined as: * 'weight': the number of times a feature is used to split the data across all trees. * 'gain': the average gain across all splits the feature is used in. * 'cover': the average coverage across all splits the fea...
[ "Get", "feature", "importance", "of", "each", "feature", ".", "Importance", "type", "can", "be", "defined", "as", ":" ]
python
train
aouyar/PyMunin
pymunin/plugins/fsstats.py
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/fsstats.py#L110-L117
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ fs = FSinfo(self._fshost, self._fsport, self._fspass) return fs is not None
[ "def", "autoconf", "(", "self", ")", ":", "fs", "=", "FSinfo", "(", "self", ".", "_fshost", ",", "self", ".", "_fsport", ",", "self", ".", "_fspass", ")", "return", "fs", "is", "not", "None" ]
Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise.
[ "Implements", "Munin", "Plugin", "Auto", "-", "Configuration", "Option", "." ]
python
train
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers2.py#L882-L916
def convert_permute(builder, layer, input_names, output_names, keras_layer): """ Convert a softmax layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object. """ input_name, o...
[ "def", "convert_permute", "(", "builder", ",", "layer", ",", "input_names", ",", "output_names", ",", "keras_layer", ")", ":", "input_name", ",", "output_name", "=", "(", "input_names", "[", "0", "]", ",", "output_names", "[", "0", "]", ")", "keras_dims", ...
Convert a softmax layer from keras to coreml. Parameters keras_layer: layer ---------- A keras layer object. builder: NeuralNetworkBuilder A neural network builder object.
[ "Convert", "a", "softmax", "layer", "from", "keras", "to", "coreml", "." ]
python
train
tmontaigu/pylas
pylas/headers/rawheader.py
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L159-L163
def date(self, date): """ Returns the date of file creation as a python date object """ self.creation_year = date.year self.creation_day_of_year = date.timetuple().tm_yday
[ "def", "date", "(", "self", ",", "date", ")", ":", "self", ".", "creation_year", "=", "date", ".", "year", "self", ".", "creation_day_of_year", "=", "date", ".", "timetuple", "(", ")", ".", "tm_yday" ]
Returns the date of file creation as a python date object
[ "Returns", "the", "date", "of", "file", "creation", "as", "a", "python", "date", "object" ]
python
test
debrouwere/google-analytics
googleanalytics/query.py
https://github.com/debrouwere/google-analytics/blob/7d585c2f6f5ca191e975e6e3eaf7d5e2424fa11c/googleanalytics/query.py#L1068-L1085
def limit(self, maximum): """ Return a new query, limited to a certain number of results. Unlike core reporting queries, you cannot specify a starting point for live queries, just the maximum results returned. ```python # first 50 query.limit(50) ``` ...
[ "def", "limit", "(", "self", ",", "maximum", ")", ":", "self", ".", "meta", "[", "'limit'", "]", "=", "maximum", "self", ".", "raw", ".", "update", "(", "{", "'max_results'", ":", "maximum", ",", "}", ")", "return", "self" ]
Return a new query, limited to a certain number of results. Unlike core reporting queries, you cannot specify a starting point for live queries, just the maximum results returned. ```python # first 50 query.limit(50) ```
[ "Return", "a", "new", "query", "limited", "to", "a", "certain", "number", "of", "results", "." ]
python
train
jsommers/switchyard
switchyard/importcode.py
https://github.com/jsommers/switchyard/blob/fdcb3869c937dcedbd6ea7a7822ebd412bf1e2b0/switchyard/importcode.py#L7-L52
def import_or_die(module_name, entrypoint_names): ''' Import user code; return reference to usercode function. (str) -> function reference ''' log_debug("Importing {}".format(module_name)) module_name = os.path.abspath(module_name) if module_name.endswith('.py'): module_name,ext = o...
[ "def", "import_or_die", "(", "module_name", ",", "entrypoint_names", ")", ":", "log_debug", "(", "\"Importing {}\"", ".", "format", "(", "module_name", ")", ")", "module_name", "=", "os", ".", "path", ".", "abspath", "(", "module_name", ")", "if", "module_name...
Import user code; return reference to usercode function. (str) -> function reference
[ "Import", "user", "code", ";", "return", "reference", "to", "usercode", "function", "." ]
python
train
Microsoft/azure-devops-python-api
azure-devops/azure/devops/v5_0/identity/identity_client.py
https://github.com/Microsoft/azure-devops-python-api/blob/4777ffda2f5052fabbaddb2abe9cb434e0cf1aa8/azure-devops/azure/devops/v5_0/identity/identity_client.py#L255-L265
def create_identity(self, framework_identity_info): """CreateIdentity. :param :class:`<FrameworkIdentityInfo> <azure.devops.v5_0.identity.models.FrameworkIdentityInfo>` framework_identity_info: :rtype: :class:`<Identity> <azure.devops.v5_0.identity.models.Identity>` """ content =...
[ "def", "create_identity", "(", "self", ",", "framework_identity_info", ")", ":", "content", "=", "self", ".", "_serialize", ".", "body", "(", "framework_identity_info", ",", "'FrameworkIdentityInfo'", ")", "response", "=", "self", ".", "_send", "(", "http_method",...
CreateIdentity. :param :class:`<FrameworkIdentityInfo> <azure.devops.v5_0.identity.models.FrameworkIdentityInfo>` framework_identity_info: :rtype: :class:`<Identity> <azure.devops.v5_0.identity.models.Identity>`
[ "CreateIdentity", ".", ":", "param", ":", "class", ":", "<FrameworkIdentityInfo", ">", "<azure", ".", "devops", ".", "v5_0", ".", "identity", ".", "models", ".", "FrameworkIdentityInfo", ">", "framework_identity_info", ":", ":", "rtype", ":", ":", "class", ":"...
python
train
Esri/ArcREST
src/arcrest/manageags/_kml.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_kml.py#L51-L65
def createKMZ(self, kmz_as_json): """ Creates a KMZ file from json. See http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Create_Kmz/02r3000001tm000000/ for more information. """ kmlURL = self._url + "/createKmz" params = { "f" :...
[ "def", "createKMZ", "(", "self", ",", "kmz_as_json", ")", ":", "kmlURL", "=", "self", ".", "_url", "+", "\"/createKmz\"", "params", "=", "{", "\"f\"", ":", "\"json\"", ",", "\"kml\"", ":", "kmz_as_json", "}", "return", "self", ".", "_post", "(", "url", ...
Creates a KMZ file from json. See http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Create_Kmz/02r3000001tm000000/ for more information.
[ "Creates", "a", "KMZ", "file", "from", "json", ".", "See", "http", ":", "//", "resources", ".", "arcgis", ".", "com", "/", "en", "/", "help", "/", "arcgis", "-", "rest", "-", "api", "/", "index", ".", "html#", "/", "Create_Kmz", "/", "02r3000001tm000...
python
train
peo3/cgroup-utils
cgutils/cgroup.py
https://github.com/peo3/cgroup-utils/blob/fd7e99f438ce334bac5669fba0d08a6502fd7a82/cgutils/cgroup.py#L768-L791
def get_stats(self): """ It returns a name and a value pairs of control files which are categorised in the stats group. """ stats = {} for name, cls in self.stats.items(): path = self.paths[name] if os.path.exists(path): try: ...
[ "def", "get_stats", "(", "self", ")", ":", "stats", "=", "{", "}", "for", "name", ",", "cls", "in", "self", ".", "stats", ".", "items", "(", ")", ":", "path", "=", "self", ".", "paths", "[", "name", "]", "if", "os", ".", "path", ".", "exists", ...
It returns a name and a value pairs of control files which are categorised in the stats group.
[ "It", "returns", "a", "name", "and", "a", "value", "pairs", "of", "control", "files", "which", "are", "categorised", "in", "the", "stats", "group", "." ]
python
train
gwastro/pycbc
pycbc/detector.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/detector.py#L104-L118
def light_travel_time_to_detector(self, det): """ Return the light travel time from this detector Parameters ---------- det: Detector The other detector to determine the light travel time to. Returns ------- time: float The light travel t...
[ "def", "light_travel_time_to_detector", "(", "self", ",", "det", ")", ":", "d", "=", "self", ".", "location", "-", "det", ".", "location", "return", "float", "(", "d", ".", "dot", "(", "d", ")", "**", "0.5", "/", "constants", ".", "c", ".", "value", ...
Return the light travel time from this detector Parameters ---------- det: Detector The other detector to determine the light travel time to. Returns ------- time: float The light travel time in seconds
[ "Return", "the", "light", "travel", "time", "from", "this", "detector" ]
python
train