repo
stringlengths
7
55
path
stringlengths
4
223
url
stringlengths
87
315
code
stringlengths
75
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
avg_line_len
float64
7.91
980
dmwm/DBS
Server/Python/src/dbs/web/DBSReaderModel.py
https://github.com/dmwm/DBS/blob/9619bafce3783b3e77f0415f8f9a258e33dd1e6f/Server/Python/src/dbs/web/DBSReaderModel.py#L976-L1072
def listFileArray(self): """ API to list files in DBS. Either non-wildcarded logical_file_name, non-wildcarded dataset, non-wildcarded block_name or non-wildcarded lfn list is required. The combination of a non-wildcarded dataset or block_name with an wildcarded logical_file_name is supported....
[ "def", "listFileArray", "(", "self", ")", ":", "ret", "=", "[", "]", "try", ":", "body", "=", "request", ".", "body", ".", "read", "(", ")", "if", "body", ":", "data", "=", "cjson", ".", "decode", "(", "body", ")", "data", "=", "validateJSONInputNo...
API to list files in DBS. Either non-wildcarded logical_file_name, non-wildcarded dataset, non-wildcarded block_name or non-wildcarded lfn list is required. The combination of a non-wildcarded dataset or block_name with an wildcarded logical_file_name is supported. * For lumi_list the followi...
[ "API", "to", "list", "files", "in", "DBS", ".", "Either", "non", "-", "wildcarded", "logical_file_name", "non", "-", "wildcarded", "dataset", "non", "-", "wildcarded", "block_name", "or", "non", "-", "wildcarded", "lfn", "list", "is", "required", ".", "The",...
python
train
69.835052
gmr/tinman
tinman/handlers/rabbitmq.py
https://github.com/gmr/tinman/blob/98f0acd15a228d752caa1864cdf02aaa3d492a9f/tinman/handlers/rabbitmq.py#L128-L143
def _publish_message(self, exchange, routing_key, message, properties): """Publish the message to RabbitMQ :param str exchange: The exchange to publish to :param str routing_key: The routing key to publish with :param str message: The message body :param pika.BasicProperties: Th...
[ "def", "_publish_message", "(", "self", ",", "exchange", ",", "routing_key", ",", "message", ",", "properties", ")", ":", "if", "self", ".", "_rabbitmq_is_closed", "or", "not", "self", ".", "_rabbitmq_channel", ":", "LOGGER", ".", "warning", "(", "'Temporarily...
Publish the message to RabbitMQ :param str exchange: The exchange to publish to :param str routing_key: The routing key to publish with :param str message: The message body :param pika.BasicProperties: The message properties
[ "Publish", "the", "message", "to", "RabbitMQ" ]
python
train
46.9375
cytoscape/py2cytoscape
py2cytoscape/cyrest/networks.py
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/networks.py#L1109-L1121
def deleteEdge(self, networkId, edgeId, verbose=None): """ Deletes the edge specified by the `edgeId` and `networkId` parameters. :param networkId: SUID of the network containing the edge. :param edgeId: SUID of the edge :param verbose: print more :returns: default: suc...
[ "def", "deleteEdge", "(", "self", ",", "networkId", ",", "edgeId", ",", "verbose", "=", "None", ")", ":", "response", "=", "api", "(", "url", "=", "self", ".", "___url", "+", "'networks/'", "+", "str", "(", "networkId", ")", "+", "'/edges/'", "+", "s...
Deletes the edge specified by the `edgeId` and `networkId` parameters. :param networkId: SUID of the network containing the edge. :param edgeId: SUID of the edge :param verbose: print more :returns: default: successful operation
[ "Deletes", "the", "edge", "specified", "by", "the", "edgeId", "and", "networkId", "parameters", "." ]
python
train
37.384615
google/importlab
importlab/utils.py
https://github.com/google/importlab/blob/92090a0b4421137d1369c2ed952eda6bb4c7a155/importlab/utils.py#L63-L86
def expand_source_files(filenames, cwd=None): """Expand a list of filenames passed in as sources. This is a helper function for handling command line arguments that specify a list of source files and directories. Any directories in filenames will be scanned recursively for .py files. Any files tha...
[ "def", "expand_source_files", "(", "filenames", ",", "cwd", "=", "None", ")", ":", "out", "=", "[", "]", "for", "f", "in", "expand_paths", "(", "filenames", ",", "cwd", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "f", ")", ":", "# If we h...
Expand a list of filenames passed in as sources. This is a helper function for handling command line arguments that specify a list of source files and directories. Any directories in filenames will be scanned recursively for .py files. Any files that do not end with ".py" will be dropped. Args: ...
[ "Expand", "a", "list", "of", "filenames", "passed", "in", "as", "sources", "." ]
python
train
35.25
goose3/goose3
goose3/configuration.py
https://github.com/goose3/goose3/blob/e6994b1b1826af2720a091d1bff5ca15594f558d/goose3/configuration.py#L216-L249
def known_context_patterns(self, val): ''' val must be an ArticleContextPattern, a dictionary, or list of \ dictionaries e.g., {'attr': 'class', 'value': 'my-article-class'} or [{'attr': 'class', 'value': 'my-article-class'}, {'attr': 'id', 'value': 'm...
[ "def", "known_context_patterns", "(", "self", ",", "val", ")", ":", "def", "create_pat_from_dict", "(", "val", ")", ":", "'''Helper function used to create an ArticleContextPattern from a dictionary\n '''", "if", "\"tag\"", "in", "val", ":", "pat", "=", "Articl...
val must be an ArticleContextPattern, a dictionary, or list of \ dictionaries e.g., {'attr': 'class', 'value': 'my-article-class'} or [{'attr': 'class', 'value': 'my-article-class'}, {'attr': 'id', 'value': 'my-article-id'}]
[ "val", "must", "be", "an", "ArticleContextPattern", "a", "dictionary", "or", "list", "of", "\\", "dictionaries", "e", ".", "g", ".", "{", "attr", ":", "class", "value", ":", "my", "-", "article", "-", "class", "}", "or", "[", "{", "attr", ":", "class...
python
valid
42.823529
espressif/esptool
esptool.py
https://github.com/espressif/esptool/blob/c583756c118039cfcfe256f7a3285618914d16a5/esptool.py#L1424-L1434
def load_segment(self, f, is_irom_segment=False): """ Load the next segment from the image file """ file_offs = f.tell() (offset, size) = struct.unpack('<II', f.read(8)) self.warn_if_unusual_segment(offset, size, is_irom_segment) segment_data = f.read(size) if len(segment...
[ "def", "load_segment", "(", "self", ",", "f", ",", "is_irom_segment", "=", "False", ")", ":", "file_offs", "=", "f", ".", "tell", "(", ")", "(", "offset", ",", "size", ")", "=", "struct", ".", "unpack", "(", "'<II'", ",", "f", ".", "read", "(", "...
Load the next segment from the image file
[ "Load", "the", "next", "segment", "from", "the", "image", "file" ]
python
train
52.727273
tcalmant/ipopo
pelix/ipopo/handlers/requires.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/requires.py#L441-L447
def is_valid(self): """ Tests if the dependency is in a valid state """ return super(SimpleDependency, self).is_valid() or ( self.requirement.immediate_rebind and self._pending_ref is not None )
[ "def", "is_valid", "(", "self", ")", ":", "return", "super", "(", "SimpleDependency", ",", "self", ")", ".", "is_valid", "(", ")", "or", "(", "self", ".", "requirement", ".", "immediate_rebind", "and", "self", ".", "_pending_ref", "is", "not", "None", ")...
Tests if the dependency is in a valid state
[ "Tests", "if", "the", "dependency", "is", "in", "a", "valid", "state" ]
python
train
34.285714
wummel/linkchecker
linkcheck/configuration/__init__.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/linkcheck/configuration/__init__.py#L301-L327
def sanitize_loginurl (self): """Make login configuration consistent.""" url = self["loginurl"] disable = False if not self["loginpasswordfield"]: log.warn(LOG_CHECK, _("no CGI password fieldname given for login URL.")) disable = True if not se...
[ "def", "sanitize_loginurl", "(", "self", ")", ":", "url", "=", "self", "[", "\"loginurl\"", "]", "disable", "=", "False", "if", "not", "self", "[", "\"loginpasswordfield\"", "]", ":", "log", ".", "warn", "(", "LOG_CHECK", ",", "_", "(", "\"no CGI password ...
Make login configuration consistent.
[ "Make", "login", "configuration", "consistent", "." ]
python
train
41.851852
industrial-optimization-group/DESDEO
desdeo/utils/misc.py
https://github.com/industrial-optimization-group/DESDEO/blob/c7aebe8adb20942d200b9a411d4cdec21f5f4bff/desdeo/utils/misc.py#L131-L134
def as_minimized(values: List[float], maximized: List[bool]) -> List[float]: """ Return vector values as minimized """ return [v * -1. if m else v for v, m in zip(values, maximized)]
[ "def", "as_minimized", "(", "values", ":", "List", "[", "float", "]", ",", "maximized", ":", "List", "[", "bool", "]", ")", "->", "List", "[", "float", "]", ":", "return", "[", "v", "*", "-", "1.", "if", "m", "else", "v", "for", "v", ",", "m", ...
Return vector values as minimized
[ "Return", "vector", "values", "as", "minimized" ]
python
train
47.75
hydraplatform/hydra-base
hydra_base/lib/project.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/lib/project.py#L340-L349
def set_project_status(project_id, status, **kwargs): """ Set the status of a project to 'X' """ user_id = kwargs.get('user_id') #check_perm(user_id, 'delete_project') project = _get_project(project_id) project.check_write_permission(user_id) project.status = status db.DBSession....
[ "def", "set_project_status", "(", "project_id", ",", "status", ",", "*", "*", "kwargs", ")", ":", "user_id", "=", "kwargs", ".", "get", "(", "'user_id'", ")", "#check_perm(user_id, 'delete_project')", "project", "=", "_get_project", "(", "project_id", ")", "proj...
Set the status of a project to 'X'
[ "Set", "the", "status", "of", "a", "project", "to", "X" ]
python
train
31.8
Yelp/threat_intel
threat_intel/util/http.py
https://github.com/Yelp/threat_intel/blob/60eef841d7cca115ec7857aeb9c553b72b694851/threat_intel/util/http.py#L220-L237
def multi_post(self, urls, query_params=None, data=None, to_json=True, send_as_file=False): """Issue multiple POST requests. Args: urls - A string URL or list of string URLs query_params - None, a dict, or a list of dicts representing the query params data - None, a ...
[ "def", "multi_post", "(", "self", ",", "urls", ",", "query_params", "=", "None", ",", "data", "=", "None", ",", "to_json", "=", "True", ",", "send_as_file", "=", "False", ")", ":", "return", "self", ".", "_multi_request", "(", "MultiRequest", ".", "_VERB...
Issue multiple POST requests. Args: urls - A string URL or list of string URLs query_params - None, a dict, or a list of dicts representing the query params data - None, a dict or string, or a list of dicts and strings representing the data body. to_json - A bool...
[ "Issue", "multiple", "POST", "requests", "." ]
python
train
49.722222
Dallinger/Dallinger
demos/dlgr/demos/sheep_market/experiment.py
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/demos/dlgr/demos/sheep_market/experiment.py#L37-L41
def getdrawings(): """Get all the drawings.""" infos = Info.query.all() sketches = [json.loads(info.contents) for info in infos] return jsonify(drawings=sketches)
[ "def", "getdrawings", "(", ")", ":", "infos", "=", "Info", ".", "query", ".", "all", "(", ")", "sketches", "=", "[", "json", ".", "loads", "(", "info", ".", "contents", ")", "for", "info", "in", "infos", "]", "return", "jsonify", "(", "drawings", "...
Get all the drawings.
[ "Get", "all", "the", "drawings", "." ]
python
train
34.8
iotile/coretools
transport_plugins/websocket/iotile_transport_websocket/device_adapter.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/websocket/iotile_transport_websocket/device_adapter.py#L202-L212
async def _on_trace_notification(self, trace_event): """Callback function called when a trace chunk is received. Args: trace_chunk (dict): The received trace chunk information """ conn_string = trace_event.get('connection_string') payload = trace_event.get('payload'...
[ "async", "def", "_on_trace_notification", "(", "self", ",", "trace_event", ")", ":", "conn_string", "=", "trace_event", ".", "get", "(", "'connection_string'", ")", "payload", "=", "trace_event", ".", "get", "(", "'payload'", ")", "await", "self", ".", "notify...
Callback function called when a trace chunk is received. Args: trace_chunk (dict): The received trace chunk information
[ "Callback", "function", "called", "when", "a", "trace", "chunk", "is", "received", "." ]
python
train
34.090909
Yubico/yubikey-manager
ykman/cli/opgp.py
https://github.com/Yubico/yubikey-manager/blob/3ac27bc59ae76a59db9d09a530494add2edbbabf/ykman/cli/opgp.py#L137-L147
def reset(ctx): """ Reset OpenPGP application. This action will wipe all OpenPGP data, and set all PINs to their default values. """ click.echo("Resetting OpenPGP data, don't remove your YubiKey...") ctx.obj['controller'].reset() click.echo('Success! All data has been cleared and defaul...
[ "def", "reset", "(", "ctx", ")", ":", "click", ".", "echo", "(", "\"Resetting OpenPGP data, don't remove your YubiKey...\"", ")", "ctx", ".", "obj", "[", "'controller'", "]", ".", "reset", "(", ")", "click", ".", "echo", "(", "'Success! All data has been cleared a...
Reset OpenPGP application. This action will wipe all OpenPGP data, and set all PINs to their default values.
[ "Reset", "OpenPGP", "application", "." ]
python
train
31.909091
wndhydrnt/python-oauth2
oauth2/store/dbapi/__init__.py
https://github.com/wndhydrnt/python-oauth2/blob/abe3bf5f27bda2ff737cab387b040e2e6e85c2e2/oauth2/store/dbapi/__init__.py#L140-L165
def fetch_existing_token_of_user(self, client_id, grant_type, user_id): """ Retrieve an access token issued to a client and user for a specific grant. :param client_id: The identifier of a client as a `str`. :param grant_type: The type of grant. :param user_id: The ident...
[ "def", "fetch_existing_token_of_user", "(", "self", ",", "client_id", ",", "grant_type", ",", "user_id", ")", ":", "token_data", "=", "self", ".", "fetchone", "(", "self", ".", "fetch_existing_token_of_user_query", ",", "client_id", ",", "grant_type", ",", "user_i...
Retrieve an access token issued to a client and user for a specific grant. :param client_id: The identifier of a client as a `str`. :param grant_type: The type of grant. :param user_id: The identifier of the user the access token has been issued to. :ret...
[ "Retrieve", "an", "access", "token", "issued", "to", "a", "client", "and", "user", "for", "a", "specific", "grant", "." ]
python
train
38.269231
chrisspen/weka
weka/arff.py
https://github.com/chrisspen/weka/blob/c86fc4b8eef1afd56f89ec28283bdf9e2fdc453b/weka/arff.py#L357-L367
def load(cls, filename, schema_only=False): """ Load an ARFF File from a file. """ o = open(filename) s = o.read() a = cls.parse(s, schema_only=schema_only) if not schema_only: a._filename = filename o.close() return a
[ "def", "load", "(", "cls", ",", "filename", ",", "schema_only", "=", "False", ")", ":", "o", "=", "open", "(", "filename", ")", "s", "=", "o", ".", "read", "(", ")", "a", "=", "cls", ".", "parse", "(", "s", ",", "schema_only", "=", "schema_only",...
Load an ARFF File from a file.
[ "Load", "an", "ARFF", "File", "from", "a", "file", "." ]
python
train
26.545455
saltstack/salt
salt/modules/aptpkg.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/aptpkg.py#L1704-L1814
def del_repo(repo, **kwargs): ''' Delete a repo from the sources.list / sources.list.d If the .list file is in the sources.list.d directory and the file that the repo exists in does not contain any other repo configuration, the file itself will be deleted. The repo passed in must be a fully fo...
[ "def", "del_repo", "(", "repo", ",", "*", "*", "kwargs", ")", ":", "_check_apt", "(", ")", "is_ppa", "=", "False", "if", "repo", ".", "startswith", "(", "'ppa:'", ")", "and", "__grains__", "[", "'os'", "]", "in", "(", "'Ubuntu'", ",", "'Mint'", ",", ...
Delete a repo from the sources.list / sources.list.d If the .list file is in the sources.list.d directory and the file that the repo exists in does not contain any other repo configuration, the file itself will be deleted. The repo passed in must be a fully formed repository definition string. ...
[ "Delete", "a", "repo", "from", "the", "sources", ".", "list", "/", "sources", ".", "list", ".", "d" ]
python
train
39.009009
CS207-Final-Project-Group-10/cs207-FinalProject
fluxions/fluxion_node.py
https://github.com/CS207-Final-Project-Group-10/cs207-FinalProject/blob/842e9c2d3ca1490cef18c086dfde81856d8d3a82/fluxions/fluxion_node.py#L200-L211
def _squeeze(self, var_tbl: dict) -> dict: """ Makes sure no extra dimensions are floating around in the input arrays Returns inferred dict of variable: val pairs """ var_names = var_tbl.copy() # squeeze any numpy arrays for v in var_tbl: val = var_tbl...
[ "def", "_squeeze", "(", "self", ",", "var_tbl", ":", "dict", ")", "->", "dict", ":", "var_names", "=", "var_tbl", ".", "copy", "(", ")", "# squeeze any numpy arrays", "for", "v", "in", "var_tbl", ":", "val", "=", "var_tbl", "[", "v", "]", "if", "isinst...
Makes sure no extra dimensions are floating around in the input arrays Returns inferred dict of variable: val pairs
[ "Makes", "sure", "no", "extra", "dimensions", "are", "floating", "around", "in", "the", "input", "arrays", "Returns", "inferred", "dict", "of", "variable", ":", "val", "pairs" ]
python
train
35.5
CiscoTestAutomation/yang
ncdiff/src/yang/ncdiff/device.py
https://github.com/CiscoTestAutomation/yang/blob/c70ec5ac5a91f276c4060009203770ece92e76b4/ncdiff/src/yang/ncdiff/device.py#L748-L785
def _get_ns(self, reply): '''_get_ns Low-level api: Return a dict of nsmap. Parameters ---------- reply : `Element` rpc-reply as an instance of Element. Returns ------- dict A dict of nsmap. ''' def get_prefix(...
[ "def", "_get_ns", "(", "self", ",", "reply", ")", ":", "def", "get_prefix", "(", "url", ")", ":", "if", "url", "in", "special_prefixes", ":", "return", "special_prefixes", "[", "url", "]", "for", "i", "in", "self", ".", "namespaces", ":", "if", "url", ...
_get_ns Low-level api: Return a dict of nsmap. Parameters ---------- reply : `Element` rpc-reply as an instance of Element. Returns ------- dict A dict of nsmap.
[ "_get_ns" ]
python
train
26.5
olitheolix/qtmacs
qtmacs/extensions/qtmacsscintilla_widget.py
https://github.com/olitheolix/qtmacs/blob/36253b082b82590f183fe154b053eb3a1e741be2/qtmacs/extensions/qtmacsscintilla_widget.py#L932-L961
def SCISetStylingEx(self, line: int, col: int, style: bytearray): """ Pythonic wrapper for the SCI_SETSTYLINGEX command. For example, the following code will fetch the styling for the first five characters applies it verbatim to the next five characters. text, style = SCIGe...
[ "def", "SCISetStylingEx", "(", "self", ",", "line", ":", "int", ",", "col", ":", "int", ",", "style", ":", "bytearray", ")", ":", "if", "not", "self", ".", "isPositionValid", "(", "line", ",", "col", ")", ":", "return", "pos", "=", "self", ".", "po...
Pythonic wrapper for the SCI_SETSTYLINGEX command. For example, the following code will fetch the styling for the first five characters applies it verbatim to the next five characters. text, style = SCIGetStyledText((0, 0, 0, 5)) SCISetStylingEx((0, 5), style) |Args| ...
[ "Pythonic", "wrapper", "for", "the", "SCI_SETSTYLINGEX", "command", "." ]
python
train
32.2
lago-project/lago
lago/config.py
https://github.com/lago-project/lago/blob/5b8970f7687e063e4619066d5b8093ca997678c9/lago/config.py#L161-L178
def update_parser(self, parser): """Update config dictionary with declared arguments in an argparse.parser New variables will be created, and existing ones overridden. Args: parser (argparse.ArgumentParser): parser to read variables from """ self._parser = parser ...
[ "def", "update_parser", "(", "self", ",", "parser", ")", ":", "self", ".", "_parser", "=", "parser", "ini_str", "=", "argparse_to_ini", "(", "parser", ")", "configp", "=", "configparser", ".", "ConfigParser", "(", "allow_no_value", "=", "True", ")", "configp...
Update config dictionary with declared arguments in an argparse.parser New variables will be created, and existing ones overridden. Args: parser (argparse.ArgumentParser): parser to read variables from
[ "Update", "config", "dictionary", "with", "declared", "arguments", "in", "an", "argparse", ".", "parser", "New", "variables", "will", "be", "created", "and", "existing", "ones", "overridden", "." ]
python
train
33.611111
AustralianSynchrotron/lightflow
lightflow/models/datastore.py
https://github.com/AustralianSynchrotron/lightflow/blob/dc53dbc1d961e20fb144273baca258060705c03e/lightflow/models/datastore.py#L413-L445
def _decode_value(self, value): """ Decodes the value by turning any binary data back into Python objects. The method searches for ObjectId values, loads the associated binary data from GridFS and returns the decoded Python object. Args: value (object): The value that shoul...
[ "def", "_decode_value", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "(", "int", ",", "float", ",", "str", ",", "bool", ",", "datetime", ")", ")", ":", "return", "value", "elif", "isinstance", "(", "value", ",", "list",...
Decodes the value by turning any binary data back into Python objects. The method searches for ObjectId values, loads the associated binary data from GridFS and returns the decoded Python object. Args: value (object): The value that should be decoded. Raises: D...
[ "Decodes", "the", "value", "by", "turning", "any", "binary", "data", "back", "into", "Python", "objects", "." ]
python
train
38.666667
ransford/sllurp
sllurp/llrp.py
https://github.com/ransford/sllurp/blob/d744b7e17d7ba64a24d9a31bde6cba65d91ad9b1/sllurp/llrp.py#L66-L97
def deserialize(self): """Turns a sequence of bytes into a message dictionary.""" if self.msgbytes is None: raise LLRPError('No message bytes to deserialize.') data = self.msgbytes msgtype, length, msgid = struct.unpack(self.full_hdr_fmt, ...
[ "def", "deserialize", "(", "self", ")", ":", "if", "self", ".", "msgbytes", "is", "None", ":", "raise", "LLRPError", "(", "'No message bytes to deserialize.'", ")", "data", "=", "self", ".", "msgbytes", "msgtype", ",", "length", ",", "msgid", "=", "struct", ...
Turns a sequence of bytes into a message dictionary.
[ "Turns", "a", "sequence", "of", "bytes", "into", "a", "message", "dictionary", "." ]
python
train
41.59375
JukeboxPipeline/jukebox-core
src/jukeboxcore/gui/widgets/commentwidget.py
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/gui/widgets/commentwidget.py#L27-L41
def set_index(self, index): """Display the data of the given index :param index: the index to paint :type index: QtCore.QModelIndex :returns: None :rtype: None :raises: None """ item = index.internalPointer() note = item.internal_data() se...
[ "def", "set_index", "(", "self", ",", "index", ")", ":", "item", "=", "index", ".", "internalPointer", "(", ")", "note", "=", "item", ".", "internal_data", "(", ")", "self", ".", "content_lb", ".", "setText", "(", "note", ".", "content", ")", "self", ...
Display the data of the given index :param index: the index to paint :type index: QtCore.QModelIndex :returns: None :rtype: None :raises: None
[ "Display", "the", "data", "of", "the", "given", "index" ]
python
train
36
mathiasertl/django-ca
ca/django_ca/utils.py
https://github.com/mathiasertl/django-ca/blob/976d7ea05276320f20daed2a6d59c8f5660fe976/ca/django_ca/utils.py#L143-L157
def format_general_name(name): """Format a single general name. >>> import ipaddress >>> format_general_name(x509.DNSName('example.com')) 'DNS:example.com' >>> format_general_name(x509.IPAddress(ipaddress.IPv4Address('127.0.0.1'))) 'IP:127.0.0.1' """ if isinstance(name, x509.DirectoryN...
[ "def", "format_general_name", "(", "name", ")", ":", "if", "isinstance", "(", "name", ",", "x509", ".", "DirectoryName", ")", ":", "value", "=", "format_name", "(", "name", ".", "value", ")", "else", ":", "value", "=", "name", ".", "value", "return", "...
Format a single general name. >>> import ipaddress >>> format_general_name(x509.DNSName('example.com')) 'DNS:example.com' >>> format_general_name(x509.IPAddress(ipaddress.IPv4Address('127.0.0.1'))) 'IP:127.0.0.1'
[ "Format", "a", "single", "general", "name", "." ]
python
train
29.866667
jopohl/urh
src/urh/controller/GeneratorTabController.py
https://github.com/jopohl/urh/blob/2eb33b125c8407964cd1092843cde5010eb88aae/src/urh/controller/GeneratorTabController.py#L499-L517
def refresh_existing_encodings(self, encodings_from_file): """ Refresh existing encodings for messages, when encoding was changed by user in dialog :return: """ update = False for msg in self.table_model.protocol.messages: i = next((i for i, d in enumerate(e...
[ "def", "refresh_existing_encodings", "(", "self", ",", "encodings_from_file", ")", ":", "update", "=", "False", "for", "msg", "in", "self", ".", "table_model", ".", "protocol", ".", "messages", ":", "i", "=", "next", "(", "(", "i", "for", "i", ",", "d", ...
Refresh existing encodings for messages, when encoding was changed by user in dialog :return:
[ "Refresh", "existing", "encodings", "for", "messages", "when", "encoding", "was", "changed", "by", "user", "in", "dialog" ]
python
train
35.263158
MAVENSDC/cdflib
cdflib/cdfread.py
https://github.com/MAVENSDC/cdflib/blob/d237c60e5db67db0f92d96054209c25c4042465c/cdflib/cdfread.py#L2072-L2098
def _convert_type(self, data_type): ''' CDF data types to python struct data types ''' if (data_type == 1) or (data_type == 41): dt_string = 'b' elif data_type == 2: dt_string = 'h' elif data_type == 4: dt_string = 'i' elif (dat...
[ "def", "_convert_type", "(", "self", ",", "data_type", ")", ":", "if", "(", "data_type", "==", "1", ")", "or", "(", "data_type", "==", "41", ")", ":", "dt_string", "=", "'b'", "elif", "data_type", "==", "2", ":", "dt_string", "=", "'h'", "elif", "dat...
CDF data types to python struct data types
[ "CDF", "data", "types", "to", "python", "struct", "data", "types" ]
python
train
32.555556
python-openxml/python-docx
docx/text/tabstops.py
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/text/tabstops.py#L69-L82
def add_tab_stop(self, position, alignment=WD_TAB_ALIGNMENT.LEFT, leader=WD_TAB_LEADER.SPACES): """ Add a new tab stop at *position*, a |Length| object specifying the location of the tab stop relative to the paragraph edge. A negative *position* value is valid and ap...
[ "def", "add_tab_stop", "(", "self", ",", "position", ",", "alignment", "=", "WD_TAB_ALIGNMENT", ".", "LEFT", ",", "leader", "=", "WD_TAB_LEADER", ".", "SPACES", ")", ":", "tabs", "=", "self", ".", "_pPr", ".", "get_or_add_tabs", "(", ")", "tab", "=", "ta...
Add a new tab stop at *position*, a |Length| object specifying the location of the tab stop relative to the paragraph edge. A negative *position* value is valid and appears in hanging indentation. Tab alignment defaults to left, but may be specified by passing a member of the :ref:`WdTab...
[ "Add", "a", "new", "tab", "stop", "at", "*", "position", "*", "a", "|Length|", "object", "specifying", "the", "location", "of", "the", "tab", "stop", "relative", "to", "the", "paragraph", "edge", ".", "A", "negative", "*", "position", "*", "value", "is",...
python
train
54.714286
josuebrunel/myql
myql/myql.py
https://github.com/josuebrunel/myql/blob/891bad29cc83a81b3f5ebc4d0401d6f2c22f119e/myql/myql.py#L112-L122
def execute_query(self, payload): '''Execute the query and returns and response''' if vars(self).get('oauth'): if not self.oauth.token_is_valid(): # Refresh token if token has expired self.oauth.refresh_token() response = self.oauth.session.get(self.PRIVATE_URL, p...
[ "def", "execute_query", "(", "self", ",", "payload", ")", ":", "if", "vars", "(", "self", ")", ".", "get", "(", "'oauth'", ")", ":", "if", "not", "self", ".", "oauth", ".", "token_is_valid", "(", ")", ":", "# Refresh token if token has expired", "self", ...
Execute the query and returns and response
[ "Execute", "the", "query", "and", "returns", "and", "response" ]
python
train
47
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_openstack_helper.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_openstack_helper.py#L82-L94
def delete_network(self, name, tenant_id, subnet_id, net_id): """Delete the openstack subnet and network. """ try: self.neutronclient.delete_subnet(subnet_id) except Exception as exc: LOG.error("Failed to delete subnet %(sub)s exc %(exc)s", {'sub': s...
[ "def", "delete_network", "(", "self", ",", "name", ",", "tenant_id", ",", "subnet_id", ",", "net_id", ")", ":", "try", ":", "self", ".", "neutronclient", ".", "delete_subnet", "(", "subnet_id", ")", "except", "Exception", "as", "exc", ":", "LOG", ".", "e...
Delete the openstack subnet and network.
[ "Delete", "the", "openstack", "subnet", "and", "network", "." ]
python
train
44.615385
rfverbruggen/rachiopy
rachiopy/device.py
https://github.com/rfverbruggen/rachiopy/blob/c91abc9984f0f453e60fa905285c1b640c3390ae/rachiopy/device.py#L59-L66
def off(self, dev_id): """Turn OFF all features of the device. schedules, weather intelligence, water budget, etc. """ path = 'device/off' payload = {'id': dev_id} return self.rachio.put(path, payload)
[ "def", "off", "(", "self", ",", "dev_id", ")", ":", "path", "=", "'device/off'", "payload", "=", "{", "'id'", ":", "dev_id", "}", "return", "self", ".", "rachio", ".", "put", "(", "path", ",", "payload", ")" ]
Turn OFF all features of the device. schedules, weather intelligence, water budget, etc.
[ "Turn", "OFF", "all", "features", "of", "the", "device", "." ]
python
train
30.375
inveniosoftware-attic/invenio-upgrader
invenio_upgrader/logging.py
https://github.com/inveniosoftware-attic/invenio-upgrader/blob/cee4bcb118515463ecf6de1421642007f79a9fcd/invenio_upgrader/logging.py#L41-L54
def get_level_fmt(self, level): """Get format for log level.""" key = None if level == logging.DEBUG: key = 'debug' elif level == logging.INFO: key = 'info' elif level == logging.WARNING: key = 'warning' elif level == logging.ERROR: ...
[ "def", "get_level_fmt", "(", "self", ",", "level", ")", ":", "key", "=", "None", "if", "level", "==", "logging", ".", "DEBUG", ":", "key", "=", "'debug'", "elif", "level", "==", "logging", ".", "INFO", ":", "key", "=", "'info'", "elif", "level", "=="...
Get format for log level.
[ "Get", "format", "for", "log", "level", "." ]
python
train
32
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/query.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/query.py#L598-L613
def _set_properties(self, api_response): """Update properties from resource in body of ``api_response`` :type api_response: dict :param api_response: response returned from an API call """ job_id_present = ( "jobReference" in api_response and "jobId" in a...
[ "def", "_set_properties", "(", "self", ",", "api_response", ")", ":", "job_id_present", "=", "(", "\"jobReference\"", "in", "api_response", "and", "\"jobId\"", "in", "api_response", "[", "\"jobReference\"", "]", "and", "\"projectId\"", "in", "api_response", "[", "...
Update properties from resource in body of ``api_response`` :type api_response: dict :param api_response: response returned from an API call
[ "Update", "properties", "from", "resource", "in", "body", "of", "api_response" ]
python
train
37.3125
GoogleCloudPlatform/compute-image-packages
packages/python-google-compute-engine/google_compute_engine/distro_lib/ip_forwarding_utils.py
https://github.com/GoogleCloudPlatform/compute-image-packages/blob/53ea8cd069fb4d9a1984d1c167e54c133033f8da/packages/python-google-compute-engine/google_compute_engine/distro_lib/ip_forwarding_utils.py#L284-L292
def AddForwardedIp(self, address, interface): """Configure a new IP address on the network interface. Args: address: string, the IP address to configure. interface: string, the output device to use. """ for ip in list(netaddr.IPNetwork(address)): self._RunIfconfig(args=[interface, 'al...
[ "def", "AddForwardedIp", "(", "self", ",", "address", ",", "interface", ")", ":", "for", "ip", "in", "list", "(", "netaddr", ".", "IPNetwork", "(", "address", ")", ")", ":", "self", ".", "_RunIfconfig", "(", "args", "=", "[", "interface", ",", "'alias'...
Configure a new IP address on the network interface. Args: address: string, the IP address to configure. interface: string, the output device to use.
[ "Configure", "a", "new", "IP", "address", "on", "the", "network", "interface", "." ]
python
train
37.444444
django-leonardo/django-leonardo
leonardo/module/web/admin.py
https://github.com/django-leonardo/django-leonardo/blob/4b933e1792221a13b4028753d5f1d3499b0816d4/leonardo/module/web/admin.py#L84-L103
def get_changeform_initial_data(self, request): '''Copy initial data from parent''' initial = super(PageAdmin, self).get_changeform_initial_data(request) if ('translation_of' in request.GET): original = self.model._tree_manager.get( pk=request.GET.get('translation_of'...
[ "def", "get_changeform_initial_data", "(", "self", ",", "request", ")", ":", "initial", "=", "super", "(", "PageAdmin", ",", "self", ")", ".", "get_changeform_initial_data", "(", "request", ")", "if", "(", "'translation_of'", "in", "request", ".", "GET", ")", ...
Copy initial data from parent
[ "Copy", "initial", "data", "from", "parent" ]
python
train
42.95
saltstack/salt
salt/modules/cmdmod.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/cmdmod.py#L250-L858
def _run(cmd, cwd=None, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, output_encoding=None, output_loglevel='debug', log_callback=None, runas=None, group=None, shell=DEFAULT_SHELL, python_shell=False, ...
[ "def", "_run", "(", "cmd", ",", "cwd", "=", "None", ",", "stdin", "=", "None", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ",", "output_encoding", "=", "None", ",", "output_loglevel", "=", "'debug'", ",...
Do the DRY thing and only call subprocess.Popen() once
[ "Do", "the", "DRY", "thing", "and", "only", "call", "subprocess", ".", "Popen", "()", "once" ]
python
train
36.635468
softlayer/softlayer-python
SoftLayer/CLI/image/list.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/image/list.py#L20-L58
def cli(env, name, public): """List images.""" image_mgr = SoftLayer.ImageManager(env.client) images = [] if public in [False, None]: for image in image_mgr.list_private_images(name=name, mask=image_mod.MASK): images.append(image) ...
[ "def", "cli", "(", "env", ",", "name", ",", "public", ")", ":", "image_mgr", "=", "SoftLayer", ".", "ImageManager", "(", "env", ".", "client", ")", "images", "=", "[", "]", "if", "public", "in", "[", "False", ",", "None", "]", ":", "for", "image", ...
List images.
[ "List", "images", "." ]
python
train
35.025641
kennethreitz/records
records.py
https://github.com/kennethreitz/records/blob/ecd857266c5e7830d657cbe0196816314790563b/records.py#L424-L432
def _reduce_datetimes(row): """Receives a row, converts datetimes to strings.""" row = list(row) for i in range(len(row)): if hasattr(row[i], 'isoformat'): row[i] = row[i].isoformat() return tuple(row)
[ "def", "_reduce_datetimes", "(", "row", ")", ":", "row", "=", "list", "(", "row", ")", "for", "i", "in", "range", "(", "len", "(", "row", ")", ")", ":", "if", "hasattr", "(", "row", "[", "i", "]", ",", "'isoformat'", ")", ":", "row", "[", "i", ...
Receives a row, converts datetimes to strings.
[ "Receives", "a", "row", "converts", "datetimes", "to", "strings", "." ]
python
train
25.666667
python-openxml/python-docx
docx/oxml/ns.py
https://github.com/python-openxml/python-docx/blob/6756f6cd145511d3eb6d1d188beea391b1ddfd53/docx/oxml/ns.py#L105-L113
def qn(tag): """ Stands for "qualified name", a utility function to turn a namespace prefixed tag name into a Clark-notation qualified tag name for lxml. For example, ``qn('p:cSld')`` returns ``'{http://schemas.../main}cSld'``. """ prefix, tagroot = tag.split(':') uri = nsmap[prefix] ret...
[ "def", "qn", "(", "tag", ")", ":", "prefix", ",", "tagroot", "=", "tag", ".", "split", "(", "':'", ")", "uri", "=", "nsmap", "[", "prefix", "]", "return", "'{%s}%s'", "%", "(", "uri", ",", "tagroot", ")" ]
Stands for "qualified name", a utility function to turn a namespace prefixed tag name into a Clark-notation qualified tag name for lxml. For example, ``qn('p:cSld')`` returns ``'{http://schemas.../main}cSld'``.
[ "Stands", "for", "qualified", "name", "a", "utility", "function", "to", "turn", "a", "namespace", "prefixed", "tag", "name", "into", "a", "Clark", "-", "notation", "qualified", "tag", "name", "for", "lxml", ".", "For", "example", "qn", "(", "p", ":", "cS...
python
train
37.888889
gwastro/pycbc-glue
pycbc_glue/ligolw/utils/segments.py
https://github.com/gwastro/pycbc-glue/blob/a3e906bae59fbfd707c3ff82e5d008d939ec5e24/pycbc_glue/ligolw/utils/segments.py#L371-L398
def get_by_name(self, name, clip_to_valid = False): """ Retrieve the active segmentlists whose name equals name. The result is a segmentlistdict indexed by instrument. All segmentlist objects within it will be copies of the contents of this object, modifications will not affect the contents of this object....
[ "def", "get_by_name", "(", "self", ",", "name", ",", "clip_to_valid", "=", "False", ")", ":", "result", "=", "segments", ".", "segmentlistdict", "(", ")", "for", "seglist", "in", "self", ":", "if", "seglist", ".", "name", "!=", "name", ":", "continue", ...
Retrieve the active segmentlists whose name equals name. The result is a segmentlistdict indexed by instrument. All segmentlist objects within it will be copies of the contents of this object, modifications will not affect the contents of this object. If clip_to_valid is True then the segmentlists will be i...
[ "Retrieve", "the", "active", "segmentlists", "whose", "name", "equals", "name", ".", "The", "result", "is", "a", "segmentlistdict", "indexed", "by", "instrument", ".", "All", "segmentlist", "objects", "within", "it", "will", "be", "copies", "of", "the", "conte...
python
train
38.071429
thieman/dagobah
dagobah/daemon/util.py
https://github.com/thieman/dagobah/blob/e624180c2291034960302c9e0b818b65b5a7ee11/dagobah/daemon/util.py#L82-L118
def validate_dict(in_dict, **kwargs): """ Returns Boolean of whether given dict conforms to type specifications given in kwargs. """ if not isinstance(in_dict, dict): raise ValueError('requires a dictionary') for key, value in kwargs.iteritems(): if key == 'required': for ...
[ "def", "validate_dict", "(", "in_dict", ",", "*", "*", "kwargs", ")", ":", "if", "not", "isinstance", "(", "in_dict", ",", "dict", ")", ":", "raise", "ValueError", "(", "'requires a dictionary'", ")", "for", "key", ",", "value", "in", "kwargs", ".", "ite...
Returns Boolean of whether given dict conforms to type specifications given in kwargs.
[ "Returns", "Boolean", "of", "whether", "given", "dict", "conforms", "to", "type", "specifications", "given", "in", "kwargs", "." ]
python
train
26.648649
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L826-L864
def add_bias(self, name, b, input_name, output_name, shape_bias = [1]): """ Add bias layer to the model. Parameters ---------- name: str The name of this layer. b: int | numpy.array Bias to add to the input. input_name: str The...
[ "def", "add_bias", "(", "self", ",", "name", ",", "b", ",", "input_name", ",", "output_name", ",", "shape_bias", "=", "[", "1", "]", ")", ":", "spec", "=", "self", ".", "spec", "nn_spec", "=", "self", ".", "nn_spec", "spec_layer", "=", "nn_spec", "."...
Add bias layer to the model. Parameters ---------- name: str The name of this layer. b: int | numpy.array Bias to add to the input. input_name: str The input blob name of this layer. output_name: str The output blob name of...
[ "Add", "bias", "layer", "to", "the", "model", "." ]
python
train
33.512821
jreese/dotlink
dotlink/dotlink.py
https://github.com/jreese/dotlink/blob/5e48c1493c20fc6df4ad0144e80563915ce339b6/dotlink/dotlink.py#L213-L220
def sh(self, *command, **kwargs): """Run a shell command with the given arguments.""" self.log.debug('shell: %s', ' '.join(command)) return subprocess.check_call(' '.join(command), stdout=sys.stdout, stderr=sys.stderr, ...
[ "def", "sh", "(", "self", ",", "*", "command", ",", "*", "*", "kwargs", ")", ":", "self", ".", "log", ".", "debug", "(", "'shell: %s'", ",", "' '", ".", "join", "(", "command", ")", ")", "return", "subprocess", ".", "check_call", "(", "' '", ".", ...
Run a shell command with the given arguments.
[ "Run", "a", "shell", "command", "with", "the", "given", "arguments", "." ]
python
train
52.75
jd/daiquiri
daiquiri/__init__.py
https://github.com/jd/daiquiri/blob/3fd8df555ab9ed1d11b5931bfef3ba6dce5b8166/daiquiri/__init__.py#L64-L77
def getLogger(name=None, **kwargs): """Build a logger with the given name. :param name: The name for the logger. This is usually the module name, ``__name__``. :type name: string """ adapter = _LOGGERS.get(name) if not adapter: # NOTE(jd) Keep using the `adapter' variab...
[ "def", "getLogger", "(", "name", "=", "None", ",", "*", "*", "kwargs", ")", ":", "adapter", "=", "_LOGGERS", ".", "get", "(", "name", ")", "if", "not", "adapter", ":", "# NOTE(jd) Keep using the `adapter' variable here because so it's not", "# collected by Python si...
Build a logger with the given name. :param name: The name for the logger. This is usually the module name, ``__name__``. :type name: string
[ "Build", "a", "logger", "with", "the", "given", "name", "." ]
python
train
37.785714
42matters/bottle-couchbase
bottle_couchbase.py
https://github.com/42matters/bottle-couchbase/blob/79e8c347e0ec4e1daab5da2a844fe8aa763019e2/bottle_couchbase.py#L100-L107
def release_client(self, cb): """ Return a Connection object to the pool :param Connection cb: the client to release """ if cb: self._q.put(cb, True) self._clients_in_use -= 1
[ "def", "release_client", "(", "self", ",", "cb", ")", ":", "if", "cb", ":", "self", ".", "_q", ".", "put", "(", "cb", ",", "True", ")", "self", ".", "_clients_in_use", "-=", "1" ]
Return a Connection object to the pool :param Connection cb: the client to release
[ "Return", "a", "Connection", "object", "to", "the", "pool", ":", "param", "Connection", "cb", ":", "the", "client", "to", "release" ]
python
train
29
lemieuxl/pyGenClean
pyGenClean/LaTeX/utils.py
https://github.com/lemieuxl/pyGenClean/blob/6173a48ccc0cf3a3bd711b1f2a1fa16248b8bf55/pyGenClean/LaTeX/utils.py#L155-L168
def wrap_lines(content, length=80): """Wraps long lines to a maximum length of 80. :param content: the content to wrap. :param legnth: the maximum length to wrap the content. :type content: str :type length: int :returns: a string containing the wrapped content. :rtype: str """ r...
[ "def", "wrap_lines", "(", "content", ",", "length", "=", "80", ")", ":", "return", "\"\\n\"", ".", "join", "(", "textwrap", ".", "wrap", "(", "content", ",", "length", ",", "break_long_words", "=", "False", ")", ")" ]
Wraps long lines to a maximum length of 80. :param content: the content to wrap. :param legnth: the maximum length to wrap the content. :type content: str :type length: int :returns: a string containing the wrapped content. :rtype: str
[ "Wraps", "long", "lines", "to", "a", "maximum", "length", "of", "80", "." ]
python
train
27
Brazelton-Lab/bio_utils
bio_utils/iterators/b6.py
https://github.com/Brazelton-Lab/bio_utils/blob/5a7ddf13ee0bf4baaaeb6b2b99e01bf74aa132b7/bio_utils/iterators/b6.py#L97-L125
def write(self, default: bool=False): """Restore B6/M8 entry to original format Args: default (bool): output entry in default BLAST+ B6 format Returns: str: properly formatted string containing the B6/M8 entry """ none_type = type(None) if def...
[ "def", "write", "(", "self", ",", "default", ":", "bool", "=", "False", ")", ":", "none_type", "=", "type", "(", "None", ")", "if", "default", ":", "# Default order of format specifiers", "ordered_vals", "=", "[", "'query'", ",", "'subject'", ",", "'identity...
Restore B6/M8 entry to original format Args: default (bool): output entry in default BLAST+ B6 format Returns: str: properly formatted string containing the B6/M8 entry
[ "Restore", "B6", "/", "M8", "entry", "to", "original", "format" ]
python
train
38.793103
ontio/ontology-python-sdk
ontology/io/binary_writer.py
https://github.com/ontio/ontology-python-sdk/blob/ac88bdda941896c5d2ced08422a9c5179d3f9b19/ontology/io/binary_writer.py#L260-L275
def write_uint64(self, value, little_endian=True): """ Pack the value as an unsigned integer and write 8 bytes to the stream. Args: value: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: the number of bytes writte...
[ "def", "write_uint64", "(", "self", ",", "value", ",", "little_endian", "=", "True", ")", ":", "if", "little_endian", ":", "endian", "=", "\"<\"", "else", ":", "endian", "=", "\">\"", "return", "self", ".", "pack", "(", "'%sQ'", "%", "endian", ",", "va...
Pack the value as an unsigned integer and write 8 bytes to the stream. Args: value: little_endian (bool): specify the endianness. (Default) Little endian. Returns: int: the number of bytes written.
[ "Pack", "the", "value", "as", "an", "unsigned", "integer", "and", "write", "8", "bytes", "to", "the", "stream", "." ]
python
train
28.5625
LLNL/scraper
scripts/github_stats.py
https://github.com/LLNL/scraper/blob/881a316e4c04dfa5a9cf491b7c7f9f997a7c56ea/scripts/github_stats.py#L158-L167
def get_teams_of_org(self): """ Retrieves the number of teams of the organization. """ print 'Getting teams.' counter = 0 for team in self.org_retrieved.iter_teams(): self.teams_json[team.id] = team.to_json() counter += 1 return counter
[ "def", "get_teams_of_org", "(", "self", ")", ":", "print", "'Getting teams.'", "counter", "=", "0", "for", "team", "in", "self", ".", "org_retrieved", ".", "iter_teams", "(", ")", ":", "self", ".", "teams_json", "[", "team", ".", "id", "]", "=", "team", ...
Retrieves the number of teams of the organization.
[ "Retrieves", "the", "number", "of", "teams", "of", "the", "organization", "." ]
python
test
30.7
stephen-bunn/file-config
src/file_config/handlers/_common.py
https://github.com/stephen-bunn/file-config/blob/93429360c949985202e1f2b9cd0340731819ba75/src/file_config/handlers/_common.py#L189-L199
def load(self, config, file_object, prefer=None): """ An abstract method that loads from a given file object. :param class config: The config class to load into :param file file_object: The file object to load from :param str prefer: The preferred serialization module name :retu...
[ "def", "load", "(", "self", ",", "config", ",", "file_object", ",", "prefer", "=", "None", ")", ":", "return", "self", ".", "loads", "(", "config", ",", "file_object", ".", "read", "(", ")", ",", "prefer", "=", "prefer", ")" ]
An abstract method that loads from a given file object. :param class config: The config class to load into :param file file_object: The file object to load from :param str prefer: The preferred serialization module name :returns: A dictionary converted from the content of the given file...
[ "An", "abstract", "method", "that", "loads", "from", "a", "given", "file", "object", "." ]
python
train
43.818182
timofurrer/colorful
examples/colors.py
https://github.com/timofurrer/colorful/blob/919fa6da17865cc5e01e6b16119193a97d180dc9/examples/colors.py#L18-L47
def show(): """ Show the modifiers and colors """ # modifiers sys.stdout.write(colorful.bold('bold') + ' ') sys.stdout.write(colorful.dimmed('dimmed') + ' ') sys.stdout.write(colorful.italic('italic') + ' ') sys.stdout.write(colorful.underlined('underlined') + ' ') sys.stdout.write(c...
[ "def", "show", "(", ")", ":", "# modifiers", "sys", ".", "stdout", ".", "write", "(", "colorful", ".", "bold", "(", "'bold'", ")", "+", "' '", ")", "sys", ".", "stdout", ".", "write", "(", "colorful", ".", "dimmed", "(", "'dimmed'", ")", "+", "' '"...
Show the modifiers and colors
[ "Show", "the", "modifiers", "and", "colors" ]
python
valid
41.733333
pyviz/holoviews
holoviews/plotting/widgets/__init__.py
https://github.com/pyviz/holoviews/blob/ae0dd2f3de448b0ca5e9065aabd6ef8d84c7e655/holoviews/plotting/widgets/__init__.py#L233-L244
def save_json(self, frames): """ Saves frames data into a json file at the specified json_path, named with the widget uuid. """ if self.json_save_path is None: return path = os.path.join(self.json_save_path, '%s.json' % self.id) if not os.path.isdir(self.json_save...
[ "def", "save_json", "(", "self", ",", "frames", ")", ":", "if", "self", ".", "json_save_path", "is", "None", ":", "return", "path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "json_save_path", ",", "'%s.json'", "%", "self", ".", "id", ")"...
Saves frames data into a json file at the specified json_path, named with the widget uuid.
[ "Saves", "frames", "data", "into", "a", "json", "file", "at", "the", "specified", "json_path", "named", "with", "the", "widget", "uuid", "." ]
python
train
38.166667
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
40.181818
denisenkom/pytds
src/pytds/__init__.py
https://github.com/denisenkom/pytds/blob/7d875cab29134afdef719406831c1c6a0d7af48a/src/pytds/__init__.py#L104-L118
def namedtuple_row_strategy(column_names): """ Namedtuple row strategy, rows returned as named tuples Column names that are not valid Python identifiers will be replaced with col<number>_ """ import collections # replace empty column names with placeholders column_names = [name if is_valid_...
[ "def", "namedtuple_row_strategy", "(", "column_names", ")", ":", "import", "collections", "# replace empty column names with placeholders", "column_names", "=", "[", "name", "if", "is_valid_identifier", "(", "name", ")", "else", "'col%s_'", "%", "idx", "for", "idx", "...
Namedtuple row strategy, rows returned as named tuples Column names that are not valid Python identifiers will be replaced with col<number>_
[ "Namedtuple", "row", "strategy", "rows", "returned", "as", "named", "tuples" ]
python
train
35.066667
genialis/resolwe
resolwe/process/fields.py
https://github.com/genialis/resolwe/blob/f7bb54932c81ec0cfc5b5e80d238fceaeaa48d86/resolwe/process/fields.py#L141-L146
def validate(self, value): """Validate field value.""" if value is not None and not isinstance(value, bool): raise ValidationError("field must be a boolean") super().validate(value)
[ "def", "validate", "(", "self", ",", "value", ")", ":", "if", "value", "is", "not", "None", "and", "not", "isinstance", "(", "value", ",", "bool", ")", ":", "raise", "ValidationError", "(", "\"field must be a boolean\"", ")", "super", "(", ")", ".", "val...
Validate field value.
[ "Validate", "field", "value", "." ]
python
train
35.5
fabioz/PyDev.Debugger
pydevd.py
https://github.com/fabioz/PyDev.Debugger/blob/ed9c4307662a5593b8a7f1f3389ecd0e79b8c503/pydevd.py#L586-L610
def get_file_type(self, abs_real_path_and_basename, _cache_file_type=_CACHE_FILE_TYPE): ''' :param abs_real_path_and_basename: The result from get_abs_path_real_path_and_base_from_file or get_abs_path_real_path_and_base_from_frame. :return _pydevd_bundle.pyde...
[ "def", "get_file_type", "(", "self", ",", "abs_real_path_and_basename", ",", "_cache_file_type", "=", "_CACHE_FILE_TYPE", ")", ":", "try", ":", "return", "_cache_file_type", "[", "abs_real_path_and_basename", "[", "0", "]", "]", "except", ":", "file_type", "=", "s...
:param abs_real_path_and_basename: The result from get_abs_path_real_path_and_base_from_file or get_abs_path_real_path_and_base_from_frame. :return _pydevd_bundle.pydevd_dont_trace_files.PYDEV_FILE: If it's a file internal to the debugger which shouldn't be ...
[ ":", "param", "abs_real_path_and_basename", ":", "The", "result", "from", "get_abs_path_real_path_and_base_from_file", "or", "get_abs_path_real_path_and_base_from_frame", "." ]
python
train
44.24
bitesofcode/projexui
projexui/widgets/xtreewidget/xtreewidgetitem.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xtreewidget/xtreewidgetitem.py#L98-L103
def _updateFrame(self): """ Updates the frame for the given sender. """ for col, mov in self._movies.items(): self.setIcon(col, QtGui.QIcon(mov.currentPixmap()))
[ "def", "_updateFrame", "(", "self", ")", ":", "for", "col", ",", "mov", "in", "self", ".", "_movies", ".", "items", "(", ")", ":", "self", ".", "setIcon", "(", "col", ",", "QtGui", ".", "QIcon", "(", "mov", ".", "currentPixmap", "(", ")", ")", ")...
Updates the frame for the given sender.
[ "Updates", "the", "frame", "for", "the", "given", "sender", "." ]
python
train
34.166667
manahl/arctic
arctic/tickstore/tickstore.py
https://github.com/manahl/arctic/blob/57e110b6e182dbab00e7e214dc26f7d9ec47c120/arctic/tickstore/tickstore.py#L774-L787
def max_date(self, symbol): """ Return the maximum datetime stored for a particular symbol Parameters ---------- symbol : `str` symbol name for the item """ res = self._collection.find_one({SYMBOL: symbol}, projection={ID: 0, END: 1}, ...
[ "def", "max_date", "(", "self", ",", "symbol", ")", ":", "res", "=", "self", ".", "_collection", ".", "find_one", "(", "{", "SYMBOL", ":", "symbol", "}", ",", "projection", "=", "{", "ID", ":", "0", ",", "END", ":", "1", "}", ",", "sort", "=", ...
Return the maximum datetime stored for a particular symbol Parameters ---------- symbol : `str` symbol name for the item
[ "Return", "the", "maximum", "datetime", "stored", "for", "a", "particular", "symbol" ]
python
train
36.571429
soravux/scoop
scoop/discovery/minusconf.py
https://github.com/soravux/scoop/blob/d391dfa62f47e49d48328ee9cf08aa114256fd33/scoop/discovery/minusconf.py#L243-L248
def start_blocking(self): """ Start the advertiser in the background, but wait until it is ready """ self._cav_started.clear() self.start() self._cav_started.wait()
[ "def", "start_blocking", "(", "self", ")", ":", "self", ".", "_cav_started", ".", "clear", "(", ")", "self", ".", "start", "(", ")", "self", ".", "_cav_started", ".", "wait", "(", ")" ]
Start the advertiser in the background, but wait until it is ready
[ "Start", "the", "advertiser", "in", "the", "background", "but", "wait", "until", "it", "is", "ready" ]
python
train
32
christophertbrown/bioscripts
ctbBio/genome_abundance.py
https://github.com/christophertbrown/bioscripts/blob/83b2566b3a5745437ec651cd6cafddd056846240/ctbBio/genome_abundance.py#L116-L146
def genome_coverage(genomes, scaffold_coverage, total_bases): """ coverage = (number of bases / length of genome) * 100 """ coverage = {} custom = {} std = {} for genome in genomes: for sequence in parse_fasta(genome): scaffold = sequence[0].split('>')[1].split()[0] coverage, std = sum_coverage(coverage,...
[ "def", "genome_coverage", "(", "genomes", ",", "scaffold_coverage", ",", "total_bases", ")", ":", "coverage", "=", "{", "}", "custom", "=", "{", "}", "std", "=", "{", "}", "for", "genome", "in", "genomes", ":", "for", "sequence", "in", "parse_fasta", "("...
coverage = (number of bases / length of genome) * 100
[ "coverage", "=", "(", "number", "of", "bases", "/", "length", "of", "genome", ")", "*", "100" ]
python
train
35.16129
softlayer/softlayer-python
SoftLayer/managers/hardware.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/managers/hardware.py#L204-L265
def get_hardware(self, hardware_id, **kwargs): """Get details about a hardware device. :param integer id: the hardware ID :returns: A dictionary containing a large amount of information about the specified server. Example:: object_mask = "mask[id,networkV...
[ "def", "get_hardware", "(", "self", ",", "hardware_id", ",", "*", "*", "kwargs", ")", ":", "if", "'mask'", "not", "in", "kwargs", ":", "kwargs", "[", "'mask'", "]", "=", "(", "'id,'", "'globalIdentifier,'", "'fullyQualifiedDomainName,'", "'hostname,'", "'domai...
Get details about a hardware device. :param integer id: the hardware ID :returns: A dictionary containing a large amount of information about the specified server. Example:: object_mask = "mask[id,networkVlans[vlanNumber]]" # Object masks are optional...
[ "Get", "details", "about", "a", "hardware", "device", "." ]
python
train
43.096774
jxtech/wechatpy
wechatpy/client/api/card.py
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/card.py#L514-L534
def get_redirect_url(self, url, encrypt_code, card_id): """ 获取卡券跳转外链 """ from wechatpy.utils import WeChatSigner code = self.decrypt_code(encrypt_code) signer = WeChatSigner() signer.add_data(self.secret) signer.add_data(code) signer.add_data(car...
[ "def", "get_redirect_url", "(", "self", ",", "url", ",", "encrypt_code", ",", "card_id", ")", ":", "from", "wechatpy", ".", "utils", "import", "WeChatSigner", "code", "=", "self", ".", "decrypt_code", "(", "encrypt_code", ")", "signer", "=", "WeChatSigner", ...
获取卡券跳转外链
[ "获取卡券跳转外链" ]
python
train
27.190476
Qiskit/qiskit-terra
qiskit/tools/qcvv/tomography.py
https://github.com/Qiskit/qiskit-terra/blob/d4f58d903bc96341b816f7c35df936d6421267d1/qiskit/tools/qcvv/tomography.py#L441-L487
def process_tomography_set(meas_qubits, meas_basis='Pauli', prep_qubits=None, prep_basis='SIC'): """ Generate a dictionary of process tomography experiment configurations. This returns a data structure that is used by other tomography functions to generate state and process t...
[ "def", "process_tomography_set", "(", "meas_qubits", ",", "meas_basis", "=", "'Pauli'", ",", "prep_qubits", "=", "None", ",", "prep_basis", "=", "'SIC'", ")", ":", "return", "tomography_set", "(", "meas_qubits", ",", "meas_basis", "=", "meas_basis", ",", "prep_q...
Generate a dictionary of process tomography experiment configurations. This returns a data structure that is used by other tomography functions to generate state and process tomography circuits, and extract tomography data from results after execution on a backend. A quantum process tomography set is c...
[ "Generate", "a", "dictionary", "of", "process", "tomography", "experiment", "configurations", "." ]
python
test
48.617021
fjwCode/cerium
cerium/service.py
https://github.com/fjwCode/cerium/blob/f6e06e0dcf83a0bc924828e9d6cb81383ed2364f/cerium/service.py#L85-L90
def connect(self, host: str = '192.168.0.3', port: Union[int, str] = 5555) -> None: '''Connect to a device via TCP/IP directly.''' self.device_sn = f'{host}:{port}' if not is_connectable(host, port): raise ConnectionError(f'Cannot connect to {self.device_sn}.') self._execute(...
[ "def", "connect", "(", "self", ",", "host", ":", "str", "=", "'192.168.0.3'", ",", "port", ":", "Union", "[", "int", ",", "str", "]", "=", "5555", ")", "->", "None", ":", "self", ".", "device_sn", "=", "f'{host}:{port}'", "if", "not", "is_connectable",...
Connect to a device via TCP/IP directly.
[ "Connect", "to", "a", "device", "via", "TCP", "/", "IP", "directly", "." ]
python
train
56.833333
nirum/descent
descent/proxops.py
https://github.com/nirum/descent/blob/074c8452f15a0da638668a4fe139fde06ccfae7f/descent/proxops.py#L236-L247
def simplex(x, rho): """ Projection onto the probability simplex http://arxiv.org/pdf/1309.1541v1.pdf """ # sort the elements in descending order u = np.flipud(np.sort(x.ravel())) lambdas = (1 - np.cumsum(u)) / (1. + np.arange(u.size)) ix = np.where(u + lambdas > 0)[0].max() return...
[ "def", "simplex", "(", "x", ",", "rho", ")", ":", "# sort the elements in descending order", "u", "=", "np", ".", "flipud", "(", "np", ".", "sort", "(", "x", ".", "ravel", "(", ")", ")", ")", "lambdas", "=", "(", "1", "-", "np", ".", "cumsum", "(",...
Projection onto the probability simplex http://arxiv.org/pdf/1309.1541v1.pdf
[ "Projection", "onto", "the", "probability", "simplex" ]
python
valid
28.333333
AdvancedClimateSystems/uModbus
umodbus/client/serial/rtu.py
https://github.com/AdvancedClimateSystems/uModbus/blob/0560a42308003f4072d988f28042b8d55b694ad4/umodbus/client/serial/rtu.py#L70-L80
def read_coils(slave_id, starting_address, quantity): """ Return ADU for Modbus function code 01: Read Coils. :param slave_id: Number of slave. :return: Byte array with ADU. """ function = ReadCoils() function.starting_address = starting_address function.quantity = quantity return _cre...
[ "def", "read_coils", "(", "slave_id", ",", "starting_address", ",", "quantity", ")", ":", "function", "=", "ReadCoils", "(", ")", "function", ".", "starting_address", "=", "starting_address", "function", ".", "quantity", "=", "quantity", "return", "_create_request...
Return ADU for Modbus function code 01: Read Coils. :param slave_id: Number of slave. :return: Byte array with ADU.
[ "Return", "ADU", "for", "Modbus", "function", "code", "01", ":", "Read", "Coils", "." ]
python
train
32.454545
Yelp/kafka-utils
kafka_utils/kafka_corruption_check/main.py
https://github.com/Yelp/kafka-utils/blob/cdb4d64308f3079ee0873250bf7b34d0d94eca50/kafka_utils/kafka_corruption_check/main.py#L275-L296
def parse_output(host, output): """Parse the output of the dump tool and print warnings or error messages accordingly. :param host: the source :type host: str :param output: the output of the script on host :type output: list of str """ current_file = None for line in output.readlin...
[ "def", "parse_output", "(", "host", ",", "output", ")", ":", "current_file", "=", "None", "for", "line", "in", "output", ".", "readlines", "(", ")", ":", "file_name_search", "=", "FILE_PATH_REGEX", ".", "search", "(", "line", ")", "if", "file_name_search", ...
Parse the output of the dump tool and print warnings or error messages accordingly. :param host: the source :type host: str :param output: the output of the script on host :type output: list of str
[ "Parse", "the", "output", "of", "the", "dump", "tool", "and", "print", "warnings", "or", "error", "messages", "accordingly", "." ]
python
train
36.818182
projecthamster/hamster
src/hamster/lib/graphics.py
https://github.com/projecthamster/hamster/blob/ca5254eff53172796ddafc72226c394ed1858245/src/hamster/lib/graphics.py#L1046-L1051
def send_to_back(self): """adjusts sprite's z-order so that the sprite is behind it's siblings""" if not self.parent: return self.z_order = self.parent._z_ordered_sprites[0].z_order - 1
[ "def", "send_to_back", "(", "self", ")", ":", "if", "not", "self", ".", "parent", ":", "return", "self", ".", "z_order", "=", "self", ".", "parent", ".", "_z_ordered_sprites", "[", "0", "]", ".", "z_order", "-", "1" ]
adjusts sprite's z-order so that the sprite is behind it's siblings
[ "adjusts", "sprite", "s", "z", "-", "order", "so", "that", "the", "sprite", "is", "behind", "it", "s", "siblings" ]
python
train
37.333333
Alignak-monitoring/alignak
alignak/objects/hostextinfo.py
https://github.com/Alignak-monitoring/alignak/blob/f3c145207e83159b799d3714e4241399c7740a64/alignak/objects/hostextinfo.py#L136-L151
def merge_extinfo(host, extinfo): """Merge extended host information into a host :param host: the host to edit :type host: alignak.objects.host.Host :param extinfo: the external info we get data from :type extinfo: alignak.objects.hostextinfo.HostExtInfo :return: None ...
[ "def", "merge_extinfo", "(", "host", ",", "extinfo", ")", ":", "# Note that 2d_coords and 3d_coords are never merged, so not usable !", "properties", "=", "[", "'notes'", ",", "'notes_url'", ",", "'icon_image'", ",", "'icon_image_alt'", ",", "'vrml_image'", ",", "'statusm...
Merge extended host information into a host :param host: the host to edit :type host: alignak.objects.host.Host :param extinfo: the external info we get data from :type extinfo: alignak.objects.hostextinfo.HostExtInfo :return: None
[ "Merge", "extended", "host", "information", "into", "a", "host" ]
python
train
47.5
mushkevych/scheduler
synergy/system/system_logger.py
https://github.com/mushkevych/scheduler/blob/6740331360f49083c208085fb5a60ce80ebf418b/synergy/system/system_logger.py#L97-L107
def get_log_tag(process_name): """method returns tag that all messages will be preceded with""" process_obj = context.process_context[process_name] if isinstance(process_obj, FreerunProcessEntry): return str(process_obj.token) elif isinstance(process_obj, ManagedProcessEntry): return str...
[ "def", "get_log_tag", "(", "process_name", ")", ":", "process_obj", "=", "context", ".", "process_context", "[", "process_name", "]", "if", "isinstance", "(", "process_obj", ",", "FreerunProcessEntry", ")", ":", "return", "str", "(", "process_obj", ".", "token",...
method returns tag that all messages will be preceded with
[ "method", "returns", "tag", "that", "all", "messages", "will", "be", "preceded", "with" ]
python
train
50.727273
Mindwerks/worldengine
worldengine/draw.py
https://github.com/Mindwerks/worldengine/blob/64dff8eb7824ce46b5b6cb8006bcef21822ef144/worldengine/draw.py#L234-L256
def get_normalized_elevation_array(world): ''' Convert raw elevation into normalized values between 0 and 255, and return a numpy array of these values ''' e = world.layers['elevation'].data ocean = world.layers['ocean'].data mask = numpy.ma.array(e, mask=ocean) # only land min_elev_land ...
[ "def", "get_normalized_elevation_array", "(", "world", ")", ":", "e", "=", "world", ".", "layers", "[", "'elevation'", "]", ".", "data", "ocean", "=", "world", ".", "layers", "[", "'ocean'", "]", ".", "data", "mask", "=", "numpy", ".", "ma", ".", "arra...
Convert raw elevation into normalized values between 0 and 255, and return a numpy array of these values
[ "Convert", "raw", "elevation", "into", "normalized", "values", "between", "0", "and", "255", "and", "return", "a", "numpy", "array", "of", "these", "values" ]
python
train
37.869565
tensorflow/lucid
lucid/modelzoo/util.py
https://github.com/tensorflow/lucid/blob/d1a1e2e4fd4be61b89b8cba20dc425a5ae34576e/lucid/modelzoo/util.py#L39-L47
def load_graphdef(model_url, reset_device=True): """Load GraphDef from a binary proto file.""" graph_def = load(model_url) if reset_device: for n in graph_def.node: n.device = "" return graph_def
[ "def", "load_graphdef", "(", "model_url", ",", "reset_device", "=", "True", ")", ":", "graph_def", "=", "load", "(", "model_url", ")", "if", "reset_device", ":", "for", "n", "in", "graph_def", ".", "node", ":", "n", ".", "device", "=", "\"\"", "return", ...
Load GraphDef from a binary proto file.
[ "Load", "GraphDef", "from", "a", "binary", "proto", "file", "." ]
python
train
23
obulpathi/cdn-fastly-python
fastly/__init__.py
https://github.com/obulpathi/cdn-fastly-python/blob/db2564b047e8af4bce72c3b88d6c27d3d0291425/fastly/__init__.py#L480-L483
def get_header(self, service_id, version_number, name): """Retrieves a Header object by name.""" content = self._fetch("/service/%s/version/%d/header/%s" % (service_id, version_number, name)) return FastlyHeader(self, content)
[ "def", "get_header", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/header/%s\"", "%", "(", "service_id", ",", "version_number", ",", "name", ")", ")", "return...
Retrieves a Header object by name.
[ "Retrieves", "a", "Header", "object", "by", "name", "." ]
python
train
57.25
OpenTreeOfLife/peyotl
peyotl/nexson_syntax/__init__.py
https://github.com/OpenTreeOfLife/peyotl/blob/5e4e52a0fdbd17f490aa644ad79fda6ea2eda7c0/peyotl/nexson_syntax/__init__.py#L868-L885
def _write_newick_internal_label(out, node_id, node, otu_group, label_key, needs_quotes_pattern): """`label_key` is a string (a key in the otu object) or a callable that takes two arguments: the node, and the otu (which may be None for an internal node) If `leaf_labels` is not None, it shoulr be a (list...
[ "def", "_write_newick_internal_label", "(", "out", ",", "node_id", ",", "node", ",", "otu_group", ",", "label_key", ",", "needs_quotes_pattern", ")", ":", "otu_id", "=", "node", ".", "get", "(", "'@otu'", ")", "if", "is_str_type", "(", "label_key", ")", ":",...
`label_key` is a string (a key in the otu object) or a callable that takes two arguments: the node, and the otu (which may be None for an internal node) If `leaf_labels` is not None, it shoulr be a (list, dict) pair which will be filled. The list will hold the order encountered, and the dict...
[ "label_key", "is", "a", "string", "(", "a", "key", "in", "the", "otu", "object", ")", "or", "a", "callable", "that", "takes", "two", "arguments", ":", "the", "node", "and", "the", "otu", "(", "which", "may", "be", "None", "for", "an", "internal", "no...
python
train
44.222222
timkpaine/pyEX
pyEX/stocks.py
https://github.com/timkpaine/pyEX/blob/91cf751dafdb208a0c8b5377945e5808b99f94ba/pyEX/stocks.py#L1280-L1300
def ohlcDF(symbol, token='', version=''): '''Returns the official open and close for a give symbol. https://iexcloud.io/docs/api/#news 9:30am-5pm ET Mon-Fri Args: symbol (string); Ticker to request token (string); Access token version (string); API version Returns: ...
[ "def", "ohlcDF", "(", "symbol", ",", "token", "=", "''", ",", "version", "=", "''", ")", ":", "o", "=", "ohlc", "(", "symbol", ",", "token", ",", "version", ")", "if", "o", ":", "df", "=", "pd", ".", "io", ".", "json", ".", "json_normalize", "(...
Returns the official open and close for a give symbol. https://iexcloud.io/docs/api/#news 9:30am-5pm ET Mon-Fri Args: symbol (string); Ticker to request token (string); Access token version (string); API version Returns: DataFrame: result
[ "Returns", "the", "official", "open", "and", "close", "for", "a", "give", "symbol", "." ]
python
valid
23.380952
Becksteinlab/GromacsWrapper
gromacs/setup.py
https://github.com/Becksteinlab/GromacsWrapper/blob/d4f9a8cb6f48292732cf7c7e4ef4a6d2ccbc51b9/gromacs/setup.py#L638-L759
def energy_minimize(dirname='em', mdp=config.templates['em.mdp'], struct='solvate/ionized.gro', top='top/system.top', output='em.pdb', deffnm="em", mdrunner=None, mdrun_args=None, **kwargs): """Energy minimize the system. This sets...
[ "def", "energy_minimize", "(", "dirname", "=", "'em'", ",", "mdp", "=", "config", ".", "templates", "[", "'em.mdp'", "]", ",", "struct", "=", "'solvate/ionized.gro'", ",", "top", "=", "'top/system.top'", ",", "output", "=", "'em.pdb'", ",", "deffnm", "=", ...
Energy minimize the system. This sets up the system (creates run input files) and also runs ``mdrun_d``. Thus it can take a while. Additional itp files should be in the same directory as the top file. Many of the keyword arguments below already have sensible values. :Keywords: *dirname* ...
[ "Energy", "minimize", "the", "system", "." ]
python
valid
40.819672
flo-compbio/genometools
genometools/ensembl/filter_fasta.py
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/filter_fasta.py#L87-L139
def main(args=None): """Script body.""" if args is None: # parse command-line arguments parser = get_argument_parser() args = parser.parse_args() fasta_file = args.fasta_file species = args.species chrom_pat = args.chromosome_pattern output_file = args.output_file ...
[ "def", "main", "(", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "# parse command-line arguments ", "parser", "=", "get_argument_parser", "(", ")", "args", "=", "parser", ".", "parse_args", "(", ")", "fasta_file", "=", "args", ".", "fast...
Script body.
[ "Script", "body", "." ]
python
train
29.716981
cocaine/cocaine-tools
cocaine/tools/dispatch.py
https://github.com/cocaine/cocaine-tools/blob/d8834f8e04ca42817d5f4e368d471484d4b3419f/cocaine/tools/dispatch.py#L1721-L1729
def auth_view(name, **kwargs): """ Shows an authorization group's content. """ ctx = Context(**kwargs) ctx.execute_action('auth:group:view', **{ 'storage': ctx.repo.create_secure_service('storage'), 'name': name, })
[ "def", "auth_view", "(", "name", ",", "*", "*", "kwargs", ")", ":", "ctx", "=", "Context", "(", "*", "*", "kwargs", ")", "ctx", ".", "execute_action", "(", "'auth:group:view'", ",", "*", "*", "{", "'storage'", ":", "ctx", ".", "repo", ".", "create_se...
Shows an authorization group's content.
[ "Shows", "an", "authorization", "group", "s", "content", "." ]
python
train
27.444444
databio/pypiper
pypiper/ngstk.py
https://github.com/databio/pypiper/blob/00e6c2b94033c4187d47ff14c5580bbfc2ff097f/pypiper/ngstk.py#L276-L381
def merge_or_link(self, input_args, raw_folder, local_base="sample"): """ This function standardizes various input possibilities by converting either .bam, .fastq, or .fastq.gz files into a local file; merging those if multiple files given. :param list input_args: This is a list...
[ "def", "merge_or_link", "(", "self", ",", "input_args", ",", "raw_folder", ",", "local_base", "=", "\"sample\"", ")", ":", "self", ".", "make_sure_path_exists", "(", "raw_folder", ")", "if", "not", "isinstance", "(", "input_args", ",", "list", ")", ":", "rai...
This function standardizes various input possibilities by converting either .bam, .fastq, or .fastq.gz files into a local file; merging those if multiple files given. :param list input_args: This is a list of arguments, each one is a class of inputs (which can in turn be a string or...
[ "This", "function", "standardizes", "various", "input", "possibilities", "by", "converting", "either", ".", "bam", ".", "fastq", "or", ".", "fastq", ".", "gz", "files", "into", "a", "local", "file", ";", "merging", "those", "if", "multiple", "files", "given"...
python
train
48.226415
NLeSC/noodles
noodles/patterns/find_first.py
https://github.com/NLeSC/noodles/blob/3759e24e6e54a3a1a364431309dbb1061f617c04/noodles/patterns/find_first.py#L24-L37
def s_find_first(pred, first, lst): """Evaluate `first`; if predicate `pred` succeeds on the result of `first`, return the result; otherwise recur on the first element of `lst`. :param pred: a predicate. :param first: a promise. :param lst: a list of quoted promises. :return: the first element ...
[ "def", "s_find_first", "(", "pred", ",", "first", ",", "lst", ")", ":", "if", "pred", "(", "first", ")", ":", "return", "first", "elif", "lst", ":", "return", "s_find_first", "(", "pred", ",", "unquote", "(", "lst", "[", "0", "]", ")", ",", "lst", ...
Evaluate `first`; if predicate `pred` succeeds on the result of `first`, return the result; otherwise recur on the first element of `lst`. :param pred: a predicate. :param first: a promise. :param lst: a list of quoted promises. :return: the first element for which predicate is true.
[ "Evaluate", "first", ";", "if", "predicate", "pred", "succeeds", "on", "the", "result", "of", "first", "return", "the", "result", ";", "otherwise", "recur", "on", "the", "first", "element", "of", "lst", "." ]
python
train
34.5
sdispater/eloquent
eloquent/schema/blueprint.py
https://github.com/sdispater/eloquent/blob/0638b688d5fd0c1a46b7471dd465eeb4c2f84666/eloquent/schema/blueprint.py#L393-L408
def medium_integer(self, column, auto_increment=False, unsigned=False): """ Create a new medium integer column on the table. :param column: The column :type column: str :type auto_increment: bool :type unsigned: bool :rtype: Fluent """ return s...
[ "def", "medium_integer", "(", "self", ",", "column", ",", "auto_increment", "=", "False", ",", "unsigned", "=", "False", ")", ":", "return", "self", ".", "_add_column", "(", "'medium_integer'", ",", "column", ",", "auto_increment", "=", "auto_increment", ",", ...
Create a new medium integer column on the table. :param column: The column :type column: str :type auto_increment: bool :type unsigned: bool :rtype: Fluent
[ "Create", "a", "new", "medium", "integer", "column", "on", "the", "table", "." ]
python
train
28.75
thiagopbueno/rddl2tf
rddl2tf/fluent.py
https://github.com/thiagopbueno/rddl2tf/blob/f7c03d3a74d2663807c1e23e04eeed2e85166b71/rddl2tf/fluent.py#L109-L135
def Uniform(cls, low: 'TensorFluent', high: 'TensorFluent', batch_size: Optional[int] = None) -> Tuple[Distribution, 'TensorFluent']: '''Returns a TensorFluent for the Uniform sampling op with given low and high parameters. Args: low: The low parameter of the Uniform...
[ "def", "Uniform", "(", "cls", ",", "low", ":", "'TensorFluent'", ",", "high", ":", "'TensorFluent'", ",", "batch_size", ":", "Optional", "[", "int", "]", "=", "None", ")", "->", "Tuple", "[", "Distribution", ",", "'TensorFluent'", "]", ":", "if", "low", ...
Returns a TensorFluent for the Uniform sampling op with given low and high parameters. Args: low: The low parameter of the Uniform distribution. high: The high parameter of the Uniform distribution. batch_size: The size of the batch (optional). Returns: ...
[ "Returns", "a", "TensorFluent", "for", "the", "Uniform", "sampling", "op", "with", "given", "low", "and", "high", "parameters", "." ]
python
train
41.407407
dbcli/athenacli
athenacli/config.py
https://github.com/dbcli/athenacli/blob/bcab59e4953145866430083e902ed4d042d4ebba/athenacli/config.py#L42-L48
def log(logger, level, message): """Logs message to stderr if logging isn't initialized.""" if logger.parent.name != 'root': logger.log(level, message) else: print(message, file=sys.stderr)
[ "def", "log", "(", "logger", ",", "level", ",", "message", ")", ":", "if", "logger", ".", "parent", ".", "name", "!=", "'root'", ":", "logger", ".", "log", "(", "level", ",", "message", ")", "else", ":", "print", "(", "message", ",", "file", "=", ...
Logs message to stderr if logging isn't initialized.
[ "Logs", "message", "to", "stderr", "if", "logging", "isn", "t", "initialized", "." ]
python
train
30.285714
MAVENSDC/cdflib
cdflib/cdfwrite.py
https://github.com/MAVENSDC/cdflib/blob/d237c60e5db67db0f92d96054209c25c4042465c/cdflib/cdfwrite.py#L1216-L1284
def _add_vxr_levels_r(self, f, vxrhead, numVXRs): ''' Build a new level of VXRs... make VXRs more tree-like From: VXR1 -> VXR2 -> VXR3 -> VXR4 -> ... -> VXRn To: new VXR1 / | \ VXR2 VXR3 VXR4 ...
[ "def", "_add_vxr_levels_r", "(", "self", ",", "f", ",", "vxrhead", ",", "numVXRs", ")", ":", "newNumVXRs", "=", "int", "(", "numVXRs", "/", "CDF", ".", "NUM_VXRlvl_ENTRIES", ")", "remaining", "=", "int", "(", "numVXRs", "%", "CDF", ".", "NUM_VXRlvl_ENTRIES...
Build a new level of VXRs... make VXRs more tree-like From: VXR1 -> VXR2 -> VXR3 -> VXR4 -> ... -> VXRn To: new VXR1 / | \ VXR2 VXR3 VXR4 / | \ ... ...
[ "Build", "a", "new", "level", "of", "VXRs", "...", "make", "VXRs", "more", "tree", "-", "like" ]
python
train
34.014493
pygobject/pgi
pgi/clib/_utils.py
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/clib/_utils.py#L23-L27
def track(cls, obj, ptr): """ Track an object which needs destruction when it is garbage collected. """ cls._objects.add(cls(obj, ptr))
[ "def", "track", "(", "cls", ",", "obj", ",", "ptr", ")", ":", "cls", ".", "_objects", ".", "add", "(", "cls", "(", "obj", ",", "ptr", ")", ")" ]
Track an object which needs destruction when it is garbage collected.
[ "Track", "an", "object", "which", "needs", "destruction", "when", "it", "is", "garbage", "collected", "." ]
python
train
32.6
softlayer/softlayer-python
SoftLayer/CLI/metadata.py
https://github.com/softlayer/softlayer-python/blob/9f181be08cc3668353b05a6de0cb324f52cff6fa/SoftLayer/CLI/metadata.py#L50-L64
def cli(env, prop): """Find details about this machine.""" try: if prop == 'network': env.fout(get_network()) return meta_prop = META_MAPPING.get(prop) or prop env.fout(SoftLayer.MetadataManager().get(meta_prop)) except SoftLayer.TransportError: rais...
[ "def", "cli", "(", "env", ",", "prop", ")", ":", "try", ":", "if", "prop", "==", "'network'", ":", "env", ".", "fout", "(", "get_network", "(", ")", ")", "return", "meta_prop", "=", "META_MAPPING", ".", "get", "(", "prop", ")", "or", "prop", "env",...
Find details about this machine.
[ "Find", "details", "about", "this", "machine", "." ]
python
train
32.933333
urschrei/pyzotero
pyzotero/zotero.py
https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L582-L586
def last_modified_version(self, **kwargs): """ Get the last modified version """ self.items(**kwargs) return int(self.request.headers.get("last-modified-version", 0))
[ "def", "last_modified_version", "(", "self", ",", "*", "*", "kwargs", ")", ":", "self", ".", "items", "(", "*", "*", "kwargs", ")", "return", "int", "(", "self", ".", "request", ".", "headers", ".", "get", "(", "\"last-modified-version\"", ",", "0", ")...
Get the last modified version
[ "Get", "the", "last", "modified", "version" ]
python
valid
38.8
NORDUnet/python-norduniclient
norduniclient/core.py
https://github.com/NORDUnet/python-norduniclient/blob/ee5084a6f45caac614b4fda4a023749ca52f786c/norduniclient/core.py#L640-L652
def create_physical_relationship(manager, physical_handle_id, other_handle_id, rel_type): """ Makes relationship between the two nodes and returns the relationship. If a relationship is not possible NoRelationshipPossible exception is raised. """ other_meta_type = get_node_meta_type(manager, oth...
[ "def", "create_physical_relationship", "(", "manager", ",", "physical_handle_id", ",", "other_handle_id", ",", "rel_type", ")", ":", "other_meta_type", "=", "get_node_meta_type", "(", "manager", ",", "other_handle_id", ")", "if", "other_meta_type", "==", "'Physical'", ...
Makes relationship between the two nodes and returns the relationship. If a relationship is not possible NoRelationshipPossible exception is raised.
[ "Makes", "relationship", "between", "the", "two", "nodes", "and", "returns", "the", "relationship", ".", "If", "a", "relationship", "is", "not", "possible", "NoRelationshipPossible", "exception", "is", "raised", "." ]
python
train
61.230769
cmbruns/pyopenvr
src/openvr/__init__.py
https://github.com/cmbruns/pyopenvr/blob/68395d26bb3df6ab1f0f059c38d441f962938be6/src/openvr/__init__.py#L3579-L3584
def getApplicationSupportedMimeTypes(self, pchAppKey, pchMimeTypesBuffer, unMimeTypesBuffer): """Get the list of supported mime types for this application, comma-delimited""" fn = self.function_table.getApplicationSupportedMimeTypes result = fn(pchAppKey, pchMimeTypesBuffer, unMimeTypesBuffer) ...
[ "def", "getApplicationSupportedMimeTypes", "(", "self", ",", "pchAppKey", ",", "pchMimeTypesBuffer", ",", "unMimeTypesBuffer", ")", ":", "fn", "=", "self", ".", "function_table", ".", "getApplicationSupportedMimeTypes", "result", "=", "fn", "(", "pchAppKey", ",", "p...
Get the list of supported mime types for this application, comma-delimited
[ "Get", "the", "list", "of", "supported", "mime", "types", "for", "this", "application", "comma", "-", "delimited" ]
python
train
56
pandas-dev/pandas
pandas/core/arrays/sparse.py
https://github.com/pandas-dev/pandas/blob/9feb3ad92cc0397a04b665803a49299ee7aa1037/pandas/core/arrays/sparse.py#L979-L1015
def value_counts(self, dropna=True): """ Returns a Series containing counts of unique values. Parameters ---------- dropna : boolean, default True Don't include counts of NaN, even if NaN is in sp_values. Returns ------- counts : Series ...
[ "def", "value_counts", "(", "self", ",", "dropna", "=", "True", ")", ":", "from", "pandas", "import", "Index", ",", "Series", "keys", ",", "counts", "=", "algos", ".", "_value_counts_arraylike", "(", "self", ".", "sp_values", ",", "dropna", "=", "dropna", ...
Returns a Series containing counts of unique values. Parameters ---------- dropna : boolean, default True Don't include counts of NaN, even if NaN is in sp_values. Returns ------- counts : Series
[ "Returns", "a", "Series", "containing", "counts", "of", "unique", "values", "." ]
python
train
30.756757
ehansis/ozelot
ozelot/etl/util.py
https://github.com/ehansis/ozelot/blob/948675e02eb6fca940450f5cb814f53e97159e5b/ozelot/etl/util.py#L12-L127
def render_diagram(root_task, out_base, max_param_len=20, horizontal=False, colored=False): """Render a diagram of the ETL pipeline All upstream tasks (i.e. requirements) of :attr:`root_task` are rendered. Nodes are, by default, styled as simple rects. This style is augmented by any :attr:`diagram_sty...
[ "def", "render_diagram", "(", "root_task", ",", "out_base", ",", "max_param_len", "=", "20", ",", "horizontal", "=", "False", ",", "colored", "=", "False", ")", ":", "import", "re", "import", "codecs", "import", "subprocess", "from", "ozelot", "import", "con...
Render a diagram of the ETL pipeline All upstream tasks (i.e. requirements) of :attr:`root_task` are rendered. Nodes are, by default, styled as simple rects. This style is augmented by any :attr:`diagram_style` attributes of the tasks. .. note:: This function requires the 'dot' executable from the Gr...
[ "Render", "a", "diagram", "of", "the", "ETL", "pipeline" ]
python
train
40.508621
LEMS/pylems
lems/sim/sim.py
https://github.com/LEMS/pylems/blob/4eeb719d2f23650fe16c38626663b69b5c83818b/lems/sim/sim.py#L86-L97
def run(self): """ Runs the simulation. """ self.init_run() if self.debug: self.dump("AfterInit: ") #print("++++++++++++++++ Time: %f"%self.current_time) while self.step(): #self.dump("Time: %f"%self.current_time) #print("++++++++++++++++ ...
[ "def", "run", "(", "self", ")", ":", "self", ".", "init_run", "(", ")", "if", "self", ".", "debug", ":", "self", ".", "dump", "(", "\"AfterInit: \"", ")", "#print(\"++++++++++++++++ Time: %f\"%self.current_time)", "while", "self", ".", "step", "(", ")", ":",...
Runs the simulation.
[ "Runs", "the", "simulation", "." ]
python
train
29.5
rsgalloway/grit
grit/server/handler.py
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/server/handler.py#L63-L68
def handle_items(repo, **kwargs): """:return: repo.files()""" log.info('items: %s %s' %(repo, kwargs)) if not hasattr(repo, 'items'): return [] return [i.serialize() for i in repo.items(**kwargs)]
[ "def", "handle_items", "(", "repo", ",", "*", "*", "kwargs", ")", ":", "log", ".", "info", "(", "'items: %s %s'", "%", "(", "repo", ",", "kwargs", ")", ")", "if", "not", "hasattr", "(", "repo", ",", "'items'", ")", ":", "return", "[", "]", "return"...
:return: repo.files()
[ ":", "return", ":", "repo", ".", "files", "()" ]
python
train
35.833333
tanghaibao/goatools
goatools/wr_tbl_class.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/wr_tbl_class.py#L100-L107
def _get_err_msg(row, col, fld, val, prt_flds): """Return an informative message with details of xlsx write attempt.""" import traceback traceback.print_exc() err_msg = ( "ROW({R}) COL({C}) FIELD({F}) VAL({V})\n".format(R=row, C=col, F=fld, V=val), "PRINT FIELDS({...
[ "def", "_get_err_msg", "(", "row", ",", "col", ",", "fld", ",", "val", ",", "prt_flds", ")", ":", "import", "traceback", "traceback", ".", "print_exc", "(", ")", "err_msg", "=", "(", "\"ROW({R}) COL({C}) FIELD({F}) VAL({V})\\n\"", ".", "format", "(", "R", "=...
Return an informative message with details of xlsx write attempt.
[ "Return", "an", "informative", "message", "with", "details", "of", "xlsx", "write", "attempt", "." ]
python
train
50.375
bpsmith/tia
tia/analysis/perf.py
https://github.com/bpsmith/tia/blob/a7043b6383e557aeea8fc7112bbffd6e36a230e9/tia/analysis/perf.py#L104-L115
def _resolve_periods_in_year(scale, frame): """ Convert the scale to an annualzation factor. If scale is None then attempt to resolve from frame. If scale is a scalar then use it. If scale is a string then use it to lookup the annual factor """ if scale is None: return periodicity(frame) ...
[ "def", "_resolve_periods_in_year", "(", "scale", ",", "frame", ")", ":", "if", "scale", "is", "None", ":", "return", "periodicity", "(", "frame", ")", "elif", "isinstance", "(", "scale", ",", "basestring", ")", ":", "return", "periodicity", "(", "scale", "...
Convert the scale to an annualzation factor. If scale is None then attempt to resolve from frame. If scale is a scalar then use it. If scale is a string then use it to lookup the annual factor
[ "Convert", "the", "scale", "to", "an", "annualzation", "factor", ".", "If", "scale", "is", "None", "then", "attempt", "to", "resolve", "from", "frame", ".", "If", "scale", "is", "a", "scalar", "then", "use", "it", ".", "If", "scale", "is", "a", "string...
python
train
44
pytroll/posttroll
posttroll/subscriber.py
https://github.com/pytroll/posttroll/blob/8e811a0544b5182c4a72aed074b2ff8c4324e94d/posttroll/subscriber.py#L399-L414
def handle_msg(self, msg): """handle the message *msg*. """ addr_ = msg.data["URI"] status = msg.data.get('status', True) if status: service = msg.data.get('service') for service in self.services: if not service or service in service: ...
[ "def", "handle_msg", "(", "self", ",", "msg", ")", ":", "addr_", "=", "msg", ".", "data", "[", "\"URI\"", "]", "status", "=", "msg", ".", "data", ".", "get", "(", "'status'", ",", "True", ")", "if", "status", ":", "service", "=", "msg", ".", "dat...
handle the message *msg*.
[ "handle", "the", "message", "*", "msg", "*", "." ]
python
train
37.75
maxfischer2781/chainlet
chainlet/concurrency/thread.py
https://github.com/maxfischer2781/chainlet/blob/4e17f9992b4780bd0d9309202e2847df640bffe8/chainlet/concurrency/thread.py#L97-L106
def _ensure_worker(self): """Ensure there are enough workers available""" while len(self._workers) < self._min_workers or len(self._workers) < self._queue.qsize() < self._max_workers: worker = threading.Thread( target=self._execute_futures, name=self.identifie...
[ "def", "_ensure_worker", "(", "self", ")", ":", "while", "len", "(", "self", ".", "_workers", ")", "<", "self", ".", "_min_workers", "or", "len", "(", "self", ".", "_workers", ")", "<", "self", ".", "_queue", ".", "qsize", "(", ")", "<", "self", "....
Ensure there are enough workers available
[ "Ensure", "there", "are", "enough", "workers", "available" ]
python
train
44.7
dourvaris/nano-python
src/nano/rpc.py
https://github.com/dourvaris/nano-python/blob/f26b8bc895b997067780f925049a70e82c0c2479/src/nano/rpc.py#L2143-L2165
def wallet_representative(self, wallet): """ Returns the default representative for **wallet** :param wallet: Wallet to get default representative account for :type wallet: str :raises: :py:exc:`nano.rpc.RPCException` >>> rpc.wallet_representative( ... wall...
[ "def", "wallet_representative", "(", "self", ",", "wallet", ")", ":", "wallet", "=", "self", ".", "_process_value", "(", "wallet", ",", "'wallet'", ")", "payload", "=", "{", "\"wallet\"", ":", "wallet", "}", "resp", "=", "self", ".", "call", "(", "'walle...
Returns the default representative for **wallet** :param wallet: Wallet to get default representative account for :type wallet: str :raises: :py:exc:`nano.rpc.RPCException` >>> rpc.wallet_representative( ... wallet="000D1BAEC8EC208142C99059B393051BAC8380F9B5A2E6B2489A277D8...
[ "Returns", "the", "default", "representative", "for", "**", "wallet", "**" ]
python
train
28.782609
chrisspen/dtree
dtree.py
https://github.com/chrisspen/dtree/blob/9e9c9992b22ad9a7e296af7e6837666b05db43ef/dtree.py#L1374-L1385
def set_missing_value_policy(self, policy, target_attr_name=None): """ Sets the behavior for one or all attributes to use when traversing the tree using a query vector and it encounters a branch that does not exist. """ assert policy in MISSING_VALUE_POLICIES, \ ...
[ "def", "set_missing_value_policy", "(", "self", ",", "policy", ",", "target_attr_name", "=", "None", ")", ":", "assert", "policy", "in", "MISSING_VALUE_POLICIES", ",", "\"Unknown policy: %s\"", "%", "(", "policy", ",", ")", "for", "attr_name", "in", "self", ".",...
Sets the behavior for one or all attributes to use when traversing the tree using a query vector and it encounters a branch that does not exist.
[ "Sets", "the", "behavior", "for", "one", "or", "all", "attributes", "to", "use", "when", "traversing", "the", "tree", "using", "a", "query", "vector", "and", "it", "encounters", "a", "branch", "that", "does", "not", "exist", "." ]
python
train
46.5
Brazelton-Lab/bio_utils
bio_utils/iterators/gff3.py
https://github.com/Brazelton-Lab/bio_utils/blob/5a7ddf13ee0bf4baaaeb6b2b99e01bf74aa132b7/bio_utils/iterators/gff3.py#L132-L155
def write(self): """Restore GFF3 entry to original format Returns: str: properly formatted string containing the GFF3 entry """ none_type = type(None) # Format attributes for writing attrs = self.attribute_string() # Place holder if field value is ...
[ "def", "write", "(", "self", ")", ":", "none_type", "=", "type", "(", "None", ")", "# Format attributes for writing", "attrs", "=", "self", ".", "attribute_string", "(", ")", "# Place holder if field value is NoneType", "for", "attr", "in", "self", ".", "__dict__"...
Restore GFF3 entry to original format Returns: str: properly formatted string containing the GFF3 entry
[ "Restore", "GFF3", "entry", "to", "original", "format" ]
python
train
31.208333