repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
project-rig/rig
rig/machine_control/bmp_controller.py
https://github.com/project-rig/rig/blob/3a3e053d3214899b6d68758685835de0afd5542b/rig/machine_control/bmp_controller.py#L125-L145
def send_scp(self, *args, **kwargs): """Transmit an SCP Packet to a specific board. Automatically determines the appropriate connection to use. See the arguments for :py:meth:`~rig.machine_control.scp_connection.SCPConnection` for details. Parameters ----------...
[ "def", "send_scp", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Retrieve contextual arguments from the keyword arguments. The", "# context system ensures that these values are present.", "cabinet", "=", "kwargs", ".", "pop", "(", "\"cabinet\"", ")...
Transmit an SCP Packet to a specific board. Automatically determines the appropriate connection to use. See the arguments for :py:meth:`~rig.machine_control.scp_connection.SCPConnection` for details. Parameters ---------- cabinet : int frame : int ...
[ "Transmit", "an", "SCP", "Packet", "to", "a", "specific", "board", "." ]
python
train
DataDog/integrations-core
ntp/datadog_checks/ntp/ntp.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/ntp/datadog_checks/ntp/ntp.py#L23-L36
def _get_service_port(self, instance): """ Get the ntp server port """ host = instance.get('host', DEFAULT_HOST) port = instance.get('port', DEFAULT_PORT) # default port is the name of the service but lookup would fail # if the /etc/services file is missing. In th...
[ "def", "_get_service_port", "(", "self", ",", "instance", ")", ":", "host", "=", "instance", ".", "get", "(", "'host'", ",", "DEFAULT_HOST", ")", "port", "=", "instance", ".", "get", "(", "'port'", ",", "DEFAULT_PORT", ")", "# default port is the name of the s...
Get the ntp server port
[ "Get", "the", "ntp", "server", "port" ]
python
train
eruvanos/openbrokerapi
openbrokerapi/service_broker.py
https://github.com/eruvanos/openbrokerapi/blob/29d514e5932f2eac27e03995dd41c8cecf40bb10/openbrokerapi/service_broker.py#L296-L306
def update(self, instance_id: str, details: UpdateDetails, async_allowed: bool) -> UpdateServiceSpec: """ Further readings `CF Broker API#Update <https://docs.cloudfoundry.org/services/api.html#updating_service_instance>`_ :param instance_id: Instance id provided by the platform :param ...
[ "def", "update", "(", "self", ",", "instance_id", ":", "str", ",", "details", ":", "UpdateDetails", ",", "async_allowed", ":", "bool", ")", "->", "UpdateServiceSpec", ":", "raise", "NotImplementedError", "(", ")" ]
Further readings `CF Broker API#Update <https://docs.cloudfoundry.org/services/api.html#updating_service_instance>`_ :param instance_id: Instance id provided by the platform :param details: Details about the service to update :param async_allowed: Client allows async creation :rtype: Up...
[ "Further", "readings", "CF", "Broker", "API#Update", "<https", ":", "//", "docs", ".", "cloudfoundry", ".", "org", "/", "services", "/", "api", ".", "html#updating_service_instance", ">", "_" ]
python
train
gwastro/pycbc-glue
pycbc_glue/segments.py
https://github.com/gwastro/pycbc-glue/blob/a3e906bae59fbfd707c3ff82e5d008d939ec5e24/pycbc_glue/segments.py#L1141-L1152
def all_intersects_all(self, other): """ Returns True if self and other have the same keys, and each segmentlist intersects the corresponding segmentlist in the other; returns False if this is not the case or if either dictionary is empty. See also: .intersects(), .all_intersects(), .intersects_all() ...
[ "def", "all_intersects_all", "(", "self", ",", "other", ")", ":", "return", "set", "(", "self", ")", "==", "set", "(", "other", ")", "and", "all", "(", "other", "[", "key", "]", ".", "intersects", "(", "value", ")", "for", "key", ",", "value", "in"...
Returns True if self and other have the same keys, and each segmentlist intersects the corresponding segmentlist in the other; returns False if this is not the case or if either dictionary is empty. See also: .intersects(), .all_intersects(), .intersects_all()
[ "Returns", "True", "if", "self", "and", "other", "have", "the", "same", "keys", "and", "each", "segmentlist", "intersects", "the", "corresponding", "segmentlist", "in", "the", "other", ";", "returns", "False", "if", "this", "is", "not", "the", "case", "or", ...
python
train
openpaperwork/paperwork-backend
paperwork_backend/img/page.py
https://github.com/openpaperwork/paperwork-backend/blob/114b831e94e039e68b339751fd18250877abad76/paperwork_backend/img/page.py#L95-L120
def __get_boxes(self): """ Get all the word boxes of this page. """ boxfile = self.__box_path try: box_builder = pyocr.builders.LineBoxBuilder() with self.fs.open(boxfile, 'r') as file_desc: boxes = box_builder.read_file(file_desc) ...
[ "def", "__get_boxes", "(", "self", ")", ":", "boxfile", "=", "self", ".", "__box_path", "try", ":", "box_builder", "=", "pyocr", ".", "builders", ".", "LineBoxBuilder", "(", ")", "with", "self", ".", "fs", ".", "open", "(", "boxfile", ",", "'r'", ")", ...
Get all the word boxes of this page.
[ "Get", "all", "the", "word", "boxes", "of", "this", "page", "." ]
python
train
jantman/awslimitchecker
awslimitchecker/services/elb.py
https://github.com/jantman/awslimitchecker/blob/e50197f70f3d0abcc5cfc7fde6336f548b790e34/awslimitchecker/services/elb.py#L225-L249
def _update_usage_for_nlb(self, conn, nlb_arn, nlb_name): """ Update usage for a single NLB. :param conn: elbv2 API connection :type conn: :py:class:`ElasticLoadBalancing.Client` :param nlb_arn: Load Balancer ARN :type nlb_arn: str :param nlb_name: Load Balancer ...
[ "def", "_update_usage_for_nlb", "(", "self", ",", "conn", ",", "nlb_arn", ",", "nlb_name", ")", ":", "logger", ".", "debug", "(", "'Updating usage for NLB %s'", ",", "nlb_arn", ")", "listeners", "=", "paginate_dict", "(", "conn", ".", "describe_listeners", ",", ...
Update usage for a single NLB. :param conn: elbv2 API connection :type conn: :py:class:`ElasticLoadBalancing.Client` :param nlb_arn: Load Balancer ARN :type nlb_arn: str :param nlb_name: Load Balancer Name :type nlb_name: str
[ "Update", "usage", "for", "a", "single", "NLB", "." ]
python
train
mohamedattahri/PyXMLi
pyxmli/__init__.py
https://github.com/mohamedattahri/PyXMLi/blob/a81a245be822d62f1a20c734ca14b42c786ae81e/pyxmli/__init__.py#L624-L632
def __set_identifier(self, value): ''' Sets the ID of the invoice. @param value:str ''' if not value or not len(value): raise ValueError("Invalid invoice ID") self.__identifier = value
[ "def", "__set_identifier", "(", "self", ",", "value", ")", ":", "if", "not", "value", "or", "not", "len", "(", "value", ")", ":", "raise", "ValueError", "(", "\"Invalid invoice ID\"", ")", "self", ".", "__identifier", "=", "value" ]
Sets the ID of the invoice. @param value:str
[ "Sets", "the", "ID", "of", "the", "invoice", "." ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/zmq/session.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/session.py#L438-L492
def serialize(self, msg, ident=None): """Serialize the message components to bytes. This is roughly the inverse of unserialize. The serialize/unserialize methods work with full message lists, whereas pack/unpack work with the individual message parts in the message list. Parame...
[ "def", "serialize", "(", "self", ",", "msg", ",", "ident", "=", "None", ")", ":", "content", "=", "msg", ".", "get", "(", "'content'", ",", "{", "}", ")", "if", "content", "is", "None", ":", "content", "=", "self", ".", "none", "elif", "isinstance"...
Serialize the message components to bytes. This is roughly the inverse of unserialize. The serialize/unserialize methods work with full message lists, whereas pack/unpack work with the individual message parts in the message list. Parameters ---------- msg : dict or Mes...
[ "Serialize", "the", "message", "components", "to", "bytes", "." ]
python
test
prompt-toolkit/pymux
pymux/client/posix.py
https://github.com/prompt-toolkit/pymux/blob/3f66e62b9de4b2251c7f9afad6c516dc5a30ec67/pymux/client/posix.py#L160-L173
def _process_stdin(self): """ Received data on stdin. Read and send to server. """ with nonblocking(sys.stdin.fileno()): data = self._stdin_reader.read() # Send input in chunks of 4k. step = 4056 for i in range(0, len(data), step): self._s...
[ "def", "_process_stdin", "(", "self", ")", ":", "with", "nonblocking", "(", "sys", ".", "stdin", ".", "fileno", "(", ")", ")", ":", "data", "=", "self", ".", "_stdin_reader", ".", "read", "(", ")", "# Send input in chunks of 4k.", "step", "=", "4056", "f...
Received data on stdin. Read and send to server.
[ "Received", "data", "on", "stdin", ".", "Read", "and", "send", "to", "server", "." ]
python
train
tcalmant/ipopo
pelix/ipopo/handlers/provides.py
https://github.com/tcalmant/ipopo/blob/2f9ae0c44cd9c34ef1a9d50837b3254e75678eb1/pelix/ipopo/handlers/provides.py#L154-L187
def _field_controller_generator(self): """ Generates the methods called by the injected controller """ # Local variable, to avoid messing with "self" stored_instance = self._ipopo_instance def get_value(self, name): # pylint: disable=W0613 """ ...
[ "def", "_field_controller_generator", "(", "self", ")", ":", "# Local variable, to avoid messing with \"self\"", "stored_instance", "=", "self", ".", "_ipopo_instance", "def", "get_value", "(", "self", ",", "name", ")", ":", "# pylint: disable=W0613", "\"\"\"\n R...
Generates the methods called by the injected controller
[ "Generates", "the", "methods", "called", "by", "the", "injected", "controller" ]
python
train
mukulhase/WebWhatsapp-Wrapper
sample/flask/webapi.py
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/81b918ee4e0cd0cb563807a72baa167f670d70cb/sample/flask/webapi.py#L518-L527
def get_unread_messages(): """Get all unread messages""" mark_seen = request.args.get('mark_seen', True) unread_msg = g.driver.get_unread() if mark_seen: for msg in unread_msg: msg.chat.send_seen() return jsonify(unread_msg)
[ "def", "get_unread_messages", "(", ")", ":", "mark_seen", "=", "request", ".", "args", ".", "get", "(", "'mark_seen'", ",", "True", ")", "unread_msg", "=", "g", ".", "driver", ".", "get_unread", "(", ")", "if", "mark_seen", ":", "for", "msg", "in", "un...
Get all unread messages
[ "Get", "all", "unread", "messages" ]
python
train
numenta/nupic
examples/opf/experiments/missing_record/make_datasets.py
https://github.com/numenta/nupic/blob/5922fafffdccc8812e72b3324965ad2f7d4bbdad/examples/opf/experiments/missing_record/make_datasets.py#L35-L110
def _generateSimple(filename="simple.csv", numSequences=1, elementsPerSeq=3, numRepeats=10): """ Generate a simple dataset. This contains a bunch of non-overlapping sequences. At the end of the dataset, we introduce missing records so that test code can insure that the model didn't get ...
[ "def", "_generateSimple", "(", "filename", "=", "\"simple.csv\"", ",", "numSequences", "=", "1", ",", "elementsPerSeq", "=", "3", ",", "numRepeats", "=", "10", ")", ":", "# Create the output file", "scriptDir", "=", "os", ".", "path", ".", "dirname", "(", "_...
Generate a simple dataset. This contains a bunch of non-overlapping sequences. At the end of the dataset, we introduce missing records so that test code can insure that the model didn't get confused by them. Parameters: ---------------------------------------------------- filename: name of the...
[ "Generate", "a", "simple", "dataset", ".", "This", "contains", "a", "bunch", "of", "non", "-", "overlapping", "sequences", ".", "At", "the", "end", "of", "the", "dataset", "we", "introduce", "missing", "records", "so", "that", "test", "code", "can", "insur...
python
valid
NetEaseGame/ATX
atx/cmds/tkgui.py
https://github.com/NetEaseGame/ATX/blob/f4415c57b45cb0730e08899cbc92a2af1c047ffb/atx/cmds/tkgui.py#L41-L58
def insert_code(filename, code, save=True, marker='# ATX CODE END'): """ Auto append code """ content = '' found = False for line in open(filename, 'rb'): if not found and line.strip() == marker: found = True cnt = line.find(marker) content += line[:cnt] + cod...
[ "def", "insert_code", "(", "filename", ",", "code", ",", "save", "=", "True", ",", "marker", "=", "'# ATX CODE END'", ")", ":", "content", "=", "''", "found", "=", "False", "for", "line", "in", "open", "(", "filename", ",", "'rb'", ")", ":", "if", "n...
Auto append code
[ "Auto", "append", "code" ]
python
train
hydraplatform/hydra-base
hydra_base/db/model.py
https://github.com/hydraplatform/hydra-base/blob/9251ff7946505f7a272c87837390acd1c435bc6e/hydra_base/db/model.py#L909-L928
def add_group(self, name, desc, status): """ Add a new group to a network. """ existing_group = get_session().query(ResourceGroup).filter(ResourceGroup.name==name, ResourceGroup.network_id==self.id).first() if existing_group is not None: raise HydraError("A resou...
[ "def", "add_group", "(", "self", ",", "name", ",", "desc", ",", "status", ")", ":", "existing_group", "=", "get_session", "(", ")", ".", "query", "(", "ResourceGroup", ")", ".", "filter", "(", "ResourceGroup", ".", "name", "==", "name", ",", "ResourceGro...
Add a new group to a network.
[ "Add", "a", "new", "group", "to", "a", "network", "." ]
python
train
saltstack/salt
salt/modules/xml.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/xml.py#L85-L103
def set_attribute(file, element, key, value): ''' Set the requested attribute key and value for matched xpath element. CLI Example: .. code-block:: bash salt '*' xml.set_attribute /tmp/test.xml ".//element[@id='3']" editedby "gal" ''' try: root = ET.parse(file) element...
[ "def", "set_attribute", "(", "file", ",", "element", ",", "key", ",", "value", ")", ":", "try", ":", "root", "=", "ET", ".", "parse", "(", "file", ")", "element", "=", "root", ".", "find", "(", "element", ")", "except", "AttributeError", ":", "log", ...
Set the requested attribute key and value for matched xpath element. CLI Example: .. code-block:: bash salt '*' xml.set_attribute /tmp/test.xml ".//element[@id='3']" editedby "gal"
[ "Set", "the", "requested", "attribute", "key", "and", "value", "for", "matched", "xpath", "element", "." ]
python
train
mcocdawc/chemcoord
src/chemcoord/internal_coordinates/_zmat_class_core.py
https://github.com/mcocdawc/chemcoord/blob/95561ce387c142227c38fb14a1d182179aef8f5f/src/chemcoord/internal_coordinates/_zmat_class_core.py#L663-L778
def get_grad_cartesian(self, as_function=True, chain=True, drop_auto_dummies=True): r"""Return the gradient for the transformation to a Cartesian. If ``as_function`` is True, a function is returned that can be directly applied onto instances of :class:`~Zmat`, which c...
[ "def", "get_grad_cartesian", "(", "self", ",", "as_function", "=", "True", ",", "chain", "=", "True", ",", "drop_auto_dummies", "=", "True", ")", ":", "zmat", "=", "self", ".", "change_numbering", "(", ")", "c_table", "=", "zmat", ".", "loc", "[", ":", ...
r"""Return the gradient for the transformation to a Cartesian. If ``as_function`` is True, a function is returned that can be directly applied onto instances of :class:`~Zmat`, which contain the applied distortions in Zmatrix space. In this case the user does not have to worry about ind...
[ "r", "Return", "the", "gradient", "for", "the", "transformation", "to", "a", "Cartesian", "." ]
python
train
jstitch/MambuPy
MambuPy/rest/mambustruct.py
https://github.com/jstitch/MambuPy/blob/2af98cc12e7ed5ec183b3e97644e880e70b79ee8/MambuPy/rest/mambustruct.py#L837-L878
def setCustomField(mambuentity, customfield="", *args, **kwargs): """Modifies the customField field for the given object with something related to the value of the given field. If the dataType == "USER_LINK" then instead of using the value of the CF, it will be a MambuUser object. Same if dataType...
[ "def", "setCustomField", "(", "mambuentity", ",", "customfield", "=", "\"\"", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "from", ".", "import", "mambuuser", "from", ".", "import", "mambuclient", "try", ":", "customFieldValue", "=", "mambuentity", ...
Modifies the customField field for the given object with something related to the value of the given field. If the dataType == "USER_LINK" then instead of using the value of the CF, it will be a MambuUser object. Same if dataType == "CLIENT_LINK", but with a MambuClient. Default case: just uses t...
[ "Modifies", "the", "customField", "field", "for", "the", "given", "object", "with", "something", "related", "to", "the", "value", "of", "the", "given", "field", "." ]
python
train
neurosynth/neurosynth
neurosynth/analysis/decode.py
https://github.com/neurosynth/neurosynth/blob/948ce7edce15d7df693446e76834e0c23bfe8f11/neurosynth/analysis/decode.py#L216-L219
def _dot_product(self, imgs_to_decode): """ Decoding using the dot product. """ return np.dot(imgs_to_decode.T, self.feature_images).T
[ "def", "_dot_product", "(", "self", ",", "imgs_to_decode", ")", ":", "return", "np", ".", "dot", "(", "imgs_to_decode", ".", "T", ",", "self", ".", "feature_images", ")", ".", "T" ]
Decoding using the dot product.
[ "Decoding", "using", "the", "dot", "product", "." ]
python
test
NoviceLive/pat
pat/utils.py
https://github.com/NoviceLive/pat/blob/bd223fc5e758213662befbebdf9538f3fbf58ad6/pat/utils.py#L49-L57
def window(seq, count=2): """Slide window.""" iseq = iter(seq) result = tuple(islice(iseq, count)) if len(result) == count: yield result for elem in iseq: result = result[1:] + (elem,) yield result
[ "def", "window", "(", "seq", ",", "count", "=", "2", ")", ":", "iseq", "=", "iter", "(", "seq", ")", "result", "=", "tuple", "(", "islice", "(", "iseq", ",", "count", ")", ")", "if", "len", "(", "result", ")", "==", "count", ":", "yield", "resu...
Slide window.
[ "Slide", "window", "." ]
python
train
edx/edx-enterprise
enterprise/utils.py
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/utils.py#L715-L730
def is_course_run_enrollable(course_run): """ Return true if the course run is enrollable, false otherwise. We look for the following criteria: - end is greater than now OR null - enrollment_start is less than now OR null - enrollment_end is greater than now OR null """ now = datetime.d...
[ "def", "is_course_run_enrollable", "(", "course_run", ")", ":", "now", "=", "datetime", ".", "datetime", ".", "now", "(", "pytz", ".", "UTC", ")", "end", "=", "parse_datetime_handle_invalid", "(", "course_run", ".", "get", "(", "'end'", ")", ")", "enrollment...
Return true if the course run is enrollable, false otherwise. We look for the following criteria: - end is greater than now OR null - enrollment_start is less than now OR null - enrollment_end is greater than now OR null
[ "Return", "true", "if", "the", "course", "run", "is", "enrollable", "false", "otherwise", "." ]
python
valid
tchellomello/python-amcrest
src/amcrest/ptz.py
https://github.com/tchellomello/python-amcrest/blob/ed842139e234de2eaf6ee8fb480214711cde1249/src/amcrest/ptz.py#L210-L221
def go_to_preset(self, action=None, channel=0, preset_point_number=1): """ Params: action - start or stop channel - channel number preset_point_number - preset point number """ ret = self.command( 'ptz.cgi?action={0...
[ "def", "go_to_preset", "(", "self", ",", "action", "=", "None", ",", "channel", "=", "0", ",", "preset_point_number", "=", "1", ")", ":", "ret", "=", "self", ".", "command", "(", "'ptz.cgi?action={0}&channel={1}&code=GotoPreset&arg1=0'", "'&arg2={2}&arg3=0'", ".",...
Params: action - start or stop channel - channel number preset_point_number - preset point number
[ "Params", ":", "action", "-", "start", "or", "stop", "channel", "-", "channel", "number", "preset_point_number", "-", "preset", "point", "number" ]
python
train
jedie/django-cms-tools
django_cms_tools/fixture_helper/pages.py
https://github.com/jedie/django-cms-tools/blob/0a70dbbb6f770f5a73c8ecd174d5559a37262792/django_cms_tools/fixture_helper/pages.py#L47-L60
def publish_page(page, languages): """ Publish a CMS page in all given languages. """ for language_code, lang_name in iter_languages(languages): url = page.get_absolute_url() if page.publisher_is_draft: page.publish(language_code) log.info('page "%s" published in...
[ "def", "publish_page", "(", "page", ",", "languages", ")", ":", "for", "language_code", ",", "lang_name", "in", "iter_languages", "(", "languages", ")", ":", "url", "=", "page", ".", "get_absolute_url", "(", ")", "if", "page", ".", "publisher_is_draft", ":",...
Publish a CMS page in all given languages.
[ "Publish", "a", "CMS", "page", "in", "all", "given", "languages", "." ]
python
train
genepattern/genepattern-notebook
genepattern/remote_widgets.py
https://github.com/genepattern/genepattern-notebook/blob/953168bd08c5332412438cbc5bb59993a07a6911/genepattern/remote_widgets.py#L23-L51
def register(self, server, username, password): """ Register a new GenePattern server session for the provided server, username and password. Return the session. :param server: :param username: :param password: :return: """ # Create the session ...
[ "def", "register", "(", "self", ",", "server", ",", "username", ",", "password", ")", ":", "# Create the session", "session", "=", "gp", ".", "GPServer", "(", "server", ",", "username", ",", "password", ")", "# Validate username if not empty", "valid_username", ...
Register a new GenePattern server session for the provided server, username and password. Return the session. :param server: :param username: :param password: :return:
[ "Register", "a", "new", "GenePattern", "server", "session", "for", "the", "provided", "server", "username", "and", "password", ".", "Return", "the", "session", ".", ":", "param", "server", ":", ":", "param", "username", ":", ":", "param", "password", ":", ...
python
valid
python-cmd2/cmd2
cmd2/cmd2.py
https://github.com/python-cmd2/cmd2/blob/b22c0bd891ed08c8b09df56df9d91f48166a5e2a/cmd2/cmd2.py#L194-L241
def with_argparser_and_unknown_args(argparser: argparse.ArgumentParser, preserve_quotes: bool = False) -> \ Callable[[argparse.Namespace, List], Optional[bool]]: """A decorator to alter a cmd2 method to populate its ``args`` argument by parsing arguments with the given instance of argparse.ArgumentParse...
[ "def", "with_argparser_and_unknown_args", "(", "argparser", ":", "argparse", ".", "ArgumentParser", ",", "preserve_quotes", ":", "bool", "=", "False", ")", "->", "Callable", "[", "[", "argparse", ".", "Namespace", ",", "List", "]", ",", "Optional", "[", "bool"...
A decorator to alter a cmd2 method to populate its ``args`` argument by parsing arguments with the given instance of argparse.ArgumentParser, but also returning unknown args as a list. :param argparser: unique instance of ArgumentParser :param preserve_quotes: if True, then arguments passed to argparse mai...
[ "A", "decorator", "to", "alter", "a", "cmd2", "method", "to", "populate", "its", "args", "argument", "by", "parsing", "arguments", "with", "the", "given", "instance", "of", "argparse", ".", "ArgumentParser", "but", "also", "returning", "unknown", "args", "as",...
python
train
ybrs/pydisque
pydisque/client.py
https://github.com/ybrs/pydisque/blob/ea5ce1576b66398c1cce32cad0f15709b1ea8df8/pydisque/client.py#L402-L415
def show(self, job_id, return_dict=False): """ Describe the job. :param job_id: """ rtn = self.execute_command('SHOW', job_id) if return_dict: grouped = self._grouper(rtn, 2) rtn = dict((a, b) for a, b in grouped) return rtn
[ "def", "show", "(", "self", ",", "job_id", ",", "return_dict", "=", "False", ")", ":", "rtn", "=", "self", ".", "execute_command", "(", "'SHOW'", ",", "job_id", ")", "if", "return_dict", ":", "grouped", "=", "self", ".", "_grouper", "(", "rtn", ",", ...
Describe the job. :param job_id:
[ "Describe", "the", "job", "." ]
python
train
jobovy/galpy
galpy/util/bovy_coords.py
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/util/bovy_coords.py#L1991-L2037
def Rz_to_lambdanu(R,z,ac=5.,Delta=1.): """ NAME: Rz_to_lambdanu PURPOSE: calculate the prolate spheroidal coordinates (lambda,nu) from galactocentric cylindrical coordinates (R,z) by solving eq. (2.2) in Dejonghe & de Zeeuw (1988a) for (lambda,nu): R^2...
[ "def", "Rz_to_lambdanu", "(", "R", ",", "z", ",", "ac", "=", "5.", ",", "Delta", "=", "1.", ")", ":", "g", "=", "Delta", "**", "2", "/", "(", "1.", "-", "ac", "**", "2", ")", "a", "=", "g", "-", "Delta", "**", "2", "term", "=", "R", "**",...
NAME: Rz_to_lambdanu PURPOSE: calculate the prolate spheroidal coordinates (lambda,nu) from galactocentric cylindrical coordinates (R,z) by solving eq. (2.2) in Dejonghe & de Zeeuw (1988a) for (lambda,nu): R^2 = (l+a) * (n+a) / (a-g) z^2 = (l+g) * (...
[ "NAME", ":" ]
python
train
mitsei/dlkit
dlkit/json_/repository/objects.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/objects.py#L948-L960
def clear_distribute_compositions(self): """Removes the distribution rights. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Implemented from temp...
[ "def", "clear_distribute_compositions", "(", "self", ")", ":", "# Implemented from template for osid.resource.ResourceForm.clear_group_template", "if", "(", "self", ".", "get_distribute_compositions_metadata", "(", ")", ".", "is_read_only", "(", ")", "or", "self", ".", "get...
Removes the distribution rights. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.*
[ "Removes", "the", "distribution", "rights", "." ]
python
train
unt-libraries/pyuntl
pyuntl/untl_structure.py
https://github.com/unt-libraries/pyuntl/blob/f92413302897dab948aac18ee9e482ace0187bd4/pyuntl/untl_structure.py#L358-L369
def create_xml_string(self): """Create a UNTL document in a string from a UNTL metadata root object. untl_xml_string = metadata_root_object.create_xml_string() """ root = self.create_xml() xml = '<?xml version="1.0" encoding="UTF-8"?>\n' + tostring( root, pr...
[ "def", "create_xml_string", "(", "self", ")", ":", "root", "=", "self", ".", "create_xml", "(", ")", "xml", "=", "'<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n'", "+", "tostring", "(", "root", ",", "pretty_print", "=", "True", ")", "return", "xml" ]
Create a UNTL document in a string from a UNTL metadata root object. untl_xml_string = metadata_root_object.create_xml_string()
[ "Create", "a", "UNTL", "document", "in", "a", "string", "from", "a", "UNTL", "metadata", "root", "object", "." ]
python
train
gem/oq-engine
openquake/hazardlib/gsim/edwards_fah_2013a.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/edwards_fah_2013a.py#L219-L227
def _compute_mean(self, C, mag, term_dist_r): """ compute mean """ return (self._compute_term_1(C, mag) + self._compute_term_2(C, mag, term_dist_r) + self._compute_term_3(C, mag, term_dist_r) + self._compute_term_4(C, mag, term_dist_r) + ...
[ "def", "_compute_mean", "(", "self", ",", "C", ",", "mag", ",", "term_dist_r", ")", ":", "return", "(", "self", ".", "_compute_term_1", "(", "C", ",", "mag", ")", "+", "self", ".", "_compute_term_2", "(", "C", ",", "mag", ",", "term_dist_r", ")", "+"...
compute mean
[ "compute", "mean" ]
python
train
tensorflow/tensor2tensor
tensor2tensor/models/mtf_resnet.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/models/mtf_resnet.py#L145-L204
def block_layer(inputs, filters, blocks, strides, is_training, name, row_blocks_dim=None, col_blocks_dim=None): """Creates one layer of blocks for the ResNet model. Args: inputs: `Tensor` of size `[b...
[ "def", "block_layer", "(", "inputs", ",", "filters", ",", "blocks", ",", "strides", ",", "is_training", ",", "name", ",", "row_blocks_dim", "=", "None", ",", "col_blocks_dim", "=", "None", ")", ":", "with", "tf", ".", "variable_scope", "(", "name", ",", ...
Creates one layer of blocks for the ResNet model. Args: inputs: `Tensor` of size `[batch, channels, height, width]`. filters: `int` number of filters for the first convolution of the layer. blocks: `int` number of blocks contained in the layer. strides: `int` stride to use for the first convolution o...
[ "Creates", "one", "layer", "of", "blocks", "for", "the", "ResNet", "model", "." ]
python
train
vpelletier/python-libusb1
usb1/__init__.py
https://github.com/vpelletier/python-libusb1/blob/740c9778e28523e4ec3543415d95f5400ae0fa24/usb1/__init__.py#L1118-L1127
def unregister(self, fd): """ Unregister an USB-unrelated fd from poller. Convenience method. """ if fd in self.__fd_set: raise ValueError( 'This fd is a special USB event fd, it must stay registered.' ) self.__poller.unregister(fd)
[ "def", "unregister", "(", "self", ",", "fd", ")", ":", "if", "fd", "in", "self", ".", "__fd_set", ":", "raise", "ValueError", "(", "'This fd is a special USB event fd, it must stay registered.'", ")", "self", ".", "__poller", ".", "unregister", "(", "fd", ")" ]
Unregister an USB-unrelated fd from poller. Convenience method.
[ "Unregister", "an", "USB", "-", "unrelated", "fd", "from", "poller", ".", "Convenience", "method", "." ]
python
train
RedHatInsights/insights-core
insights/specs/default.py
https://github.com/RedHatInsights/insights-core/blob/b57cbf8ed7c089672426ede0441e0a4f789ef4a1/insights/specs/default.py#L121-L131
def tomcat_base(broker): """Path: Tomcat base path""" ps = broker[DefaultSpecs.ps_auxww].content results = [] findall = re.compile(r"\-Dcatalina\.base=(\S+)").findall for p in ps: found = findall(p) if found: # Only get the path which is ab...
[ "def", "tomcat_base", "(", "broker", ")", ":", "ps", "=", "broker", "[", "DefaultSpecs", ".", "ps_auxww", "]", ".", "content", "results", "=", "[", "]", "findall", "=", "re", ".", "compile", "(", "r\"\\-Dcatalina\\.base=(\\S+)\"", ")", ".", "findall", "for...
Path: Tomcat base path
[ "Path", ":", "Tomcat", "base", "path" ]
python
train
pybel/pybel
src/pybel/cli.py
https://github.com/pybel/pybel/blob/c8a7a1bdae4c475fa2a8c77f3a9a5f6d79556ca0/src/pybel/cli.py#L421-L429
def prune(manager: Manager): """Prune nodes not belonging to any edges.""" nodes_to_delete = [ node for node in tqdm(manager.session.query(Node), total=manager.count_nodes()) if not node.networks ] manager.session.delete(nodes_to_delete) manager.session.commit()
[ "def", "prune", "(", "manager", ":", "Manager", ")", ":", "nodes_to_delete", "=", "[", "node", "for", "node", "in", "tqdm", "(", "manager", ".", "session", ".", "query", "(", "Node", ")", ",", "total", "=", "manager", ".", "count_nodes", "(", ")", ")...
Prune nodes not belonging to any edges.
[ "Prune", "nodes", "not", "belonging", "to", "any", "edges", "." ]
python
train
mrcagney/gtfstk
gtfstk/validators.py
https://github.com/mrcagney/gtfstk/blob/c91494e6fefc02523889655a0dc92d1c0eee8d03/gtfstk/validators.py#L138-L181
def check_for_required_columns( problems: List, table: str, df: DataFrame ) -> List: """ Check that the given GTFS table has the required columns. Parameters ---------- problems : list A four-tuple containing 1. A problem type (string) equal to ``'error'`` or ``'warning'``; ...
[ "def", "check_for_required_columns", "(", "problems", ":", "List", ",", "table", ":", "str", ",", "df", ":", "DataFrame", ")", "->", "List", ":", "r", "=", "cs", ".", "GTFS_REF", "req_columns", "=", "r", ".", "loc", "[", "(", "r", "[", "\"table\"", "...
Check that the given GTFS table has the required columns. Parameters ---------- problems : list A four-tuple containing 1. A problem type (string) equal to ``'error'`` or ``'warning'``; ``'error'`` means the GTFS is violated; ``'warning'`` means there is a problem but...
[ "Check", "that", "the", "given", "GTFS", "table", "has", "the", "required", "columns", "." ]
python
train
estnltk/estnltk
estnltk/mw_verbs/verbchain_nom_vinf_extender.py
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/mw_verbs/verbchain_nom_vinf_extender.py#L120-L130
def extendChainsInSentence( self, sentence, foundChains ): ''' Rakendab meetodit self.extendChainsInClause() antud lause igal osalausel. ''' # 1) Preprocessing clauses = getClausesByClauseIDs( sentence ) # 2) Extend verb chains in each clause allDetectedVerbChains...
[ "def", "extendChainsInSentence", "(", "self", ",", "sentence", ",", "foundChains", ")", ":", "# 1) Preprocessing\r", "clauses", "=", "getClausesByClauseIDs", "(", "sentence", ")", "# 2) Extend verb chains in each clause\r", "allDetectedVerbChains", "=", "[", "]", "for", ...
Rakendab meetodit self.extendChainsInClause() antud lause igal osalausel.
[ "Rakendab", "meetodit", "self", ".", "extendChainsInClause", "()", "antud", "lause", "igal", "osalausel", "." ]
python
train
wesyoung/pyzyre
czmq/_czmq_ctypes.py
https://github.com/wesyoung/pyzyre/blob/22d4c757acefcfdb700d3802adaf30b402bb9eea/czmq/_czmq_ctypes.py#L1214-L1220
def append(self, data, size): """ Append user-supplied data to chunk, return resulting chunk size. If the data would exceeded the available space, it is truncated. If you want to grow the chunk to accommodate new data, use the zchunk_extend method. """ return lib.zchunk_append(self._as_p...
[ "def", "append", "(", "self", ",", "data", ",", "size", ")", ":", "return", "lib", ".", "zchunk_append", "(", "self", ".", "_as_parameter_", ",", "data", ",", "size", ")" ]
Append user-supplied data to chunk, return resulting chunk size. If the data would exceeded the available space, it is truncated. If you want to grow the chunk to accommodate new data, use the zchunk_extend method.
[ "Append", "user", "-", "supplied", "data", "to", "chunk", "return", "resulting", "chunk", "size", ".", "If", "the", "data", "would", "exceeded", "the", "available", "space", "it", "is", "truncated", ".", "If", "you", "want", "to", "grow", "the", "chunk", ...
python
train
iotile/coretools
iotileemulate/iotile/emulate/reference/controller_features/config_database.py
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L39-L47
def dump(self): """Serialize this object.""" return { 'target': str(self.target), 'data': base64.b64encode(self.data).decode('utf-8'), 'var_id': self.var_id, 'valid': self.valid }
[ "def", "dump", "(", "self", ")", ":", "return", "{", "'target'", ":", "str", "(", "self", ".", "target", ")", ",", "'data'", ":", "base64", ".", "b64encode", "(", "self", ".", "data", ")", ".", "decode", "(", "'utf-8'", ")", ",", "'var_id'", ":", ...
Serialize this object.
[ "Serialize", "this", "object", "." ]
python
train
cmbruns/pyopenvr
src/openvr/__init__.py
https://github.com/cmbruns/pyopenvr/blob/68395d26bb3df6ab1f0f059c38d441f962938be6/src/openvr/__init__.py#L3339-L3346
def getVideoStreamTextureGL(self, hTrackedCamera, eFrameType, nFrameHeaderSize): """Access a shared GL texture for the specified tracked camera stream""" fn = self.function_table.getVideoStreamTextureGL pglTextureId = glUInt_t() pFrameHeader = CameraVideoStreamFrameHeader_t() re...
[ "def", "getVideoStreamTextureGL", "(", "self", ",", "hTrackedCamera", ",", "eFrameType", ",", "nFrameHeaderSize", ")", ":", "fn", "=", "self", ".", "function_table", ".", "getVideoStreamTextureGL", "pglTextureId", "=", "glUInt_t", "(", ")", "pFrameHeader", "=", "C...
Access a shared GL texture for the specified tracked camera stream
[ "Access", "a", "shared", "GL", "texture", "for", "the", "specified", "tracked", "camera", "stream" ]
python
train
alfred82santa/dirty-models
dirty_models/models.py
https://github.com/alfred82santa/dirty-models/blob/354becdb751b21f673515eae928c256c7e923c50/dirty_models/models.py#L494-L499
def clear(self): """ Clears all the data in the object, keeping original data """ self.__modified_data__ = {} self.__deleted_fields__ = [field for field in self.__original_data__.keys()]
[ "def", "clear", "(", "self", ")", ":", "self", ".", "__modified_data__", "=", "{", "}", "self", ".", "__deleted_fields__", "=", "[", "field", "for", "field", "in", "self", ".", "__original_data__", ".", "keys", "(", ")", "]" ]
Clears all the data in the object, keeping original data
[ "Clears", "all", "the", "data", "in", "the", "object", "keeping", "original", "data" ]
python
train
jnrbsn/daemonocle
daemonocle/core.py
https://github.com/jnrbsn/daemonocle/blob/a1e09bc99608eab8dfe024c6741b7ecb7143f717/daemonocle/core.py#L395-L421
def _run(self): """Run the worker function with some custom exception handling.""" try: # Run the worker self.worker() except SystemExit as ex: # sys.exit() was called if isinstance(ex.code, int): if ex.code is not None and ex.code ...
[ "def", "_run", "(", "self", ")", ":", "try", ":", "# Run the worker", "self", ".", "worker", "(", ")", "except", "SystemExit", "as", "ex", ":", "# sys.exit() was called", "if", "isinstance", "(", "ex", ".", "code", ",", "int", ")", ":", "if", "ex", "."...
Run the worker function with some custom exception handling.
[ "Run", "the", "worker", "function", "with", "some", "custom", "exception", "handling", "." ]
python
train
mcieslik-mctp/papy
src/papy/core.py
https://github.com/mcieslik-mctp/papy/blob/708e50827b5db46bbea081982cb74b9b0e464064/src/papy/core.py#L631-L648
def load(self, filename): """ Instanciates (loads) pipeline from a source code file. Arguments: - filename(``path``) location of the pipeline source code. """ dir_name = os.path.dirname(filename) mod_name = os.path.basename(filename)...
[ "def", "load", "(", "self", ",", "filename", ")", ":", "dir_name", "=", "os", ".", "path", ".", "dirname", "(", "filename", ")", "mod_name", "=", "os", ".", "path", ".", "basename", "(", "filename", ")", ".", "split", "(", "'.'", ")", "[", "0", "...
Instanciates (loads) pipeline from a source code file. Arguments: - filename(``path``) location of the pipeline source code.
[ "Instanciates", "(", "loads", ")", "pipeline", "from", "a", "source", "code", "file", ".", "Arguments", ":", "-", "filename", "(", "path", ")", "location", "of", "the", "pipeline", "source", "code", "." ]
python
train
mlenzen/collections-extended
collections_extended/range_map.py
https://github.com/mlenzen/collections-extended/blob/ee9e86f6bbef442dbebcb3a5970642c5c969e2cf/collections_extended/range_map.py#L348-L353
def empty(self, start=None, stop=None): """Empty the range from start to stop. Like delete, but no Error is raised if the entire range isn't mapped. """ self.set(NOT_SET, start=start, stop=stop)
[ "def", "empty", "(", "self", ",", "start", "=", "None", ",", "stop", "=", "None", ")", ":", "self", ".", "set", "(", "NOT_SET", ",", "start", "=", "start", ",", "stop", "=", "stop", ")" ]
Empty the range from start to stop. Like delete, but no Error is raised if the entire range isn't mapped.
[ "Empty", "the", "range", "from", "start", "to", "stop", "." ]
python
train
reincubate/ricloud
ricloud/utils.py
https://github.com/reincubate/ricloud/blob/e46bce4529fbdca34a4190c18c7219e937e2b697/ricloud/utils.py#L90-L102
def print_prompt_values(values, message=None, sub_attr=None): """Prints prompt title and choices with a bit of formatting.""" if message: prompt_message(message) for index, entry in enumerate(values): if sub_attr: line = '{:2d}: {}'.format(index, getattr(utf8(entry), sub_attr)) ...
[ "def", "print_prompt_values", "(", "values", ",", "message", "=", "None", ",", "sub_attr", "=", "None", ")", ":", "if", "message", ":", "prompt_message", "(", "message", ")", "for", "index", ",", "entry", "in", "enumerate", "(", "values", ")", ":", "if",...
Prints prompt title and choices with a bit of formatting.
[ "Prints", "prompt", "title", "and", "choices", "with", "a", "bit", "of", "formatting", "." ]
python
train
scopus-api/scopus
scopus/scopus_search.py
https://github.com/scopus-api/scopus/blob/27ce02dd3095bfdab9d3e8475543d7c17767d1ab/scopus/scopus_search.py#L196-L200
def _join(lst, key, sep=";"): """Auxiliary function to join same elements of a list of dictionaries if the elements are not None. """ return sep.join([d[key] for d in lst if d[key]])
[ "def", "_join", "(", "lst", ",", "key", ",", "sep", "=", "\";\"", ")", ":", "return", "sep", ".", "join", "(", "[", "d", "[", "key", "]", "for", "d", "in", "lst", "if", "d", "[", "key", "]", "]", ")" ]
Auxiliary function to join same elements of a list of dictionaries if the elements are not None.
[ "Auxiliary", "function", "to", "join", "same", "elements", "of", "a", "list", "of", "dictionaries", "if", "the", "elements", "are", "not", "None", "." ]
python
train
mailgun/talon
talon/quotations.py
https://github.com/mailgun/talon/blob/cdd84563dd329c4f887591807870d10015e0c7a7/talon/quotations.py#L601-L609
def is_splitter(line): ''' Returns Matcher object if provided string is a splitter and None otherwise. ''' for pattern in SPLITTER_PATTERNS: matcher = re.match(pattern, line) if matcher: return matcher
[ "def", "is_splitter", "(", "line", ")", ":", "for", "pattern", "in", "SPLITTER_PATTERNS", ":", "matcher", "=", "re", ".", "match", "(", "pattern", ",", "line", ")", "if", "matcher", ":", "return", "matcher" ]
Returns Matcher object if provided string is a splitter and None otherwise.
[ "Returns", "Matcher", "object", "if", "provided", "string", "is", "a", "splitter", "and", "None", "otherwise", "." ]
python
train
markovmodel/PyEMMA
pyemma/_ext/variational/estimators/moments.py
https://github.com/markovmodel/PyEMMA/blob/5c3124398217de05ba5ce9c8fb01519222481ab8/pyemma/_ext/variational/estimators/moments.py#L386-L401
def _M2_dense(X, Y, weights=None, diag_only=False): """ 2nd moment matrix using dense matrix computations. This function is encapsulated such that we can make easy modifications of the basic algorithms """ if weights is not None: if diag_only: return np.sum(weights[:, None] * X * Y...
[ "def", "_M2_dense", "(", "X", ",", "Y", ",", "weights", "=", "None", ",", "diag_only", "=", "False", ")", ":", "if", "weights", "is", "not", "None", ":", "if", "diag_only", ":", "return", "np", ".", "sum", "(", "weights", "[", ":", ",", "None", "...
2nd moment matrix using dense matrix computations. This function is encapsulated such that we can make easy modifications of the basic algorithms
[ "2nd", "moment", "matrix", "using", "dense", "matrix", "computations", "." ]
python
train
google/tangent
tangent/utils.py
https://github.com/google/tangent/blob/6533e83af09de7345d1b438512679992f080dcc9/tangent/utils.py#L700-L722
def push_stack(stack, substack, op_id): """Proxy of push, where we know we're pushing a stack onto a stack. Used when differentiating call trees,where sub-functions get their own stack. See push() for more. Args: stack: The stack object, which must support appending values. substack: The stack to appe...
[ "def", "push_stack", "(", "stack", ",", "substack", ",", "op_id", ")", ":", "if", "substack", "is", "not", "None", "and", "not", "isinstance", "(", "substack", ",", "Stack", ")", ":", "raise", "ValueError", "(", "'Substack should be type tangent.Stack or None, i...
Proxy of push, where we know we're pushing a stack onto a stack. Used when differentiating call trees,where sub-functions get their own stack. See push() for more. Args: stack: The stack object, which must support appending values. substack: The stack to append. op_id: A unique variable that is also...
[ "Proxy", "of", "push", "where", "we", "know", "we", "re", "pushing", "a", "stack", "onto", "a", "stack", "." ]
python
train
PyCQA/astroid
astroid/as_string.py
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/as_string.py#L363-L367
def visit_keyword(self, node): """return an astroid.Keyword node as string""" if node.arg is None: return "**%s" % node.value.accept(self) return "%s=%s" % (node.arg, node.value.accept(self))
[ "def", "visit_keyword", "(", "self", ",", "node", ")", ":", "if", "node", ".", "arg", "is", "None", ":", "return", "\"**%s\"", "%", "node", ".", "value", ".", "accept", "(", "self", ")", "return", "\"%s=%s\"", "%", "(", "node", ".", "arg", ",", "no...
return an astroid.Keyword node as string
[ "return", "an", "astroid", ".", "Keyword", "node", "as", "string" ]
python
train
xflr6/gsheets
gsheets/tools.py
https://github.com/xflr6/gsheets/blob/ca4f1273044704e529c1138e3f942836fc496e1b/gsheets/tools.py#L133-L140
def uniqued(iterable): """Return unique list of ``iterable`` items preserving order. >>> uniqued('spameggs') ['s', 'p', 'a', 'm', 'e', 'g'] """ seen = set() return [item for item in iterable if item not in seen and not seen.add(item)]
[ "def", "uniqued", "(", "iterable", ")", ":", "seen", "=", "set", "(", ")", "return", "[", "item", "for", "item", "in", "iterable", "if", "item", "not", "in", "seen", "and", "not", "seen", ".", "add", "(", "item", ")", "]" ]
Return unique list of ``iterable`` items preserving order. >>> uniqued('spameggs') ['s', 'p', 'a', 'm', 'e', 'g']
[ "Return", "unique", "list", "of", "iterable", "items", "preserving", "order", "." ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/extensions/autoreload.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/extensions/autoreload.py#L132-L136
def _get_compiled_ext(): """Official way to get the extension of compiled files (.pyc or .pyo)""" for ext, mode, typ in imp.get_suffixes(): if typ == imp.PY_COMPILED: return ext
[ "def", "_get_compiled_ext", "(", ")", ":", "for", "ext", ",", "mode", ",", "typ", "in", "imp", ".", "get_suffixes", "(", ")", ":", "if", "typ", "==", "imp", ".", "PY_COMPILED", ":", "return", "ext" ]
Official way to get the extension of compiled files (.pyc or .pyo)
[ "Official", "way", "to", "get", "the", "extension", "of", "compiled", "files", "(", ".", "pyc", "or", ".", "pyo", ")" ]
python
test
jbasko/configmanager
configmanager/items.py
https://github.com/jbasko/configmanager/blob/1d7229ce367143c7210d8e5f0782de03945a1721/configmanager/items.py#L178-L197
def _get_envvar_value(self): """ Internal helper to get item value from an environment variable if item is controlled by one, and if the variable is set. Returns not_set otherwise. """ envvar_name = None if self.envvar is True: envvar_name = self.env...
[ "def", "_get_envvar_value", "(", "self", ")", ":", "envvar_name", "=", "None", "if", "self", ".", "envvar", "is", "True", ":", "envvar_name", "=", "self", ".", "envvar_name", "if", "envvar_name", "is", "None", ":", "envvar_name", "=", "'_'", ".", "join", ...
Internal helper to get item value from an environment variable if item is controlled by one, and if the variable is set. Returns not_set otherwise.
[ "Internal", "helper", "to", "get", "item", "value", "from", "an", "environment", "variable", "if", "item", "is", "controlled", "by", "one", "and", "if", "the", "variable", "is", "set", "." ]
python
train
miku/gluish
gluish/intervals.py
https://github.com/miku/gluish/blob/56d3ac4f41a944e31ecac0aa3b6d1dc2ce705e29/gluish/intervals.py#L73-L77
def biweekly(date=datetime.date.today()): """ Every two weeks. """ return datetime.date(date.year, date.month, 1 if date.day < 15 else 15)
[ "def", "biweekly", "(", "date", "=", "datetime", ".", "date", ".", "today", "(", ")", ")", ":", "return", "datetime", ".", "date", "(", "date", ".", "year", ",", "date", ".", "month", ",", "1", "if", "date", ".", "day", "<", "15", "else", "15", ...
Every two weeks.
[ "Every", "two", "weeks", "." ]
python
train
LionelAuroux/pyrser
pyrser/type_system/scope.py
https://github.com/LionelAuroux/pyrser/blob/f153a97ef2b6bf915a1ed468c0252a9a59b754d5/pyrser/type_system/scope.py#L406-L504
def get_by_params(self, params: [Scope]) -> (Scope, [[Scope]]): """ Retrieve a Set of all signature that match the parameter list. Return a pair: pair[0] the overloads for the functions pair[1] the overloads for the parameters (a list of candidate list of paramet...
[ "def", "get_by_params", "(", "self", ",", "params", ":", "[", "Scope", "]", ")", "->", "(", "Scope", ",", "[", "[", "Scope", "]", "]", ")", ":", "lst", "=", "[", "]", "scopep", "=", "[", "]", "# for each of our signatures", "for", "s", "in", "self"...
Retrieve a Set of all signature that match the parameter list. Return a pair: pair[0] the overloads for the functions pair[1] the overloads for the parameters (a list of candidate list of parameters)
[ "Retrieve", "a", "Set", "of", "all", "signature", "that", "match", "the", "parameter", "list", ".", "Return", "a", "pair", ":" ]
python
test
benhoff/vexbot
vexbot/util/messaging.py
https://github.com/benhoff/vexbot/blob/9b844eb20e84eea92a0e7db7d86a90094956c38f/vexbot/util/messaging.py#L3-L17
def get_addresses(message: list) -> list: """ parses a raw list from zmq to get back the components that are the address messages are broken by the addresses in the beginning and then the message, like this: ```addresses | '' | message ``` """ # Need the address so that we know who to send the m...
[ "def", "get_addresses", "(", "message", ":", "list", ")", "->", "list", ":", "# Need the address so that we know who to send the message back to", "addresses", "=", "[", "]", "for", "address", "in", "message", ":", "# if we hit a blank string, then we've got all the addresses...
parses a raw list from zmq to get back the components that are the address messages are broken by the addresses in the beginning and then the message, like this: ```addresses | '' | message ```
[ "parses", "a", "raw", "list", "from", "zmq", "to", "get", "back", "the", "components", "that", "are", "the", "address", "messages", "are", "broken", "by", "the", "addresses", "in", "the", "beginning", "and", "then", "the", "message", "like", "this", ":", ...
python
train
IdentityPython/fedoidcmsg
src/fedoidcmsg/operator.py
https://github.com/IdentityPython/fedoidcmsg/blob/d30107be02521fa6cdfe285da3b6b0cdd153c8cc/src/fedoidcmsg/operator.py#L237-L329
def _unpack(self, ms_dict, keyjar, cls, jwt_ms=None, liss=None): """ :param ms_dict: Metadata statement as a dictionary :param keyjar: A keyjar with the necessary FO keys :param cls: What class to map the metadata into :param jwt_ms: Metadata statement as a JWS ...
[ "def", "_unpack", "(", "self", ",", "ms_dict", ",", "keyjar", ",", "cls", ",", "jwt_ms", "=", "None", ",", "liss", "=", "None", ")", ":", "if", "liss", "is", "None", ":", "liss", "=", "[", "]", "_pr", "=", "ParseInfo", "(", ")", "_pr", ".", "in...
:param ms_dict: Metadata statement as a dictionary :param keyjar: A keyjar with the necessary FO keys :param cls: What class to map the metadata into :param jwt_ms: Metadata statement as a JWS :param liss: List of FO issuer IDs :return: ParseInfo instance
[ ":", "param", "ms_dict", ":", "Metadata", "statement", "as", "a", "dictionary", ":", "param", "keyjar", ":", "A", "keyjar", "with", "the", "necessary", "FO", "keys", ":", "param", "cls", ":", "What", "class", "to", "map", "the", "metadata", "into", ":", ...
python
test
jepegit/cellpy
cellpy/readers/dbreader.py
https://github.com/jepegit/cellpy/blob/9f4a84cdd11f72cfa02cda8c2d7b5174abbb7370/cellpy/readers/dbreader.py#L122-L151
def _open_sheet(self, dtypes_dict=None): """Opens sheets and returns it""" table_name = self.db_sheet_table header_row = self.db_header_row nrows = self.nrows if dtypes_dict is None: dtypes_dict = self.dtypes_dict rows_to_skip = self.skiprows logging...
[ "def", "_open_sheet", "(", "self", ",", "dtypes_dict", "=", "None", ")", ":", "table_name", "=", "self", ".", "db_sheet_table", "header_row", "=", "self", ".", "db_header_row", "nrows", "=", "self", ".", "nrows", "if", "dtypes_dict", "is", "None", ":", "dt...
Opens sheets and returns it
[ "Opens", "sheets", "and", "returns", "it" ]
python
train
marcomusy/vtkplotter
vtkplotter/actors.py
https://github.com/marcomusy/vtkplotter/blob/692c3396782722ec525bc1346a26999868c650c6/vtkplotter/actors.py#L1002-L1011
def centerOfMass(self): """Get the center of mass of actor. .. hint:: |fatlimb| |fatlimb.py|_ """ cmf = vtk.vtkCenterOfMass() cmf.SetInputData(self.polydata(True)) cmf.Update() c = cmf.GetCenter() return np.array(c)
[ "def", "centerOfMass", "(", "self", ")", ":", "cmf", "=", "vtk", ".", "vtkCenterOfMass", "(", ")", "cmf", ".", "SetInputData", "(", "self", ".", "polydata", "(", "True", ")", ")", "cmf", ".", "Update", "(", ")", "c", "=", "cmf", ".", "GetCenter", "...
Get the center of mass of actor. .. hint:: |fatlimb| |fatlimb.py|_
[ "Get", "the", "center", "of", "mass", "of", "actor", "." ]
python
train
ajslater/picopt
picopt/files.py
https://github.com/ajslater/picopt/blob/261da837027563c1dc3ed07b70e1086520a60402/picopt/files.py#L19-L48
def _cleanup_after_optimize_aux(filename, new_filename, old_format, new_format): """ Replace old file with better one or discard new wasteful file. """ bytes_in = 0 bytes_out = 0 final_filename = filename try: bytes_in = os.stat(filename).st_size ...
[ "def", "_cleanup_after_optimize_aux", "(", "filename", ",", "new_filename", ",", "old_format", ",", "new_format", ")", ":", "bytes_in", "=", "0", "bytes_out", "=", "0", "final_filename", "=", "filename", "try", ":", "bytes_in", "=", "os", ".", "stat", "(", "...
Replace old file with better one or discard new wasteful file.
[ "Replace", "old", "file", "with", "better", "one", "or", "discard", "new", "wasteful", "file", "." ]
python
train
pypa/pipenv
pipenv/vendor/orderedmultidict/orderedmultidict.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/vendor/orderedmultidict/orderedmultidict.py#L353-L392
def setlist(self, key, values): """ Sets <key>'s list of values to <values>. Existing items with key <key> are first replaced with new values from <values>. Any remaining old items that haven't been replaced with new values are deleted, and any new values from <values> that don't...
[ "def", "setlist", "(", "self", ",", "key", ",", "values", ")", ":", "if", "not", "values", "and", "key", "in", "self", ":", "self", ".", "pop", "(", "key", ")", "else", ":", "it", "=", "zip_longest", "(", "list", "(", "self", ".", "_map", ".", ...
Sets <key>'s list of values to <values>. Existing items with key <key> are first replaced with new values from <values>. Any remaining old items that haven't been replaced with new values are deleted, and any new values from <values> that don't have corresponding items with <key> to repl...
[ "Sets", "<key", ">", "s", "list", "of", "values", "to", "<values", ">", ".", "Existing", "items", "with", "key", "<key", ">", "are", "first", "replaced", "with", "new", "values", "from", "<values", ">", ".", "Any", "remaining", "old", "items", "that", ...
python
train
ricequant/rqalpha
rqalpha/interface.py
https://github.com/ricequant/rqalpha/blob/ac40a62d4e7eca9494b4d0a14f46facf5616820c/rqalpha/interface.py#L360-L398
def history_bars(self, instrument, bar_count, frequency, fields, dt, skip_suspended=True, include_now=False, adjust_type='pre', adjust_orig=None): """ 获取历史数据 :param instrument: 合约对象 :type instrument: :class:`~Instrument` :param int bar_count: 获取的历史数据数量 ...
[ "def", "history_bars", "(", "self", ",", "instrument", ",", "bar_count", ",", "frequency", ",", "fields", ",", "dt", ",", "skip_suspended", "=", "True", ",", "include_now", "=", "False", ",", "adjust_type", "=", "'pre'", ",", "adjust_orig", "=", "None", ")...
获取历史数据 :param instrument: 合约对象 :type instrument: :class:`~Instrument` :param int bar_count: 获取的历史数据数量 :param str frequency: 周期频率,`1d` 表示日周期, `1m` 表示分钟周期 :param str fields: 返回数据字段 ========================= =================================================== fi...
[ "获取历史数据" ]
python
train
EventTeam/beliefs
src/beliefs/beliefstate.py
https://github.com/EventTeam/beliefs/blob/c07d22b61bebeede74a72800030dde770bf64208/src/beliefs/beliefstate.py#L460-L473
def number_of_singleton_referents(self): """ Returns the number of singleton elements of the referential domain that are compatible with the current belief state. This is the size of the union of all referent sets. """ if self.__dict__['referential_domain']: ...
[ "def", "number_of_singleton_referents", "(", "self", ")", ":", "if", "self", ".", "__dict__", "[", "'referential_domain'", "]", ":", "ct", "=", "0", "for", "i", "in", "self", ".", "iter_singleton_referents", "(", ")", ":", "ct", "+=", "1", "return", "ct", ...
Returns the number of singleton elements of the referential domain that are compatible with the current belief state. This is the size of the union of all referent sets.
[ "Returns", "the", "number", "of", "singleton", "elements", "of", "the", "referential", "domain", "that", "are", "compatible", "with", "the", "current", "belief", "state", "." ]
python
train
LogicalDash/LiSE
allegedb/allegedb/cache.py
https://github.com/LogicalDash/LiSE/blob/fe6fd4f0a7c1780e065f4c9babb9bc443af6bb84/allegedb/allegedb/cache.py#L931-L938
def iter_predecessors(self, graph, dest, branch, turn, tick, *, forward=None): """Iterate over predecessors to a given destination node at a given time.""" if self.db._no_kc: yield from self._adds_dels_sucpred(self.predecessors[graph, dest], branch, turn, tick)[0] return ...
[ "def", "iter_predecessors", "(", "self", ",", "graph", ",", "dest", ",", "branch", ",", "turn", ",", "tick", ",", "*", ",", "forward", "=", "None", ")", ":", "if", "self", ".", "db", ".", "_no_kc", ":", "yield", "from", "self", ".", "_adds_dels_sucpr...
Iterate over predecessors to a given destination node at a given time.
[ "Iterate", "over", "predecessors", "to", "a", "given", "destination", "node", "at", "a", "given", "time", "." ]
python
train
nugget/python-insteonplm
insteonplm/address.py
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/address.py#L116-L121
def hex(self): """Emit the address in bare hex format (aabbcc).""" addrstr = '000000' if self.addr is not None: addrstr = binascii.hexlify(self.addr).decode() return addrstr
[ "def", "hex", "(", "self", ")", ":", "addrstr", "=", "'000000'", "if", "self", ".", "addr", "is", "not", "None", ":", "addrstr", "=", "binascii", ".", "hexlify", "(", "self", ".", "addr", ")", ".", "decode", "(", ")", "return", "addrstr" ]
Emit the address in bare hex format (aabbcc).
[ "Emit", "the", "address", "in", "bare", "hex", "format", "(", "aabbcc", ")", "." ]
python
train
bspaans/python-mingus
mingus/midi/sequencer.py
https://github.com/bspaans/python-mingus/blob/aa5a5d992d45ada61be0f9f86261380731bd7749/mingus/midi/sequencer.py#L98-L102
def detach(self, listener): """Detach a listening object so that it won't receive any events anymore.""" if listener in self.listeners: self.listeners.remove(listener)
[ "def", "detach", "(", "self", ",", "listener", ")", ":", "if", "listener", "in", "self", ".", "listeners", ":", "self", ".", "listeners", ".", "remove", "(", "listener", ")" ]
Detach a listening object so that it won't receive any events anymore.
[ "Detach", "a", "listening", "object", "so", "that", "it", "won", "t", "receive", "any", "events", "anymore", "." ]
python
train
angr/claripy
claripy/ast/fp.py
https://github.com/angr/claripy/blob/4ed61924880af1ea8fb778047d896ec0156412a6/claripy/ast/fp.py#L16-L27
def to_fp(self, sort, rm=None): """ Convert this float to a different sort :param sort: The sort to convert to :param rm: Optional: The rounding mode to use :return: An FP AST """ if rm is None: rm = fp.RM.default() return fpTo...
[ "def", "to_fp", "(", "self", ",", "sort", ",", "rm", "=", "None", ")", ":", "if", "rm", "is", "None", ":", "rm", "=", "fp", ".", "RM", ".", "default", "(", ")", "return", "fpToFP", "(", "rm", ",", "self", ",", "sort", ")" ]
Convert this float to a different sort :param sort: The sort to convert to :param rm: Optional: The rounding mode to use :return: An FP AST
[ "Convert", "this", "float", "to", "a", "different", "sort" ]
python
train
72squared/redpipe
redpipe/keyspaces.py
https://github.com/72squared/redpipe/blob/e6ee518bc9f3e2fee323c8c53d08997799bd9b1b/redpipe/keyspaces.py#L1503-L1531
def zrange(self, name, start, end, desc=False, withscores=False, score_cast_func=float): """ Returns all the elements including between ``start`` (non included) and ``stop`` (included). :param name: str the name of the redis key :param start: :param en...
[ "def", "zrange", "(", "self", ",", "name", ",", "start", ",", "end", ",", "desc", "=", "False", ",", "withscores", "=", "False", ",", "score_cast_func", "=", "float", ")", ":", "with", "self", ".", "pipe", "as", "pipe", ":", "f", "=", "Future", "("...
Returns all the elements including between ``start`` (non included) and ``stop`` (included). :param name: str the name of the redis key :param start: :param end: :param desc: :param withscores: :param score_cast_func: :return:
[ "Returns", "all", "the", "elements", "including", "between", "start", "(", "non", "included", ")", "and", "stop", "(", "included", ")", "." ]
python
train
shmir/PyIxExplorer
ixexplorer/ixe_port.py
https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L169-L181
def reserve(self, force=False): """ Reserve port. :param force: True - take forcefully, False - fail if port is reserved by other user """ if not force: try: self.api.call_rc('ixPortTakeOwnership {}'.format(self.uri)) except Exception as _: ...
[ "def", "reserve", "(", "self", ",", "force", "=", "False", ")", ":", "if", "not", "force", ":", "try", ":", "self", ".", "api", ".", "call_rc", "(", "'ixPortTakeOwnership {}'", ".", "format", "(", "self", ".", "uri", ")", ")", "except", "Exception", ...
Reserve port. :param force: True - take forcefully, False - fail if port is reserved by other user
[ "Reserve", "port", "." ]
python
train
ejeschke/ginga
ginga/Bindings.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/Bindings.py#L2658-L2704
def mode_key_down(self, viewer, keyname): """This method is called when a key is pressed and was not handled by some other handler with precedence, such as a subcanvas. """ # Is this a mode key? if keyname not in self.mode_map: if (keyname not in self.mode_tbl) or (se...
[ "def", "mode_key_down", "(", "self", ",", "viewer", ",", "keyname", ")", ":", "# Is this a mode key?", "if", "keyname", "not", "in", "self", ".", "mode_map", ":", "if", "(", "keyname", "not", "in", "self", ".", "mode_tbl", ")", "or", "(", "self", ".", ...
This method is called when a key is pressed and was not handled by some other handler with precedence, such as a subcanvas.
[ "This", "method", "is", "called", "when", "a", "key", "is", "pressed", "and", "was", "not", "handled", "by", "some", "other", "handler", "with", "precedence", "such", "as", "a", "subcanvas", "." ]
python
train
mathiasertl/xmpp-backends
xmpp_backends/base.py
https://github.com/mathiasertl/xmpp-backends/blob/214ef0664dbf90fa300c2483b9b3416559e5d171/xmpp_backends/base.py#L174-L192
def module(self): """The module specified by the ``library`` attribute.""" if self._module is None: if self.library is None: raise ValueError( "Backend '%s' doesn't specify a library attribute" % self.__class__) try: if '.' in...
[ "def", "module", "(", "self", ")", ":", "if", "self", ".", "_module", "is", "None", ":", "if", "self", ".", "library", "is", "None", ":", "raise", "ValueError", "(", "\"Backend '%s' doesn't specify a library attribute\"", "%", "self", ".", "__class__", ")", ...
The module specified by the ``library`` attribute.
[ "The", "module", "specified", "by", "the", "library", "attribute", "." ]
python
train
jaegertracing/jaeger-client-python
jaeger_client/span.py
https://github.com/jaegertracing/jaeger-client-python/blob/06face094757c645a6d81f0e073c001931a22a05/jaeger_client/span.py#L76-L90
def set_tag(self, key, value): """ :param key: :param value: """ with self.update_lock: if key == ext_tags.SAMPLING_PRIORITY and not self._set_sampling_priority(value): return self if self.is_sampled(): tag = thrift.make_tag...
[ "def", "set_tag", "(", "self", ",", "key", ",", "value", ")", ":", "with", "self", ".", "update_lock", ":", "if", "key", "==", "ext_tags", ".", "SAMPLING_PRIORITY", "and", "not", "self", ".", "_set_sampling_priority", "(", "value", ")", ":", "return", "s...
:param key: :param value:
[ ":", "param", "key", ":", ":", "param", "value", ":" ]
python
train
annoviko/pyclustering
pyclustering/cluster/xmeans.py
https://github.com/annoviko/pyclustering/blob/98aa0dd89fd36f701668fb1eb29c8fb5662bf7d0/pyclustering/cluster/xmeans.py#L412-L460
def __bayesian_information_criterion(self, clusters, centers): """! @brief Calculates splitting criterion for input clusters using bayesian information criterion. @param[in] clusters (list): Clusters for which splitting criterion should be calculated. @param[in] centers (li...
[ "def", "__bayesian_information_criterion", "(", "self", ",", "clusters", ",", "centers", ")", ":", "scores", "=", "[", "float", "(", "'inf'", ")", "]", "*", "len", "(", "clusters", ")", "# splitting criterion\r", "dimension", "=", "len", "(", "self", ".", ...
! @brief Calculates splitting criterion for input clusters using bayesian information criterion. @param[in] clusters (list): Clusters for which splitting criterion should be calculated. @param[in] centers (list): Centers of the clusters. @return (double) Splitting...
[ "!" ]
python
valid
casebeer/audiogen
audiogen/sampler.py
https://github.com/casebeer/audiogen/blob/184dee2ca32c2bb4315a0f18e62288728fcd7881/audiogen/sampler.py#L189-L197
def cache_finite_samples(f): '''Decorator to cache audio samples produced by the wrapped generator.''' cache = {} def wrap(*args): key = FRAME_RATE, args if key not in cache: cache[key] = [sample for sample in f(*args)] return (sample for sample in cache[key]) return wrap
[ "def", "cache_finite_samples", "(", "f", ")", ":", "cache", "=", "{", "}", "def", "wrap", "(", "*", "args", ")", ":", "key", "=", "FRAME_RATE", ",", "args", "if", "key", "not", "in", "cache", ":", "cache", "[", "key", "]", "=", "[", "sample", "fo...
Decorator to cache audio samples produced by the wrapped generator.
[ "Decorator", "to", "cache", "audio", "samples", "produced", "by", "the", "wrapped", "generator", "." ]
python
train
booktype/python-ooxml
ooxml/serialize.py
https://github.com/booktype/python-ooxml/blob/b56990a5bee2e1bc46839cec5161ff3726dc4d87/ooxml/serialize.py#L776-L794
def serialize_endnote(ctx, document, el, root): "Serializes endnotes." footnote_num = el.rid if el.rid not in ctx.endnote_list: ctx.endnote_id += 1 ctx.endnote_list[el.rid] = ctx.endnote_id footnote_num = ctx.endnote_list[el.rid] note = etree.SubElement(root, 'sup') link = et...
[ "def", "serialize_endnote", "(", "ctx", ",", "document", ",", "el", ",", "root", ")", ":", "footnote_num", "=", "el", ".", "rid", "if", "el", ".", "rid", "not", "in", "ctx", ".", "endnote_list", ":", "ctx", ".", "endnote_id", "+=", "1", "ctx", ".", ...
Serializes endnotes.
[ "Serializes", "endnotes", "." ]
python
train
kivy/python-for-android
pythonforandroid/recipe.py
https://github.com/kivy/python-for-android/blob/8e0e8056bc22e4d5bd3398a6b0301f38ff167933/pythonforandroid/recipe.py#L1167-L1173
def md5sum(filen): '''Calculate the md5sum of a file. ''' with open(filen, 'rb') as fileh: md5 = hashlib.md5(fileh.read()) return md5.hexdigest()
[ "def", "md5sum", "(", "filen", ")", ":", "with", "open", "(", "filen", ",", "'rb'", ")", "as", "fileh", ":", "md5", "=", "hashlib", ".", "md5", "(", "fileh", ".", "read", "(", ")", ")", "return", "md5", ".", "hexdigest", "(", ")" ]
Calculate the md5sum of a file.
[ "Calculate", "the", "md5sum", "of", "a", "file", "." ]
python
train
idmillington/layout
layout/managers/root.py
https://github.com/idmillington/layout/blob/c452d1d7a74c9a74f7639c1b49e2a41c4e354bb5/layout/managers/root.py#L55-L65
def _get_smallest_dimensions(self, data): """A utility method to return the minimum size needed to fit all the elements in.""" min_width = 0 min_height = 0 for element in self.elements: if not element: continue size = element.get_minimum_size(data) ...
[ "def", "_get_smallest_dimensions", "(", "self", ",", "data", ")", ":", "min_width", "=", "0", "min_height", "=", "0", "for", "element", "in", "self", ".", "elements", ":", "if", "not", "element", ":", "continue", "size", "=", "element", ".", "get_minimum_s...
A utility method to return the minimum size needed to fit all the elements in.
[ "A", "utility", "method", "to", "return", "the", "minimum", "size", "needed", "to", "fit", "all", "the", "elements", "in", "." ]
python
train
ethereum/py-evm
eth/db/header.py
https://github.com/ethereum/py-evm/blob/58346848f076116381d3274bbcea96b9e2cfcbdf/eth/db/header.py#L286-L320
def _set_as_canonical_chain_head(cls, db: BaseDB, block_hash: Hash32 ) -> Tuple[Tuple[BlockHeader, ...], Tuple[BlockHeader, ...]]: """ Sets the canonical chain HEAD to the block header as specified by the given block hash. :return: a tuple of the hea...
[ "def", "_set_as_canonical_chain_head", "(", "cls", ",", "db", ":", "BaseDB", ",", "block_hash", ":", "Hash32", ")", "->", "Tuple", "[", "Tuple", "[", "BlockHeader", ",", "...", "]", ",", "Tuple", "[", "BlockHeader", ",", "...", "]", "]", ":", "try", ":...
Sets the canonical chain HEAD to the block header as specified by the given block hash. :return: a tuple of the headers that are newly in the canonical chain, and the headers that are no longer in the canonical chain
[ "Sets", "the", "canonical", "chain", "HEAD", "to", "the", "block", "header", "as", "specified", "by", "the", "given", "block", "hash", "." ]
python
train
saltstack/salt
salt/cloud/clouds/linode.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/cloud/clouds/linode.py#L1661-L1671
def _get_status_descr_by_id(status_id): ''' Return linode status by ID status_id linode VM status ID ''' for status_name, status_data in six.iteritems(LINODE_STATUS): if status_data['code'] == int(status_id): return status_data['descr'] return LINODE_STATUS.get(statu...
[ "def", "_get_status_descr_by_id", "(", "status_id", ")", ":", "for", "status_name", ",", "status_data", "in", "six", ".", "iteritems", "(", "LINODE_STATUS", ")", ":", "if", "status_data", "[", "'code'", "]", "==", "int", "(", "status_id", ")", ":", "return",...
Return linode status by ID status_id linode VM status ID
[ "Return", "linode", "status", "by", "ID" ]
python
train
openvax/varcode
varcode/effects/effect_ordering.py
https://github.com/openvax/varcode/blob/981633db45ca2b31f76c06894a7360ea5d70a9b8/varcode/effects/effect_ordering.py#L316-L331
def select_between_exonic_splice_site_and_alternate_effect(effect): """ If the given effect is an ExonicSpliceSite then it might contain an alternate effect of higher priority. In that case, return the alternate effect. Otherwise, this acts as an identity function. """ if effect.__class__ is not...
[ "def", "select_between_exonic_splice_site_and_alternate_effect", "(", "effect", ")", ":", "if", "effect", ".", "__class__", "is", "not", "ExonicSpliceSite", ":", "return", "effect", "if", "effect", ".", "alternate_effect", "is", "None", ":", "return", "effect", "spl...
If the given effect is an ExonicSpliceSite then it might contain an alternate effect of higher priority. In that case, return the alternate effect. Otherwise, this acts as an identity function.
[ "If", "the", "given", "effect", "is", "an", "ExonicSpliceSite", "then", "it", "might", "contain", "an", "alternate", "effect", "of", "higher", "priority", ".", "In", "that", "case", "return", "the", "alternate", "effect", ".", "Otherwise", "this", "acts", "a...
python
train
AmesCornish/buttersink
buttersink/S3Store.py
https://github.com/AmesCornish/buttersink/blob/5cc37e30d9f8071fcf3497dca8b8a91b910321ea/buttersink/S3Store.py#L195-L203
def receiveVolumeInfo(self, paths): """ Return Context Manager for a file-like (stream) object to store volume info. """ path = self.selectReceivePath(paths) path = path + Store.theInfoExtension if self._skipDryRun(logger)("receive info in '%s'", path): return None ...
[ "def", "receiveVolumeInfo", "(", "self", ",", "paths", ")", ":", "path", "=", "self", ".", "selectReceivePath", "(", "paths", ")", "path", "=", "path", "+", "Store", ".", "theInfoExtension", "if", "self", ".", "_skipDryRun", "(", "logger", ")", "(", "\"r...
Return Context Manager for a file-like (stream) object to store volume info.
[ "Return", "Context", "Manager", "for", "a", "file", "-", "like", "(", "stream", ")", "object", "to", "store", "volume", "info", "." ]
python
train
tuomas2/automate
src/automate/statusobject.py
https://github.com/tuomas2/automate/blob/d8a8cd03cd0da047e033a2d305f3f260f8c4e017/src/automate/statusobject.py#L354-L366
def _do_change_status(self, status, force=False): """ This function is called by - set_status - _update_program_stack if active program is being changed - thia may be launched by sensor status change. status lock is necessary because these happen from diff...
[ "def", "_do_change_status", "(", "self", ",", "status", ",", "force", "=", "False", ")", ":", "self", ".", "system", ".", "worker_thread", ".", "put", "(", "DummyStatusWorkerTask", "(", "self", ".", "_request_status_change_in_queue", ",", "status", ",", "force...
This function is called by - set_status - _update_program_stack if active program is being changed - thia may be launched by sensor status change. status lock is necessary because these happen from different threads. This does not directly change sta...
[ "This", "function", "is", "called", "by", "-", "set_status", "-", "_update_program_stack", "if", "active", "program", "is", "being", "changed", "-", "thia", "may", "be", "launched", "by", "sensor", "status", "change", ".", "status", "lock", "is", "necessary", ...
python
train
project-ncl/pnc-cli
pnc_cli/projects.py
https://github.com/project-ncl/pnc-cli/blob/3dc149bf84928f60a8044ac50b58bbaddd451902/pnc_cli/projects.py#L44-L50
def update_project(id, **kwargs): """ Update an existing Project with new information """ content = update_project_raw(id, **kwargs) if content: return utils.format_json(content)
[ "def", "update_project", "(", "id", ",", "*", "*", "kwargs", ")", ":", "content", "=", "update_project_raw", "(", "id", ",", "*", "*", "kwargs", ")", "if", "content", ":", "return", "utils", ".", "format_json", "(", "content", ")" ]
Update an existing Project with new information
[ "Update", "an", "existing", "Project", "with", "new", "information" ]
python
train
Karaage-Cluster/karaage
karaage/plugins/kgapplications/views/states.py
https://github.com/Karaage-Cluster/karaage/blob/2f4c8b4e2d728b3fcbb151160c49000f1c04f5c9/karaage/plugins/kgapplications/views/states.py#L391-L459
def get_next_action(self, request, application, label, roles): """ Process the get_next_action request at the current step. """ actions = self.get_actions(request, application, roles) # if the user is not the applicant, the steps don't apply. if 'is_applicant' not in roles: ...
[ "def", "get_next_action", "(", "self", ",", "request", ",", "application", ",", "label", ",", "roles", ")", ":", "actions", "=", "self", ".", "get_actions", "(", "request", ",", "application", ",", "roles", ")", "# if the user is not the applicant, the steps don't...
Process the get_next_action request at the current step.
[ "Process", "the", "get_next_action", "request", "at", "the", "current", "step", "." ]
python
train
The-Politico/politico-civic-almanac
almanac/utils/auth.py
https://github.com/The-Politico/politico-civic-almanac/blob/f97521fabd445c8a0fa97a435f6d39f517ef3892/almanac/utils/auth.py#L8-L21
def secure(view): """ Authentication decorator for views. If DEBUG is on, we serve the view without authenticating. Default is 'django.contrib.auth.decorators.login_required'. Can also be 'django.contrib.admin.views.decorators.staff_member_required' or a custom decorator. """ auth_decor...
[ "def", "secure", "(", "view", ")", ":", "auth_decorator", "=", "import_class", "(", "settings", ".", "AUTH_DECORATOR", ")", "return", "(", "view", "if", "project_settings", ".", "DEBUG", "else", "method_decorator", "(", "auth_decorator", ",", "name", "=", "'di...
Authentication decorator for views. If DEBUG is on, we serve the view without authenticating. Default is 'django.contrib.auth.decorators.login_required'. Can also be 'django.contrib.admin.views.decorators.staff_member_required' or a custom decorator.
[ "Authentication", "decorator", "for", "views", "." ]
python
train
Crypto-toolbox/bitex
bitex/api/WSS/bitfinex.py
https://github.com/Crypto-toolbox/bitex/blob/56d46ea3db6de5219a72dad9b052fbabc921232f/bitex/api/WSS/bitfinex.py#L307-L364
def process(self): """ Processes the Client queue, and passes the data to the respective methods. :return: """ while self.running: if self._processor_lock.acquire(blocking=False): if self.ping_timer: try: ...
[ "def", "process", "(", "self", ")", ":", "while", "self", ".", "running", ":", "if", "self", ".", "_processor_lock", ".", "acquire", "(", "blocking", "=", "False", ")", ":", "if", "self", ".", "ping_timer", ":", "try", ":", "self", ".", "_check_ping", ...
Processes the Client queue, and passes the data to the respective methods. :return:
[ "Processes", "the", "Client", "queue", "and", "passes", "the", "data", "to", "the", "respective", "methods", ".", ":", "return", ":" ]
python
train
radjkarl/imgProcessor
imgProcessor/transformations.py
https://github.com/radjkarl/imgProcessor/blob/7c5a28718f81c01a430152c60a686ac50afbfd7c/imgProcessor/transformations.py#L78-L87
def toFloatArray(img): ''' transform an unsigned integer array into a float array of the right size ''' _D = {1: np.float32, # uint8 2: np.float32, # uint16 4: np.float64, # uint32 8: np.float64} # uint64 return img.astype(_D[img.itemsize])
[ "def", "toFloatArray", "(", "img", ")", ":", "_D", "=", "{", "1", ":", "np", ".", "float32", ",", "# uint8\r", "2", ":", "np", ".", "float32", ",", "# uint16\r", "4", ":", "np", ".", "float64", ",", "# uint32\r", "8", ":", "np", ".", "float64", "...
transform an unsigned integer array into a float array of the right size
[ "transform", "an", "unsigned", "integer", "array", "into", "a", "float", "array", "of", "the", "right", "size" ]
python
train
pkkid/python-plexapi
plexapi/sync.py
https://github.com/pkkid/python-plexapi/blob/9efbde96441c2bfbf410eacfb46e811e108e8bbc/plexapi/sync.py#L93-L101
def markDownloaded(self, media): """ Mark the file as downloaded (by the nature of Plex it will be marked as downloaded within any SyncItem where it presented). Parameters: media (base.Playable): the media to be marked as downloaded. """ url = '/sync/%s/i...
[ "def", "markDownloaded", "(", "self", ",", "media", ")", ":", "url", "=", "'/sync/%s/item/%s/downloaded'", "%", "(", "self", ".", "clientIdentifier", ",", "media", ".", "ratingKey", ")", "media", ".", "_server", ".", "query", "(", "url", ",", "method", "="...
Mark the file as downloaded (by the nature of Plex it will be marked as downloaded within any SyncItem where it presented). Parameters: media (base.Playable): the media to be marked as downloaded.
[ "Mark", "the", "file", "as", "downloaded", "(", "by", "the", "nature", "of", "Plex", "it", "will", "be", "marked", "as", "downloaded", "within", "any", "SyncItem", "where", "it", "presented", ")", "." ]
python
train
wonambi-python/wonambi
wonambi/trans/select.py
https://github.com/wonambi-python/wonambi/blob/1d8e3d7e53df8017c199f703bcab582914676e76/wonambi/trans/select.py#L690-L715
def _create_subepochs(x, nperseg, step): """Transform the data into a matrix for easy manipulation Parameters ---------- x : 1d ndarray actual data values nperseg : int number of samples in each row to create step : int distance in samples between rows Returns --...
[ "def", "_create_subepochs", "(", "x", ",", "nperseg", ",", "step", ")", ":", "axis", "=", "x", ".", "ndim", "-", "1", "# last dim", "nsmp", "=", "x", ".", "shape", "[", "axis", "]", "stride", "=", "x", ".", "strides", "[", "axis", "]", "noverlap", ...
Transform the data into a matrix for easy manipulation Parameters ---------- x : 1d ndarray actual data values nperseg : int number of samples in each row to create step : int distance in samples between rows Returns ------- 2d ndarray a view (i.e. doesn'...
[ "Transform", "the", "data", "into", "a", "matrix", "for", "easy", "manipulation" ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/zmq/kernelapp.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/kernelapp.py#L267-L270
def init_session(self): """create our session object""" default_secure(self.config) self.session = Session(config=self.config, username=u'kernel')
[ "def", "init_session", "(", "self", ")", ":", "default_secure", "(", "self", ".", "config", ")", "self", ".", "session", "=", "Session", "(", "config", "=", "self", ".", "config", ",", "username", "=", "u'kernel'", ")" ]
create our session object
[ "create", "our", "session", "object" ]
python
test
Unidata/MetPy
examples/gridding/Point_Interpolation.py
https://github.com/Unidata/MetPy/blob/16f68a94919b9a82dcf9cada2169cf039129e67b/examples/gridding/Point_Interpolation.py#L24-L34
def basic_map(proj): """Make our basic default map for plotting""" fig = plt.figure(figsize=(15, 10)) add_metpy_logo(fig, 0, 80, size='large') view = fig.add_axes([0, 0, 1, 1], projection=proj) view.set_extent([-120, -70, 20, 50]) view.add_feature(cfeature.STATES.with_scale('50m')) view.add_...
[ "def", "basic_map", "(", "proj", ")", ":", "fig", "=", "plt", ".", "figure", "(", "figsize", "=", "(", "15", ",", "10", ")", ")", "add_metpy_logo", "(", "fig", ",", "0", ",", "80", ",", "size", "=", "'large'", ")", "view", "=", "fig", ".", "add...
Make our basic default map for plotting
[ "Make", "our", "basic", "default", "map", "for", "plotting" ]
python
train
PmagPy/PmagPy
pmagpy/pmag.py
https://github.com/PmagPy/PmagPy/blob/c7984f8809bf40fe112e53dcc311a33293b62d0b/pmagpy/pmag.py#L10888-L10971
def chart_maker(Int, Top, start=100, outfile='chart.txt'): """ Makes a chart for performing IZZI experiments. Print out the file and tape it to the oven. This chart will help keep track of the different steps. Z : performed in zero field - enter the temperature XXX.0 in the sio formatted me...
[ "def", "chart_maker", "(", "Int", ",", "Top", ",", "start", "=", "100", ",", "outfile", "=", "'chart.txt'", ")", ":", "low", ",", "k", ",", "iz", "=", "start", ",", "0", ",", "0", "Tzero", "=", "[", "]", "f", "=", "open", "(", "'chart.txt'", ",...
Makes a chart for performing IZZI experiments. Print out the file and tape it to the oven. This chart will help keep track of the different steps. Z : performed in zero field - enter the temperature XXX.0 in the sio formatted measurement file created by the LabView program I : performed in the ...
[ "Makes", "a", "chart", "for", "performing", "IZZI", "experiments", ".", "Print", "out", "the", "file", "and", "tape", "it", "to", "the", "oven", ".", "This", "chart", "will", "help", "keep", "track", "of", "the", "different", "steps", ".", "Z", ":", "p...
python
train
fboender/ansible-cmdb
lib/mako/lexer.py
https://github.com/fboender/ansible-cmdb/blob/ebd960ac10684e8c9ec2b12751bba2c4c9504ab7/lib/mako/lexer.py#L66-L94
def match_reg(self, reg): """match the given regular expression object to the current text position. if a match occurs, update the current text and line position. """ mp = self.match_position match = reg.match(self.text, self.match_position) if match: ...
[ "def", "match_reg", "(", "self", ",", "reg", ")", ":", "mp", "=", "self", ".", "match_position", "match", "=", "reg", ".", "match", "(", "self", ".", "text", ",", "self", ".", "match_position", ")", "if", "match", ":", "(", "start", ",", "end", ")"...
match the given regular expression object to the current text position. if a match occurs, update the current text and line position.
[ "match", "the", "given", "regular", "expression", "object", "to", "the", "current", "text", "position", "." ]
python
train
python-beaver/python-beaver
beaver/transports/stomp_transport.py
https://github.com/python-beaver/python-beaver/blob/93941e968016c5a962dffed9e7a9f6dc1d23236c/beaver/transports/stomp_transport.py#L64-L74
def reconnect(self): """Allows reconnection from when a handled TransportException is thrown""" try: self.conn.close() except Exception,e: self.logger.warn(e) self.createConnection() return True
[ "def", "reconnect", "(", "self", ")", ":", "try", ":", "self", ".", "conn", ".", "close", "(", ")", "except", "Exception", ",", "e", ":", "self", ".", "logger", ".", "warn", "(", "e", ")", "self", ".", "createConnection", "(", ")", "return", "True"...
Allows reconnection from when a handled TransportException is thrown
[ "Allows", "reconnection", "from", "when", "a", "handled", "TransportException", "is", "thrown" ]
python
train
novopl/peltak
src/peltak/extra/docker/logic.py
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/docker/logic.py#L58-L84
def docker_list(registry_pass): # type: (str) -> None """ List docker images stored in the remote registry. Args: registry_pass (str): Remote docker registry password. """ registry = conf.get('docker.registry', None) if registry is None: log.err("You must define doc...
[ "def", "docker_list", "(", "registry_pass", ")", ":", "# type: (str) -> None", "registry", "=", "conf", ".", "get", "(", "'docker.registry'", ",", "None", ")", "if", "registry", "is", "None", ":", "log", ".", "err", "(", "\"You must define docker.registry conf var...
List docker images stored in the remote registry. Args: registry_pass (str): Remote docker registry password.
[ "List", "docker", "images", "stored", "in", "the", "remote", "registry", "." ]
python
train
spyder-ide/spyder
spyder/dependencies.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/dependencies.py#L66-L75
def add(modname, features, required_version, installed_version=None, optional=False): """Add Spyder dependency""" global DEPENDENCIES for dependency in DEPENDENCIES: if dependency.modname == modname: raise ValueError("Dependency has already been registered: %s"\ ...
[ "def", "add", "(", "modname", ",", "features", ",", "required_version", ",", "installed_version", "=", "None", ",", "optional", "=", "False", ")", ":", "global", "DEPENDENCIES", "for", "dependency", "in", "DEPENDENCIES", ":", "if", "dependency", ".", "modname"...
Add Spyder dependency
[ "Add", "Spyder", "dependency" ]
python
train
has2k1/plydata
plydata/dataframe/common.py
https://github.com/has2k1/plydata/blob/d8ca85ff70eee621e96f7c74034e90fec16e8b61/plydata/dataframe/common.py#L440-L445
def _all(cls, verb): """ A verb """ groups = set(_get_groups(verb)) return [col for col in verb.data if col not in groups]
[ "def", "_all", "(", "cls", ",", "verb", ")", ":", "groups", "=", "set", "(", "_get_groups", "(", "verb", ")", ")", "return", "[", "col", "for", "col", "in", "verb", ".", "data", "if", "col", "not", "in", "groups", "]" ]
A verb
[ "A", "verb" ]
python
train
4degrees/clique
source/clique/collection.py
https://github.com/4degrees/clique/blob/af1d4fef1d60c30a870257199a4d98597d15417d/source/clique/collection.py#L77-L82
def _update_expression(self): '''Update internal expression.''' self._expression = re.compile( '^{0}(?P<index>(?P<padding>0*)\d+?){1}$' .format(re.escape(self.head), re.escape(self.tail)) )
[ "def", "_update_expression", "(", "self", ")", ":", "self", ".", "_expression", "=", "re", ".", "compile", "(", "'^{0}(?P<index>(?P<padding>0*)\\d+?){1}$'", ".", "format", "(", "re", ".", "escape", "(", "self", ".", "head", ")", ",", "re", ".", "escape", "...
Update internal expression.
[ "Update", "internal", "expression", "." ]
python
train
StackStorm/pybind
pybind/nos/v6_0_2f/brocade_vcs_rpc/__init__.py
https://github.com/StackStorm/pybind/blob/44c467e71b2b425be63867aba6e6fa28b2cfe7fb/pybind/nos/v6_0_2f/brocade_vcs_rpc/__init__.py#L158-L182
def _set_get_last_config_update_time(self, v, load=False): """ Setter method for get_last_config_update_time, mapped from YANG variable /brocade_vcs_rpc/get_last_config_update_time (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_get_last_config_update_time is consi...
[ "def", "_set_get_last_config_update_time", "(", "self", ",", "v", ",", "load", "=", "False", ")", ":", "if", "hasattr", "(", "v", ",", "\"_utype\"", ")", ":", "v", "=", "v", ".", "_utype", "(", "v", ")", "try", ":", "t", "=", "YANGDynClass", "(", "...
Setter method for get_last_config_update_time, mapped from YANG variable /brocade_vcs_rpc/get_last_config_update_time (rpc) If this variable is read-only (config: false) in the source YANG file, then _set_get_last_config_update_time is considered as a private method. Backends looking to populate this variab...
[ "Setter", "method", "for", "get_last_config_update_time", "mapped", "from", "YANG", "variable", "/", "brocade_vcs_rpc", "/", "get_last_config_update_time", "(", "rpc", ")", "If", "this", "variable", "is", "read", "-", "only", "(", "config", ":", "false", ")", "i...
python
train
rsgalloway/grit
grit/repo/proxy.py
https://github.com/rsgalloway/grit/blob/e6434ad8a1f4ac5d0903ebad630c81f8a5164d78/grit/repo/proxy.py#L90-L112
def __request(self, url, params): """ Make an HTTP POST request to the server and return JSON data. :param url: HTTP URL to object. :returns: Response as dict. """ log.debug('request: %s %s' %(url, str(params))) try: response = urlopen(url, urlenco...
[ "def", "__request", "(", "self", ",", "url", ",", "params", ")", ":", "log", ".", "debug", "(", "'request: %s %s'", "%", "(", "url", ",", "str", "(", "params", ")", ")", ")", "try", ":", "response", "=", "urlopen", "(", "url", ",", "urlencode", "("...
Make an HTTP POST request to the server and return JSON data. :param url: HTTP URL to object. :returns: Response as dict.
[ "Make", "an", "HTTP", "POST", "request", "to", "the", "server", "and", "return", "JSON", "data", "." ]
python
train
edx/edx-oauth2-provider
edx_oauth2_provider/oidc/core.py
https://github.com/edx/edx-oauth2-provider/blob/73e7569a8369e74c345022ccba634365e24befab/edx_oauth2_provider/oidc/core.py#L39-L56
def encode(self, secret, algorithm='HS256'): """ Encode the set of claims to the JWT (JSON Web Token) format according to the OpenID Connect specification: http://openid.net/specs/openid-connect-basic-1_0.html#IDToken Arguments: claims (dict): A dictionary with the ...
[ "def", "encode", "(", "self", ",", "secret", ",", "algorithm", "=", "'HS256'", ")", ":", "return", "jwt", ".", "encode", "(", "self", ".", "claims", ",", "secret", ",", "algorithm", ")" ]
Encode the set of claims to the JWT (JSON Web Token) format according to the OpenID Connect specification: http://openid.net/specs/openid-connect-basic-1_0.html#IDToken Arguments: claims (dict): A dictionary with the OpenID Connect claims. secret (str): Secret used to e...
[ "Encode", "the", "set", "of", "claims", "to", "the", "JWT", "(", "JSON", "Web", "Token", ")", "format", "according", "to", "the", "OpenID", "Connect", "specification", ":" ]
python
train
aparo/pyes
pyes/orm/queryset.py
https://github.com/aparo/pyes/blob/712eb6095961755067b2b5baa262008ade6584b3/pyes/orm/queryset.py#L643-L647
def none(self): """ Returns an empty QuerySet. """ return EmptyQuerySet(model=self.model, using=self._using, connection=self._connection)
[ "def", "none", "(", "self", ")", ":", "return", "EmptyQuerySet", "(", "model", "=", "self", ".", "model", ",", "using", "=", "self", ".", "_using", ",", "connection", "=", "self", ".", "_connection", ")" ]
Returns an empty QuerySet.
[ "Returns", "an", "empty", "QuerySet", "." ]
python
train