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
Esri/ArcREST
src/arcrest/manageorg/_portals.py
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1536-L1543
def portalAdmin(self): """gets a reference to a portal administration class""" from ..manageportal import PortalAdministration return PortalAdministration(admin_url="https://%s/portaladmin" % self.portalHostname, securityHandler=self._securityHandler, ...
[ "def", "portalAdmin", "(", "self", ")", ":", "from", ".", ".", "manageportal", "import", "PortalAdministration", "return", "PortalAdministration", "(", "admin_url", "=", "\"https://%s/portaladmin\"", "%", "self", ".", "portalHostname", ",", "securityHandler", "=", "...
gets a reference to a portal administration class
[ "gets", "a", "reference", "to", "a", "portal", "administration", "class" ]
python
train
60.625
pywbem/pywbem
attic/cim_provider.py
https://github.com/pywbem/pywbem/blob/e54ecb82c2211e289a268567443d60fdd489f1e4/attic/cim_provider.py#L661-L676
def MI_deleteInstance(self, env, instanceName): # pylint: disable=invalid-name """Delete a CIM instance Implements the WBEM operation DeleteInstance in terms of the delete_instance method. A derived class will not normally ove...
[ "def", "MI_deleteInstance", "(", "self", ",", "env", ",", "instanceName", ")", ":", "# pylint: disable=invalid-name", "logger", "=", "env", ".", "get_logger", "(", ")", "logger", ".", "log_debug", "(", "'CIMProvider MI_deleteInstance called...'", ")", "self", ".", ...
Delete a CIM instance Implements the WBEM operation DeleteInstance in terms of the delete_instance method. A derived class will not normally override this method.
[ "Delete", "a", "CIM", "instance" ]
python
train
35.8125
pymupdf/PyMuPDF
fitz/fitz.py
https://github.com/pymupdf/PyMuPDF/blob/917f2d83482510e26ba0ff01fd2392c26f3a8e90/fitz/fitz.py#L3888-L3894
def fileUpd(self, buffer=None, filename=None, ufilename=None, desc=None): """Update annotation attached file.""" CheckParent(self) return _fitz.Annot_fileUpd(self, buffer, filename, ufilename, desc)
[ "def", "fileUpd", "(", "self", ",", "buffer", "=", "None", ",", "filename", "=", "None", ",", "ufilename", "=", "None", ",", "desc", "=", "None", ")", ":", "CheckParent", "(", "self", ")", "return", "_fitz", ".", "Annot_fileUpd", "(", "self", ",", "b...
Update annotation attached file.
[ "Update", "annotation", "attached", "file", "." ]
python
train
31.285714
mitsei/dlkit
dlkit/json_/commenting/searches.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/searches.py#L97-L108
def get_comments(self): """Gets the comment list resulting from a search. return: (osid.commenting.CommentList) - the comment list raise: IllegalState - list has already been retrieved *compliance: mandatory -- This method must be implemented.* """ if self.retrieved: ...
[ "def", "get_comments", "(", "self", ")", ":", "if", "self", ".", "retrieved", ":", "raise", "errors", ".", "IllegalState", "(", "'List has already been retrieved.'", ")", "self", ".", "retrieved", "=", "True", "return", "objects", ".", "CommentList", "(", "sel...
Gets the comment list resulting from a search. return: (osid.commenting.CommentList) - the comment list raise: IllegalState - list has already been retrieved *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "comment", "list", "resulting", "from", "a", "search", "." ]
python
train
40.333333
sendgrid/sendgrid-python
examples/helpers/mail_example.py
https://github.com/sendgrid/sendgrid-python/blob/266c2abde7a35dfcce263e06bedc6a0bbdebeac9/examples/helpers/mail_example.py#L49-L79
def get_mock_personalization_dict(): """Get a dict of personalization mock.""" mock_pers = dict() mock_pers['to_list'] = [To("test1@example.com", "Example User"), To("test2@example.com", "Example User")] mo...
[ "def", "get_mock_personalization_dict", "(", ")", ":", "mock_pers", "=", "dict", "(", ")", "mock_pers", "[", "'to_list'", "]", "=", "[", "To", "(", "\"test1@example.com\"", ",", "\"Example User\"", ")", ",", "To", "(", "\"test2@example.com\"", ",", "\"Example Us...
Get a dict of personalization mock.
[ "Get", "a", "dict", "of", "personalization", "mock", "." ]
python
train
37.322581
sassoo/goldman
goldman/deserializers/form_data.py
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/deserializers/form_data.py#L35-L60
def deserialize(self, mimetypes): # pylint: disable=arguments-differ """ Invoke the deserializer Upon successful deserialization a dict will be returned containing the following key/vals: { 'content': <uploaded object>, 'content-type': <content-type...
[ "def", "deserialize", "(", "self", ",", "mimetypes", ")", ":", "# pylint: disable=arguments-differ", "super", "(", "Deserializer", ",", "self", ")", ".", "deserialize", "(", ")", "parts", "=", "self", ".", "parse", "(", "mimetypes", ")", "data", "=", "self",...
Invoke the deserializer Upon successful deserialization a dict will be returned containing the following key/vals: { 'content': <uploaded object>, 'content-type': <content-type of content>, 'file-ext': <file extension based on content-type>, ...
[ "Invoke", "the", "deserializer" ]
python
train
28.923077
fgmacedo/django-export-action
export_action/introspection.py
https://github.com/fgmacedo/django-export-action/blob/215fecb9044d22e3ae19d86c3b220041a11fad07/export_action/introspection.py#L66-L74
def get_direct_fields_from_model(model_class): """ Direct, not m2m, not FK """ direct_fields = [] all_fields_names = _get_all_field_names(model_class) for field_name in all_fields_names: field, model, direct, m2m = _get_field_by_name(model_class, field_name) if direct and not m2m and not...
[ "def", "get_direct_fields_from_model", "(", "model_class", ")", ":", "direct_fields", "=", "[", "]", "all_fields_names", "=", "_get_all_field_names", "(", "model_class", ")", "for", "field_name", "in", "all_fields_names", ":", "field", ",", "model", ",", "direct", ...
Direct, not m2m, not FK
[ "Direct", "not", "m2m", "not", "FK" ]
python
train
44.444444
JoelBender/bacpypes
py25/bacpypes/debugging.py
https://github.com/JoelBender/bacpypes/blob/4111b8604a16fa2b7f80d8104a43b9f3e28dfc78/py25/bacpypes/debugging.py#L30-L36
def xtob(data, sep=''): """Interpret the hex encoding of a blob (string).""" # remove the non-hex characters data = re.sub("[^0-9a-fA-F]", '', data) # interpret the hex return binascii.unhexlify(data)
[ "def", "xtob", "(", "data", ",", "sep", "=", "''", ")", ":", "# remove the non-hex characters", "data", "=", "re", ".", "sub", "(", "\"[^0-9a-fA-F]\"", ",", "''", ",", "data", ")", "# interpret the hex", "return", "binascii", ".", "unhexlify", "(", "data", ...
Interpret the hex encoding of a blob (string).
[ "Interpret", "the", "hex", "encoding", "of", "a", "blob", "(", "string", ")", "." ]
python
train
30.714286
sixty-north/asq
asq/queryables.py
https://github.com/sixty-north/asq/blob/db0c4cbcf2118435136d4b63c62a12711441088e/asq/queryables.py#L1391-L1452
def join(self, inner_iterable, outer_key_selector=identity, inner_key_selector=identity, result_selector=lambda outer, inner: (outer, inner)): '''Perform an inner join with a second sequence using selected keys. The order of elements from outer is maintained. For each of these...
[ "def", "join", "(", "self", ",", "inner_iterable", ",", "outer_key_selector", "=", "identity", ",", "inner_key_selector", "=", "identity", ",", "result_selector", "=", "lambda", "outer", ",", "inner", ":", "(", "outer", ",", "inner", ")", ")", ":", "if", "...
Perform an inner join with a second sequence using selected keys. The order of elements from outer is maintained. For each of these the order of elements from inner is also preserved. Note: This method uses deferred execution. Args: inner_iterable: The sequence to join wit...
[ "Perform", "an", "inner", "join", "with", "a", "second", "sequence", "using", "selected", "keys", "." ]
python
train
48.145161
Nic30/hwt
hwt/synthesizer/param.py
https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/synthesizer/param.py#L50-L64
def set(self, val): """ set value of this param """ assert not self.__isReadOnly, \ ("This parameter(%s) was locked" " and now it can not be changed" % self.name) assert self.replacedWith is None, \ ("This param was replaced with new one and t...
[ "def", "set", "(", "self", ",", "val", ")", ":", "assert", "not", "self", ".", "__isReadOnly", ",", "(", "\"This parameter(%s) was locked\"", "\" and now it can not be changed\"", "%", "self", ".", "name", ")", "assert", "self", ".", "replacedWith", "is", "None"...
set value of this param
[ "set", "value", "of", "this", "param" ]
python
test
31.6
Anaconda-Platform/anaconda-client
binstar_client/inspect_package/pypi.py
https://github.com/Anaconda-Platform/anaconda-client/blob/b276f0572744c73c184a8b43a897cfa7fc1dc523/binstar_client/inspect_package/pypi.py#L297-L391
def format_sdist_header_metadata(data, filename): """ Format the metadata of pypi packages stored in email header format. Currently only used as backup on the wheel (compressed) file format. """ description = get_header_description(data) config_items = python_version_check(data) attrs = dic...
[ "def", "format_sdist_header_metadata", "(", "data", ",", "filename", ")", ":", "description", "=", "get_header_description", "(", "data", ")", "config_items", "=", "python_version_check", "(", "data", ")", "attrs", "=", "dict", "(", "config_items", ")", "name", ...
Format the metadata of pypi packages stored in email header format. Currently only used as backup on the wheel (compressed) file format.
[ "Format", "the", "metadata", "of", "pypi", "packages", "stored", "in", "email", "header", "format", "." ]
python
train
32.642105
cloud9ers/gurumate
environment/lib/python2.7/site-packages/nose/plugins/xunit.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/nose/plugins/xunit.py#L164-L184
def report(self, stream): """Writes an Xunit-formatted XML file The file includes a report of test errors and failures. """ self.stats['encoding'] = self.encoding self.stats['total'] = (self.stats['errors'] + self.stats['failures'] + self.stats['p...
[ "def", "report", "(", "self", ",", "stream", ")", ":", "self", ".", "stats", "[", "'encoding'", "]", "=", "self", ".", "encoding", "self", ".", "stats", "[", "'total'", "]", "=", "(", "self", ".", "stats", "[", "'errors'", "]", "+", "self", ".", ...
Writes an Xunit-formatted XML file The file includes a report of test errors and failures.
[ "Writes", "an", "Xunit", "-", "formatted", "XML", "file" ]
python
test
46.714286
NYUCCL/psiTurk
psiturk/psiturk_org_services.py
https://github.com/NYUCCL/psiTurk/blob/7170b992a0b5f56c165929cf87b3d3a1f3336c36/psiturk/psiturk_org_services.py#L94-L99
def delete_record(self, name, recordid, username, password): ''' Delete record ''' #headers = {'key': username, 'secret': password} req = requests.delete(self.api_server + '/api/' + name + '/' + str(recordid), auth=(username, password)) return req
[ "def", "delete_record", "(", "self", ",", "name", ",", "recordid", ",", "username", ",", "password", ")", ":", "#headers = {'key': username, 'secret': password}", "req", "=", "requests", ".", "delete", "(", "self", ".", "api_server", "+", "'/api/'", "+", "name",...
Delete record
[ "Delete", "record" ]
python
train
50.666667
lowandrew/OLCTools
databasesetup/database_setup.py
https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/databasesetup/database_setup.py#L242-L258
def univec(self, databasepath): """ Download the UniVec core database :param databasepath: path to use to save the database """ logging.info('Downloading univec database') databasepath = self.create_database_folder(databasepath, 'univec') # Set the name of the out...
[ "def", "univec", "(", "self", ",", "databasepath", ")", ":", "logging", ".", "info", "(", "'Downloading univec database'", ")", "databasepath", "=", "self", ".", "create_database_folder", "(", "databasepath", ",", "'univec'", ")", "# Set the name of the output file", ...
Download the UniVec core database :param databasepath: path to use to save the database
[ "Download", "the", "UniVec", "core", "database", ":", "param", "databasepath", ":", "path", "to", "use", "to", "save", "the", "database" ]
python
train
48.764706
thetarkus/django-semanticui-forms
semanticuiforms/utils.py
https://github.com/thetarkus/django-semanticui-forms/blob/9664c6f01621568c3fa39b36439178586649eafe/semanticuiforms/utils.py#L25-L66
def get_choices(field): """ Find choices of a field, whether it has choices or has a queryset. Args: field (BoundField): Django form boundfield Returns: list: List of choices """ empty_label = getattr(field.field, "empty_label", False) needs_empty_value = False choices = [] # Data is the choices if ha...
[ "def", "get_choices", "(", "field", ")", ":", "empty_label", "=", "getattr", "(", "field", ".", "field", ",", "\"empty_label\"", ",", "False", ")", "needs_empty_value", "=", "False", "choices", "=", "[", "]", "# Data is the choices", "if", "hasattr", "(", "f...
Find choices of a field, whether it has choices or has a queryset. Args: field (BoundField): Django form boundfield Returns: list: List of choices
[ "Find", "choices", "of", "a", "field", "whether", "it", "has", "choices", "or", "has", "a", "queryset", "." ]
python
train
25.333333
a1ezzz/wasp-general
wasp_general/network/web/session.py
https://github.com/a1ezzz/wasp-general/blob/1029839d33eb663f8dec76c1c46754d53c1de4a9/wasp_general/network/web/session.py#L67-L88
def read_request_line(self, request_line): """ Read HTTP-request line :param request_line: line to parse for HTTP/0.9 is GET <Request-URI> for HTTP/1.0 and 1.1 is <METHOD> <Request-URI> HTTP/<HTTP-Version>, where HTTP-Version is 1.0 or 1.1. for HTTP/2: binary headers are used """ request = self.__...
[ "def", "read_request_line", "(", "self", ",", "request_line", ")", ":", "request", "=", "self", ".", "__request_cls", ".", "parse_request_line", "(", "self", ",", "request_line", ")", "protocol_version", "=", "self", ".", "protocol_version", "(", ")", "if", "p...
Read HTTP-request line :param request_line: line to parse for HTTP/0.9 is GET <Request-URI> for HTTP/1.0 and 1.1 is <METHOD> <Request-URI> HTTP/<HTTP-Version>, where HTTP-Version is 1.0 or 1.1. for HTTP/2: binary headers are used
[ "Read", "HTTP", "-", "request", "line" ]
python
train
30.954545
playpauseandstop/rororo
rororo/logger.py
https://github.com/playpauseandstop/rororo/blob/28a04e8028c29647941e727116335e9d6fd64c27/rororo/logger.py#L28-L75
def default_logging_dict(*loggers: str, **kwargs: Any) -> DictStrAny: r"""Prepare logging dict suitable with ``logging.config.dictConfig``. **Usage**:: from logging.config import dictConfig dictConfig(default_logging_dict('yourlogger')) :param \*loggers: Enable logging for each logger in ...
[ "def", "default_logging_dict", "(", "*", "loggers", ":", "str", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "DictStrAny", ":", "kwargs", ".", "setdefault", "(", "'level'", ",", "'INFO'", ")", "return", "{", "'version'", ":", "1", ",", "'disable_exist...
r"""Prepare logging dict suitable with ``logging.config.dictConfig``. **Usage**:: from logging.config import dictConfig dictConfig(default_logging_dict('yourlogger')) :param \*loggers: Enable logging for each logger in sequence. :param \*\*kwargs: Setup additional logger params via keywor...
[ "r", "Prepare", "logging", "dict", "suitable", "with", "logging", ".", "config", ".", "dictConfig", "." ]
python
train
30.354167
arista-eosplus/pyeapi
pyeapi/api/vrrp.py
https://github.com/arista-eosplus/pyeapi/blob/96a74faef1fe3bd79c4e900aed29c9956a0587d6/pyeapi/api/vrrp.py#L174-L229
def get(self, name): """Get the vrrp configurations for a single node interface Args: name (string): The name of the interface for which vrrp configurations will be retrieved. Returns: A dictionary containing the vrrp configurations on the interface. ...
[ "def", "get", "(", "self", ",", "name", ")", ":", "# Validate the interface and vrid are specified", "interface", "=", "name", "if", "not", "interface", ":", "raise", "ValueError", "(", "\"Vrrp.get(): interface must contain a value.\"", ")", "# Get the config for the interf...
Get the vrrp configurations for a single node interface Args: name (string): The name of the interface for which vrrp configurations will be retrieved. Returns: A dictionary containing the vrrp configurations on the interface. Returns None if no vrrp...
[ "Get", "the", "vrrp", "configurations", "for", "a", "single", "node", "interface" ]
python
train
40.196429
yeraydiazdiaz/lunr.py
lunr/builder.py
https://github.com/yeraydiazdiaz/lunr.py/blob/28ec3f6d4888295eed730211ee9617aa488d6ba3/lunr/builder.py#L69-L98
def field(self, field_name, boost=1, extractor=None): """Adds a field to the list of document fields that will be indexed. Every document being indexed should have this field. None values for this field in indexed documents will not cause errors but will limit the chance of that documen...
[ "def", "field", "(", "self", ",", "field_name", ",", "boost", "=", "1", ",", "extractor", "=", "None", ")", ":", "if", "\"/\"", "in", "field_name", ":", "raise", "ValueError", "(", "\"Field {} contains illegal character `/`\"", ")", "self", ".", "_fields", "...
Adds a field to the list of document fields that will be indexed. Every document being indexed should have this field. None values for this field in indexed documents will not cause errors but will limit the chance of that document being retrieved by searches. All fields should be adde...
[ "Adds", "a", "field", "to", "the", "list", "of", "document", "fields", "that", "will", "be", "indexed", "." ]
python
train
43.933333
pylp/pylp
pylp/lib/runner.py
https://github.com/pylp/pylp/blob/7ebaa55fbaf61cb8175f211dd41ef2928c22d4d4/pylp/lib/runner.py#L63-L77
def call_task_fn(self): """Call the function attached to the task.""" if not self.fn: return self.log_finished() future = asyncio.Future() future.add_done_callback(lambda x: self.log_finished()) if inspect.iscoroutinefunction(self.fn): f = asyncio.ensure_future(self.fn()) f.add_done_callback(lambda...
[ "def", "call_task_fn", "(", "self", ")", ":", "if", "not", "self", ".", "fn", ":", "return", "self", ".", "log_finished", "(", ")", "future", "=", "asyncio", ".", "Future", "(", ")", "future", ".", "add_done_callback", "(", "lambda", "x", ":", "self", ...
Call the function attached to the task.
[ "Call", "the", "function", "attached", "to", "the", "task", "." ]
python
train
27
bitesofcode/projexui
projexui/widgets/xmenutemplatewidget/xmenutemplatewidget.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xmenutemplatewidget/xmenutemplatewidget.py#L120-L130
def createMenu( self ): """ Creates a new menu with the given name. """ name, accepted = QInputDialog.getText( self, 'Create Menu', 'Name: ') if ( accepted ): self.a...
[ "def", "createMenu", "(", "self", ")", ":", "name", ",", "accepted", "=", "QInputDialog", ".", "getText", "(", "self", ",", "'Create Menu'", ",", "'Name: '", ")", "if", "(", "accepted", ")", ":", "self", ".", "addMenuItem", "(", "self", ".", "createMenuI...
Creates a new menu with the given name.
[ "Creates", "a", "new", "menu", "with", "the", "given", "name", "." ]
python
train
37.090909
cytoscape/py2cytoscape
py2cytoscape/cyrest/networks.py
https://github.com/cytoscape/py2cytoscape/blob/dd34de8d028f512314d0057168df7fef7c5d5195/py2cytoscape/cyrest/networks.py#L937-L949
def getGroup(self, networkId, groupNodeId, verbose=None): """ Returns the group specified by the `groupNodeId` and `networkId` parameters. :param networkId: SUID of the Network :param groupNodeId: SUID of the Node representing the Group :param verbose: print more :retur...
[ "def", "getGroup", "(", "self", ",", "networkId", ",", "groupNodeId", ",", "verbose", "=", "None", ")", ":", "response", "=", "api", "(", "url", "=", "self", ".", "___url", "+", "'networks/'", "+", "str", "(", "networkId", ")", "+", "'/groups/'", "+", ...
Returns the group specified by the `groupNodeId` and `networkId` parameters. :param networkId: SUID of the Network :param groupNodeId: SUID of the Node representing the Group :param verbose: print more :returns: 200: successful operation
[ "Returns", "the", "group", "specified", "by", "the", "groupNodeId", "and", "networkId", "parameters", "." ]
python
train
40.076923
santoshphilip/eppy
eppy/EPlusInterfaceFunctions/eplusdata.py
https://github.com/santoshphilip/eppy/blob/55410ff7c11722f35bc4331ff5e00a0b86f787e1/eppy/EPlusInterfaceFunctions/eplusdata.py#L234-L238
def addinnode(self, otherplus, node, objectname): """add an item to the node. example: add a new zone to the element 'ZONE' """ # do a test for unique object here newelement = otherplus.dt[node.upper()]
[ "def", "addinnode", "(", "self", ",", "otherplus", ",", "node", ",", "objectname", ")", ":", "# do a test for unique object here", "newelement", "=", "otherplus", ".", "dt", "[", "node", ".", "upper", "(", ")", "]" ]
add an item to the node. example: add a new zone to the element 'ZONE'
[ "add", "an", "item", "to", "the", "node", ".", "example", ":", "add", "a", "new", "zone", "to", "the", "element", "ZONE" ]
python
train
46
noobermin/pys
pys/__init__.py
https://github.com/noobermin/pys/blob/e01b74210c65eb96d019bb42e0a3c9e6676da943/pys/__init__.py#L69-L75
def filelines(fname,strip=False): '''read lines from a file into lines...optional strip''' with open(fname,'r') as f: lines = f.readlines(); if strip: lines[:] = [line.strip() for line in lines] return lines;
[ "def", "filelines", "(", "fname", ",", "strip", "=", "False", ")", ":", "with", "open", "(", "fname", ",", "'r'", ")", "as", "f", ":", "lines", "=", "f", ".", "readlines", "(", ")", "if", "strip", ":", "lines", "[", ":", "]", "=", "[", "line", ...
read lines from a file into lines...optional strip
[ "read", "lines", "from", "a", "file", "into", "lines", "...", "optional", "strip" ]
python
train
33.428571
intuition-io/insights
insights/plugins/hipchat.py
https://github.com/intuition-io/insights/blob/a4eae53a1886164db96751d2b0964aa2acb7c2d7/insights/plugins/hipchat.py#L53-L68
def message(self, body, room_id, style='text'): ''' Send a message to the given room ''' # TODO Automatically detect body format ? path = 'rooms/message' data = { 'room_id': room_id, 'message': body, 'from': self.name, 'notify': 1, ...
[ "def", "message", "(", "self", ",", "body", ",", "room_id", ",", "style", "=", "'text'", ")", ":", "# TODO Automatically detect body format ?", "path", "=", "'rooms/message'", "data", "=", "{", "'room_id'", ":", "room_id", ",", "'message'", ":", "body", ",", ...
Send a message to the given room
[ "Send", "a", "message", "to", "the", "given", "room" ]
python
train
35.375
Jajcus/pyxmpp2
pyxmpp2/mainloop/glib.py
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/mainloop/glib.py#L147-L175
def _prepare_io_handler(self, handler): """Call the `interfaces.IOHandler.prepare` method and remove the handler from unprepared handler list when done. """ logger.debug(" preparing handler: {0!r}".format(handler)) self._unprepared_pending.discard(handler) ret = handler.p...
[ "def", "_prepare_io_handler", "(", "self", ",", "handler", ")", ":", "logger", ".", "debug", "(", "\" preparing handler: {0!r}\"", ".", "format", "(", "handler", ")", ")", "self", ".", "_unprepared_pending", ".", "discard", "(", "handler", ")", "ret", "=", "...
Call the `interfaces.IOHandler.prepare` method and remove the handler from unprepared handler list when done.
[ "Call", "the", "interfaces", ".", "IOHandler", ".", "prepare", "method", "and", "remove", "the", "handler", "from", "unprepared", "handler", "list", "when", "done", "." ]
python
valid
44.517241
RazerM/yourls-python
yourls/core.py
https://github.com/RazerM/yourls-python/blob/716845562a2bbb430de3c379c9481b195e451ccf/yourls/core.py#L166-L181
def db_stats(self): """Get database statistics. Returns: DBStats: Total clicks and links statistics. Raises: requests.exceptions.HTTPError: Generic HTTP Error """ data = dict(action='db-stats') jsondata = self._api_request(params=data) s...
[ "def", "db_stats", "(", "self", ")", ":", "data", "=", "dict", "(", "action", "=", "'db-stats'", ")", "jsondata", "=", "self", ".", "_api_request", "(", "params", "=", "data", ")", "stats", "=", "DBStats", "(", "total_clicks", "=", "int", "(", "jsondat...
Get database statistics. Returns: DBStats: Total clicks and links statistics. Raises: requests.exceptions.HTTPError: Generic HTTP Error
[ "Get", "database", "statistics", "." ]
python
test
29.6875
siznax/wptools
wptools/page.py
https://github.com/siznax/wptools/blob/100eaea585c34aa9ad87a9eda8982bb4898f6ec9/wptools/page.py#L576-L605
def get_parse(self, show=True, proxy=None, timeout=0): """ GET MediaWiki:API action=parse request https://en.wikipedia.org/w/api.php?action=help&modules=parse Required {params}: title OR pageid - title: <str> article title - pageid: <int> Wikipedia database ID O...
[ "def", "get_parse", "(", "self", ",", "show", "=", "True", ",", "proxy", "=", "None", ",", "timeout", "=", "0", ")", ":", "if", "not", "self", ".", "params", ".", "get", "(", "'title'", ")", "and", "not", "self", ".", "params", ".", "get", "(", ...
GET MediaWiki:API action=parse request https://en.wikipedia.org/w/api.php?action=help&modules=parse Required {params}: title OR pageid - title: <str> article title - pageid: <int> Wikipedia database ID Optional arguments: - [show]: <bool> echo page data if true ...
[ "GET", "MediaWiki", ":", "API", "action", "=", "parse", "request", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "w", "/", "api", ".", "php?action", "=", "help&modules", "=", "parse" ]
python
train
36.833333
blockcypher/blockcypher-python
blockcypher/api.py
https://github.com/blockcypher/blockcypher-python/blob/7601ea21916957ff279384fd699527ff9c28a56e/blockcypher/api.py#L152-L188
def get_addresses_details(address_list, coin_symbol='btc', txn_limit=None, api_key=None, before_bh=None, after_bh=None, unspent_only=False, show_confidence=False, confirmations=0, include_script=False): ''' Batch version of get_address_details method ''' for address in address_list: ...
[ "def", "get_addresses_details", "(", "address_list", ",", "coin_symbol", "=", "'btc'", ",", "txn_limit", "=", "None", ",", "api_key", "=", "None", ",", "before_bh", "=", "None", ",", "after_bh", "=", "None", ",", "unspent_only", "=", "False", ",", "show_conf...
Batch version of get_address_details method
[ "Batch", "version", "of", "get_address_details", "method" ]
python
train
33.594595
MacHu-GWU/crawlib-project
crawlib/util.py
https://github.com/MacHu-GWU/crawlib-project/blob/241516f2a7a0a32c692f7af35a1f44064e8ce1ab/crawlib/util.py#L36-L60
def join_all(domain, *parts): """ Join all url components. Example:: >>> join_all("https://www.apple.com", "iphone") https://www.apple.com/iphone :param domain: Domain parts, example: https://www.python.org :param parts: Other parts, example: "/doc", "/py27" :return: url "...
[ "def", "join_all", "(", "domain", ",", "*", "parts", ")", ":", "l", "=", "list", "(", ")", "if", "domain", ".", "endswith", "(", "\"/\"", ")", ":", "domain", "=", "domain", "[", ":", "-", "1", "]", "l", ".", "append", "(", "domain", ")", "for",...
Join all url components. Example:: >>> join_all("https://www.apple.com", "iphone") https://www.apple.com/iphone :param domain: Domain parts, example: https://www.python.org :param parts: Other parts, example: "/doc", "/py27" :return: url
[ "Join", "all", "url", "components", "." ]
python
train
21.68
pantsbuild/pants
src/python/pants/backend/jvm/tasks/jar_task.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/backend/jvm/tasks/jar_task.py#L204-L212
def writejar(self, jar): """Schedules all entries from the given ``jar``'s to be added to this jar save for the manifest. :param string jar: the path to the pre-existing jar to graft into this jar """ if not jar or not isinstance(jar, string_types): raise ValueError('The jar path must be a non-em...
[ "def", "writejar", "(", "self", ",", "jar", ")", ":", "if", "not", "jar", "or", "not", "isinstance", "(", "jar", ",", "string_types", ")", ":", "raise", "ValueError", "(", "'The jar path must be a non-empty string'", ")", "self", ".", "_jars", ".", "append",...
Schedules all entries from the given ``jar``'s to be added to this jar save for the manifest. :param string jar: the path to the pre-existing jar to graft into this jar
[ "Schedules", "all", "entries", "from", "the", "given", "jar", "s", "to", "be", "added", "to", "this", "jar", "save", "for", "the", "manifest", "." ]
python
train
39.111111
mitsei/dlkit
dlkit/handcar/learning/managers.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/learning/managers.py#L3190-L3220
def get_activity_admin_session_for_objective_bank(self, objective_bank_id, proxy, *args, **kwargs): """Gets the ``OsidSession`` associated with the activity admin service for the given objective bank. :param objective_bank_id: the ``Id`` of the objective bank :type objective_bank_id: ``osid.id....
[ "def", "get_activity_admin_session_for_objective_bank", "(", "self", ",", "objective_bank_id", ",", "proxy", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "objective_bank_id", ":", "raise", "NullArgument", "if", "not", "self", ".", "supports_...
Gets the ``OsidSession`` associated with the activity admin service for the given objective bank. :param objective_bank_id: the ``Id`` of the objective bank :type objective_bank_id: ``osid.id.Id`` :param proxy: a proxy :type proxy: ``osid.proxy.Proxy`` :return: a ``ActivityAdmin...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "activity", "admin", "service", "for", "the", "given", "objective", "bank", "." ]
python
train
48.16129
DLR-RM/RAFCON
source/rafcon/gui/controllers/global_variable_manager.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/global_variable_manager.py#L158-L170
def remove_core_element(self, model): """Remove respective core element of handed global variable name :param str model: String that is the key/gv_name of core element which should be removed :return: """ gv_name = model if self.global_variable_is_editable(gv_name, "Dele...
[ "def", "remove_core_element", "(", "self", ",", "model", ")", ":", "gv_name", "=", "model", "if", "self", ".", "global_variable_is_editable", "(", "gv_name", ",", "\"Deletion\"", ")", ":", "try", ":", "self", ".", "model", ".", "global_variable_manager", ".", ...
Remove respective core element of handed global variable name :param str model: String that is the key/gv_name of core element which should be removed :return:
[ "Remove", "respective", "core", "element", "of", "handed", "global", "variable", "name" ]
python
train
45.769231
ChrisCummins/labm8
system.py
https://github.com/ChrisCummins/labm8/blob/dd10d67a757aefb180cb508f86696f99440c94f5/system.py#L237-L284
def which(program, path=None): """ Returns the full path of shell commands. Replicates the functionality of system which (1) command. Looks for the named program in the directories indicated in the $PATH environment variable, and returns the full path if found. Examples: >>> system.wh...
[ "def", "which", "(", "program", ",", "path", "=", "None", ")", ":", "# If path is not given, read the $PATH environment variable.", "path", "=", "path", "or", "os", ".", "environ", "[", "\"PATH\"", "]", ".", "split", "(", "os", ".", "pathsep", ")", "abspath", ...
Returns the full path of shell commands. Replicates the functionality of system which (1) command. Looks for the named program in the directories indicated in the $PATH environment variable, and returns the full path if found. Examples: >>> system.which("ls") "/bin/ls" >>> sy...
[ "Returns", "the", "full", "path", "of", "shell", "commands", "." ]
python
train
27.6875
inonit/drf-haystack
drf_haystack/serializers.py
https://github.com/inonit/drf-haystack/blob/ceabd0f6318f129758341ab08292a20205d6f4cd/drf_haystack/serializers.py#L470-L477
def get_document_field(instance): """ Returns which field the search index has marked as it's `document=True` field. """ for name, field in instance.searchindex.fields.items(): if field.document is True: return name
[ "def", "get_document_field", "(", "instance", ")", ":", "for", "name", ",", "field", "in", "instance", ".", "searchindex", ".", "fields", ".", "items", "(", ")", ":", "if", "field", ".", "document", "is", "True", ":", "return", "name" ]
Returns which field the search index has marked as it's `document=True` field.
[ "Returns", "which", "field", "the", "search", "index", "has", "marked", "as", "it", "s", "document", "=", "True", "field", "." ]
python
train
34.5
secdev/scapy
scapy/layers/tls/cert.py
https://github.com/secdev/scapy/blob/3ffe757c184017dd46464593a8f80f85abc1e79a/scapy/layers/tls/cert.py#L80-L91
def pem2der(pem_string): """Convert PEM string to DER format""" # Encode all lines between the first '-----\n' and the 2nd-to-last '-----'. pem_string = pem_string.replace(b"\r", b"") first_idx = pem_string.find(b"-----\n") + 6 if pem_string.find(b"-----BEGIN", first_idx) != -1: raise Except...
[ "def", "pem2der", "(", "pem_string", ")", ":", "# Encode all lines between the first '-----\\n' and the 2nd-to-last '-----'.", "pem_string", "=", "pem_string", ".", "replace", "(", "b\"\\r\"", ",", "b\"\"", ")", "first_idx", "=", "pem_string", ".", "find", "(", "b\"----...
Convert PEM string to DER format
[ "Convert", "PEM", "string", "to", "DER", "format" ]
python
train
49.5
saltstack/salt
salt/cloud/clouds/vmware.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/vmware.py#L1645-L1661
def list_datastores_full(kwargs=None, call=None): ''' List all the datastores for this VMware environment, with extra information CLI Example: .. code-block:: bash salt-cloud -f list_datastores_full my-vmware-config ''' if call != 'function': raise SaltCloudSystemExit( ...
[ "def", "list_datastores_full", "(", "kwargs", "=", "None", ",", "call", "=", "None", ")", ":", "if", "call", "!=", "'function'", ":", "raise", "SaltCloudSystemExit", "(", "'The list_datastores_full function must be called with '", "'-f or --function.'", ")", "return", ...
List all the datastores for this VMware environment, with extra information CLI Example: .. code-block:: bash salt-cloud -f list_datastores_full my-vmware-config
[ "List", "all", "the", "datastores", "for", "this", "VMware", "environment", "with", "extra", "information" ]
python
train
28.529412
quantumlib/Cirq
cirq/google/engine/engine.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/google/engine/engine.py#L460-L470
def cancel_job(self, job_resource_name: str): """Cancels the given job. See also the cancel method on EngineJob. Params: job_resource_name: A string of the form `projects/project_id/programs/program_id/jobs/job_id`. """ self.service.projects().progra...
[ "def", "cancel_job", "(", "self", ",", "job_resource_name", ":", "str", ")", ":", "self", ".", "service", ".", "projects", "(", ")", ".", "programs", "(", ")", ".", "jobs", "(", ")", ".", "cancel", "(", "name", "=", "job_resource_name", ",", "body", ...
Cancels the given job. See also the cancel method on EngineJob. Params: job_resource_name: A string of the form `projects/project_id/programs/program_id/jobs/job_id`.
[ "Cancels", "the", "given", "job", "." ]
python
train
34.909091
erikdejonge/pyprofiler
main_profile.py
https://github.com/erikdejonge/pyprofiler/blob/e32dfcfeb5f1340d4274e7a683c1c5b414595c0e/main_profile.py#L85-L94
def get_print_list(): """ get_print_list """ profiler = start_profile() meth1() meth2() meth3() meth4() return end_profile(profiler, returnvalue=True)
[ "def", "get_print_list", "(", ")", ":", "profiler", "=", "start_profile", "(", ")", "meth1", "(", ")", "meth2", "(", ")", "meth3", "(", ")", "meth4", "(", ")", "return", "end_profile", "(", "profiler", ",", "returnvalue", "=", "True", ")" ]
get_print_list
[ "get_print_list" ]
python
train
17.7
maas/python-libmaas
maas/client/viscera/bcache_cache_sets.py
https://github.com/maas/python-libmaas/blob/4092c68ef7fb1753efc843569848e2bcc3415002/maas/client/viscera/bcache_cache_sets.py#L73-L103
async def create( cls, node: Union[Node, str], cache_device: Union[BlockDevice, Partition]): """ Create a BcacheCacheSet on a Node. :param node: Node to create the interface on. :type node: `Node` or `str` :param cache_device: Block device or partition to...
[ "async", "def", "create", "(", "cls", ",", "node", ":", "Union", "[", "Node", ",", "str", "]", ",", "cache_device", ":", "Union", "[", "BlockDevice", ",", "Partition", "]", ")", ":", "params", "=", "{", "}", "if", "isinstance", "(", "node", ",", "s...
Create a BcacheCacheSet on a Node. :param node: Node to create the interface on. :type node: `Node` or `str` :param cache_device: Block device or partition to create the cache set on. :type cache_device: `BlockDevice` or `Partition`
[ "Create", "a", "BcacheCacheSet", "on", "a", "Node", "." ]
python
train
37.483871
sentinel-hub/eo-learn
core/eolearn/core/constants.py
https://github.com/sentinel-hub/eo-learn/blob/b8c390b9f553c561612fe9eb64e720611633a035/core/eolearn/core/constants.py#L88-L101
def ndim(self): """If given FeatureType stores a dictionary of numpy.ndarrays it returns dimensions of such arrays.""" if self.is_raster(): return { FeatureType.DATA: 4, FeatureType.MASK: 4, FeatureType.SCALAR: 2, FeatureType.LA...
[ "def", "ndim", "(", "self", ")", ":", "if", "self", ".", "is_raster", "(", ")", ":", "return", "{", "FeatureType", ".", "DATA", ":", "4", ",", "FeatureType", ".", "MASK", ":", "4", ",", "FeatureType", ".", "SCALAR", ":", "2", ",", "FeatureType", "....
If given FeatureType stores a dictionary of numpy.ndarrays it returns dimensions of such arrays.
[ "If", "given", "FeatureType", "stores", "a", "dictionary", "of", "numpy", ".", "ndarrays", "it", "returns", "dimensions", "of", "such", "arrays", "." ]
python
train
38.571429
fictorial/filesysdb
filesysdb/__init__.py
https://github.com/fictorial/filesysdb/blob/bbf1e32218b71c7c15c33ada660433fffc6fa6ab/filesysdb/__init__.py#L141-L148
def each_object_id(collection): """Yields each object ID in the given ``collection``. The objects are not loaded.""" c_path = collection_path(collection) paths = glob('%s/*.%s' % (c_path, _ext)) for path in paths: match = regex.match(r'.+/(.+)\.%s$' % _ext, path) yield match.groups()...
[ "def", "each_object_id", "(", "collection", ")", ":", "c_path", "=", "collection_path", "(", "collection", ")", "paths", "=", "glob", "(", "'%s/*.%s'", "%", "(", "c_path", ",", "_ext", ")", ")", "for", "path", "in", "paths", ":", "match", "=", "regex", ...
Yields each object ID in the given ``collection``. The objects are not loaded.
[ "Yields", "each", "object", "ID", "in", "the", "given", "collection", ".", "The", "objects", "are", "not", "loaded", "." ]
python
train
39.5
onnx/onnxmltools
onnxutils/onnxconverter_common/onnx_ops.py
https://github.com/onnx/onnxmltools/blob/d4e4c31990fc2d9fd1f92139f497d360914c9df2/onnxutils/onnxconverter_common/onnx_ops.py#L128-L160
def apply_cast(scope, input_name, output_name, container, operator_name=None, to=None): ''' :param to: enum defined in ONNX TensorProto.DataType, for example, TensorProto.FLOAT and TensorProto.INT64. ''' name = _create_name_or_use_existing_one(scope, 'Cast', operator_name) attrs = {'name': name} ...
[ "def", "apply_cast", "(", "scope", ",", "input_name", ",", "output_name", ",", "container", ",", "operator_name", "=", "None", ",", "to", "=", "None", ")", ":", "name", "=", "_create_name_or_use_existing_one", "(", "scope", ",", "'Cast'", ",", "operator_name",...
:param to: enum defined in ONNX TensorProto.DataType, for example, TensorProto.FLOAT and TensorProto.INT64.
[ ":", "param", "to", ":", "enum", "defined", "in", "ONNX", "TensorProto", ".", "DataType", "for", "example", "TensorProto", ".", "FLOAT", "and", "TensorProto", ".", "INT64", "." ]
python
train
49.242424
tus/tus-py-client
tusclient/uploader.py
https://github.com/tus/tus-py-client/blob/0e5856efcfae6fc281171359ce38488a70468993/tusclient/uploader.py#L148-L154
def headers_as_list(self): """ Does the same as 'headers' except it is returned as a list. """ headers = self.headers headers_list = ['{}: {}'.format(key, value) for key, value in iteritems(headers)] return headers_list
[ "def", "headers_as_list", "(", "self", ")", ":", "headers", "=", "self", ".", "headers", "headers_list", "=", "[", "'{}: {}'", ".", "format", "(", "key", ",", "value", ")", "for", "key", ",", "value", "in", "iteritems", "(", "headers", ")", "]", "retur...
Does the same as 'headers' except it is returned as a list.
[ "Does", "the", "same", "as", "headers", "except", "it", "is", "returned", "as", "a", "list", "." ]
python
train
37.285714
google/python-gflags
gflags/flag.py
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/flag.py#L359-L386
def parse(self, arguments): """Parses one or more arguments with the installed parser. Args: arguments: a single argument or a list of arguments (typically a list of default values); a single argument is converted internally into a list containing one item. """ if not isinstance(a...
[ "def", "parse", "(", "self", ",", "arguments", ")", ":", "if", "not", "isinstance", "(", "arguments", ",", "list", ")", ":", "# Default value may be a list of values. Most other arguments", "# will not be, so convert them into a single-item list to make", "# processing simpler...
Parses one or more arguments with the installed parser. Args: arguments: a single argument or a list of arguments (typically a list of default values); a single argument is converted internally into a list containing one item.
[ "Parses", "one", "or", "more", "arguments", "with", "the", "installed", "parser", "." ]
python
train
35.642857
ib-lundgren/flask-oauthprovider
flask_oauthprovider.py
https://github.com/ib-lundgren/flask-oauthprovider/blob/6c91e8c11fc3cee410cb755d52d9d2c5331ee324/flask_oauthprovider.py#L219-L228
def authorized(self, request_token): """Create a verifier for an user authorized client""" verifier = generate_token(length=self.verifier_length[1]) self.save_verifier(request_token, verifier) response = [ (u'oauth_token', request_token), (u'oauth_verifier', verif...
[ "def", "authorized", "(", "self", ",", "request_token", ")", ":", "verifier", "=", "generate_token", "(", "length", "=", "self", ".", "verifier_length", "[", "1", "]", ")", "self", ".", "save_verifier", "(", "request_token", ",", "verifier", ")", "response",...
Create a verifier for an user authorized client
[ "Create", "a", "verifier", "for", "an", "user", "authorized", "client" ]
python
train
44
google/grr
grr/server/grr_response_server/databases/mem_hunts.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/databases/mem_hunts.py#L261-L291
def ReadHuntCounters(self, hunt_id): """Reads hunt counters.""" num_clients = self.CountHuntFlows(hunt_id) num_successful_clients = self.CountHuntFlows( hunt_id, filter_condition=db.HuntFlowsCondition.SUCCEEDED_FLOWS_ONLY) num_failed_clients = self.CountHuntFlows( hunt_id, filter_conditi...
[ "def", "ReadHuntCounters", "(", "self", ",", "hunt_id", ")", ":", "num_clients", "=", "self", ".", "CountHuntFlows", "(", "hunt_id", ")", "num_successful_clients", "=", "self", ".", "CountHuntFlows", "(", "hunt_id", ",", "filter_condition", "=", "db", ".", "Hu...
Reads hunt counters.
[ "Reads", "hunt", "counters", "." ]
python
train
43.516129
tanghaibao/jcvi
jcvi/utils/cbook.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/utils/cbook.py#L473-L484
def tile(lt, width=70, gap=1): """ Pretty print list of items. """ from jcvi.utils.iter import grouper max_len = max(len(x) for x in lt) + gap items_per_line = max(width // max_len, 1) lt = [x.rjust(max_len) for x in lt] g = list(grouper(lt, items_per_line, fillvalue="")) return "\...
[ "def", "tile", "(", "lt", ",", "width", "=", "70", ",", "gap", "=", "1", ")", ":", "from", "jcvi", ".", "utils", ".", "iter", "import", "grouper", "max_len", "=", "max", "(", "len", "(", "x", ")", "for", "x", "in", "lt", ")", "+", "gap", "ite...
Pretty print list of items.
[ "Pretty", "print", "list", "of", "items", "." ]
python
train
28.25
gitpython-developers/GitPython
git/refs/remote.py
https://github.com/gitpython-developers/GitPython/blob/1f66e25c25cde2423917ee18c4704fff83b837d1/git/refs/remote.py#L28-L46
def delete(cls, repo, *refs, **kwargs): """Delete the given remote references :note: kwargs are given for comparability with the base class method as we should not narrow the signature.""" repo.git.branch("-d", "-r", *refs) # the official deletion method will ign...
[ "def", "delete", "(", "cls", ",", "repo", ",", "*", "refs", ",", "*", "*", "kwargs", ")", ":", "repo", ".", "git", ".", "branch", "(", "\"-d\"", ",", "\"-r\"", ",", "*", "refs", ")", "# the official deletion method will ignore remote symbolic refs - these", ...
Delete the given remote references :note: kwargs are given for comparability with the base class method as we should not narrow the signature.
[ "Delete", "the", "given", "remote", "references" ]
python
train
38.105263
spyder-ide/spyder
spyder/plugins/explorer/widgets.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/explorer/widgets.py#L729-L756
def move(self, fnames=None, directory=None): """Move files/directories""" if fnames is None: fnames = self.get_selected_filenames() orig = fixpath(osp.dirname(fnames[0])) while True: self.redirect_stdio.emit(False) if directory is None: ...
[ "def", "move", "(", "self", ",", "fnames", "=", "None", ",", "directory", "=", "None", ")", ":", "if", "fnames", "is", "None", ":", "fnames", "=", "self", ".", "get_selected_filenames", "(", ")", "orig", "=", "fixpath", "(", "osp", ".", "dirname", "(...
Move files/directories
[ "Move", "files", "/", "directories" ]
python
train
41.785714
aleju/imgaug
imgaug/augmenters/convolutional.py
https://github.com/aleju/imgaug/blob/786be74aa855513840113ea523c5df495dc6a8af/imgaug/augmenters/convolutional.py#L296-L378
def Emboss(alpha=0, strength=1, name=None, deterministic=False, random_state=None): """ Augmenter that embosses images and overlays the result with the original image. The embossed version pronounces highlights and shadows, letting the image look as if it was recreated on a metal plate ("embossed")...
[ "def", "Emboss", "(", "alpha", "=", "0", ",", "strength", "=", "1", ",", "name", "=", "None", ",", "deterministic", "=", "False", ",", "random_state", "=", "None", ")", ":", "alpha_param", "=", "iap", ".", "handle_continuous_param", "(", "alpha", ",", ...
Augmenter that embosses images and overlays the result with the original image. The embossed version pronounces highlights and shadows, letting the image look as if it was recreated on a metal plate ("embossed"). dtype support:: See ``imgaug.augmenters.convolutional.Convolve``. Parameter...
[ "Augmenter", "that", "embosses", "images", "and", "overlays", "the", "result", "with", "the", "original", "image", "." ]
python
valid
43.518072
google/python_portpicker
src/portserver.py
https://github.com/google/python_portpicker/blob/f737189ea7a2d4b97048a2f4e37609e293b03546/src/portserver.py#L199-L205
def add_port_to_free_pool(self, port): """Add a new port to the free pool for allocation.""" if port < 1 or port > 65535: raise ValueError( 'Port must be in the [1, 65535] range, not %d.' % port) port_info = _PortInfo(port=port) self._port_queue.append(port_in...
[ "def", "add_port_to_free_pool", "(", "self", ",", "port", ")", ":", "if", "port", "<", "1", "or", "port", ">", "65535", ":", "raise", "ValueError", "(", "'Port must be in the [1, 65535] range, not %d.'", "%", "port", ")", "port_info", "=", "_PortInfo", "(", "p...
Add a new port to the free pool for allocation.
[ "Add", "a", "new", "port", "to", "the", "free", "pool", "for", "allocation", "." ]
python
train
45.285714
openstax/cnx-epub
cnxepub/html_parsers.py
https://github.com/openstax/cnx-epub/blob/f648a309eff551b0a68a115a98ddf7858149a2ea/cnxepub/html_parsers.py#L22-L39
def parse_navigation_html_to_tree(html, id): """Parse the given ``html`` (an etree object) to a tree. The ``id`` is required in order to assign the top-level tree id value. """ def xpath(x): return html.xpath(x, namespaces=HTML_DOCUMENT_NAMESPACES) try: value = xpath('//*[@data-type=...
[ "def", "parse_navigation_html_to_tree", "(", "html", ",", "id", ")", ":", "def", "xpath", "(", "x", ")", ":", "return", "html", ".", "xpath", "(", "x", ",", "namespaces", "=", "HTML_DOCUMENT_NAMESPACES", ")", "try", ":", "value", "=", "xpath", "(", "'//*...
Parse the given ``html`` (an etree object) to a tree. The ``id`` is required in order to assign the top-level tree id value.
[ "Parse", "the", "given", "html", "(", "an", "etree", "object", ")", "to", "a", "tree", ".", "The", "id", "is", "required", "in", "order", "to", "assign", "the", "top", "-", "level", "tree", "id", "value", "." ]
python
train
38.388889
BerkeleyAutomation/autolab_core
autolab_core/transformations.py
https://github.com/BerkeleyAutomation/autolab_core/blob/8f3813f6401972868cc5e3981ba1b4382d4418d5/autolab_core/transformations.py#L1157-L1171
def quaternion_about_axis(angle, axis): """Return quaternion for rotation about axis. >>> q = quaternion_about_axis(0.123, (1, 0, 0)) >>> numpy.allclose(q, [0.06146124, 0, 0, 0.99810947]) True """ quaternion = numpy.zeros((4, ), dtype=numpy.float64) quaternion[:3] = axis[:3] qlen = vec...
[ "def", "quaternion_about_axis", "(", "angle", ",", "axis", ")", ":", "quaternion", "=", "numpy", ".", "zeros", "(", "(", "4", ",", ")", ",", "dtype", "=", "numpy", ".", "float64", ")", "quaternion", "[", ":", "3", "]", "=", "axis", "[", ":", "3", ...
Return quaternion for rotation about axis. >>> q = quaternion_about_axis(0.123, (1, 0, 0)) >>> numpy.allclose(q, [0.06146124, 0, 0, 0.99810947]) True
[ "Return", "quaternion", "for", "rotation", "about", "axis", "." ]
python
train
30.466667
mbedmicro/pyOCD
pyocd/core/coresight_target.py
https://github.com/mbedmicro/pyOCD/blob/41a174718a9739f3cbe785c2ba21cb7fd1310c6f/pyocd/core/coresight_target.py#L225-L232
def check_for_cores(self): """! @brief Init task: verify that at least one core was discovered.""" if not len(self.cores): # Allow the user to override the exception to enable uses like chip bringup. if self.session.options.get('allow_no_cores', False): logging.er...
[ "def", "check_for_cores", "(", "self", ")", ":", "if", "not", "len", "(", "self", ".", "cores", ")", ":", "# Allow the user to override the exception to enable uses like chip bringup.", "if", "self", ".", "session", ".", "options", ".", "get", "(", "'allow_no_cores'...
! @brief Init task: verify that at least one core was discovered.
[ "!" ]
python
train
54.5
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/FS.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/FS.py#L769-L781
def src_builder(self): """Fetch the source code builder for this node. If there isn't one, we cache the source code builder specified for the directory (which in turn will cache the value from its parent directory, and so on up to the file system root). """ try: ...
[ "def", "src_builder", "(", "self", ")", ":", "try", ":", "scb", "=", "self", ".", "sbuilder", "except", "AttributeError", ":", "scb", "=", "self", ".", "dir", ".", "src_builder", "(", ")", "self", ".", "sbuilder", "=", "scb", "return", "scb" ]
Fetch the source code builder for this node. If there isn't one, we cache the source code builder specified for the directory (which in turn will cache the value from its parent directory, and so on up to the file system root).
[ "Fetch", "the", "source", "code", "builder", "for", "this", "node", "." ]
python
train
34.923077
markovmodel/PyEMMA
pyemma/util/contexts.py
https://github.com/markovmodel/PyEMMA/blob/5c3124398217de05ba5ce9c8fb01519222481ab8/pyemma/util/contexts.py#L51-L66
def random_seed(seed=42): """ sets the random seed of Python within the context. Example ------- >>> import random >>> with random_seed(seed=0): ... random.randint(0, 1000) # doctest: +SKIP 864 """ old_state = random.getstate() random.seed(seed) try: yield fin...
[ "def", "random_seed", "(", "seed", "=", "42", ")", ":", "old_state", "=", "random", ".", "getstate", "(", ")", "random", ".", "seed", "(", "seed", ")", "try", ":", "yield", "finally", ":", "random", ".", "setstate", "(", "old_state", ")" ]
sets the random seed of Python within the context. Example ------- >>> import random >>> with random_seed(seed=0): ... random.randint(0, 1000) # doctest: +SKIP 864
[ "sets", "the", "random", "seed", "of", "Python", "within", "the", "context", "." ]
python
train
21.5625
twilio/twilio-python
twilio/rest/api/v2010/account/conference/__init__.py
https://github.com/twilio/twilio-python/blob/c867895f55dcc29f522e6e8b8868d0d18483132f/twilio/rest/api/v2010/account/conference/__init__.py#L240-L249
def get_instance(self, payload): """ Build an instance of ConferenceInstance :param dict payload: Payload response from the API :returns: twilio.rest.api.v2010.account.conference.ConferenceInstance :rtype: twilio.rest.api.v2010.account.conference.ConferenceInstance """ ...
[ "def", "get_instance", "(", "self", ",", "payload", ")", ":", "return", "ConferenceInstance", "(", "self", ".", "_version", ",", "payload", ",", "account_sid", "=", "self", ".", "_solution", "[", "'account_sid'", "]", ",", ")" ]
Build an instance of ConferenceInstance :param dict payload: Payload response from the API :returns: twilio.rest.api.v2010.account.conference.ConferenceInstance :rtype: twilio.rest.api.v2010.account.conference.ConferenceInstance
[ "Build", "an", "instance", "of", "ConferenceInstance" ]
python
train
41.3
tensorflow/probability
tensorflow_probability/python/distributions/von_mises_fisher.py
https://github.com/tensorflow/probability/blob/e87fe34111d68c35db0f9eeb4935f1ece9e1a8f5/tensorflow_probability/python/distributions/von_mises_fisher.py#L358-L385
def _sample_3d(self, n, seed=None): """Specialized inversion sampler for 3D.""" seed = seed_stream.SeedStream(seed, salt='von_mises_fisher_3d') u_shape = tf.concat([[n], self._batch_shape_tensor()], axis=0) z = tf.random.uniform(u_shape, seed=seed(), dtype=self.dtype) # TODO(bjp): Higher-order odd d...
[ "def", "_sample_3d", "(", "self", ",", "n", ",", "seed", "=", "None", ")", ":", "seed", "=", "seed_stream", ".", "SeedStream", "(", "seed", ",", "salt", "=", "'von_mises_fisher_3d'", ")", "u_shape", "=", "tf", ".", "concat", "(", "[", "[", "n", "]", ...
Specialized inversion sampler for 3D.
[ "Specialized", "inversion", "sampler", "for", "3D", "." ]
python
test
49.5
PrefPy/prefpy
prefpy/profile.py
https://github.com/PrefPy/prefpy/blob/f395ba3782f05684fa5de0cece387a6da9391d02/prefpy/profile.py#L261-L284
def importPreflibFile(self, fileName): """ Imports a preflib format file that contains all the information of a Profile. This function will completely override all members of the current Profile object. Currently, we assume that in an election where incomplete ordering are allowed, if a...
[ "def", "importPreflibFile", "(", "self", ",", "fileName", ")", ":", "# Use the functionality found in io to read the file.", "elecFileObj", "=", "open", "(", "fileName", ",", "'r'", ")", "self", ".", "candMap", ",", "rankMaps", ",", "wmgMapsCounts", ",", "self", "...
Imports a preflib format file that contains all the information of a Profile. This function will completely override all members of the current Profile object. Currently, we assume that in an election where incomplete ordering are allowed, if a voter ranks only one candidate, then the voter di...
[ "Imports", "a", "preflib", "format", "file", "that", "contains", "all", "the", "information", "of", "a", "Profile", ".", "This", "function", "will", "completely", "override", "all", "members", "of", "the", "current", "Profile", "object", ".", "Currently", "we"...
python
train
50.875
numenta/htmresearch
htmresearch/frameworks/layers/object_machine_base.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/frameworks/layers/object_machine_base.py#L132-L145
def randomTraversal(sensations, numTraversals): """ Given a list of sensations, return the SDRs that would be obtained by numTraversals random traversals of that set of sensations. Each sensation is a dict mapping cortical column index to a pair of SDR's (one location and one feature). """ ...
[ "def", "randomTraversal", "(", "sensations", ",", "numTraversals", ")", ":", "newSensations", "=", "[", "]", "for", "_", "in", "range", "(", "numTraversals", ")", ":", "s", "=", "copy", ".", "deepcopy", "(", "sensations", ")", "random", ".", "shuffle", "...
Given a list of sensations, return the SDRs that would be obtained by numTraversals random traversals of that set of sensations. Each sensation is a dict mapping cortical column index to a pair of SDR's (one location and one feature).
[ "Given", "a", "list", "of", "sensations", "return", "the", "SDRs", "that", "would", "be", "obtained", "by", "numTraversals", "random", "traversals", "of", "that", "set", "of", "sensations", "." ]
python
train
33.571429
f3at/feat
src/feat/agencies/net/agency.py
https://github.com/f3at/feat/blob/15da93fc9d6ec8154f52a9172824e25821195ef8/src/feat/agencies/net/agency.py#L455-L464
def actually_start_agent(self, descriptor, **kwargs): """ This method will be run only on the master agency. """ factory = IAgentFactory( applications.lookup_agent(descriptor.type_name)) if factory.standalone: return self.start_standalone_agent(descriptor,...
[ "def", "actually_start_agent", "(", "self", ",", "descriptor", ",", "*", "*", "kwargs", ")", ":", "factory", "=", "IAgentFactory", "(", "applications", ".", "lookup_agent", "(", "descriptor", ".", "type_name", ")", ")", "if", "factory", ".", "standalone", ":...
This method will be run only on the master agency.
[ "This", "method", "will", "be", "run", "only", "on", "the", "master", "agency", "." ]
python
train
41
eaton-lab/toytree
toytree/Multitree.py
https://github.com/eaton-lab/toytree/blob/0347ed2098acc5f707fadf52a0ecd411a6d1859c/toytree/Multitree.py#L407-L418
def hash_trees(self): "hash ladderized tree topologies" observed = {} for idx, tree in enumerate(self.treelist): nwk = tree.write(tree_format=9) hashed = md5(nwk.encode("utf-8")).hexdigest() if hashed not in observed: observed[hashed] = ...
[ "def", "hash_trees", "(", "self", ")", ":", "observed", "=", "{", "}", "for", "idx", ",", "tree", "in", "enumerate", "(", "self", ".", "treelist", ")", ":", "nwk", "=", "tree", ".", "write", "(", "tree_format", "=", "9", ")", "hashed", "=", "md5", ...
hash ladderized tree topologies
[ "hash", "ladderized", "tree", "topologies" ]
python
train
37.333333
aws/aws-xray-sdk-python
aws_xray_sdk/core/context.py
https://github.com/aws/aws-xray-sdk-python/blob/707358cd3a516d51f2ebf71cf34f00e8d906a667/aws_xray_sdk/core/context.py#L40-L54
def end_segment(self, end_time=None): """ End the current active segment. :param int end_time: epoch in seconds. If not specified the current system time will be used. """ entity = self.get_trace_entity() if not entity: log.warning("No segment to ...
[ "def", "end_segment", "(", "self", ",", "end_time", "=", "None", ")", ":", "entity", "=", "self", ".", "get_trace_entity", "(", ")", "if", "not", "entity", ":", "log", ".", "warning", "(", "\"No segment to end\"", ")", "return", "if", "self", ".", "_is_s...
End the current active segment. :param int end_time: epoch in seconds. If not specified the current system time will be used.
[ "End", "the", "current", "active", "segment", "." ]
python
train
31.266667
mitodl/PyLmod
pylmod/gradebook.py
https://github.com/mitodl/PyLmod/blob/b798b86c33d1eb615e7cd4f3457b5c15da1d86e0/pylmod/gradebook.py#L723-L838
def get_students( self, gradebook_id='', simple=False, section_name='', include_photo=False, include_grade_info=False, include_grade_history=False, include_makeup_grades=False ): """Get students for a gradebook. ...
[ "def", "get_students", "(", "self", ",", "gradebook_id", "=", "''", ",", "simple", "=", "False", ",", "section_name", "=", "''", ",", "include_photo", "=", "False", ",", "include_grade_info", "=", "False", ",", "include_grade_history", "=", "False", ",", "in...
Get students for a gradebook. Get a list of students for a given gradebook, specified by a gradebook id. Does not include grade data. Args: gradebook_id (str): unique identifier for gradebook, i.e. ``2314`` simple (bool): if ``True``, just return diction...
[ "Get", "students", "for", "a", "gradebook", "." ]
python
train
35.12931
dsoprea/PySchedules
pyschedules/xml_callbacks.py
https://github.com/dsoprea/PySchedules/blob/e5aae988fad90217f72db45f93bf69839f4d75e7/pyschedules/xml_callbacks.py#L268-L275
def _startGenresNode(self, name, attrs): """Process the start of a node under xtvd/genres""" if name == 'programGenre': self._programId = attrs.get('program') elif name == 'genre': self._genre = None self._relevance = None
[ "def", "_startGenresNode", "(", "self", ",", "name", ",", "attrs", ")", ":", "if", "name", "==", "'programGenre'", ":", "self", ".", "_programId", "=", "attrs", ".", "get", "(", "'program'", ")", "elif", "name", "==", "'genre'", ":", "self", ".", "_gen...
Process the start of a node under xtvd/genres
[ "Process", "the", "start", "of", "a", "node", "under", "xtvd", "/", "genres" ]
python
train
34.5
kensho-technologies/graphql-compiler
graphql_compiler/compiler/compiler_frontend.py
https://github.com/kensho-technologies/graphql-compiler/blob/f6079c6d10f64932f6b3af309b79bcea2123ca8f/graphql_compiler/compiler/compiler_frontend.py#L190-L209
def _get_inline_fragment(ast): """Return the inline fragment at the current AST node, or None if no fragment exists.""" if not ast.selection_set: # There is nothing selected here, so no fragment. return None fragments = [ ast_node for ast_node in ast.selection_set.selections...
[ "def", "_get_inline_fragment", "(", "ast", ")", ":", "if", "not", "ast", ".", "selection_set", ":", "# There is nothing selected here, so no fragment.", "return", "None", "fragments", "=", "[", "ast_node", "for", "ast_node", "in", "ast", ".", "selection_set", ".", ...
Return the inline fragment at the current AST node, or None if no fragment exists.
[ "Return", "the", "inline", "fragment", "at", "the", "current", "AST", "node", "or", "None", "if", "no", "fragment", "exists", "." ]
python
train
30.6
knipknap/exscript
Exscript/protocols/telnetlib.py
https://github.com/knipknap/exscript/blob/72718eee3e87b345d5a5255be9824e867e42927b/Exscript/protocols/telnetlib.py#L324-L338
def read_some(self): """Read at least one byte of cooked data unless EOF is hit. Return '' if EOF is hit. Block if no data is immediately available. """ self.process_rawq() while self.cookedq.tell() == 0 and not self.eof: self.fill_rawq() self.p...
[ "def", "read_some", "(", "self", ")", ":", "self", ".", "process_rawq", "(", ")", "while", "self", ".", "cookedq", ".", "tell", "(", ")", "==", "0", "and", "not", "self", ".", "eof", ":", "self", ".", "fill_rawq", "(", ")", "self", ".", "process_ra...
Read at least one byte of cooked data unless EOF is hit. Return '' if EOF is hit. Block if no data is immediately available.
[ "Read", "at", "least", "one", "byte", "of", "cooked", "data", "unless", "EOF", "is", "hit", "." ]
python
train
29.133333
dwavesystems/dwave-cloud-client
dwave/cloud/client.py
https://github.com/dwavesystems/dwave-cloud-client/blob/df3221a8385dc0c04d7b4d84f740bf3ad6706230/dwave/cloud/client.py#L957-L962
def _submit(self, body, future): """Enqueue a problem for submission to the server. This method is thread safe. """ self._submission_queue.put(self._submit.Message(body, future))
[ "def", "_submit", "(", "self", ",", "body", ",", "future", ")", ":", "self", ".", "_submission_queue", ".", "put", "(", "self", ".", "_submit", ".", "Message", "(", "body", ",", "future", ")", ")" ]
Enqueue a problem for submission to the server. This method is thread safe.
[ "Enqueue", "a", "problem", "for", "submission", "to", "the", "server", "." ]
python
train
34.333333
MartinThoma/mpu
mpu/io.py
https://github.com/MartinThoma/mpu/blob/61bc36d0192ca90c0bcf9b8a5d7d0d8520e20ff6/mpu/io.py#L309-L330
def get_creation_datetime(filepath): """ Get the date that a file was created. Parameters ---------- filepath : str Returns ------- creation_datetime : datetime.datetime or None """ if platform.system() == 'Windows': return datetime.fromtimestamp(os.path.getctime(filepa...
[ "def", "get_creation_datetime", "(", "filepath", ")", ":", "if", "platform", ".", "system", "(", ")", "==", "'Windows'", ":", "return", "datetime", ".", "fromtimestamp", "(", "os", ".", "path", ".", "getctime", "(", "filepath", ")", ")", "else", ":", "st...
Get the date that a file was created. Parameters ---------- filepath : str Returns ------- creation_datetime : datetime.datetime or None
[ "Get", "the", "date", "that", "a", "file", "was", "created", "." ]
python
train
28.363636
KnowledgeLinks/rdfframework
rdfframework/utilities/statistics.py
https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/utilities/statistics.py#L144-L157
def update_counts(self, current): """ updates counts for the class instance based on the current dictionary counts args: ----- current: current dictionary counts """ for item in current: try: self.counts[item] += 1 ...
[ "def", "update_counts", "(", "self", ",", "current", ")", ":", "for", "item", "in", "current", ":", "try", ":", "self", ".", "counts", "[", "item", "]", "+=", "1", "except", "KeyError", ":", "self", ".", "counts", "[", "item", "]", "=", "1" ]
updates counts for the class instance based on the current dictionary counts args: ----- current: current dictionary counts
[ "updates", "counts", "for", "the", "class", "instance", "based", "on", "the", "current", "dictionary", "counts" ]
python
train
26.071429
kunitoki/django-custard
custard/builder.py
https://github.com/kunitoki/django-custard/blob/3cf3aa5acf84de2f653e96469e2f9c42813df50a/custard/builder.py#L279-L331
def create_mixin(self): """ This will create the custom Model Mixin to attach to your custom field enabled model. :return: """ _builder = self class CustomModelMixin(object): @cached_property def _content_type(self): retu...
[ "def", "create_mixin", "(", "self", ")", ":", "_builder", "=", "self", "class", "CustomModelMixin", "(", "object", ")", ":", "@", "cached_property", "def", "_content_type", "(", "self", ")", ":", "return", "ContentType", ".", "objects", ".", "get_for_model", ...
This will create the custom Model Mixin to attach to your custom field enabled model. :return:
[ "This", "will", "create", "the", "custom", "Model", "Mixin", "to", "attach", "to", "your", "custom", "field", "enabled", "model", "." ]
python
train
45.358491
saltstack/salt
salt/modules/dockercompose.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/dockercompose.py#L266-L280
def __dump_docker_compose(path, content, already_existed): ''' Dumps :param path: :param content: the not-yet dumped content :return: ''' try: dumped = yaml.safe_dump(content, indent=2, default_flow_style=False) return __write_docker_compose(path, dumped, already_existed) ...
[ "def", "__dump_docker_compose", "(", "path", ",", "content", ",", "already_existed", ")", ":", "try", ":", "dumped", "=", "yaml", ".", "safe_dump", "(", "content", ",", "indent", "=", "2", ",", "default_flow_style", "=", "False", ")", "return", "__write_dock...
Dumps :param path: :param content: the not-yet dumped content :return:
[ "Dumps" ]
python
train
32.8
watson-developer-cloud/python-sdk
ibm_watson/assistant_v1.py
https://github.com/watson-developer-cloud/python-sdk/blob/4c2c9df4466fcde88975da9ecd834e6ba95eb353/ibm_watson/assistant_v1.py#L5552-L5592
def _from_dict(cls, _dict): """Initialize a Log object from a json dictionary.""" args = {} if 'request' in _dict: args['request'] = MessageRequest._from_dict(_dict.get('request')) else: raise ValueError( 'Required property \'request\' not present ...
[ "def", "_from_dict", "(", "cls", ",", "_dict", ")", ":", "args", "=", "{", "}", "if", "'request'", "in", "_dict", ":", "args", "[", "'request'", "]", "=", "MessageRequest", ".", "_from_dict", "(", "_dict", ".", "get", "(", "'request'", ")", ")", "els...
Initialize a Log object from a json dictionary.
[ "Initialize", "a", "Log", "object", "from", "a", "json", "dictionary", "." ]
python
train
40.878049
DataDog/integrations-core
docker_daemon/datadog_checks/docker_daemon/docker_daemon.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/docker_daemon/datadog_checks/docker_daemon/docker_daemon.py#L623-L637
def _report_container_count(self, containers_by_id): """Report container count per state""" m_func = FUNC_MAP[GAUGE][self.use_histogram] per_state_count = defaultdict(int) filterlambda = lambda ctr: not self._is_container_excluded(ctr) containers = list(filter(filterlambda, con...
[ "def", "_report_container_count", "(", "self", ",", "containers_by_id", ")", ":", "m_func", "=", "FUNC_MAP", "[", "GAUGE", "]", "[", "self", ".", "use_histogram", "]", "per_state_count", "=", "defaultdict", "(", "int", ")", "filterlambda", "=", "lambda", "ctr"...
Report container count per state
[ "Report", "container", "count", "per", "state" ]
python
train
40.133333
fulfilio/python-magento
magento/sales.py
https://github.com/fulfilio/python-magento/blob/720ec136a6e438a9ee4ee92848a9820b91732750/magento/sales.py#L262-L284
def create(self, order_increment_id, items_qty, comment=None, email=True, include_comment=False): """ Create new shipment for order :param order_increment_id: Order Increment ID :type order_increment_id: str :param items_qty: items qty to ship :type items_qty...
[ "def", "create", "(", "self", ",", "order_increment_id", ",", "items_qty", ",", "comment", "=", "None", ",", "email", "=", "True", ",", "include_comment", "=", "False", ")", ":", "if", "comment", "is", "None", ":", "comment", "=", "''", "return", "self",...
Create new shipment for order :param order_increment_id: Order Increment ID :type order_increment_id: str :param items_qty: items qty to ship :type items_qty: associative array (order_item_id ⇒ qty) as dict :param comment: Shipment Comment :type comment: str :par...
[ "Create", "new", "shipment", "for", "order" ]
python
train
36.521739
TUNE-Archive/freight_forwarder
freight_forwarder/container/container.py
https://github.com/TUNE-Archive/freight_forwarder/blob/6ea4a49f474ec04abb8bb81b175c774a16b5312f/freight_forwarder/container/container.py#L341-L426
def _find_by_id(self, id): """ Expected response: { "Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2", "Created": "2013-05-07T14:51:42.041847+02:00", "Path": "date", "Args": [], ...
[ "def", "_find_by_id", "(", "self", ",", "id", ")", ":", "if", "not", "isinstance", "(", "id", ",", "six", ".", "string_types", ")", ":", "raise", "TypeError", "(", "'must supply a string as the id'", ")", "# TODO: We should probably catch container not found error and...
Expected response: { "Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2", "Created": "2013-05-07T14:51:42.041847+02:00", "Path": "date", "Args": [], "Config": { ...
[ "Expected", "response", ":", "{", "Id", ":", "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2", "Created", ":", "2013", "-", "05", "-", "07T14", ":", "51", ":", "42", ".", "041847", "+", "02", ":", "00", "Path", ":", "date", "Args", ":", "[]...
python
train
42.895349
sassoo/goldman
goldman/resources/model.py
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/resources/model.py#L42-L55
def on_get(resc, req, resp, rid): """ Find the model by id & serialize it back """ signals.pre_req.send(resc.model) signals.pre_req_find.send(resc.model) model = find(resc.model, rid) props = to_rest_model(model, includes=req.includes) resp.last_modified = model.updated resp.serialize(pro...
[ "def", "on_get", "(", "resc", ",", "req", ",", "resp", ",", "rid", ")", ":", "signals", ".", "pre_req", ".", "send", "(", "resc", ".", "model", ")", "signals", ".", "pre_req_find", ".", "send", "(", "resc", ".", "model", ")", "model", "=", "find", ...
Find the model by id & serialize it back
[ "Find", "the", "model", "by", "id", "&", "serialize", "it", "back" ]
python
train
28
twneale/visitors
visitors/ext/pyast.py
https://github.com/twneale/visitors/blob/17a2759fb0ddc0a039cf42e1bbb053295b3b2445/visitors/ext/pyast.py#L26-L55
def from_ast( pyast_node, node=None, node_cls=None, Node=Node, iter_fields=ast.iter_fields, AST=ast.AST): '''Convert the ast tree to a tater tree. ''' node_cls = node_cls or Node node = node or node_cls() name = pyast_node.__class__.__name__ attrs = [] for field, value in it...
[ "def", "from_ast", "(", "pyast_node", ",", "node", "=", "None", ",", "node_cls", "=", "None", ",", "Node", "=", "Node", ",", "iter_fields", "=", "ast", ".", "iter_fields", ",", "AST", "=", "ast", ".", "AST", ")", ":", "node_cls", "=", "node_cls", "or...
Convert the ast tree to a tater tree.
[ "Convert", "the", "ast", "tree", "to", "a", "tater", "tree", "." ]
python
train
36.1
log2timeline/dftimewolf
dftimewolf/config.py
https://github.com/log2timeline/dftimewolf/blob/45f898476a288d73c4256ae8e3836a2a4848c0d7/dftimewolf/config.py#L19-L33
def get_extra(cls, name=None): """Gets extra configuration parameters. These parameters should be loaded through load_extra or load_extra_data. Args: name: str, the name of the configuration data to load. Returns: A dictionary containing the requested configuration data. None if dat...
[ "def", "get_extra", "(", "cls", ",", "name", "=", "None", ")", ":", "if", "not", "name", ":", "return", "cls", ".", "_extra_config", "return", "cls", ".", "_extra_config", ".", "get", "(", "name", ",", "None", ")" ]
Gets extra configuration parameters. These parameters should be loaded through load_extra or load_extra_data. Args: name: str, the name of the configuration data to load. Returns: A dictionary containing the requested configuration data. None if data was never loaded under that name.
[ "Gets", "extra", "configuration", "parameters", "." ]
python
train
29.466667
juju/python-libjuju
juju/model.py
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/model.py#L343-L355
def previous(self): """Return a copy of this object as was at its previous state in history. Returns None if this object is new (and therefore has no history). The returned object is always "disconnected", i.e. does not receive live updates. """ return self.mod...
[ "def", "previous", "(", "self", ")", ":", "return", "self", ".", "model", ".", "state", ".", "get_entity", "(", "self", ".", "entity_type", ",", "self", ".", "entity_id", ",", "self", ".", "_history_index", "-", "1", ",", "connected", "=", "False", ")"...
Return a copy of this object as was at its previous state in history. Returns None if this object is new (and therefore has no history). The returned object is always "disconnected", i.e. does not receive live updates.
[ "Return", "a", "copy", "of", "this", "object", "as", "was", "at", "its", "previous", "state", "in", "history", "." ]
python
train
32.923077
spyder-ide/spyder
spyder/plugins/plots/widgets/figurebrowser.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L878-L885
def blink_figure(self): """Blink figure once.""" if self.fig: self._blink_flag = not self._blink_flag self.repaint() if self._blink_flag: timer = QTimer() timer.singleShot(40, self.blink_figure)
[ "def", "blink_figure", "(", "self", ")", ":", "if", "self", ".", "fig", ":", "self", ".", "_blink_flag", "=", "not", "self", ".", "_blink_flag", "self", ".", "repaint", "(", ")", "if", "self", ".", "_blink_flag", ":", "timer", "=", "QTimer", "(", ")"...
Blink figure once.
[ "Blink", "figure", "once", "." ]
python
train
33.875
ihgazni2/elist
elist/elist.py
https://github.com/ihgazni2/elist/blob/8c07b5029bda34ead60ce10335ceb145f209263c/elist/elist.py#L4179-L4191
def select_loose_in(pl,k): ''' pl = ['bcd','xabcxx','x','y'] select_loose_in(pl,'abc') ''' def cond_func(ele,index,k): if(type(ele) == type([])): cond = loose_in(ele,k) else: cond = (k in ele) return(cond) arr = cond_select_values_all2(pl,c...
[ "def", "select_loose_in", "(", "pl", ",", "k", ")", ":", "def", "cond_func", "(", "ele", ",", "index", ",", "k", ")", ":", "if", "(", "type", "(", "ele", ")", "==", "type", "(", "[", "]", ")", ")", ":", "cond", "=", "loose_in", "(", "ele", ",...
pl = ['bcd','xabcxx','x','y'] select_loose_in(pl,'abc')
[ "pl", "=", "[", "bcd", "xabcxx", "x", "y", "]", "select_loose_in", "(", "pl", "abc", ")" ]
python
valid
28
pycontribs/pyrax
pyrax/base_identity.py
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/base_identity.py#L1058-L1077
def list_roles(self, service_id=None, limit=None, marker=None): """ Returns a list of all global roles for users, optionally limited by service. Pagination can be handled through the standard 'limit' and 'marker' parameters. """ uri = "OS-KSADM/roles" pagination_i...
[ "def", "list_roles", "(", "self", ",", "service_id", "=", "None", ",", "limit", "=", "None", ",", "marker", "=", "None", ")", ":", "uri", "=", "\"OS-KSADM/roles\"", "pagination_items", "=", "[", "]", "if", "service_id", "is", "not", "None", ":", "paginat...
Returns a list of all global roles for users, optionally limited by service. Pagination can be handled through the standard 'limit' and 'marker' parameters.
[ "Returns", "a", "list", "of", "all", "global", "roles", "for", "users", "optionally", "limited", "by", "service", ".", "Pagination", "can", "be", "handled", "through", "the", "standard", "limit", "and", "marker", "parameters", "." ]
python
train
42.2
sdispater/poetry
get-poetry.py
https://github.com/sdispater/poetry/blob/2d27acd76c165dd49f11934520a7973de7a3762a/get-poetry.py#L466-L490
def make_lib(self, version): """ Packs everything into a single lib/ directory. """ if os.path.exists(POETRY_LIB_BACKUP): shutil.rmtree(POETRY_LIB_BACKUP) # Backup the current installation if os.path.exists(POETRY_LIB): shutil.copytree(POETRY_LIB,...
[ "def", "make_lib", "(", "self", ",", "version", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "POETRY_LIB_BACKUP", ")", ":", "shutil", ".", "rmtree", "(", "POETRY_LIB_BACKUP", ")", "# Backup the current installation", "if", "os", ".", "path", ".", ...
Packs everything into a single lib/ directory.
[ "Packs", "everything", "into", "a", "single", "lib", "/", "directory", "." ]
python
train
29.8
inveniosoftware/invenio-accounts
invenio_accounts/admin.py
https://github.com/inveniosoftware/invenio-accounts/blob/b0d2f0739b00dbefea22ca15d7d374a1b4a63aec/invenio_accounts/admin.py#L193-L199
def delete_model(self, model): """Delete a specific session.""" if SessionActivity.is_current(sid_s=model.sid_s): flash('You could not remove your current session', 'error') return delete_session(sid_s=model.sid_s) db.session.commit()
[ "def", "delete_model", "(", "self", ",", "model", ")", ":", "if", "SessionActivity", ".", "is_current", "(", "sid_s", "=", "model", ".", "sid_s", ")", ":", "flash", "(", "'You could not remove your current session'", ",", "'error'", ")", "return", "delete_sessio...
Delete a specific session.
[ "Delete", "a", "specific", "session", "." ]
python
train
40.571429
julienc91/utools
utools/files.py
https://github.com/julienc91/utools/blob/6b2f18a5cb30a9349ba25a20c720c737f0683099/utools/files.py#L39-L65
def read_mutiple_items(f, container_type, item_type, separator=" "): """ Extract an iterable from the current line of a file-like object. Args: f (file): the file-like object to read from container_type (type): type of the iterable that will be returned item_type (type): type of the va...
[ "def", "read_mutiple_items", "(", "f", ",", "container_type", ",", "item_type", ",", "separator", "=", "\" \"", ")", ":", "return", "__read", "(", "f", ",", "lambda", "line", ":", "container_type", "(", "item_type", "(", "item", ")", "for", "item", "in", ...
Extract an iterable from the current line of a file-like object. Args: f (file): the file-like object to read from container_type (type): type of the iterable that will be returned item_type (type): type of the values that will be elements of the returned iterable separator (str): t...
[ "Extract", "an", "iterable", "from", "the", "current", "line", "of", "a", "file", "-", "like", "object", "." ]
python
train
40.037037
wakatime/wakatime
wakatime/packages/pygments/formatters/img.py
https://github.com/wakatime/wakatime/blob/74519ace04e8472f3a3993269963732b9946a01d/wakatime/packages/pygments/formatters/img.py#L500-L509
def _draw_line_numbers(self): """ Create drawables for the line numbers. """ if not self.line_numbers: return for p in xrange(self.maxlineno): n = p + self.line_number_start if (n % self.line_number_step) == 0: self._draw_linenu...
[ "def", "_draw_line_numbers", "(", "self", ")", ":", "if", "not", "self", ".", "line_numbers", ":", "return", "for", "p", "in", "xrange", "(", "self", ".", "maxlineno", ")", ":", "n", "=", "p", "+", "self", ".", "line_number_start", "if", "(", "n", "%...
Create drawables for the line numbers.
[ "Create", "drawables", "for", "the", "line", "numbers", "." ]
python
train
32.1
inveniosoftware-contrib/invenio-groups
invenio_groups/models.py
https://github.com/inveniosoftware-contrib/invenio-groups/blob/109481d6b02701db00b72223dd4a65e167c589a6/invenio_groups/models.py#L755-L763
def get(cls, group, admin): """Get specific GroupAdmin object.""" try: ga = cls.query.filter_by( group=group, admin_id=admin.get_id(), admin_type=resolve_admin_type(admin)).one() return ga except Exception: return None
[ "def", "get", "(", "cls", ",", "group", ",", "admin", ")", ":", "try", ":", "ga", "=", "cls", ".", "query", ".", "filter_by", "(", "group", "=", "group", ",", "admin_id", "=", "admin", ".", "get_id", "(", ")", ",", "admin_type", "=", "resolve_admin...
Get specific GroupAdmin object.
[ "Get", "specific", "GroupAdmin", "object", "." ]
python
valid
33.555556
praekeltfoundation/marathon-acme
marathon_acme/service.py
https://github.com/praekeltfoundation/marathon-acme/blob/b1b71e3dde0ba30e575089280658bd32890e3325/marathon_acme/service.py#L135-L155
def sync(self): """ Fetch the list of apps from Marathon, find the domains that require certificates, and issue certificates for any domains that don't already have a certificate. """ self.log.info('Starting a sync...') def log_success(result): self.l...
[ "def", "sync", "(", "self", ")", ":", "self", ".", "log", ".", "info", "(", "'Starting a sync...'", ")", "def", "log_success", "(", "result", ")", ":", "self", ".", "log", ".", "info", "(", "'Sync completed successfully'", ")", "return", "result", "def", ...
Fetch the list of apps from Marathon, find the domains that require certificates, and issue certificates for any domains that don't already have a certificate.
[ "Fetch", "the", "list", "of", "apps", "from", "Marathon", "find", "the", "domains", "that", "require", "certificates", "and", "issue", "certificates", "for", "any", "domains", "that", "don", "t", "already", "have", "a", "certificate", "." ]
python
valid
36.095238
frostming/atoml
atoml/decoder.py
https://github.com/frostming/atoml/blob/85414ef77777366887a819a05b496d5279296cd2/atoml/decoder.py#L28-L35
def contains_list(longer, shorter): """Check if longer list starts with shorter list""" if len(longer) <= len(shorter): return False for a, b in zip(shorter, longer): if a != b: return False return True
[ "def", "contains_list", "(", "longer", ",", "shorter", ")", ":", "if", "len", "(", "longer", ")", "<=", "len", "(", "shorter", ")", ":", "return", "False", "for", "a", ",", "b", "in", "zip", "(", "shorter", ",", "longer", ")", ":", "if", "a", "!=...
Check if longer list starts with shorter list
[ "Check", "if", "longer", "list", "starts", "with", "shorter", "list" ]
python
train
29.875
apache/airflow
airflow/jobs.py
https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/jobs.py#L2071-L2101
def _task_instances_for_dag_run(self, dag_run, session=None): """ Returns a map of task instance key to task instance object for the tasks to run in the given dag run. :param dag_run: the dag run to get the tasks from :type dag_run: airflow.models.DagRun :param session: ...
[ "def", "_task_instances_for_dag_run", "(", "self", ",", "dag_run", ",", "session", "=", "None", ")", ":", "tasks_to_run", "=", "{", "}", "if", "dag_run", "is", "None", ":", "return", "tasks_to_run", "# check if we have orphaned tasks", "self", ".", "reset_state_fo...
Returns a map of task instance key to task instance object for the tasks to run in the given dag run. :param dag_run: the dag run to get the tasks from :type dag_run: airflow.models.DagRun :param session: the database session object :type session: sqlalchemy.orm.session.Session
[ "Returns", "a", "map", "of", "task", "instance", "key", "to", "task", "instance", "object", "for", "the", "tasks", "to", "run", "in", "the", "given", "dag", "run", "." ]
python
test
37.064516
cltk/cltk
cltk/corpus/arabic/utils/pyarabic/araby.py
https://github.com/cltk/cltk/blob/ed9c025b7ec43c949481173251b70e05e4dffd27/cltk/corpus/arabic/utils/pyarabic/araby.py#L904-L945
def waznlike(word1, wazn): """If the word1 is like a wazn (pattern), the letters must be equal, the wazn has FEH, AIN, LAM letters. this are as generic letters. The two words can be full vocalized, or partial vocalized @param word1: input word @type word1: unicode @param wazn: given...
[ "def", "waznlike", "(", "word1", ",", "wazn", ")", ":", "stack1", "=", "stack", ".", "Stack", "(", "word1", ")", "stack2", "=", "stack", ".", "Stack", "(", "wazn", ")", "root", "=", "stack", ".", "Stack", "(", ")", "last1", "=", "stack1", ".", "p...
If the word1 is like a wazn (pattern), the letters must be equal, the wazn has FEH, AIN, LAM letters. this are as generic letters. The two words can be full vocalized, or partial vocalized @param word1: input word @type word1: unicode @param wazn: given word template وزن @type wazn...
[ "If", "the", "word1", "is", "like", "a", "wazn", "(", "pattern", ")", "the", "letters", "must", "be", "equal", "the", "wazn", "has", "FEH", "AIN", "LAM", "letters", ".", "this", "are", "as", "generic", "letters", ".", "The", "two", "words", "can", "b...
python
train
32
Microsoft/LightGBM
python-package/lightgbm/plotting.py
https://github.com/Microsoft/LightGBM/blob/8d2ec69f4f685b0ab1c4624d59ee2d3287bb3147/python-package/lightgbm/plotting.py#L30-L141
def plot_importance(booster, ax=None, height=0.2, xlim=None, ylim=None, title='Feature importance', xlabel='Feature importance', ylabel='Features', importance_type='split', max_num_features=None, ignore_zero=True, figsize=None, grid=True, ...
[ "def", "plot_importance", "(", "booster", ",", "ax", "=", "None", ",", "height", "=", "0.2", ",", "xlim", "=", "None", ",", "ylim", "=", "None", ",", "title", "=", "'Feature importance'", ",", "xlabel", "=", "'Feature importance'", ",", "ylabel", "=", "'...
Plot model's feature importances. Parameters ---------- booster : Booster or LGBMModel Booster or LGBMModel instance which feature importance should be plotted. ax : matplotlib.axes.Axes or None, optional (default=None) Target axes instance. If None, new figure and axes will be ...
[ "Plot", "model", "s", "feature", "importances", "." ]
python
train
36.767857
inasafe/inasafe
safe/gui/tools/help/metadata_converter_help.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/help/metadata_converter_help.py#L19-L31
def metadata_converter_help(): """Help message for metadata converter Dialog. .. versionadded:: 4.3 :returns: A message object containing helpful information. :rtype: messaging.message.Message """ message = m.Message() message.add(m.Brand()) message.add(heading()) message.add(conte...
[ "def", "metadata_converter_help", "(", ")", ":", "message", "=", "m", ".", "Message", "(", ")", "message", ".", "add", "(", "m", ".", "Brand", "(", ")", ")", "message", ".", "add", "(", "heading", "(", ")", ")", "message", ".", "add", "(", "content...
Help message for metadata converter Dialog. .. versionadded:: 4.3 :returns: A message object containing helpful information. :rtype: messaging.message.Message
[ "Help", "message", "for", "metadata", "converter", "Dialog", "." ]
python
train
25.538462
pygobject/pgi
pgi/overrides/Gtk.py
https://github.com/pygobject/pgi/blob/2090435df6241a15ec2a78379a36b738b728652c/pgi/overrides/Gtk.py#L1625-L1630
def get_previous(self): """Returns the previous :obj:`Gtk.TreeModelRow` or None""" prev_iter = self.model.iter_previous(self.iter) if prev_iter: return TreeModelRow(self.model, prev_iter)
[ "def", "get_previous", "(", "self", ")", ":", "prev_iter", "=", "self", ".", "model", ".", "iter_previous", "(", "self", ".", "iter", ")", "if", "prev_iter", ":", "return", "TreeModelRow", "(", "self", ".", "model", ",", "prev_iter", ")" ]
Returns the previous :obj:`Gtk.TreeModelRow` or None
[ "Returns", "the", "previous", ":", "obj", ":", "Gtk", ".", "TreeModelRow", "or", "None" ]
python
train
36.5
DLR-RM/RAFCON
source/rafcon/gui/models/auto_backup.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/models/auto_backup.py#L398-L401
def write_backup_meta_data(self): """Write the auto backup meta data into the current tmp-storage path""" auto_backup_meta_file = os.path.join(self._tmp_storage_path, FILE_NAME_AUTO_BACKUP) storage.storage_utils.write_dict_to_json(self.meta, auto_backup_meta_file)
[ "def", "write_backup_meta_data", "(", "self", ")", ":", "auto_backup_meta_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_tmp_storage_path", ",", "FILE_NAME_AUTO_BACKUP", ")", "storage", ".", "storage_utils", ".", "write_dict_to_json", "(", "self",...
Write the auto backup meta data into the current tmp-storage path
[ "Write", "the", "auto", "backup", "meta", "data", "into", "the", "current", "tmp", "-", "storage", "path" ]
python
train
71.25
numenta/htmresearch
projects/sequence_prediction/reberGrammar/reberSequencePrediction_LSTM.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/projects/sequence_prediction/reberGrammar/reberSequencePrediction_LSTM.py#L161-L199
def runExperiment(): """ Experiment 1: Calculate error rate as a function of training sequence numbers :return: """ trainSeqN = [5, 10, 20, 50, 100, 200] rptPerCondition = 5 correctRateAll = np.zeros((len(trainSeqN), rptPerCondition)) missRateAll = np.zeros((len(trainSeqN), rptPerCondition)) fpRateAll...
[ "def", "runExperiment", "(", ")", ":", "trainSeqN", "=", "[", "5", ",", "10", ",", "20", ",", "50", ",", "100", ",", "200", "]", "rptPerCondition", "=", "5", "correctRateAll", "=", "np", ".", "zeros", "(", "(", "len", "(", "trainSeqN", ")", ",", ...
Experiment 1: Calculate error rate as a function of training sequence numbers :return:
[ "Experiment", "1", ":", "Calculate", "error", "rate", "as", "a", "function", "of", "training", "sequence", "numbers", ":", "return", ":" ]
python
train
38.282051
bitesofcode/projexui
projexui/widgets/xchartwidget/xchartscene.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xchartwidget/xchartscene.py#L347-L353
def leaveEvent( self, event ): """ Toggles the display for the tracker item. """ item = self.trackerItem() if ( item ): item.setVisible(False)
[ "def", "leaveEvent", "(", "self", ",", "event", ")", ":", "item", "=", "self", ".", "trackerItem", "(", ")", "if", "(", "item", ")", ":", "item", ".", "setVisible", "(", "False", ")" ]
Toggles the display for the tracker item.
[ "Toggles", "the", "display", "for", "the", "tracker", "item", "." ]
python
train
27.714286
boriel/zxbasic
arch/zx48k/backend/__8bit.py
https://github.com/boriel/zxbasic/blob/23b28db10e41117805bdb3c0f78543590853b132/arch/zx48k/backend/__8bit.py#L521-L533
def _gtu8(ins): """ Compares & pops top 2 operands out of the stack, and checks if the 1st operand > 2nd operand (top of the stack). Pushes 0 if False, 1 if True. 8 bit unsigned version """ output = _8bit_oper(ins.quad[2], ins.quad[3], reversed_=True) output.append('cp h') o...
[ "def", "_gtu8", "(", "ins", ")", ":", "output", "=", "_8bit_oper", "(", "ins", ".", "quad", "[", "2", "]", ",", "ins", ".", "quad", "[", "3", "]", ",", "reversed_", "=", "True", ")", "output", ".", "append", "(", "'cp h'", ")", "output", ".", "...
Compares & pops top 2 operands out of the stack, and checks if the 1st operand > 2nd operand (top of the stack). Pushes 0 if False, 1 if True. 8 bit unsigned version
[ "Compares", "&", "pops", "top", "2", "operands", "out", "of", "the", "stack", "and", "checks", "if", "the", "1st", "operand", ">", "2nd", "operand", "(", "top", "of", "the", "stack", ")", ".", "Pushes", "0", "if", "False", "1", "if", "True", "." ]
python
train
29.230769