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
quantumlib/Cirq
cirq/sim/wave_function_simulator.py
https://github.com/quantumlib/Cirq/blob/0827da80dd7880e5b923eb69407e980ed9bc0bd2/cirq/sim/wave_function_simulator.py#L70-L94
def compute_displays( self, program: Union[circuits.Circuit, schedules.Schedule], param_resolver: study.ParamResolver = study.ParamResolver({}), qubit_order: ops.QubitOrderOrList = ops.QubitOrder.DEFAULT, initial_state: Union[int, np.ndarray] = 0, ) -> study.ComputeDisplaysRe...
[ "def", "compute_displays", "(", "self", ",", "program", ":", "Union", "[", "circuits", ".", "Circuit", ",", "schedules", ".", "Schedule", "]", ",", "param_resolver", ":", "study", ".", "ParamResolver", "=", "study", ".", "ParamResolver", "(", "{", "}", ")"...
Computes displays in the supplied Circuit or Schedule. Args: program: The circuit or schedule to simulate. param_resolver: Parameters to run with the program. qubit_order: Determines the canonical ordering of the qubits used to define the order of amplitudes ...
[ "Computes", "displays", "in", "the", "supplied", "Circuit", "or", "Schedule", "." ]
python
train
49.56
developersociety/django-glitter
glitter/reminders/models.py
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/reminders/models.py#L34-L63
def get_interval_timedelta(self): """ Spits out the timedelta in days. """ now_datetime = timezone.now() current_month_days = monthrange(now_datetime.year, now_datetime.month)[1] # Two weeks if self.interval == reminders_choices.INTERVAL_2_WEEKS: interval_timedelta ...
[ "def", "get_interval_timedelta", "(", "self", ")", ":", "now_datetime", "=", "timezone", ".", "now", "(", ")", "current_month_days", "=", "monthrange", "(", "now_datetime", ".", "year", ",", "now_datetime", ".", "month", ")", "[", "1", "]", "# Two weeks", "i...
Spits out the timedelta in days.
[ "Spits", "out", "the", "timedelta", "in", "days", "." ]
python
train
38.833333
spyder-ide/spyder
spyder/plugins/editor/lsp/providers/document.py
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/lsp/providers/document.py#L216-L230
def document_did_save_notification(self, params): """ Handle the textDocument/didSave message received from an LSP server. """ text = None if 'text' in params: text = params['text'] params = { 'textDocument': { 'uri': path_as_uri(pa...
[ "def", "document_did_save_notification", "(", "self", ",", "params", ")", ":", "text", "=", "None", "if", "'text'", "in", "params", ":", "text", "=", "params", "[", "'text'", "]", "params", "=", "{", "'textDocument'", ":", "{", "'uri'", ":", "path_as_uri",...
Handle the textDocument/didSave message received from an LSP server.
[ "Handle", "the", "textDocument", "/", "didSave", "message", "received", "from", "an", "LSP", "server", "." ]
python
train
28.533333
ev3dev/ev3dev-lang-python
ev3dev2/motor.py
https://github.com/ev3dev/ev3dev-lang-python/blob/afc98d35004b533dc161a01f7c966e78607d7c1e/ev3dev2/motor.py#L591-L598
def max_speed(self): """ Returns the maximum value that is accepted by the `speed_sp` attribute. This may be slightly different than the maximum speed that a particular motor can reach - it's the maximum theoretical speed. """ (self._max_speed, value) = self.get_cached_at...
[ "def", "max_speed", "(", "self", ")", ":", "(", "self", ".", "_max_speed", ",", "value", ")", "=", "self", ".", "get_cached_attr_int", "(", "self", ".", "_max_speed", ",", "'max_speed'", ")", "return", "value" ]
Returns the maximum value that is accepted by the `speed_sp` attribute. This may be slightly different than the maximum speed that a particular motor can reach - it's the maximum theoretical speed.
[ "Returns", "the", "maximum", "value", "that", "is", "accepted", "by", "the", "speed_sp", "attribute", ".", "This", "may", "be", "slightly", "different", "than", "the", "maximum", "speed", "that", "a", "particular", "motor", "can", "reach", "-", "it", "s", ...
python
train
46.25
sirfoga/pyhal
hal/strings/models.py
https://github.com/sirfoga/pyhal/blob/4394d8a1f7e45bea28a255ec390f4962ee64d33a/hal/strings/models.py#L105-L115
def remove_all(self, token): """Removes all occurrences of token :param token: string to remove :return: input without token """ out = self.string.replace(" ", token) # replace tokens while out.find(token + token) >= 0: # while there are tokens out = out.r...
[ "def", "remove_all", "(", "self", ",", "token", ")", ":", "out", "=", "self", ".", "string", ".", "replace", "(", "\" \"", ",", "token", ")", "# replace tokens", "while", "out", ".", "find", "(", "token", "+", "token", ")", ">=", "0", ":", "# while t...
Removes all occurrences of token :param token: string to remove :return: input without token
[ "Removes", "all", "occurrences", "of", "token" ]
python
train
32.454545
uktrade/directory-validators
directory_validators/company.py
https://github.com/uktrade/directory-validators/blob/e01f9d2aec683e34d978e4f67ed383ea2f9b85a0/directory_validators/company.py#L179-L196
def no_company_with_insufficient_companies_house_data(value): """ Confirms that the company number is not for for a company that Companies House does not hold information on. Args: value (string): The company number to check. Raises: django.forms.ValidationError """ for p...
[ "def", "no_company_with_insufficient_companies_house_data", "(", "value", ")", ":", "for", "prefix", ",", "name", "in", "company_types_with_insufficient_companies_house_data", ":", "if", "value", ".", "upper", "(", ")", ".", "startswith", "(", "prefix", ")", ":", "r...
Confirms that the company number is not for for a company that Companies House does not hold information on. Args: value (string): The company number to check. Raises: django.forms.ValidationError
[ "Confirms", "that", "the", "company", "number", "is", "not", "for", "for", "a", "company", "that", "Companies", "House", "does", "not", "hold", "information", "on", "." ]
python
train
29.444444
apache/incubator-mxnet
python/mxnet/kvstore.py
https://github.com/apache/incubator-mxnet/blob/1af29e9c060a4c7d60eeaacba32afdb9a7775ba7/python/mxnet/kvstore.py#L33-L66
def _ctype_key_value(keys, vals): """ Returns ctype arrays for the key-value args, and the whether string keys are used. For internal use only. """ if isinstance(keys, (tuple, list)): assert(len(keys) == len(vals)) c_keys = [] c_vals = [] use_str_keys = None f...
[ "def", "_ctype_key_value", "(", "keys", ",", "vals", ")", ":", "if", "isinstance", "(", "keys", ",", "(", "tuple", ",", "list", ")", ")", ":", "assert", "(", "len", "(", "keys", ")", "==", "len", "(", "vals", ")", ")", "c_keys", "=", "[", "]", ...
Returns ctype arrays for the key-value args, and the whether string keys are used. For internal use only.
[ "Returns", "ctype", "arrays", "for", "the", "key", "-", "value", "args", "and", "the", "whether", "string", "keys", "are", "used", ".", "For", "internal", "use", "only", "." ]
python
train
44.852941
googleapis/google-cloud-python
spanner/google/cloud/spanner_v1/database.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/spanner/google/cloud/spanner_v1/database.py#L680-L741
def generate_query_batches( self, sql, params=None, param_types=None, partition_size_bytes=None, max_partitions=None, ): """Start a partitioned query operation. Uses the ``PartitionQuery`` API request to start a partitioned query operation. R...
[ "def", "generate_query_batches", "(", "self", ",", "sql", ",", "params", "=", "None", ",", "param_types", "=", "None", ",", "partition_size_bytes", "=", "None", ",", "max_partitions", "=", "None", ",", ")", ":", "partitions", "=", "self", ".", "_get_snapshot...
Start a partitioned query operation. Uses the ``PartitionQuery`` API request to start a partitioned query operation. Returns a list of batch information needed to peform the actual queries. :type sql: str :param sql: SQL query statement :type params: dict, {str -> col...
[ "Start", "a", "partitioned", "query", "operation", "." ]
python
train
34.967742
hughsie/python-appstream
appstream/component.py
https://github.com/hughsie/python-appstream/blob/f2606380278c5728ee7f8e7d19914c54fca05e76/appstream/component.py#L526-L661
def parse(self, xml_data): """ Parse XML data """ # parse tree if isinstance(xml_data, string_types): # Presumably, this is textual xml data. try: root = ET.fromstring(xml_data) except StdlibParseError as e: raise ParseError(st...
[ "def", "parse", "(", "self", ",", "xml_data", ")", ":", "# parse tree", "if", "isinstance", "(", "xml_data", ",", "string_types", ")", ":", "# Presumably, this is textual xml data.", "try", ":", "root", "=", "ET", ".", "fromstring", "(", "xml_data", ")", "exce...
Parse XML data
[ "Parse", "XML", "data" ]
python
train
31.558824
Pytwitcher/pytwitcherapi
src/pytwitcherapi/models.py
https://github.com/Pytwitcher/pytwitcherapi/blob/d53ac5ad5ca113ecb7da542e8cdcbbf8c762b336/src/pytwitcherapi/models.py#L138-L150
def wrap_get_channel(cls, response): """Wrap the response from getting a channel into an instance and return it :param response: The response from getting a channel :type response: :class:`requests.Response` :returns: the new channel instance :rtype: :class:`list` of :cl...
[ "def", "wrap_get_channel", "(", "cls", ",", "response", ")", ":", "json", "=", "response", ".", "json", "(", ")", "c", "=", "cls", ".", "wrap_json", "(", "json", ")", "return", "c" ]
Wrap the response from getting a channel into an instance and return it :param response: The response from getting a channel :type response: :class:`requests.Response` :returns: the new channel instance :rtype: :class:`list` of :class:`channel` :raises: None
[ "Wrap", "the", "response", "from", "getting", "a", "channel", "into", "an", "instance", "and", "return", "it" ]
python
train
33.461538
arne-cl/discoursegraphs
src/discoursegraphs/util.py
https://github.com/arne-cl/discoursegraphs/blob/842f0068a3190be2c75905754521b176b25a54fb/src/discoursegraphs/util.py#L43-L67
def get_segment_token_offsets(segment_token_list, token_map): """ given a list of token node IDs, returns the index of its first and last elements. this actually calculates the int indices, as there are weird formats like RS3, which use unordered / wrongly ordered IDs. Parameters ---------- ...
[ "def", "get_segment_token_offsets", "(", "segment_token_list", ",", "token_map", ")", ":", "token_indices", "=", "[", "token_map", "[", "token_id", "]", "for", "token_id", "in", "segment_token_list", "]", "# we need to foolproof this for nasty RS3 files or other input formats...
given a list of token node IDs, returns the index of its first and last elements. this actually calculates the int indices, as there are weird formats like RS3, which use unordered / wrongly ordered IDs. Parameters ---------- segment_token_list : list of str sorted list of token IDs (i.e. t...
[ "given", "a", "list", "of", "token", "node", "IDs", "returns", "the", "index", "of", "its", "first", "and", "last", "elements", ".", "this", "actually", "calculates", "the", "int", "indices", "as", "there", "are", "weird", "formats", "like", "RS3", "which"...
python
train
36.84
redodo/formats
formats/banks.py
https://github.com/redodo/formats/blob/5bc7a79a2c93ef895534edbbf83f1efe2f62e081/formats/banks.py#L18-L32
def register(self, type, parser, composer, **meta): """Registers a parser and composer of a format. You can use this method to overwrite existing formats. :param type: The unique name of the format :param parser: The method to parse data as the format :param composer: The metho...
[ "def", "register", "(", "self", ",", "type", ",", "parser", ",", "composer", ",", "*", "*", "meta", ")", ":", "self", ".", "registered_formats", "[", "type", "]", "=", "{", "'parser'", ":", "parser", ",", "'composer'", ":", "composer", ",", "'meta'", ...
Registers a parser and composer of a format. You can use this method to overwrite existing formats. :param type: The unique name of the format :param parser: The method to parse data as the format :param composer: The method to compose data as the format :param meta: The extra ...
[ "Registers", "a", "parser", "and", "composer", "of", "a", "format", "." ]
python
train
37.4
andreikop/qutepart
qutepart/indenter/lisp.py
https://github.com/andreikop/qutepart/blob/109d76b239751318bcef06f39b2fbbf18687a40b/qutepart/indenter/lisp.py#L8-L26
def computeSmartIndent(self, block, ch): """special rules: ;;; -> indent 0 ;; -> align with next line, if possible ; -> usually on the same line as code -> ignore """ if re.search(r'^\s*;;;', block.text()): return '' elif...
[ "def", "computeSmartIndent", "(", "self", ",", "block", ",", "ch", ")", ":", "if", "re", ".", "search", "(", "r'^\\s*;;;'", ",", "block", ".", "text", "(", ")", ")", ":", "return", "''", "elif", "re", ".", "search", "(", "r'^\\s*;;'", ",", "block", ...
special rules: ;;; -> indent 0 ;; -> align with next line, if possible ; -> usually on the same line as code -> ignore
[ "special", "rules", ":", ";;;", "-", ">", "indent", "0", ";;", "-", ">", "align", "with", "next", "line", "if", "possible", ";", "-", ">", "usually", "on", "the", "same", "line", "as", "code", "-", ">", "ignore" ]
python
train
39.578947
jjmontesl/python-clementine-remote
clementineremote/clementine.py
https://github.com/jjmontesl/python-clementine-remote/blob/af5198f8bb56a4845f4e081fd8a553f935c94cde/clementineremote/clementine.py#L179-L185
def next(self): """ Sends a "next" command to the player. """ msg = cr.Message() msg.type = cr.NEXT self.send_message(msg)
[ "def", "next", "(", "self", ")", ":", "msg", "=", "cr", ".", "Message", "(", ")", "msg", ".", "type", "=", "cr", ".", "NEXT", "self", ".", "send_message", "(", "msg", ")" ]
Sends a "next" command to the player.
[ "Sends", "a", "next", "command", "to", "the", "player", "." ]
python
train
23.428571
svven/summary
summary/request.py
https://github.com/svven/summary/blob/3a6c43d2da08a7452f6b76d1813aa70ba36b8a54/summary/request.py#L27-L45
def phantomjs_get(url): """ Perform the request via PhantomJS. """ from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities dcap = dict(DesiredCapabilities.PHANTOMJS) dcap["phantomjs.page.settings.userAgent"] = config.USER_AGENT dcap[...
[ "def", "phantomjs_get", "(", "url", ")", ":", "from", "selenium", "import", "webdriver", "from", "selenium", ".", "webdriver", ".", "common", ".", "desired_capabilities", "import", "DesiredCapabilities", "dcap", "=", "dict", "(", "DesiredCapabilities", ".", "PHANT...
Perform the request via PhantomJS.
[ "Perform", "the", "request", "via", "PhantomJS", "." ]
python
train
32.789474
gunthercox/ChatterBot
chatterbot/storage/django_storage.py
https://github.com/gunthercox/ChatterBot/blob/1a03dcb45cba7bdc24d3db5e750582e0cb1518e2/chatterbot/storage/django_storage.py#L123-L157
def create_many(self, statements): """ Creates multiple statement entries. """ Statement = self.get_model('statement') Tag = self.get_model('tag') tag_cache = {} for statement in statements: statement_data = statement.serialize() tag_dat...
[ "def", "create_many", "(", "self", ",", "statements", ")", ":", "Statement", "=", "self", ".", "get_model", "(", "'statement'", ")", "Tag", "=", "self", ".", "get_model", "(", "'tag'", ")", "tag_cache", "=", "{", "}", "for", "statement", "in", "statement...
Creates multiple statement entries.
[ "Creates", "multiple", "statement", "entries", "." ]
python
train
33.6
PyCQA/astroid
astroid/node_classes.py
https://github.com/PyCQA/astroid/blob/e0a298df55b15abcb77c2a93253f5ab7be52d0fb/astroid/node_classes.py#L975-L985
def previous_sibling(self): """The previous sibling statement. :returns: The previous sibling statement node. :rtype: NodeNG or None """ stmts = self.parent.child_sequence(self) index = stmts.index(self) if index >= 1: return stmts[index - 1] ...
[ "def", "previous_sibling", "(", "self", ")", ":", "stmts", "=", "self", ".", "parent", ".", "child_sequence", "(", "self", ")", "index", "=", "stmts", ".", "index", "(", "self", ")", "if", "index", ">=", "1", ":", "return", "stmts", "[", "index", "-"...
The previous sibling statement. :returns: The previous sibling statement node. :rtype: NodeNG or None
[ "The", "previous", "sibling", "statement", "." ]
python
train
29.181818
helto4real/python-packages
smhi/smhi/smhi_lib.py
https://github.com/helto4real/python-packages/blob/8b65342eea34e370ea6fc5abdcb55e544c51fec5/smhi/smhi/smhi_lib.py#L241-L246
def get_forecast(self) -> List[SmhiForecast]: """ Returns a list of forecasts. The first in list are the current one """ json_data = self._api.get_forecast_api(self._longitude, self._latitude) return _get_forecast(json_data)
[ "def", "get_forecast", "(", "self", ")", "->", "List", "[", "SmhiForecast", "]", ":", "json_data", "=", "self", ".", "_api", ".", "get_forecast_api", "(", "self", ".", "_longitude", ",", "self", ".", "_latitude", ")", "return", "_get_forecast", "(", "json_...
Returns a list of forecasts. The first in list are the current one
[ "Returns", "a", "list", "of", "forecasts", ".", "The", "first", "in", "list", "are", "the", "current", "one" ]
python
train
44
numenta/htmresearch
htmresearch/data/sm_sequences.py
https://github.com/numenta/htmresearch/blob/70c096b09a577ea0432c3f3bfff4442d4871b7aa/htmresearch/data/sm_sequences.py#L279-L303
def getNextEyeLocation(self, currentEyeLoc): """ Generate next eye location based on current eye location. @param currentEyeLoc (numpy.array) Current coordinate describing the eye location in the world. @return (tuple) Contains: nextEyeLoc (numpy.array) Coordinate ...
[ "def", "getNextEyeLocation", "(", "self", ",", "currentEyeLoc", ")", ":", "possibleEyeLocs", "=", "[", "]", "for", "loc", "in", "self", ".", "spatialConfig", ":", "shift", "=", "abs", "(", "max", "(", "loc", "-", "currentEyeLoc", ")", ")", "if", "self", ...
Generate next eye location based on current eye location. @param currentEyeLoc (numpy.array) Current coordinate describing the eye location in the world. @return (tuple) Contains: nextEyeLoc (numpy.array) Coordinate of the next eye location. eyeDiff (numpy...
[ "Generate", "next", "eye", "location", "based", "on", "current", "eye", "location", "." ]
python
train
31.2
wesyoung/pyzyre
czmq/_czmq_ctypes.py
https://github.com/wesyoung/pyzyre/blob/22d4c757acefcfdb700d3802adaf30b402bb9eea/czmq/_czmq_ctypes.py#L2905-L2911
def comment(self, format, *args): """ Add a comment to hash table before saving to disk. You can add as many comment lines as you like. These comment lines are discarded when loading the file. If you use a null format, all comments are deleted. """ return lib.zhash_comment(self._as_param...
[ "def", "comment", "(", "self", ",", "format", ",", "*", "args", ")", ":", "return", "lib", ".", "zhash_comment", "(", "self", ".", "_as_parameter_", ",", "format", ",", "*", "args", ")" ]
Add a comment to hash table before saving to disk. You can add as many comment lines as you like. These comment lines are discarded when loading the file. If you use a null format, all comments are deleted.
[ "Add", "a", "comment", "to", "hash", "table", "before", "saving", "to", "disk", ".", "You", "can", "add", "as", "many", "comment", "lines", "as", "you", "like", ".", "These", "comment", "lines", "are", "discarded", "when", "loading", "the", "file", ".", ...
python
train
47.857143
Julian/jsonschema
jsonschema/_utils.py
https://github.com/Julian/jsonschema/blob/a72332004cdc3ba456de7918bc32059822b2f69a/jsonschema/_utils.py#L51-L58
def load_schema(name): """ Load a schema from ./schemas/``name``.json and return it. """ data = pkgutil.get_data('jsonschema', "schemas/{0}.json".format(name)) return json.loads(data.decode("utf-8"))
[ "def", "load_schema", "(", "name", ")", ":", "data", "=", "pkgutil", ".", "get_data", "(", "'jsonschema'", ",", "\"schemas/{0}.json\"", ".", "format", "(", "name", ")", ")", "return", "json", ".", "loads", "(", "data", ".", "decode", "(", "\"utf-8\"", ")...
Load a schema from ./schemas/``name``.json and return it.
[ "Load", "a", "schema", "from", ".", "/", "schemas", "/", "name", ".", "json", "and", "return", "it", "." ]
python
train
26.75
gwastro/pycbc
pycbc/workflow/core.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/workflow/core.py#L1438-L1444
def find_output_with_ifo(self, ifo): """ Find all files who have ifo = ifo """ # Enforce upper case ifo = ifo.upper() return FileList([i for i in self if ifo in i.ifo_list])
[ "def", "find_output_with_ifo", "(", "self", ",", "ifo", ")", ":", "# Enforce upper case", "ifo", "=", "ifo", ".", "upper", "(", ")", "return", "FileList", "(", "[", "i", "for", "i", "in", "self", "if", "ifo", "in", "i", ".", "ifo_list", "]", ")" ]
Find all files who have ifo = ifo
[ "Find", "all", "files", "who", "have", "ifo", "=", "ifo" ]
python
train
30.714286
sixty-north/asq
asq/queryables.py
https://github.com/sixty-north/asq/blob/db0c4cbcf2118435136d4b63c62a12711441088e/asq/queryables.py#L1358-L1389
def union(self, second_iterable, selector=identity): '''Returns those elements which are either in the source sequence or in the second_iterable, or in both. Note: This method uses deferred execution. Args: second_iterable: Elements from this sequence are returns if they ...
[ "def", "union", "(", "self", ",", "second_iterable", ",", "selector", "=", "identity", ")", ":", "if", "self", ".", "closed", "(", ")", ":", "raise", "ValueError", "(", "\"Attempt to call union() on a closed Queryable.\"", ")", "if", "not", "is_iterable", "(", ...
Returns those elements which are either in the source sequence or in the second_iterable, or in both. Note: This method uses deferred execution. Args: second_iterable: Elements from this sequence are returns if they are not also in the source sequence. ...
[ "Returns", "those", "elements", "which", "are", "either", "in", "the", "source", "sequence", "or", "in", "the", "second_iterable", "or", "in", "both", "." ]
python
train
41.375
pkkid/python-plexapi
plexapi/myplex.py
https://github.com/pkkid/python-plexapi/blob/9efbde96441c2bfbf410eacfb46e811e108e8bbc/plexapi/myplex.py#L153-L156
def devices(self): """ Returns a list of all :class:`~plexapi.myplex.MyPlexDevice` objects connected to the server. """ data = self.query(MyPlexDevice.key) return [MyPlexDevice(self, elem) for elem in data]
[ "def", "devices", "(", "self", ")", ":", "data", "=", "self", ".", "query", "(", "MyPlexDevice", ".", "key", ")", "return", "[", "MyPlexDevice", "(", "self", ",", "elem", ")", "for", "elem", "in", "data", "]" ]
Returns a list of all :class:`~plexapi.myplex.MyPlexDevice` objects connected to the server.
[ "Returns", "a", "list", "of", "all", ":", "class", ":", "~plexapi", ".", "myplex", ".", "MyPlexDevice", "objects", "connected", "to", "the", "server", "." ]
python
train
56.75
GoogleCloudPlatform/cloud-debug-python
src/googleclouddebugger/capture_collector.py
https://github.com/GoogleCloudPlatform/cloud-debug-python/blob/89ce3782c98b814838a3ecb5479ed3882368cbee/src/googleclouddebugger/capture_collector.py#L385-L406
def CaptureNamedVariable(self, name, value, depth, limits): """Appends name to the product of CaptureVariable. Args: name: name of the variable. value: data to capture depth: nested depth of dictionaries and vectors so far. limits: Per-object limits for capturing variable data. Ret...
[ "def", "CaptureNamedVariable", "(", "self", ",", "name", ",", "value", ",", "depth", ",", "limits", ")", ":", "if", "not", "hasattr", "(", "name", ",", "'__dict__'", ")", ":", "name", "=", "str", "(", "name", ")", "else", ":", "# TODO(vlif): call str(nam...
Appends name to the product of CaptureVariable. Args: name: name of the variable. value: data to capture depth: nested depth of dictionaries and vectors so far. limits: Per-object limits for capturing variable data. Returns: Formatted captured data as per Variable proto with name...
[ "Appends", "name", "to", "the", "product", "of", "CaptureVariable", "." ]
python
train
31.863636
dmlc/xgboost
python-package/xgboost/core.py
https://github.com/dmlc/xgboost/blob/253fdd8a42d5ec6b819788199584d27bf9ea6253/python-package/xgboost/core.py#L179-L194
def ctypes2numpy(cptr, length, dtype): """Convert a ctypes pointer array to a numpy array. """ NUMPY_TO_CTYPES_MAPPING = { np.float32: ctypes.c_float, np.uint32: ctypes.c_uint, } if dtype not in NUMPY_TO_CTYPES_MAPPING: raise RuntimeError('Supported types: {}'.format(NUMPY_TO...
[ "def", "ctypes2numpy", "(", "cptr", ",", "length", ",", "dtype", ")", ":", "NUMPY_TO_CTYPES_MAPPING", "=", "{", "np", ".", "float32", ":", "ctypes", ".", "c_float", ",", "np", ".", "uint32", ":", "ctypes", ".", "c_uint", ",", "}", "if", "dtype", "not",...
Convert a ctypes pointer array to a numpy array.
[ "Convert", "a", "ctypes", "pointer", "array", "to", "a", "numpy", "array", "." ]
python
train
41.4375
Spinmob/spinmob
_plotting_mess.py
https://github.com/Spinmob/spinmob/blob/f037f5df07f194bcd4a01f4d9916e57b9e8fb45a/_plotting_mess.py#L66-L98
def _match_error_to_data_set(x, ex): """ Inflates ex to match the dimensionality of x, "intelligently". x is assumed to be a 2D array. """ # Simplest case, ex is None or a number if not _fun.is_iterable(ex): # Just make a matched list of Nones if ex is None: ex = [ex]*l...
[ "def", "_match_error_to_data_set", "(", "x", ",", "ex", ")", ":", "# Simplest case, ex is None or a number", "if", "not", "_fun", ".", "is_iterable", "(", "ex", ")", ":", "# Just make a matched list of Nones", "if", "ex", "is", "None", ":", "ex", "=", "[", "ex",...
Inflates ex to match the dimensionality of x, "intelligently". x is assumed to be a 2D array.
[ "Inflates", "ex", "to", "match", "the", "dimensionality", "of", "x", "intelligently", ".", "x", "is", "assumed", "to", "be", "a", "2D", "array", "." ]
python
train
34.454545
arkottke/pysra
pysra/propagation.py
https://github.com/arkottke/pysra/blob/c72fd389d6c15203c0c00728ac00f101bae6369d/pysra/propagation.py#L514-L519
def _estimate_strains(self): """Compute an estimate of the strains.""" # Estimate the strain based on the PGV and shear-wave velocity for l in self._profile: l.reset() l.strain = self._motion.pgv / l.initial_shear_vel
[ "def", "_estimate_strains", "(", "self", ")", ":", "# Estimate the strain based on the PGV and shear-wave velocity", "for", "l", "in", "self", ".", "_profile", ":", "l", ".", "reset", "(", ")", "l", ".", "strain", "=", "self", ".", "_motion", ".", "pgv", "/", ...
Compute an estimate of the strains.
[ "Compute", "an", "estimate", "of", "the", "strains", "." ]
python
train
43.333333
django-json-api/django-rest-framework-json-api
rest_framework_json_api/relations.py
https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/relations.py#L255-L274
def get_resource_type_from_included_serializer(self): """ Check to see it this resource has a different resource_name when included and return that name, or None """ field_name = self.field_name or self.parent.field_name parent = self.get_parent_serializer() if p...
[ "def", "get_resource_type_from_included_serializer", "(", "self", ")", ":", "field_name", "=", "self", ".", "field_name", "or", "self", ".", "parent", ".", "field_name", "parent", "=", "self", ".", "get_parent_serializer", "(", ")", "if", "parent", "is", "not", ...
Check to see it this resource has a different resource_name when included and return that name, or None
[ "Check", "to", "see", "it", "this", "resource", "has", "a", "different", "resource_name", "when", "included", "and", "return", "that", "name", "or", "None" ]
python
train
38.45
jobovy/galpy
galpy/orbit/Orbit.py
https://github.com/jobovy/galpy/blob/9c5b9fe65d58835624dffe432be282060918ee08/galpy/orbit/Orbit.py#L2529-L2565
def pmll(self,*args,**kwargs): """ NAME: pmll PURPOSE: return proper motion in Galactic longitude (in mas/yr) INPUT: t - (optional) time at which to get pmll (can be Quantity) v obs=[X,Y,Z,vx,vy,vz] - (optional) position and velocity of ob...
[ "def", "pmll", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "out", "=", "self", ".", "_orb", ".", "pmll", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "len", "(", "out", ")", "==", "1", ":", "return", "out", "[...
NAME: pmll PURPOSE: return proper motion in Galactic longitude (in mas/yr) INPUT: t - (optional) time at which to get pmll (can be Quantity) v obs=[X,Y,Z,vx,vy,vz] - (optional) position and velocity of observer in the Galactocent...
[ "NAME", ":" ]
python
train
28.837838
google/transitfeed
merge.py
https://github.com/google/transitfeed/blob/eb2991a3747ba541b2cb66502b305b6304a1f85f/merge.py#L1680-L1708
def Register(self, a, b, migrated_entity): """Registers a merge mapping. If a and b are both not None, this means that entities a and b were merged to produce migrated_entity. If one of a or b are not None, then it means it was not merged but simply migrated. The effect of a call to register is to...
[ "def", "Register", "(", "self", ",", "a", ",", "b", ",", "migrated_entity", ")", ":", "# There are a few places where code needs to find the corresponding", "# migrated entity of an object without knowing in which original schedule", "# the entity started. With a_merge_map and b_merge_ma...
Registers a merge mapping. If a and b are both not None, this means that entities a and b were merged to produce migrated_entity. If one of a or b are not None, then it means it was not merged but simply migrated. The effect of a call to register is to update a_merge_map and b_merge_map according ...
[ "Registers", "a", "merge", "mapping", "." ]
python
train
46.344828
simpleai-team/simpleai
simpleai/search/local.py
https://github.com/simpleai-team/simpleai/blob/2836befa7e970013f62e0ee75562652aacac6f65/simpleai/search/local.py#L75-L90
def hill_climbing(problem, iterations_limit=0, viewer=None): ''' Hill climbing search. If iterations_limit is specified, the algorithm will end after that number of iterations. Else, it will continue until it can't find a better node than the current one. Requires: SearchProblem.actions, Search...
[ "def", "hill_climbing", "(", "problem", ",", "iterations_limit", "=", "0", ",", "viewer", "=", "None", ")", ":", "return", "_local_search", "(", "problem", ",", "_first_expander", ",", "iterations_limit", "=", "iterations_limit", ",", "fringe_size", "=", "1", ...
Hill climbing search. If iterations_limit is specified, the algorithm will end after that number of iterations. Else, it will continue until it can't find a better node than the current one. Requires: SearchProblem.actions, SearchProblem.result, and SearchProblem.value.
[ "Hill", "climbing", "search", "." ]
python
train
39
reingart/pyafipws
padron.py
https://github.com/reingart/pyafipws/blob/ee87cfe4ac12285ab431df5fec257f103042d1ab/padron.py#L242-L276
def Buscar(self, nro_doc, tipo_doc=80): "Devuelve True si fue encontrado y establece atributos con datos" # cuit: codigo único de identificación tributaria del contribuyente # (sin guiones) self.cursor.execute("SELECT * FROM padron WHERE " " tipo_doc=? A...
[ "def", "Buscar", "(", "self", ",", "nro_doc", ",", "tipo_doc", "=", "80", ")", ":", "# cuit: codigo único de identificación tributaria del contribuyente", "# (sin guiones)", "self", ".", "cursor", ".", "execute", "(", "\"SELECT * FROM padron WHERE \"", "\" tipo_doc=? ...
Devuelve True si fue encontrado y establece atributos con datos
[ "Devuelve", "True", "si", "fue", "encontrado", "y", "establece", "atributos", "con", "datos" ]
python
train
36.6
openstack/networking-cisco
networking_cisco/apps/saf/server/dfa_server.py
https://github.com/openstack/networking-cisco/blob/aa58a30aec25b86f9aa5952b0863045975debfa9/networking_cisco/apps/saf/server/dfa_server.py#L1336-L1393
def update_port_ip_address(self): """Find the ip address that assinged to a port via DHCP The port database will be updated with the ip address. """ leases = None req = dict(ip='0.0.0.0') instances = self.get_vms_for_this_req(**req) if instances is None: ...
[ "def", "update_port_ip_address", "(", "self", ")", ":", "leases", "=", "None", "req", "=", "dict", "(", "ip", "=", "'0.0.0.0'", ")", "instances", "=", "self", ".", "get_vms_for_this_req", "(", "*", "*", "req", ")", "if", "instances", "is", "None", ":", ...
Find the ip address that assinged to a port via DHCP The port database will be updated with the ip address.
[ "Find", "the", "ip", "address", "that", "assinged", "to", "a", "port", "via", "DHCP" ]
python
train
50.62069
Grunny/zap-cli
zapcli/zap_helper.py
https://github.com/Grunny/zap-cli/blob/d58d4850ecfc5467badfac5e5bcc841d064bd419/zapcli/zap_helper.py#L325-L331
def set_scanner_alert_threshold(self, scanner_ids, alert_threshold): """Set the alert theshold for the given policies.""" for scanner_id in scanner_ids: self.logger.debug('Setting alert threshold for scanner {0} to {1}'.format(scanner_id, alert_threshold)) result = self.zap.ascan...
[ "def", "set_scanner_alert_threshold", "(", "self", ",", "scanner_ids", ",", "alert_threshold", ")", ":", "for", "scanner_id", "in", "scanner_ids", ":", "self", ".", "logger", ".", "debug", "(", "'Setting alert threshold for scanner {0} to {1}'", ".", "format", "(", ...
Set the alert theshold for the given policies.
[ "Set", "the", "alert", "theshold", "for", "the", "given", "policies", "." ]
python
train
74.571429
Spirent/py-stcrestclient
stcrestclient/stchttp.py
https://github.com/Spirent/py-stcrestclient/blob/80ee82bddf2fb2808f3da8ff2c80b7d588e165e8/stcrestclient/stchttp.py#L475-L479
def connections(self): """Get list of connections.""" self._check_session() status, data = self._rest.get_request('connections') return data
[ "def", "connections", "(", "self", ")", ":", "self", ".", "_check_session", "(", ")", "status", ",", "data", "=", "self", ".", "_rest", ".", "get_request", "(", "'connections'", ")", "return", "data" ]
Get list of connections.
[ "Get", "list", "of", "connections", "." ]
python
train
33.6
bcj/AttrDict
attrdict/merge.py
https://github.com/bcj/AttrDict/blob/8c1883162178a124ee29144ca7abcd83cbd9d222/attrdict/merge.py#L10-L44
def merge(left, right): """ Merge two mappings objects together, combining overlapping Mappings, and favoring right-values left: The left Mapping object. right: The right (favored) Mapping object. NOTE: This is not commutative (merge(a,b) != merge(b,a)). """ merged = {} left_keys ...
[ "def", "merge", "(", "left", ",", "right", ")", ":", "merged", "=", "{", "}", "left_keys", "=", "frozenset", "(", "left", ")", "right_keys", "=", "frozenset", "(", "right", ")", "# Items only in the left Mapping", "for", "key", "in", "left_keys", "-", "rig...
Merge two mappings objects together, combining overlapping Mappings, and favoring right-values left: The left Mapping object. right: The right (favored) Mapping object. NOTE: This is not commutative (merge(a,b) != merge(b,a)).
[ "Merge", "two", "mappings", "objects", "together", "combining", "overlapping", "Mappings", "and", "favoring", "right", "-", "values" ]
python
train
27.2
CalebBell/thermo
thermo/elements.py
https://github.com/CalebBell/thermo/blob/3857ed023a3e64fd3039a32d53576c24990ef1c3/thermo/elements.py#L691-L731
def serialize_formula(formula): r'''Basic formula serializer to construct a consistently-formatted formula. This is necessary for handling user-supplied formulas, which are not always well formatted. Performs no sanity checking that elements are actually elements. Parameters ---------- ...
[ "def", "serialize_formula", "(", "formula", ")", ":", "charge", "=", "charge_from_formula", "(", "formula", ")", "element_dict", "=", "nested_formula_parser", "(", "formula", ")", "base", "=", "atoms_to_Hill", "(", "element_dict", ")", "if", "charge", "==", "0",...
r'''Basic formula serializer to construct a consistently-formatted formula. This is necessary for handling user-supplied formulas, which are not always well formatted. Performs no sanity checking that elements are actually elements. Parameters ---------- formula : str Formula strin...
[ "r", "Basic", "formula", "serializer", "to", "construct", "a", "consistently", "-", "formatted", "formula", ".", "This", "is", "necessary", "for", "handling", "user", "-", "supplied", "formulas", "which", "are", "not", "always", "well", "formatted", "." ]
python
valid
24.95122
Parisson/TimeSide
timeside/core/processor.py
https://github.com/Parisson/TimeSide/blob/0618d75cd2f16021afcfd3d5b77f692adad76ea5/timeside/core/processor.py#L337-L369
def append_processor(self, proc, source_proc=None): "Append a new processor to the pipe" if source_proc is None and len(self.processors): source_proc = self.processors[0] if source_proc and not isinstance(source_proc, Processor): raise TypeError('source_proc must be a Pr...
[ "def", "append_processor", "(", "self", ",", "proc", ",", "source_proc", "=", "None", ")", ":", "if", "source_proc", "is", "None", "and", "len", "(", "self", ".", "processors", ")", ":", "source_proc", "=", "self", ".", "processors", "[", "0", "]", "if...
Append a new processor to the pipe
[ "Append", "a", "new", "processor", "to", "the", "pipe" ]
python
train
47.606061
atztogo/phonopy
phonopy/api_phonopy.py
https://github.com/atztogo/phonopy/blob/869cc2ba9e7d495d5f4cf6942415ab3fc9e2a10f/phonopy/api_phonopy.py#L1897-L1959
def run_thermal_displacements(self, t_min=0, t_max=1000, t_step=10, temperatures=None, direction=None, freq_min=None...
[ "def", "run_thermal_displacements", "(", "self", ",", "t_min", "=", "0", ",", "t_max", "=", "1000", ",", "t_step", "=", "10", ",", "temperatures", "=", "None", ",", "direction", "=", "None", ",", "freq_min", "=", "None", ",", "freq_max", "=", "None", "...
Prepare thermal displacements calculation Parameters ---------- t_min, t_max, t_step : float, optional Minimum and maximum temperatures and the interval in this temperature range. Default valuues are 0, 1000, and 10. temperatures : array_like, optional ...
[ "Prepare", "thermal", "displacements", "calculation" ]
python
train
40.698413
LonamiWebs/Telethon
telethon/tl/custom/conversation.py
https://github.com/LonamiWebs/Telethon/blob/1ead9757d366b58c1e0567cddb0196e20f1a445f/telethon/tl/custom/conversation.py#L202-L228
async def get_edit(self, message=None, *, timeout=None): """ Awaits for an edit after the last message to arrive. The arguments are the same as those for `get_response`. """ start_time = time.time() target_id = self._get_message_id(message) target_date = self._ed...
[ "async", "def", "get_edit", "(", "self", ",", "message", "=", "None", ",", "*", ",", "timeout", "=", "None", ")", ":", "start_time", "=", "time", ".", "time", "(", ")", "target_id", "=", "self", ".", "_get_message_id", "(", "message", ")", "target_date...
Awaits for an edit after the last message to arrive. The arguments are the same as those for `get_response`.
[ "Awaits", "for", "an", "edit", "after", "the", "last", "message", "to", "arrive", ".", "The", "arguments", "are", "the", "same", "as", "those", "for", "get_response", "." ]
python
train
38.555556
alexa/alexa-skills-kit-sdk-for-python
ask-sdk-runtime/ask_sdk_runtime/dispatch_components/exception_components.py
https://github.com/alexa/alexa-skills-kit-sdk-for-python/blob/097b6406aa12d5ca0b825b00c936861b530cbf39/ask-sdk-runtime/ask_sdk_runtime/dispatch_components/exception_components.py#L181-L200
def get_handler(self, handler_input, exception): # type: (Input, Exception) -> Union[AbstractExceptionHandler, None] """Get the exception handler that can handle the input and exception. :param handler_input: Generic input passed to the dispatcher. :type handler_inpu...
[ "def", "get_handler", "(", "self", ",", "handler_input", ",", "exception", ")", ":", "# type: (Input, Exception) -> Union[AbstractExceptionHandler, None]", "for", "handler", "in", "self", ".", "exception_handlers", ":", "if", "handler", ".", "can_handle", "(", "handler_...
Get the exception handler that can handle the input and exception. :param handler_input: Generic input passed to the dispatcher. :type handler_input: Input :param exception: Exception thrown by :py:class:`ask_sdk_runtime.dispatch.GenericRequestDispatcher` ...
[ "Get", "the", "exception", "handler", "that", "can", "handle", "the", "input", "and", "exception", "." ]
python
train
44.55
Netflix-Skunkworks/cloudaux
cloudaux/orchestration/aws/s3.py
https://github.com/Netflix-Skunkworks/cloudaux/blob/c4b0870c3ac68b1c69e71d33cf78b6a8bdf437ea/cloudaux/orchestration/aws/s3.py#L283-L333
def get_bucket(bucket_name, include_created=None, flags=FLAGS.ALL ^ FLAGS.CREATED_DATE, **conn): """ Orchestrates all the calls required to fully build out an S3 bucket in the following format: { "Arn": ..., "Name": ..., "Region": ..., "Owner": ..., "Grants": ......
[ "def", "get_bucket", "(", "bucket_name", ",", "include_created", "=", "None", ",", "flags", "=", "FLAGS", ".", "ALL", "^", "FLAGS", ".", "CREATED_DATE", ",", "*", "*", "conn", ")", ":", "if", "type", "(", "include_created", ")", "is", "bool", ":", "# c...
Orchestrates all the calls required to fully build out an S3 bucket in the following format: { "Arn": ..., "Name": ..., "Region": ..., "Owner": ..., "Grants": ..., "GrantReferences": ..., "LifecycleRules": ..., "Logging": ..., "Policy": .....
[ "Orchestrates", "all", "the", "calls", "required", "to", "fully", "build", "out", "an", "S3", "bucket", "in", "the", "following", "format", ":", "{", "Arn", ":", "...", "Name", ":", "...", "Region", ":", "...", "Owner", ":", "...", "Grants", ":", "..."...
python
valid
35.117647
klmitch/framer
framer/framers.py
https://github.com/klmitch/framer/blob/bd34cee9737793dab61d1d8973930b64bd08acb4/framer/framers.py#L838-L854
def to_bytes(self, frame, state): """ Convert a single frame into bytes that can be transmitted on the stream. :param frame: The frame to convert. Should be the same type of object returned by ``to_frame()``. :param state: An instance of ``FramerState``. ...
[ "def", "to_bytes", "(", "self", ",", "frame", ",", "state", ")", ":", "# Encode the frame and append the delimiter", "return", "six", ".", "binary_type", "(", "self", ".", "variant", ".", "encode", "(", "six", ".", "binary_type", "(", "frame", ")", ")", ")",...
Convert a single frame into bytes that can be transmitted on the stream. :param frame: The frame to convert. Should be the same type of object returned by ``to_frame()``. :param state: An instance of ``FramerState``. This object may be used to track...
[ "Convert", "a", "single", "frame", "into", "bytes", "that", "can", "be", "transmitted", "on", "the", "stream", "." ]
python
train
38
panzarino/mlbgame
mlbgame/info.py
https://github.com/panzarino/mlbgame/blob/0a2d10540de793fdc3b8476aa18f5cf3b53d0b54/mlbgame/info.py#L36-L45
def team_info(): """Returns a list of team information dictionaries""" teams = __get_league_object().find('teams').findall('team') output = [] for team in teams: info = {} for x in team.attrib: info[x] = team.attrib[x] output.append(info) return output
[ "def", "team_info", "(", ")", ":", "teams", "=", "__get_league_object", "(", ")", ".", "find", "(", "'teams'", ")", ".", "findall", "(", "'team'", ")", "output", "=", "[", "]", "for", "team", "in", "teams", ":", "info", "=", "{", "}", "for", "x", ...
Returns a list of team information dictionaries
[ "Returns", "a", "list", "of", "team", "information", "dictionaries" ]
python
train
29.9
gem/oq-engine
openquake/hazardlib/gsim/akkar_bommer_2010.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/gsim/akkar_bommer_2010.py#L317-L336
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types): """ See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values. """ sites.vs30 = 600 * np.ones(len(sites.vs30)) mean, stddevs = ...
[ "def", "get_mean_and_stddevs", "(", "self", ",", "sites", ",", "rup", ",", "dists", ",", "imt", ",", "stddev_types", ")", ":", "sites", ".", "vs30", "=", "600", "*", "np", ".", "ones", "(", "len", "(", "sites", ".", "vs30", ")", ")", "mean", ",", ...
See :meth:`superclass method <.base.GroundShakingIntensityModel.get_mean_and_stddevs>` for spec of input and result values.
[ "See", ":", "meth", ":", "superclass", "method", "<", ".", "base", ".", "GroundShakingIntensityModel", ".", "get_mean_and_stddevs", ">", "for", "spec", "of", "input", "and", "result", "values", "." ]
python
train
36.35
daviddrysdale/python-phonenumbers
python/phonenumbers/unicode_util.py
https://github.com/daviddrysdale/python-phonenumbers/blob/9cc5bb4ab5e661e70789b4c64bf7a9383c7bdc20/python/phonenumbers/unicode_util.py#L122-L125
def get(cls, uni_char): """Return the general category code (as Unicode string) for the given Unicode character""" uni_char = unicod(uni_char) # Force to Unicode return unicod(unicodedata.category(uni_char))
[ "def", "get", "(", "cls", ",", "uni_char", ")", ":", "uni_char", "=", "unicod", "(", "uni_char", ")", "# Force to Unicode", "return", "unicod", "(", "unicodedata", ".", "category", "(", "uni_char", ")", ")" ]
Return the general category code (as Unicode string) for the given Unicode character
[ "Return", "the", "general", "category", "code", "(", "as", "Unicode", "string", ")", "for", "the", "given", "Unicode", "character" ]
python
train
57.25
dfm/celerite
celerite/celerite.py
https://github.com/dfm/celerite/blob/ad3f471f06b18d233f3dab71bb1c20a316173cae/celerite/celerite.py#L343-L418
def predict(self, y, t=None, return_cov=True, return_var=False): """ Compute the conditional predictive distribution of the model You must call :func:`GP.compute` before this method. Args: y (array[n]): The observations at coordinates ``x`` from :func:`GP.co...
[ "def", "predict", "(", "self", ",", "y", ",", "t", "=", "None", ",", "return_cov", "=", "True", ",", "return_var", "=", "False", ")", ":", "y", "=", "self", ".", "_process_input", "(", "y", ")", "if", "len", "(", "y", ".", "shape", ")", ">", "1...
Compute the conditional predictive distribution of the model You must call :func:`GP.compute` before this method. Args: y (array[n]): The observations at coordinates ``x`` from :func:`GP.compute`. t (Optional[array[ntest]]): The independent coordinates where the...
[ "Compute", "the", "conditional", "predictive", "distribution", "of", "the", "model" ]
python
train
39.5
mkoura/dump2polarion
dump2polarion/exporters/xunit_exporter.py
https://github.com/mkoura/dump2polarion/blob/f4bd24e9d5070e282aad15f1e8bb514c0525cd37/dump2polarion/exporters/xunit_exporter.py#L51-L56
def _top_element(self): """Returns top XML element.""" top = etree.Element("testsuites") comment = etree.Comment("Generated for testrun {}".format(self.testrun_id)) top.append(comment) return top
[ "def", "_top_element", "(", "self", ")", ":", "top", "=", "etree", ".", "Element", "(", "\"testsuites\"", ")", "comment", "=", "etree", ".", "Comment", "(", "\"Generated for testrun {}\"", ".", "format", "(", "self", ".", "testrun_id", ")", ")", "top", "."...
Returns top XML element.
[ "Returns", "top", "XML", "element", "." ]
python
train
38.333333
MatiasSM/fcb
fcb/processing/filesystem/Compressor.py
https://github.com/MatiasSM/fcb/blob/92a6c535287ea1c1ef986954a5d66e7905fb6221/fcb/processing/filesystem/Compressor.py#L324-L342
def do_init(self, fs_settings, global_quota): fs_settings = deepcopy(fs_settings) # because we store some of the info, we need a deep copy ''' If the same restrictions are applied for many destinations, we use the same job to avoid processing files twice ''' for sender_s...
[ "def", "do_init", "(", "self", ",", "fs_settings", ",", "global_quota", ")", ":", "fs_settings", "=", "deepcopy", "(", "fs_settings", ")", "# because we store some of the info, we need a deep copy", "for", "sender_spec", "in", "fs_settings", ".", "sender_specs", ":", ...
If the same restrictions are applied for many destinations, we use the same job to avoid processing files twice
[ "If", "the", "same", "restrictions", "are", "applied", "for", "many", "destinations", "we", "use", "the", "same", "job", "to", "avoid", "processing", "files", "twice" ]
python
train
53.631579
globus/globus-cli
globus_cli/commands/task/list.py
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/task/list.py#L75-L143
def task_list( limit, filter_task_id, filter_status, filter_type, filter_label, filter_not_label, inexact, filter_requested_after, filter_requested_before, filter_completed_after, filter_completed_before, ): """ Executor for `globus task-list` """ def _proces...
[ "def", "task_list", "(", "limit", ",", "filter_task_id", ",", "filter_status", ",", "filter_type", ",", "filter_label", ",", "filter_not_label", ",", "inexact", ",", "filter_requested_after", ",", "filter_requested_before", ",", "filter_completed_after", ",", "filter_co...
Executor for `globus task-list`
[ "Executor", "for", "globus", "task", "-", "list" ]
python
train
29.231884
openego/ding0
ding0/core/__init__.py
https://github.com/openego/ding0/blob/e2d6528f96255e4bb22ba15514a4f1883564ed5d/ding0/core/__init__.py#L1742-L1782
def run_powerflow(self, session, method='onthefly', export_pypsa=False, debug=False): """ Performs power flow calculation for all MV grids Args: session : sqlalchemy.orm.session.Session Database session method: str Specify export method ...
[ "def", "run_powerflow", "(", "self", ",", "session", ",", "method", "=", "'onthefly'", ",", "export_pypsa", "=", "False", ",", "debug", "=", "False", ")", ":", "if", "method", "==", "'db'", ":", "# Empty tables", "pypsa_io", ".", "delete_powerflow_tables", "...
Performs power flow calculation for all MV grids Args: session : sqlalchemy.orm.session.Session Database session method: str Specify export method If method='db' grid data will be exported to database If me...
[ "Performs", "power", "flow", "calculation", "for", "all", "MV", "grids" ]
python
train
43.756098
DLR-RM/RAFCON
source/rafcon/core/states/state.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/core/states/state.py#L262-L270
def join(self): """ Waits until the state finished execution. """ if self.thread: self.thread.join() self.thread = None else: logger.debug("Cannot join {0}, as the state hasn't been started, yet or is already finished!".format(self))
[ "def", "join", "(", "self", ")", ":", "if", "self", ".", "thread", ":", "self", ".", "thread", ".", "join", "(", ")", "self", ".", "thread", "=", "None", "else", ":", "logger", ".", "debug", "(", "\"Cannot join {0}, as the state hasn't been started, yet or i...
Waits until the state finished execution.
[ "Waits", "until", "the", "state", "finished", "execution", "." ]
python
train
32.666667
20c/vaping
vaping/cli.py
https://github.com/20c/vaping/blob/c51f00586c99edb3d51e4abdbdfe3174755533ee/vaping/cli.py#L70-L77
def stop(ctx, **kwargs): """ stop a vaping process """ update_context(ctx, kwargs) daemon = mk_daemon(ctx) daemon.stop()
[ "def", "stop", "(", "ctx", ",", "*", "*", "kwargs", ")", ":", "update_context", "(", "ctx", ",", "kwargs", ")", "daemon", "=", "mk_daemon", "(", "ctx", ")", "daemon", ".", "stop", "(", ")" ]
stop a vaping process
[ "stop", "a", "vaping", "process" ]
python
train
17.25
IdentityPython/pysaml2
src/saml2/cert.py
https://github.com/IdentityPython/pysaml2/blob/d3aa78eeb7d37c12688f783cb4db1c7263a14ad6/src/saml2/cert.py#L31-L176
def create_certificate(self, cert_info, request=False, valid_from=0, valid_to=315360000, sn=1, key_length=1024, hash_alg="sha256", write_to_file=False, cert_dir="", cipher_passphrase=None): """ Can create certificate reques...
[ "def", "create_certificate", "(", "self", ",", "cert_info", ",", "request", "=", "False", ",", "valid_from", "=", "0", ",", "valid_to", "=", "315360000", ",", "sn", "=", "1", ",", "key_length", "=", "1024", ",", "hash_alg", "=", "\"sha256\"", ",", "write...
Can create certificate requests, to be signed later by another certificate with the method create_cert_signed_certificate. If request is True. Can also create self signed root certificates if request is False. This is default behaviour. :param cert_info: Contains inform...
[ "Can", "create", "certificate", "requests", "to", "be", "signed", "later", "by", "another", "certificate", "with", "the", "method", "create_cert_signed_certificate", ".", "If", "request", "is", "True", "." ]
python
train
48.417808
funilrys/PyFunceble
PyFunceble/http_code.py
https://github.com/funilrys/PyFunceble/blob/cdf69cbde120199171f7158e1c33635753e6e2f5/PyFunceble/http_code.py#L109-L155
def _access(self): # pragma: no cover """ Get the HTTP code status. :return: The matched HTTP status code. :rtype: int|None """ try: # We try to get the HTTP status code. if PyFunceble.INTERN["to_test_type"] == "url": # We are g...
[ "def", "_access", "(", "self", ")", ":", "# pragma: no cover", "try", ":", "# We try to get the HTTP status code.", "if", "PyFunceble", ".", "INTERN", "[", "\"to_test_type\"", "]", "==", "\"url\"", ":", "# We are globally testing a URL.", "# We get the head of the URL.", ...
Get the HTTP code status. :return: The matched HTTP status code. :rtype: int|None
[ "Get", "the", "HTTP", "code", "status", "." ]
python
test
35.404255
openstack/swauth
swauth/middleware.py
https://github.com/openstack/swauth/blob/0c8eaf50a9e2b3317f3eba62f205546904bc6d74/swauth/middleware.py#L1702-L1709
def filter_factory(global_conf, **local_conf): """Returns a WSGI filter app for use with paste.deploy.""" conf = global_conf.copy() conf.update(local_conf) def auth_filter(app): return Swauth(app, conf) return auth_filter
[ "def", "filter_factory", "(", "global_conf", ",", "*", "*", "local_conf", ")", ":", "conf", "=", "global_conf", ".", "copy", "(", ")", "conf", ".", "update", "(", "local_conf", ")", "def", "auth_filter", "(", "app", ")", ":", "return", "Swauth", "(", "...
Returns a WSGI filter app for use with paste.deploy.
[ "Returns", "a", "WSGI", "filter", "app", "for", "use", "with", "paste", ".", "deploy", "." ]
python
train
30.375
wakatime/wakatime
wakatime/packages/ntlm_auth/ntlm.py
https://github.com/wakatime/wakatime/blob/74519ace04e8472f3a3993269963732b9946a01d/wakatime/packages/ntlm_auth/ntlm.py#L110-L133
def create_authenticate_message(self, user_name, password, domain_name=None, workstation=None, server_certificate_hash=None): """ Create an NTLM AUTHENTICATE_MESSAGE based on the Ntlm context and the previous messages sent and received :param user_name: The user name of the user we are trying t...
[ "def", "create_authenticate_message", "(", "self", ",", "user_name", ",", "password", ",", "domain_name", "=", "None", ",", "workstation", "=", "None", ",", "server_certificate_hash", "=", "None", ")", ":", "self", ".", "authenticate_message", "=", "AuthenticateMe...
Create an NTLM AUTHENTICATE_MESSAGE based on the Ntlm context and the previous messages sent and received :param user_name: The user name of the user we are trying to authenticate with :param password: The password of the user we are trying to authenticate with :param domain_name: The domain na...
[ "Create", "an", "NTLM", "AUTHENTICATE_MESSAGE", "based", "on", "the", "Ntlm", "context", "and", "the", "previous", "messages", "sent", "and", "received" ]
python
train
80.666667
timothyb0912/pylogit
pylogit/mixed_logit.py
https://github.com/timothyb0912/pylogit/blob/f83b0fd6debaa7358d87c3828428f6d4ead71357/pylogit/mixed_logit.py#L491-L623
def fit_mle(self, init_vals, num_draws, seed=None, constrained_pos=None, print_res=True, method="BFGS", loss_tol=1e-06, gradient_tol=1e-06, maxiter=1000, ridge=...
[ "def", "fit_mle", "(", "self", ",", "init_vals", ",", "num_draws", ",", "seed", "=", "None", ",", "constrained_pos", "=", "None", ",", "print_res", "=", "True", ",", "method", "=", "\"BFGS\"", ",", "loss_tol", "=", "1e-06", ",", "gradient_tol", "=", "1e-...
Parameters ---------- init_vals : 1D ndarray. Should contain the initial values to start the optimization process with. There should be one value for each utility coefficient and shape parameter being estimated. num_draws : int. Should be greater t...
[ "Parameters", "----------", "init_vals", ":", "1D", "ndarray", ".", "Should", "contain", "the", "initial", "values", "to", "start", "the", "optimization", "process", "with", ".", "There", "should", "be", "one", "value", "for", "each", "utility", "coefficient", ...
python
train
45.308271
AndrewIngram/django-extra-views
extra_views/dates.py
https://github.com/AndrewIngram/django-extra-views/blob/188e1bf1f15a44d9a599028d020083af9fb43ea7/extra_views/dates.py#L155-L239
def get_context_data(self, **kwargs): """ Injects variables necessary for rendering the calendar into the context. Variables added are: `calendar`, `weekdays`, `month`, `next_month` and `previous_month`. """ data = super(BaseCalendarMonthView, self).get_context_data(**kwargs) ...
[ "def", "get_context_data", "(", "self", ",", "*", "*", "kwargs", ")", ":", "data", "=", "super", "(", "BaseCalendarMonthView", ",", "self", ")", ".", "get_context_data", "(", "*", "*", "kwargs", ")", "year", "=", "self", ".", "get_year", "(", ")", "mon...
Injects variables necessary for rendering the calendar into the context. Variables added are: `calendar`, `weekdays`, `month`, `next_month` and `previous_month`.
[ "Injects", "variables", "necessary", "for", "rendering", "the", "calendar", "into", "the", "context", "." ]
python
valid
37.435294
google/brotli
research/brotlidump.py
https://github.com/google/brotli/blob/4b2b2d4f83ffeaac7708e44409fe34896a01a278/research/brotlidump.py#L466-L476
def readTupleAndExtra(self, stream): """Read symbol and extrabits from stream. Returns symbol length, symbol, extraBits, extra >>> olleke.pos = 6 >>> MetablockLengthAlphabet().readTupleAndExtra(olleke) (2, Symbol(MLEN, 4), 16, 46) """ length, symbol = self.decodeP...
[ "def", "readTupleAndExtra", "(", "self", ",", "stream", ")", ":", "length", ",", "symbol", "=", "self", ".", "decodePeek", "(", "stream", ".", "peek", "(", "self", ".", "maxLength", ")", ")", "stream", ".", "pos", "+=", "length", "extraBits", "=", "sel...
Read symbol and extrabits from stream. Returns symbol length, symbol, extraBits, extra >>> olleke.pos = 6 >>> MetablockLengthAlphabet().readTupleAndExtra(olleke) (2, Symbol(MLEN, 4), 16, 46)
[ "Read", "symbol", "and", "extrabits", "from", "stream", ".", "Returns", "symbol", "length", "symbol", "extraBits", "extra", ">>>", "olleke", ".", "pos", "=", "6", ">>>", "MetablockLengthAlphabet", "()", ".", "readTupleAndExtra", "(", "olleke", ")", "(", "2", ...
python
test
44.090909
econ-ark/HARK
HARK/ConsumptionSaving/ConsMedModel.py
https://github.com/econ-ark/HARK/blob/3d184153a189e618a87c9540df1cd12044039cc5/HARK/ConsumptionSaving/ConsMedModel.py#L668-L688
def updatepLvlGrid(self): ''' Update the grid of permanent income levels. Currently only works for infinite horizon models (cycles=0) and lifecycle models (cycles=1). Not clear what to do about cycles>1. Identical to version in persistent shocks model, but pLvl=0 is manually a...
[ "def", "updatepLvlGrid", "(", "self", ")", ":", "# Run basic version of this method", "PersistentShockConsumerType", ".", "updatepLvlGrid", "(", "self", ")", "for", "j", "in", "range", "(", "len", "(", "self", ".", "pLvlGrid", ")", ")", ":", "# Then add 0 to the b...
Update the grid of permanent income levels. Currently only works for infinite horizon models (cycles=0) and lifecycle models (cycles=1). Not clear what to do about cycles>1. Identical to version in persistent shocks model, but pLvl=0 is manually added to the grid (because there is no ...
[ "Update", "the", "grid", "of", "permanent", "income", "levels", ".", "Currently", "only", "works", "for", "infinite", "horizon", "models", "(", "cycles", "=", "0", ")", "and", "lifecycle", "models", "(", "cycles", "=", "1", ")", ".", "Not", "clear", "wha...
python
train
37.666667
koalalorenzo/python-digitalocean
digitalocean/Record.py
https://github.com/koalalorenzo/python-digitalocean/blob/d0221b57856fb1e131cafecf99d826f7b07a947c/digitalocean/Record.py#L94-L113
def save(self): """ Save existing record """ data = { "type": self.type, "data": self.data, "name": self.name, "priority": self.priority, "port": self.port, "ttl": self.ttl, "weight": self.weight, ...
[ "def", "save", "(", "self", ")", ":", "data", "=", "{", "\"type\"", ":", "self", ".", "type", ",", "\"data\"", ":", "self", ".", "data", ",", "\"name\"", ":", "self", ".", "name", ",", "\"priority\"", ":", "self", ".", "priority", ",", "\"port\"", ...
Save existing record
[ "Save", "existing", "record" ]
python
valid
25.9
noahbenson/neuropythy
neuropythy/commands/register_retinotopy.py
https://github.com/noahbenson/neuropythy/blob/b588889f6db36ddb9602ae4a72c1c0d3f41586b2/neuropythy/commands/register_retinotopy.py#L363-L431
def calc_retinotopy(note, error, subject, clean, run_lh, run_rh, invert_rh_angle, max_in_eccen, min_in_eccen, angle_lh_file, theta_lh_file, eccen_lh_file, rho_lh_file, weight_lh_file, radius_lh_file, angle_rh_file, theta...
[ "def", "calc_retinotopy", "(", "note", ",", "error", ",", "subject", ",", "clean", ",", "run_lh", ",", "run_rh", ",", "invert_rh_angle", ",", "max_in_eccen", ",", "min_in_eccen", ",", "angle_lh_file", ",", "theta_lh_file", ",", "eccen_lh_file", ",", "rho_lh_file...
calc_retinotopy extracts the retinotopy options from the command line, loads the relevant files, and stores them as properties on the subject's lh and rh cortices.
[ "calc_retinotopy", "extracts", "the", "retinotopy", "options", "from", "the", "command", "line", "loads", "the", "relevant", "files", "and", "stores", "them", "as", "properties", "on", "the", "subject", "s", "lh", "and", "rh", "cortices", "." ]
python
train
47.014493
rainwoodman/kdcount
kdcount/correlate.py
https://github.com/rainwoodman/kdcount/blob/483548f6d27a4f245cd5d98880b5f4edd6cc8dc1/kdcount/correlate.py#L172-L208
def linear(self, **paircoords): """ Linearize bin indices. This function is called by subclasses. Refer to the source code of :py:class:`RBinning` for an example. Parameters ---------- args : list a list of bin index, (xi, yi, zi, ..) Ret...
[ "def", "linear", "(", "self", ",", "*", "*", "paircoords", ")", ":", "N", "=", "len", "(", "paircoords", "[", "list", "(", "paircoords", ".", "keys", "(", ")", ")", "[", "0", "]", "]", ")", "integer", "=", "numpy", ".", "empty", "(", "N", ",", ...
Linearize bin indices. This function is called by subclasses. Refer to the source code of :py:class:`RBinning` for an example. Parameters ---------- args : list a list of bin index, (xi, yi, zi, ..) Returns ------- linearlized bin index
[ "Linearize", "bin", "indices", "." ]
python
train
32.486486
idlesign/uwsgiconf
uwsgiconf/options/main_process.py
https://github.com/idlesign/uwsgiconf/blob/475407acb44199edbf7e0a66261bfeb51de1afae/uwsgiconf/options/main_process.py#L305-L315
def set_hook(self, phase, action): """Allows setting hooks (attaching actions) for various uWSGI phases. :param str|unicode phase: See constants in ``.phases``. :param str|unicode|list|HookAction|list[HookAction] action: """ self._set('hook-%s' % phase, action, multi=True) ...
[ "def", "set_hook", "(", "self", ",", "phase", ",", "action", ")", ":", "self", ".", "_set", "(", "'hook-%s'", "%", "phase", ",", "action", ",", "multi", "=", "True", ")", "return", "self", ".", "_section" ]
Allows setting hooks (attaching actions) for various uWSGI phases. :param str|unicode phase: See constants in ``.phases``. :param str|unicode|list|HookAction|list[HookAction] action:
[ "Allows", "setting", "hooks", "(", "attaching", "actions", ")", "for", "various", "uWSGI", "phases", "." ]
python
train
30.545455
Adarnof/adarnauth-esi
esi/views.py
https://github.com/Adarnof/adarnauth-esi/blob/f6618a31efbfeedeb96316ab9b82ecadda776ac1/esi/views.py#L71-L84
def select_token(request, scopes='', new=False): """ Presents the user with a selection of applicable tokens for the requested view. """ @tokens_required(scopes=scopes, new=new) def _token_list(r, tokens): context = { 'tokens': tokens, 'base_template': app_settings.E...
[ "def", "select_token", "(", "request", ",", "scopes", "=", "''", ",", "new", "=", "False", ")", ":", "@", "tokens_required", "(", "scopes", "=", "scopes", ",", "new", "=", "new", ")", "def", "_token_list", "(", "r", ",", "tokens", ")", ":", "context"...
Presents the user with a selection of applicable tokens for the requested view.
[ "Presents", "the", "user", "with", "a", "selection", "of", "applicable", "tokens", "for", "the", "requested", "view", "." ]
python
train
31
ktbyers/netmiko
netmiko/calix/calix_b6.py
https://github.com/ktbyers/netmiko/blob/54e6116c0b4664de2123081937e0a9a27bdfdfea/netmiko/calix/calix_b6.py#L28-L37
def session_preparation(self): """Prepare the session after the connection has been established.""" self.ansi_escape_codes = True self._test_channel_read() self.set_base_prompt() self.disable_paging() self.set_terminal_width(command="terminal width 511") # Clear t...
[ "def", "session_preparation", "(", "self", ")", ":", "self", ".", "ansi_escape_codes", "=", "True", "self", ".", "_test_channel_read", "(", ")", "self", ".", "set_base_prompt", "(", ")", "self", ".", "disable_paging", "(", ")", "self", ".", "set_terminal_width...
Prepare the session after the connection has been established.
[ "Prepare", "the", "session", "after", "the", "connection", "has", "been", "established", "." ]
python
train
40.4
xeroc/python-graphenelib
graphenecommon/transactionbuilder.py
https://github.com/xeroc/python-graphenelib/blob/8bb5396bc79998ee424cf3813af478304173f3a6/graphenecommon/transactionbuilder.py#L550-L559
def appendMissingSignatures(self): """ Store which accounts/keys are supposed to sign the transaction This method is used for an offline-signer! """ missing_signatures = self.get("missing_signatures", []) for pub in missing_signatures: wif = self.blockchain.walle...
[ "def", "appendMissingSignatures", "(", "self", ")", ":", "missing_signatures", "=", "self", ".", "get", "(", "\"missing_signatures\"", ",", "[", "]", ")", "for", "pub", "in", "missing_signatures", ":", "wif", "=", "self", ".", "blockchain", ".", "wallet", "....
Store which accounts/keys are supposed to sign the transaction This method is used for an offline-signer!
[ "Store", "which", "accounts", "/", "keys", "are", "supposed", "to", "sign", "the", "transaction" ]
python
valid
39.9
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/tailf_confd_monitoring.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/tailf_confd_monitoring.py#L3148-L3160
def confd_state_internal_cdb_client_subscription_twophase(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") confd_state = ET.SubElement(config, "confd-state", xmlns="http://tail-f.com/yang/confd-monitoring") internal = ET.SubElement(confd_state, "internal"...
[ "def", "confd_state_internal_cdb_client_subscription_twophase", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "confd_state", "=", "ET", ".", "SubElement", "(", "config", ",", "\"confd-state\"", ",", ...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
47
atlassian-api/atlassian-python-api
atlassian/confluence.py
https://github.com/atlassian-api/atlassian-python-api/blob/540d269905c3e7547b666fe30c647b2d512cf358/atlassian/confluence.py#L319-L328
def add_comment(self, page_id, text): """ Add comment into page :param page_id :param text """ data = {'type': 'comment', 'container': {'id': page_id, 'type': 'page', 'status': 'current'}, 'body': {'storage': {'value': text, 'representation...
[ "def", "add_comment", "(", "self", ",", "page_id", ",", "text", ")", ":", "data", "=", "{", "'type'", ":", "'comment'", ",", "'container'", ":", "{", "'id'", ":", "page_id", ",", "'type'", ":", "'page'", ",", "'status'", ":", "'current'", "}", ",", "...
Add comment into page :param page_id :param text
[ "Add", "comment", "into", "page", ":", "param", "page_id", ":", "param", "text" ]
python
train
38.3
pypa/pipenv
pipenv/utils.py
https://github.com/pypa/pipenv/blob/cae8d76c210b9777e90aab76e9c4b0e53bb19cde/pipenv/utils.py#L1785-L1795
def sys_version(version_tuple): """ Set a temporary sys.version_info tuple :param version_tuple: a fake sys.version_info tuple """ old_version = sys.version_info sys.version_info = version_tuple yield sys.version_info = old_version
[ "def", "sys_version", "(", "version_tuple", ")", ":", "old_version", "=", "sys", ".", "version_info", "sys", ".", "version_info", "=", "version_tuple", "yield", "sys", ".", "version_info", "=", "old_version" ]
Set a temporary sys.version_info tuple :param version_tuple: a fake sys.version_info tuple
[ "Set", "a", "temporary", "sys", ".", "version_info", "tuple" ]
python
train
23.181818
eandersson/amqpstorm
amqpstorm/management/user.py
https://github.com/eandersson/amqpstorm/blob/38330906c0af19eea482f43c5ce79bab98a1e064/amqpstorm/management/user.py#L86-L115
def set_permission(self, username, virtual_host, configure_regex='.*', write_regex='.*', read_regex='.*'): """Set User permissions for the configured virtual host. :param str username: Username :param str virtual_host: Virtual host name :param str configure_regex:...
[ "def", "set_permission", "(", "self", ",", "username", ",", "virtual_host", ",", "configure_regex", "=", "'.*'", ",", "write_regex", "=", "'.*'", ",", "read_regex", "=", "'.*'", ")", ":", "virtual_host", "=", "quote", "(", "virtual_host", ",", "''", ")", "...
Set User permissions for the configured virtual host. :param str username: Username :param str virtual_host: Virtual host name :param str configure_regex: Permission pattern for configuration operations for this user. :param str write_regex: Permissio...
[ "Set", "User", "permissions", "for", "the", "configured", "virtual", "host", "." ]
python
train
44.566667
robertpeteuil/multi-cloud-control
mcc/core.py
https://github.com/robertpeteuil/multi-cloud-control/blob/f1565af1c0b6ed465ff312d3ccc592ba0609f4a2/mcc/core.py#L60-L79
def make_node_dict(outer_list, sort="zone"): """Convert node data from nested-list to sorted dict.""" raw_dict = {} x = 1 for inner_list in outer_list: for node in inner_list: raw_dict[x] = node x += 1 if sort == "name": # sort by provider - name srt_dict = O...
[ "def", "make_node_dict", "(", "outer_list", ",", "sort", "=", "\"zone\"", ")", ":", "raw_dict", "=", "{", "}", "x", "=", "1", "for", "inner_list", "in", "outer_list", ":", "for", "node", "in", "inner_list", ":", "raw_dict", "[", "x", "]", "=", "node", ...
Convert node data from nested-list to sorted dict.
[ "Convert", "node", "data", "from", "nested", "-", "list", "to", "sorted", "dict", "." ]
python
train
36.45
mitsei/dlkit
dlkit/json_/assessment_authoring/sessions.py
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/assessment_authoring/sessions.py#L375-L392
def get_assessment_parts(self): """Gets all ``AssessmentParts``. return: (osid.assessment.authoring.AssessmentPartList) - a list of ``AssessmentParts`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *complian...
[ "def", "get_assessment_parts", "(", "self", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resources", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONClientValidated", "(", "'assessment_authoring'", ",", "c...
Gets all ``AssessmentParts``. return: (osid.assessment.authoring.AssessmentPartList) - a list of ``AssessmentParts`` raise: OperationFailed - unable to complete request raise: PermissionDenied - authorization failure *compliance: mandatory -- This method must be implem...
[ "Gets", "all", "AssessmentParts", "." ]
python
train
50.111111
koszullab/instaGRAAL
instagraal/parse_info_frags.py
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/parse_info_frags.py#L304-L462
def correct_spurious_inversions(scaffolds, criterion="colinear"): """Invert bins based on orientation neighborhoods. Neighborhoods can be defined by three criteria: -a 'cis' neighborhood is a group of bins belonging to the same initial contig -a 'colinear' neighborhood is a 'cis' neighborhood where...
[ "def", "correct_spurious_inversions", "(", "scaffolds", ",", "criterion", "=", "\"colinear\"", ")", ":", "scaffolds", "=", "format_info_frags", "(", "scaffolds", ")", "new_scaffolds", "=", "{", "}", "def", "is_cis", "(", "bin1", ",", "bin2", ")", ":", "return"...
Invert bins based on orientation neighborhoods. Neighborhoods can be defined by three criteria: -a 'cis' neighborhood is a group of bins belonging to the same initial contig -a 'colinear' neighborhood is a 'cis' neighborhood where bins are ordered the same way they were on the initial contig -a...
[ "Invert", "bins", "based", "on", "orientation", "neighborhoods", ".", "Neighborhoods", "can", "be", "defined", "by", "three", "criteria", ":" ]
python
train
36.358491
pantsbuild/pants
src/python/pants/pantsd/process_manager.py
https://github.com/pantsbuild/pants/blob/b72e650da0df685824ffdcc71988b8c282d0962d/src/python/pants/pantsd/process_manager.py#L333-L335
def await_socket(self, timeout): """Wait up to a given timeout for a process to write socket info.""" return self.await_metadata_by_name(self._name, 'socket', timeout, self._socket_type)
[ "def", "await_socket", "(", "self", ",", "timeout", ")", ":", "return", "self", ".", "await_metadata_by_name", "(", "self", ".", "_name", ",", "'socket'", ",", "timeout", ",", "self", ".", "_socket_type", ")" ]
Wait up to a given timeout for a process to write socket info.
[ "Wait", "up", "to", "a", "given", "timeout", "for", "a", "process", "to", "write", "socket", "info", "." ]
python
train
64
DataDog/integrations-core
process/datadog_checks/process/process.py
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/process/datadog_checks/process/process.py#L98-L163
def find_pids(self, name, search_string, exact_match, ignore_ad=True): """ Create a set of pids of selected processes. Search for search_string """ if not self.should_refresh_pid_cache(name): return self.pid_cache[name] ad_error_logger = self.log.debug ...
[ "def", "find_pids", "(", "self", ",", "name", ",", "search_string", ",", "exact_match", ",", "ignore_ad", "=", "True", ")", ":", "if", "not", "self", ".", "should_refresh_pid_cache", "(", "name", ")", ":", "return", "self", ".", "pid_cache", "[", "name", ...
Create a set of pids of selected processes. Search for search_string
[ "Create", "a", "set", "of", "pids", "of", "selected", "processes", ".", "Search", "for", "search_string" ]
python
train
38.712121
scikit-tda/persim
persim/images.py
https://github.com/scikit-tda/persim/blob/f234f543058bdedb9729bf8c4a90da41e57954e0/persim/images.py#L180-L189
def kernel(self, spread=1): """ This will return whatever kind of kernel we want to use. Must have signature (ndarray size NxM, ndarray size 1xM) -> ndarray size Nx1 """ # TODO: use self.kernel_type to choose function def gaussian(data, pixel): return mvn.pdf(dat...
[ "def", "kernel", "(", "self", ",", "spread", "=", "1", ")", ":", "# TODO: use self.kernel_type to choose function", "def", "gaussian", "(", "data", ",", "pixel", ")", ":", "return", "mvn", ".", "pdf", "(", "data", ",", "mean", "=", "pixel", ",", "cov", "...
This will return whatever kind of kernel we want to use. Must have signature (ndarray size NxM, ndarray size 1xM) -> ndarray size Nx1
[ "This", "will", "return", "whatever", "kind", "of", "kernel", "we", "want", "to", "use", ".", "Must", "have", "signature", "(", "ndarray", "size", "NxM", "ndarray", "size", "1xM", ")", "-", ">", "ndarray", "size", "Nx1" ]
python
train
36.2
atlassian-api/atlassian-python-api
atlassian/jira.py
https://github.com/atlassian-api/atlassian-python-api/blob/540d269905c3e7547b666fe30c647b2d512cf358/atlassian/jira.py#L594-L607
def add_attachment(self, issue_key, filename): """ Add attachment to Issue :param issue_key: str :param filename: str, name, if file in current directory or full path to file """ log.warning('Adding attachment...') headers = {'X-Atlassian-Token': 'no-check'} ...
[ "def", "add_attachment", "(", "self", ",", "issue_key", ",", "filename", ")", ":", "log", ".", "warning", "(", "'Adding attachment...'", ")", "headers", "=", "{", "'X-Atlassian-Token'", ":", "'no-check'", "}", "with", "open", "(", "filename", ",", "'rb'", ")...
Add attachment to Issue :param issue_key: str :param filename: str, name, if file in current directory or full path to file
[ "Add", "attachment", "to", "Issue" ]
python
train
36.785714
tensorflow/cleverhans
examples/nips17_adversarial_competition/eval_infra/code/eval_lib/work_data.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/work_data.py#L179-L192
def _read_undone_shard_from_datastore(self, shard_id=None): """Reads undone worke pieces which are assigned to shard with given id.""" self._work = {} client = self._datastore_client parent_key = client.key(KIND_WORK_TYPE, self._work_type_entity_id) filters = [('is_completed', '=', False)] if sh...
[ "def", "_read_undone_shard_from_datastore", "(", "self", ",", "shard_id", "=", "None", ")", ":", "self", ".", "_work", "=", "{", "}", "client", "=", "self", ".", "_datastore_client", "parent_key", "=", "client", ".", "key", "(", "KIND_WORK_TYPE", ",", "self"...
Reads undone worke pieces which are assigned to shard with given id.
[ "Reads", "undone", "worke", "pieces", "which", "are", "assigned", "to", "shard", "with", "given", "id", "." ]
python
train
46.5
Scille/autobahn-sync
autobahn_sync/session.py
https://github.com/Scille/autobahn-sync/blob/d75fceff0d1aee61fa6dd0168eb1cd40794ad827/autobahn_sync/session.py#L100-L105
def publish(self, topic, *args, **kwargs): """Publish an event to a topic. Replace :meth:`autobahn.wamp.interface.IApplicationSession.publish` """ return self._async_session.publish(topic, *args, **kwargs)
[ "def", "publish", "(", "self", ",", "topic", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_async_session", ".", "publish", "(", "topic", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Publish an event to a topic. Replace :meth:`autobahn.wamp.interface.IApplicationSession.publish`
[ "Publish", "an", "event", "to", "a", "topic", "." ]
python
train
38.833333
UAVCAN/pyuavcan
uavcan/introspect.py
https://github.com/UAVCAN/pyuavcan/blob/a06a9975c1c0de4f1d469f05b29b374332968e2b/uavcan/introspect.py#L110-L140
def to_yaml(obj): """ This function returns correct YAML representation of a UAVCAN structure (message, request, or response), or a DSDL entity (array or primitive), or a UAVCAN transfer, with comments for human benefit. Args: obj: Object to convert. Returns: Unicode string conta...
[ "def", "to_yaml", "(", "obj", ")", ":", "if", "not", "isinstance", "(", "obj", ",", "CompoundValue", ")", "and", "hasattr", "(", "obj", ",", "'transfer'", ")", ":", "if", "hasattr", "(", "obj", ",", "'message'", ")", ":", "payload", "=", "obj", ".", ...
This function returns correct YAML representation of a UAVCAN structure (message, request, or response), or a DSDL entity (array or primitive), or a UAVCAN transfer, with comments for human benefit. Args: obj: Object to convert. Returns: Unicode string containing YAML representation of t...
[ "This", "function", "returns", "correct", "YAML", "representation", "of", "a", "UAVCAN", "structure", "(", "message", "request", "or", "response", ")", "or", "a", "DSDL", "entity", "(", "array", "or", "primitive", ")", "or", "a", "UAVCAN", "transfer", "with"...
python
train
38.451613
tensorflow/tensor2tensor
tensor2tensor/rl/dopamine_connector.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/rl/dopamine_connector.py#L471-L491
def _parse_hparams(hparams): """Split hparams, based on key prefixes. Args: hparams: hyperparameters Returns: Tuple of hparams for respectably: agent, optimizer, runner, replay_buffer. """ prefixes = ["agent_", "optimizer_", "runner_", "replay_buffer_"] ret = [] for prefix in prefixes: ret_...
[ "def", "_parse_hparams", "(", "hparams", ")", ":", "prefixes", "=", "[", "\"agent_\"", ",", "\"optimizer_\"", ",", "\"runner_\"", ",", "\"replay_buffer_\"", "]", "ret", "=", "[", "]", "for", "prefix", "in", "prefixes", ":", "ret_dict", "=", "{", "}", "for"...
Split hparams, based on key prefixes. Args: hparams: hyperparameters Returns: Tuple of hparams for respectably: agent, optimizer, runner, replay_buffer.
[ "Split", "hparams", "based", "on", "key", "prefixes", "." ]
python
train
23.238095
necaris/python3-openid
openid/consumer/consumer.py
https://github.com/necaris/python3-openid/blob/4911bbc196dfd6f9eda7155df9903d668720ecbf/openid/consumer/consumer.py#L1343-L1379
def _getOpenID1SessionType(self, assoc_response): """Given an association response message, extract the OpenID 1.X session type. This function mostly takes care of the 'no-encryption' default behavior in OpenID 1. If the association type is plain-text, this function will ...
[ "def", "_getOpenID1SessionType", "(", "self", ",", "assoc_response", ")", ":", "# If it's an OpenID 1 message, allow session_type to default", "# to None (which signifies \"no-encryption\")", "session_type", "=", "assoc_response", ".", "getArg", "(", "OPENID1_NS", ",", "'session_...
Given an association response message, extract the OpenID 1.X session type. This function mostly takes care of the 'no-encryption' default behavior in OpenID 1. If the association type is plain-text, this function will return 'no-encryption' @returns: The association t...
[ "Given", "an", "association", "response", "message", "extract", "the", "OpenID", "1", ".", "X", "session", "type", "." ]
python
train
38.783784
google/grr
grr/server/grr_response_server/data_stores/mysql_advanced_data_store.py
https://github.com/google/grr/blob/5cef4e8e2f0d5df43ea4877e9c798e0bf60bfe74/grr/server/grr_response_server/data_stores/mysql_advanced_data_store.py#L235-L242
def DropTables(self): """Drop all existing tables.""" rows, _ = self.ExecuteQuery( "SELECT table_name FROM information_schema.tables " "WHERE table_schema='%s'" % self.database_name) for row in rows: self.ExecuteQuery("DROP TABLE `%s`" % row["table_name"])
[ "def", "DropTables", "(", "self", ")", ":", "rows", ",", "_", "=", "self", ".", "ExecuteQuery", "(", "\"SELECT table_name FROM information_schema.tables \"", "\"WHERE table_schema='%s'\"", "%", "self", ".", "database_name", ")", "for", "row", "in", "rows", ":", "s...
Drop all existing tables.
[ "Drop", "all", "existing", "tables", "." ]
python
train
35.5
not-na/peng3d
peng3d/model.py
https://github.com/not-na/peng3d/blob/1151be665b26cc8a479f6307086ba919e4d32d85/peng3d/model.py#L834-L842
def set_state(self): """ Sets the state required for this vertex region. Currently binds and enables the texture of the material of the region. """ glEnable(self.region.material.target) glBindTexture(self.region.material.target, self.region.material.id) s...
[ "def", "set_state", "(", "self", ")", ":", "glEnable", "(", "self", ".", "region", ".", "material", ".", "target", ")", "glBindTexture", "(", "self", ".", "region", ".", "material", ".", "target", ",", "self", ".", "region", ".", "material", ".", "id",...
Sets the state required for this vertex region. Currently binds and enables the texture of the material of the region.
[ "Sets", "the", "state", "required", "for", "this", "vertex", "region", ".", "Currently", "binds", "and", "enables", "the", "texture", "of", "the", "material", "of", "the", "region", "." ]
python
test
38.666667
SheffieldML/GPy
GPy/models/tp_regression.py
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/tp_regression.py#L105-L118
def set_XY(self, X, Y): """ Set the input / output data of the model This is useful if we wish to change our existing data but maintain the same model :param X: input observations :type X: np.ndarray :param Y: output observations :type Y: np.ndarray or ObsAr ...
[ "def", "set_XY", "(", "self", ",", "X", ",", "Y", ")", ":", "self", ".", "update_model", "(", "False", ")", "self", ".", "set_Y", "(", "Y", ")", "self", ".", "set_X", "(", "X", ")", "self", ".", "update_model", "(", "True", ")" ]
Set the input / output data of the model This is useful if we wish to change our existing data but maintain the same model :param X: input observations :type X: np.ndarray :param Y: output observations :type Y: np.ndarray or ObsAr
[ "Set", "the", "input", "/", "output", "data", "of", "the", "model", "This", "is", "useful", "if", "we", "wish", "to", "change", "our", "existing", "data", "but", "maintain", "the", "same", "model" ]
python
train
30.214286
google/grumpy
third_party/stdlib/base64.py
https://github.com/google/grumpy/blob/3ec87959189cfcdeae82eb68a47648ac25ceb10b/third_party/stdlib/base64.py#L308-L315
def decode(input, output): """Decode a file.""" while True: line = input.readline() if not line: break s = binascii.a2b_base64(line) output.write(s)
[ "def", "decode", "(", "input", ",", "output", ")", ":", "while", "True", ":", "line", "=", "input", ".", "readline", "(", ")", "if", "not", "line", ":", "break", "s", "=", "binascii", ".", "a2b_base64", "(", "line", ")", "output", ".", "write", "("...
Decode a file.
[ "Decode", "a", "file", "." ]
python
valid
24.125
fgmacedo/django-export-action
export_action/introspection.py
https://github.com/fgmacedo/django-export-action/blob/215fecb9044d22e3ae19d86c3b220041a11fad07/export_action/introspection.py#L102-L139
def get_fields(model_class, field_name='', path=''): """ Get fields and meta data from a model :param model_class: A django model class :param field_name: The field name to get sub fields from :param path: path of our field in format field_name__second_field_name__ect__ :returns: Returns fi...
[ "def", "get_fields", "(", "model_class", ",", "field_name", "=", "''", ",", "path", "=", "''", ")", ":", "fields", "=", "get_direct_fields_from_model", "(", "model_class", ")", "app_label", "=", "model_class", ".", "_meta", ".", "app_label", "if", "field_name"...
Get fields and meta data from a model :param model_class: A django model class :param field_name: The field name to get sub fields from :param path: path of our field in format field_name__second_field_name__ect__ :returns: Returns fields and meta data about such fields fields: Django m...
[ "Get", "fields", "and", "meta", "data", "from", "a", "model" ]
python
train
31.868421
bcbio/bcbio-nextgen
bcbio/qc/qualimap.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/qc/qualimap.py#L288-L301
def _parse_qualimap_rnaseq(table): """ Retrieve metrics of interest from globals table. """ out = {} for row in table.find_all("tr"): col, val = [x.text for x in row.find_all("td")] col = col.replace(":", "").strip() val = val.replace(",", "") m = {col: val} i...
[ "def", "_parse_qualimap_rnaseq", "(", "table", ")", ":", "out", "=", "{", "}", "for", "row", "in", "table", ".", "find_all", "(", "\"tr\"", ")", ":", "col", ",", "val", "=", "[", "x", ".", "text", "for", "x", "in", "row", ".", "find_all", "(", "\...
Retrieve metrics of interest from globals table.
[ "Retrieve", "metrics", "of", "interest", "from", "globals", "table", "." ]
python
train
30.214286
Guake/guake
guake/terminal.py
https://github.com/Guake/guake/blob/4153ef38f9044cbed6494075fce80acd5809df2b/guake/terminal.py#L299-L327
def button_press(self, terminal, event): """Handles the button press event in the terminal widget. If any match string is caught, another application is open to handle the matched resource uri. """ self.matched_value = '' if (Vte.MAJOR_VERSION, Vte.MINOR_VERSION) >= (0, 4...
[ "def", "button_press", "(", "self", ",", "terminal", ",", "event", ")", ":", "self", ".", "matched_value", "=", "''", "if", "(", "Vte", ".", "MAJOR_VERSION", ",", "Vte", ".", "MINOR_VERSION", ")", ">=", "(", "0", ",", "46", ")", ":", "matched_string", ...
Handles the button press event in the terminal widget. If any match string is caught, another application is open to handle the matched resource uri.
[ "Handles", "the", "button", "press", "event", "in", "the", "terminal", "widget", ".", "If", "any", "match", "string", "is", "caught", "another", "application", "is", "open", "to", "handle", "the", "matched", "resource", "uri", "." ]
python
train
43.172414
gem/oq-engine
openquake/risklib/scientific.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/risklib/scientific.py#L1200-L1211
def average_loss(lc): """ Given a loss curve array with `poe` and `loss` fields, computes the average loss on a period of time. :note: As the loss curve is supposed to be piecewise linear as it is a result of a linear interpolation, we compute an exact integral by using the trapei...
[ "def", "average_loss", "(", "lc", ")", ":", "losses", ",", "poes", "=", "(", "lc", "[", "'loss'", "]", ",", "lc", "[", "'poe'", "]", ")", "if", "lc", ".", "dtype", ".", "names", "else", "lc", "return", "-", "pairwise_diff", "(", "losses", ")", "@...
Given a loss curve array with `poe` and `loss` fields, computes the average loss on a period of time. :note: As the loss curve is supposed to be piecewise linear as it is a result of a linear interpolation, we compute an exact integral by using the trapeizodal rule with the width given by...
[ "Given", "a", "loss", "curve", "array", "with", "poe", "and", "loss", "fields", "computes", "the", "average", "loss", "on", "a", "period", "of", "time", "." ]
python
train
42.25
splunk/splunk-sdk-python
examples/twitted/input.py
https://github.com/splunk/splunk-sdk-python/blob/a245a4eeb93b3621730418008e31715912bcdcd8/examples/twitted/input.py#L114-L151
def flatten(value, prefix=None): """Takes an arbitrary JSON(ish) object and 'flattens' it into a dict with values consisting of either simple types or lists of simple types.""" def issimple(value): # foldr(True, or, value)? for item in value: if isinstance(item, dict) or isins...
[ "def", "flatten", "(", "value", ",", "prefix", "=", "None", ")", ":", "def", "issimple", "(", "value", ")", ":", "# foldr(True, or, value)?", "for", "item", "in", "value", ":", "if", "isinstance", "(", "item", ",", "dict", ")", "or", "isinstance", "(", ...
Takes an arbitrary JSON(ish) object and 'flattens' it into a dict with values consisting of either simple types or lists of simple types.
[ "Takes", "an", "arbitrary", "JSON", "(", "ish", ")", "object", "and", "flattens", "it", "into", "a", "dict", "with", "values", "consisting", "of", "either", "simple", "types", "or", "lists", "of", "simple", "types", "." ]
python
train
30.526316
tanghaibao/jcvi
jcvi/formats/base.py
https://github.com/tanghaibao/jcvi/blob/d2e31a77b6ade7f41f3b321febc2b4744d1cdeca/jcvi/formats/base.py#L235-L288
def split(self, N, force=False): """ There are two modes of splitting the records - batch: splitting is sequentially to records/N chunks - cycle: placing each record in the splitted files and cycles use `cycle` if the len of the record is not evenly distributed """ ...
[ "def", "split", "(", "self", ",", "N", ",", "force", "=", "False", ")", ":", "mode", "=", "self", ".", "mode", "assert", "mode", "in", "(", "\"batch\"", ",", "\"cycle\"", ",", "\"optimal\"", ")", "logging", ".", "debug", "(", "\"set split mode=%s\"", "...
There are two modes of splitting the records - batch: splitting is sequentially to records/N chunks - cycle: placing each record in the splitted files and cycles use `cycle` if the len of the record is not evenly distributed
[ "There", "are", "two", "modes", "of", "splitting", "the", "records", "-", "batch", ":", "splitting", "is", "sequentially", "to", "records", "/", "N", "chunks", "-", "cycle", ":", "placing", "each", "record", "in", "the", "splitted", "files", "and", "cycles...
python
train
39.148148
pmbarrett314/curses-menu
cursesmenu/curses_menu.py
https://github.com/pmbarrett314/curses-menu/blob/c76fc00ab9d518eab275e55434fc2941f49c6b30/cursesmenu/curses_menu.py#L88-L103
def append_item(self, item): """ Add an item to the end of the menu before the exit item :param MenuItem item: The item to be added """ did_remove = self.remove_exit() item.menu = self self.items.append(item) if did_remove: self.add_exit() ...
[ "def", "append_item", "(", "self", ",", "item", ")", ":", "did_remove", "=", "self", ".", "remove_exit", "(", ")", "item", ".", "menu", "=", "self", "self", ".", "items", ".", "append", "(", "item", ")", "if", "did_remove", ":", "self", ".", "add_exi...
Add an item to the end of the menu before the exit item :param MenuItem item: The item to be added
[ "Add", "an", "item", "to", "the", "end", "of", "the", "menu", "before", "the", "exit", "item" ]
python
test
32.25
brocade/pynos
pynos/versions/ver_6/ver_6_0_1/yang/tailf_confd_monitoring.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/ver_6/ver_6_0_1/yang/tailf_confd_monitoring.py#L2633-L2648
def confd_state_internal_callpoints_authorization_callbacks_registration_type_daemon_daemon_name(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") confd_state = ET.SubElement(config, "confd-state", xmlns="http://tail-f.com/yang/confd-monitoring") internal ...
[ "def", "confd_state_internal_callpoints_authorization_callbacks_registration_type_daemon_daemon_name", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "confd_state", "=", "ET", ".", "SubElement", "(", "confi...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
53.9375
erikvw/django-collect-offline-files
django_collect_offline_files/file_queues/incoming_transactions_file_queue.py
https://github.com/erikvw/django-collect-offline-files/blob/78f61c823ea3926eb88206b019b5dca3c36017da/django_collect_offline_files/file_queues/incoming_transactions_file_queue.py#L17-L29
def next_task(self, item, **kwargs): """Calls import_batch for the next filename in the queue and "archives" the file. The archive folder is typically the folder for the deserializer queue. """ filename = os.path.basename(item) try: self.tx_importer.import_ba...
[ "def", "next_task", "(", "self", ",", "item", ",", "*", "*", "kwargs", ")", ":", "filename", "=", "os", ".", "path", ".", "basename", "(", "item", ")", "try", ":", "self", ".", "tx_importer", ".", "import_batch", "(", "filename", "=", "filename", ")"...
Calls import_batch for the next filename in the queue and "archives" the file. The archive folder is typically the folder for the deserializer queue.
[ "Calls", "import_batch", "for", "the", "next", "filename", "in", "the", "queue", "and", "archives", "the", "file", "." ]
python
train
36.923077
google-research/batch-ppo
agents/tools/nested.py
https://github.com/google-research/batch-ppo/blob/3d09705977bae4e7c3eb20339a3b384d2a5531e4/agents/tools/nested.py#L128-L192
def filter_(predicate, *structures, **kwargs): # pylint: disable=differing-param-doc,missing-param-doc, too-many-branches """Select elements of a nested structure based on a predicate function. If multiple structures are provided as input, their structure must match and the function will be applied to correspo...
[ "def", "filter_", "(", "predicate", ",", "*", "structures", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=differing-param-doc,missing-param-doc, too-many-branches", "# Named keyword arguments are not allowed after *args in Python 2.", "flatten", "=", "kwargs", ".", "pop...
Select elements of a nested structure based on a predicate function. If multiple structures are provided as input, their structure must match and the function will be applied to corresponding groups of elements. The nested structure can consist of any combination of lists, tuples, and dicts. Args: predica...
[ "Select", "elements", "of", "a", "nested", "structure", "based", "on", "a", "predicate", "function", "." ]
python
train
43.676923
rosenbrockc/fortpy
fortpy/parsers/executable.py
https://github.com/rosenbrockc/fortpy/blob/1ed0757c52d549e41d9d44bdea68cb89529293a5/fortpy/parsers/executable.py#L402-L410
def _process_docs(self, anexec, docblocks, parent, module, docsearch): """Associates the docstrings from the docblocks with their parameters.""" #The documentation for the parameters is stored outside of the executable #We need to get hold of them from docblocks from the parent text key ...
[ "def", "_process_docs", "(", "self", ",", "anexec", ",", "docblocks", ",", "parent", ",", "module", ",", "docsearch", ")", ":", "#The documentation for the parameters is stored outside of the executable", "#We need to get hold of them from docblocks from the parent text", "key", ...
Associates the docstrings from the docblocks with their parameters.
[ "Associates", "the", "docstrings", "from", "the", "docblocks", "with", "their", "parameters", "." ]
python
train
67