repo
stringlengths
7
54
path
stringlengths
4
192
url
stringlengths
87
284
code
stringlengths
78
104k
code_tokens
list
docstring
stringlengths
1
46.9k
docstring_tokens
list
language
stringclasses
1 value
partition
stringclasses
3 values
ryukinix/decorating
decorating/animation.py
https://github.com/ryukinix/decorating/blob/df78c3f87800205701704c0bc0fb9b6bb908ba7e/decorating/animation.py#L353-L356
def start(self): """Activate the TypingStream on stdout""" self.streams.append(sys.stdout) sys.stdout = self.stream
[ "def", "start", "(", "self", ")", ":", "self", ".", "streams", ".", "append", "(", "sys", ".", "stdout", ")", "sys", ".", "stdout", "=", "self", ".", "stream" ]
Activate the TypingStream on stdout
[ "Activate", "the", "TypingStream", "on", "stdout" ]
python
train
AkihikoITOH/capybara
capybara/virtualenv/lib/python2.7/site-packages/jinja2/environment.py
https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/jinja2/environment.py#L695-L720
def list_templates(self, extensions=None, filter_func=None): """Returns a list of templates for this environment. This requires that the loader supports the loader's :meth:`~BaseLoader.list_templates` method. If there are other files in the template folder besides the actual te...
[ "def", "list_templates", "(", "self", ",", "extensions", "=", "None", ",", "filter_func", "=", "None", ")", ":", "x", "=", "self", ".", "loader", ".", "list_templates", "(", ")", "if", "extensions", "is", "not", "None", ":", "if", "filter_func", "is", ...
Returns a list of templates for this environment. This requires that the loader supports the loader's :meth:`~BaseLoader.list_templates` method. If there are other files in the template folder besides the actual templates, the returned list can be filtered. There are two ways:...
[ "Returns", "a", "list", "of", "templates", "for", "this", "environment", ".", "This", "requires", "that", "the", "loader", "supports", "the", "loader", "s", ":", "meth", ":", "~BaseLoader", ".", "list_templates", "method", "." ]
python
test
hosford42/xcs
xcs/algorithms/xcs.py
https://github.com/hosford42/xcs/blob/183bdd0dd339e19ded3be202f86e1b38bdb9f1e5/xcs/algorithms/xcs.py#L546-L676
def update(self, match_set): """Update the classifier set from which the match set was drawn, e.g. by applying a genetic algorithm. The match_set argument is the MatchSet instance whose classifier set should be updated. Usage: match_set = model.match(situation) m...
[ "def", "update", "(", "self", ",", "match_set", ")", ":", "assert", "isinstance", "(", "match_set", ",", "MatchSet", ")", "assert", "match_set", ".", "model", ".", "algorithm", "is", "self", "assert", "match_set", ".", "selected_action", "is", "not", "None",...
Update the classifier set from which the match set was drawn, e.g. by applying a genetic algorithm. The match_set argument is the MatchSet instance whose classifier set should be updated. Usage: match_set = model.match(situation) match_set.select_action() mat...
[ "Update", "the", "classifier", "set", "from", "which", "the", "match", "set", "was", "drawn", "e", ".", "g", ".", "by", "applying", "a", "genetic", "algorithm", ".", "The", "match_set", "argument", "is", "the", "MatchSet", "instance", "whose", "classifier", ...
python
train
gamechanger/dusty
dusty/config.py
https://github.com/gamechanger/dusty/blob/dc12de90bb6945023d6f43a8071e984313a1d984/dusty/config.py#L87-L94
def _load_ssh_auth_post_yosemite(mac_username): """Starting with Yosemite, launchd was rearchitected and now only one launchd process runs for all users. This allows us to much more easily impersonate a user through launchd and extract the environment variables from their running processes.""" user_...
[ "def", "_load_ssh_auth_post_yosemite", "(", "mac_username", ")", ":", "user_id", "=", "subprocess", ".", "check_output", "(", "[", "'id'", ",", "'-u'", ",", "mac_username", "]", ")", "ssh_auth_sock", "=", "subprocess", ".", "check_output", "(", "[", "'launchctl'...
Starting with Yosemite, launchd was rearchitected and now only one launchd process runs for all users. This allows us to much more easily impersonate a user through launchd and extract the environment variables from their running processes.
[ "Starting", "with", "Yosemite", "launchd", "was", "rearchitected", "and", "now", "only", "one", "launchd", "process", "runs", "for", "all", "users", ".", "This", "allows", "us", "to", "much", "more", "easily", "impersonate", "a", "user", "through", "launchd", ...
python
valid
silver-castle/mach9
mach9/response.py
https://github.com/silver-castle/mach9/blob/7a623aab3c70d89d36ade6901b6307e115400c5e/mach9/response.py#L349-L373
async def file(location, mime_type=None, headers=None, _range=None): '''Return a response object with file data. :param location: Location of file on system. :param mime_type: Specific mime_type. :param headers: Custom Headers. :param _range: ''' filename = path.split(location)[-1] asy...
[ "async", "def", "file", "(", "location", ",", "mime_type", "=", "None", ",", "headers", "=", "None", ",", "_range", "=", "None", ")", ":", "filename", "=", "path", ".", "split", "(", "location", ")", "[", "-", "1", "]", "async", "with", "open_async",...
Return a response object with file data. :param location: Location of file on system. :param mime_type: Specific mime_type. :param headers: Custom Headers. :param _range:
[ "Return", "a", "response", "object", "with", "file", "data", "." ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/zmq/eventloops.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/zmq/eventloops.py#L209-L223
def enable_gui(gui, kernel=None): """Enable integration with a given GUI""" if gui not in loop_map: raise ValueError("GUI %r not supported" % gui) if kernel is None: if Application.initialized(): kernel = getattr(Application.instance(), 'kernel', None) if kernel is None: ...
[ "def", "enable_gui", "(", "gui", ",", "kernel", "=", "None", ")", ":", "if", "gui", "not", "in", "loop_map", ":", "raise", "ValueError", "(", "\"GUI %r not supported\"", "%", "gui", ")", "if", "kernel", "is", "None", ":", "if", "Application", ".", "initi...
Enable integration with a given GUI
[ "Enable", "integration", "with", "a", "given", "GUI" ]
python
test
HydrelioxGitHub/PyYeelight
pyyeelight/yeelightMessage.py
https://github.com/HydrelioxGitHub/PyYeelight/blob/74e1261f04192fffc56e92cb0262c9068835c926/pyyeelight/yeelightMessage.py#L53-L74
def build_message(self): """ Make the one string message sent to the bulb """ if self.params is None: inline_params = "" else: # Put all params in one string inline_params = "" if type(self.params) is list: for x...
[ "def", "build_message", "(", "self", ")", ":", "if", "self", ".", "params", "is", "None", ":", "inline_params", "=", "\"\"", "else", ":", "# Put all params in one string", "inline_params", "=", "\"\"", "if", "type", "(", "self", ".", "params", ")", "is", "...
Make the one string message sent to the bulb
[ "Make", "the", "one", "string", "message", "sent", "to", "the", "bulb" ]
python
train
bitesofcode/projexui
projexui/widgets/xrichtextedit/xrichtextedit.py
https://github.com/bitesofcode/projexui/blob/f18a73bec84df90b034ca69b9deea118dbedfc4d/projexui/widgets/xrichtextedit/xrichtextedit.py#L413-L439
def insertUnorderedList(self): """ Inserts an ordered list into the editor. """ cursor = self.editor().textCursor() currlist = cursor.currentList() new_style = QTextListFormat.ListDisc indent = 1 if currlist: format = currlis...
[ "def", "insertUnorderedList", "(", "self", ")", ":", "cursor", "=", "self", ".", "editor", "(", ")", ".", "textCursor", "(", ")", "currlist", "=", "cursor", ".", "currentList", "(", ")", "new_style", "=", "QTextListFormat", ".", "ListDisc", "indent", "=", ...
Inserts an ordered list into the editor.
[ "Inserts", "an", "ordered", "list", "into", "the", "editor", "." ]
python
train
gem/oq-engine
openquake/hazardlib/geo/utils.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/hazardlib/geo/utils.py#L214-L250
def line_intersects_itself(lons, lats, closed_shape=False): """ Return ``True`` if line of points intersects itself. Line with the last point repeating the first one considered intersecting itself. The line is defined by lists (or numpy arrays) of points' longitudes and latitudes (depth is not ...
[ "def", "line_intersects_itself", "(", "lons", ",", "lats", ",", "closed_shape", "=", "False", ")", ":", "assert", "len", "(", "lons", ")", "==", "len", "(", "lats", ")", "if", "len", "(", "lons", ")", "<=", "3", ":", "# line can not intersect itself unless...
Return ``True`` if line of points intersects itself. Line with the last point repeating the first one considered intersecting itself. The line is defined by lists (or numpy arrays) of points' longitudes and latitudes (depth is not taken into account). :param closed_shape: If ``True`` the l...
[ "Return", "True", "if", "line", "of", "points", "intersects", "itself", ".", "Line", "with", "the", "last", "point", "repeating", "the", "first", "one", "considered", "intersecting", "itself", "." ]
python
train
ibis-project/ibis
ibis/expr/api.py
https://github.com/ibis-project/ibis/blob/1e39a5fd9ef088b45c155e8a5f541767ee8ef2e7/ibis/expr/api.py#L3293-L3302
def _table_materialize(table): """ Force schema resolution for a joined table, selecting all fields from all tables. """ if table._is_materialized(): return table op = ops.MaterializedJoin(table) return op.to_expr()
[ "def", "_table_materialize", "(", "table", ")", ":", "if", "table", ".", "_is_materialized", "(", ")", ":", "return", "table", "op", "=", "ops", ".", "MaterializedJoin", "(", "table", ")", "return", "op", ".", "to_expr", "(", ")" ]
Force schema resolution for a joined table, selecting all fields from all tables.
[ "Force", "schema", "resolution", "for", "a", "joined", "table", "selecting", "all", "fields", "from", "all", "tables", "." ]
python
train
nicfit/MishMash
mishmash/commands/sync/utils.py
https://github.com/nicfit/MishMash/blob/8f988936340bf0ffb83ea90ea124efb3c36a1174/mishmash/commands/sync/utils.py#L64-L92
def syncImage(img, current, session): """Add or updated the Image.""" def _img_str(i): return "%s - %s" % (i.type, i.description) for db_img in current.images: img_info = (img.type, img.md5, img.size) db_img_info = (db_img.type, db_img.md5, db_img.size) if db_img_info == im...
[ "def", "syncImage", "(", "img", ",", "current", ",", "session", ")", ":", "def", "_img_str", "(", "i", ")", ":", "return", "\"%s - %s\"", "%", "(", "i", ".", "type", ",", "i", ".", "description", ")", "for", "db_img", "in", "current", ".", "images", ...
Add or updated the Image.
[ "Add", "or", "updated", "the", "Image", "." ]
python
train
timster/peewee-validates
peewee_validates.py
https://github.com/timster/peewee-validates/blob/417f0fafb87fe9209439d65bc279d86a3d9e8028/peewee_validates.py#L937-L974
def validate(self, data=None, only=None, exclude=None): """ Validate the data for all fields and return whether the validation was successful. This method also retains the validated data in ``self.data`` so that it can be accessed later. If data for a field is not provided in ``data`` t...
[ "def", "validate", "(", "self", ",", "data", "=", "None", ",", "only", "=", "None", ",", "exclude", "=", "None", ")", ":", "data", "=", "data", "or", "{", "}", "only", "=", "only", "or", "self", ".", "_meta", ".", "only", "exclude", "=", "exclude...
Validate the data for all fields and return whether the validation was successful. This method also retains the validated data in ``self.data`` so that it can be accessed later. If data for a field is not provided in ``data`` then this validator will check against the provided model instance. ...
[ "Validate", "the", "data", "for", "all", "fields", "and", "return", "whether", "the", "validation", "was", "successful", ".", "This", "method", "also", "retains", "the", "validated", "data", "in", "self", ".", "data", "so", "that", "it", "can", "be", "acce...
python
train
mikeywaites/flask-arrested
arrested/handlers.py
https://github.com/mikeywaites/flask-arrested/blob/6b97ce2ad2765f9acab10f4726e310258aa51de0/arrested/handlers.py#L54-L73
def process(self, data=None, **kwargs): """Process the provided data and invoke :meth:`Handler.handle` method for this Handler class. :params data: The data being processed. :returns: self :rtype: :class:`Handler` .. code-block:: python def post(self, *args...
[ "def", "process", "(", "self", ",", "data", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "data", "=", "self", ".", "handle", "(", "data", ",", "*", "*", "kwargs", ")", "return", "self" ]
Process the provided data and invoke :meth:`Handler.handle` method for this Handler class. :params data: The data being processed. :returns: self :rtype: :class:`Handler` .. code-block:: python def post(self, *args, **kwargs): self.request = self.ge...
[ "Process", "the", "provided", "data", "and", "invoke", ":", "meth", ":", "Handler", ".", "handle", "method", "for", "this", "Handler", "class", "." ]
python
train
frawau/aiolifx
aiolifx/aiolifx.py
https://github.com/frawau/aiolifx/blob/9bd8c5e6d291f4c79314989402f7e2c6476d5851/aiolifx/aiolifx.py#L638-L651
def get_hostinfo(self,callb=None): """Convenience method to request the device info from the device This will request the information from the device and request that callb be executed when a response is received. The is no default callback :param callb: Callable to be used when the r...
[ "def", "get_hostinfo", "(", "self", ",", "callb", "=", "None", ")", ":", "response", "=", "self", ".", "req_with_resp", "(", "GetInfo", ",", "StateInfo", ",", "callb", "=", "callb", ")", "return", "None" ]
Convenience method to request the device info from the device This will request the information from the device and request that callb be executed when a response is received. The is no default callback :param callb: Callable to be used when the response is received. If not set, ...
[ "Convenience", "method", "to", "request", "the", "device", "info", "from", "the", "device" ]
python
train
ejhigson/nestcheck
nestcheck/ns_run_utils.py
https://github.com/ejhigson/nestcheck/blob/29151c314deb89746fd674f27f6ce54b77603189/nestcheck/ns_run_utils.py#L70-L132
def dict_given_run_array(samples, thread_min_max): """ Converts an array of information about samples back into a nested sampling run dictionary (see data_processing module docstring for more details). N.B. the output dict only contains the following keys: 'logl', 'thread_label', 'nlive_array', 'th...
[ "def", "dict_given_run_array", "(", "samples", ",", "thread_min_max", ")", ":", "ns_run", "=", "{", "'logl'", ":", "samples", "[", ":", ",", "0", "]", ",", "'thread_labels'", ":", "samples", "[", ":", ",", "1", "]", ",", "'thread_min_max'", ":", "thread_...
Converts an array of information about samples back into a nested sampling run dictionary (see data_processing module docstring for more details). N.B. the output dict only contains the following keys: 'logl', 'thread_label', 'nlive_array', 'theta'. Any other keys giving additional information about th...
[ "Converts", "an", "array", "of", "information", "about", "samples", "back", "into", "a", "nested", "sampling", "run", "dictionary", "(", "see", "data_processing", "module", "docstring", "for", "more", "details", ")", "." ]
python
train
tensorflow/tensorboard
tensorboard/plugins/debugger/debug_graphs_helper.py
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/debug_graphs_helper.py#L37-L73
def get_gated_grpc_tensors(self, matching_debug_op=None): """Extract all nodes with gated-gRPC debug ops attached. Uses cached values if available. This method is thread-safe. Args: graph_def: A tf.GraphDef proto. matching_debug_op: Return tensors and nodes with only matching the s...
[ "def", "get_gated_grpc_tensors", "(", "self", ",", "matching_debug_op", "=", "None", ")", ":", "with", "self", ".", "_grpc_gated_lock", ":", "matching_debug_op", "=", "matching_debug_op", "or", "'DebugIdentity'", "if", "matching_debug_op", "not", "in", "self", ".", ...
Extract all nodes with gated-gRPC debug ops attached. Uses cached values if available. This method is thread-safe. Args: graph_def: A tf.GraphDef proto. matching_debug_op: Return tensors and nodes with only matching the specified debug op name (optional). If `None`, will extract only ...
[ "Extract", "all", "nodes", "with", "gated", "-", "gRPC", "debug", "ops", "attached", "." ]
python
train
nicolas-van/mailflash
mailflash.py
https://github.com/nicolas-van/mailflash/blob/794598d9df0e343bb1f64b03d09a68a540229774/mailflash.py#L410-L424
def attach(self, filename=None, content_type=None, data=None, disposition=None, headers=None): """Adds an attachment to the message. :param filename: filename of attachment :param content_type: file mimetype :par...
[ "def", "attach", "(", "self", ",", "filename", "=", "None", ",", "content_type", "=", "None", ",", "data", "=", "None", ",", "disposition", "=", "None", ",", "headers", "=", "None", ")", ":", "self", ".", "attachments", ".", "append", "(", "Attachment"...
Adds an attachment to the message. :param filename: filename of attachment :param content_type: file mimetype :param data: the raw file data :param disposition: content-disposition (if any)
[ "Adds", "an", "attachment", "to", "the", "message", "." ]
python
test
tensorflow/cleverhans
examples/nips17_adversarial_competition/eval_infra/code/eval_lib/image_batches.py
https://github.com/tensorflow/cleverhans/blob/97488e215760547b81afc53f5e5de8ba7da5bd98/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/image_batches.py#L72-L81
def _write_single_batch_images_internal(self, batch_id, client_batch): """Helper method to write images from single batch into datastore.""" client = self._datastore_client batch_key = client.key(self._entity_kind_batches, batch_id) for img_id, img in iteritems(self._data[batch_id]['images']): img...
[ "def", "_write_single_batch_images_internal", "(", "self", ",", "batch_id", ",", "client_batch", ")", ":", "client", "=", "self", ".", "_datastore_client", "batch_key", "=", "client", ".", "key", "(", "self", ".", "_entity_kind_batches", ",", "batch_id", ")", "f...
Helper method to write images from single batch into datastore.
[ "Helper", "method", "to", "write", "images", "from", "single", "batch", "into", "datastore", "." ]
python
train
Phyks/libbmc
libbmc/fetcher.py
https://github.com/Phyks/libbmc/blob/9ef1a29d2514157d1edd6c13ecbd61b07ae9315e/libbmc/fetcher.py#L80-L132
def download(url, proxies=None): """ Download a PDF or DJVU document from a url, eventually using proxies. :params url: The URL to the PDF/DJVU document to fetch. :params proxies: An optional list of proxies to use. Proxies will be \ used sequentially. Proxies should be a list of proxy stri...
[ "def", "download", "(", "url", ",", "proxies", "=", "None", ")", ":", "# Handle default argument", "if", "proxies", "is", "None", ":", "proxies", "=", "[", "\"\"", "]", "# Loop over all available connections", "for", "proxy", "in", "proxies", ":", "# Handle no p...
Download a PDF or DJVU document from a url, eventually using proxies. :params url: The URL to the PDF/DJVU document to fetch. :params proxies: An optional list of proxies to use. Proxies will be \ used sequentially. Proxies should be a list of proxy strings. \ Do not forget to include `...
[ "Download", "a", "PDF", "or", "DJVU", "document", "from", "a", "url", "eventually", "using", "proxies", "." ]
python
train
adafruit/Adafruit_Python_BluefruitLE
Adafruit_BluefruitLE/interfaces/gatt.py
https://github.com/adafruit/Adafruit_Python_BluefruitLE/blob/34fc6f596371b961628369d78ce836950514062f/Adafruit_BluefruitLE/interfaces/gatt.py#L44-L51
def find_characteristic(self, uuid): """Return the first child characteristic found that has the specified UUID. Will return None if no characteristic that matches is found. """ for char in self.list_characteristics(): if char.uuid == uuid: return char ...
[ "def", "find_characteristic", "(", "self", ",", "uuid", ")", ":", "for", "char", "in", "self", ".", "list_characteristics", "(", ")", ":", "if", "char", ".", "uuid", "==", "uuid", ":", "return", "char", "return", "None" ]
Return the first child characteristic found that has the specified UUID. Will return None if no characteristic that matches is found.
[ "Return", "the", "first", "child", "characteristic", "found", "that", "has", "the", "specified", "UUID", ".", "Will", "return", "None", "if", "no", "characteristic", "that", "matches", "is", "found", "." ]
python
valid
lawsie/guizero
guizero/Drawing.py
https://github.com/lawsie/guizero/blob/84c7f0b314fa86f9fc88eb11c9a0f6c4b57155e2/guizero/Drawing.py#L49-L78
def line(self, x1, y1, x2, y2, color="black", width=1): """ Draws a line between 2 points :param int x1: The x position of the starting point. :param int y1: The y position of the starting point. :param int x2: The x position of the end poin...
[ "def", "line", "(", "self", ",", "x1", ",", "y1", ",", "x2", ",", "y2", ",", "color", "=", "\"black\"", ",", "width", "=", "1", ")", ":", "return", "self", ".", "tk", ".", "create_line", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ",", "width...
Draws a line between 2 points :param int x1: The x position of the starting point. :param int y1: The y position of the starting point. :param int x2: The x position of the end point. :param int y2: The y position of the end point. ...
[ "Draws", "a", "line", "between", "2", "points" ]
python
train
aaren/notedown
notedown/notedown.py
https://github.com/aaren/notedown/blob/1e920c7e4ecbe47420c12eed3d5bcae735121222/notedown/notedown.py#L526-L533
def dequote(s): """Remove excess quotes from a string.""" if len(s) < 2: return s elif (s[0] == s[-1]) and s.startswith(('"', "'")): return s[1: -1] else: return s
[ "def", "dequote", "(", "s", ")", ":", "if", "len", "(", "s", ")", "<", "2", ":", "return", "s", "elif", "(", "s", "[", "0", "]", "==", "s", "[", "-", "1", "]", ")", "and", "s", ".", "startswith", "(", "(", "'\"'", ",", "\"'\"", ")", ")", ...
Remove excess quotes from a string.
[ "Remove", "excess", "quotes", "from", "a", "string", "." ]
python
train
Jajcus/pyxmpp2
pyxmpp2/xmppserializer.py
https://github.com/Jajcus/pyxmpp2/blob/14a40a3950910a9cd008b55f0d8905aa0186ce18/pyxmpp2/xmppserializer.py#L178-L198
def _make_prefix(self, declared_prefixes): """Make up a new namespace prefix, which won't conflict with `_prefixes` and prefixes declared in the current scope. :Parameters: - `declared_prefixes`: namespace to prefix mapping for the current scope :Types: ...
[ "def", "_make_prefix", "(", "self", ",", "declared_prefixes", ")", ":", "used_prefixes", "=", "set", "(", "self", ".", "_prefixes", ".", "values", "(", ")", ")", "used_prefixes", "|=", "set", "(", "declared_prefixes", ".", "values", "(", ")", ")", "while",...
Make up a new namespace prefix, which won't conflict with `_prefixes` and prefixes declared in the current scope. :Parameters: - `declared_prefixes`: namespace to prefix mapping for the current scope :Types: - `declared_prefixes`: `unicode` to `unicode` dic...
[ "Make", "up", "a", "new", "namespace", "prefix", "which", "won", "t", "conflict", "with", "_prefixes", "and", "prefixes", "declared", "in", "the", "current", "scope", "." ]
python
valid
BlueBrain/NeuroM
neurom/core/types.py
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/core/types.py#L95-L97
def dendrite_filter(n): '''Select only dendrites''' return n.type == NeuriteType.basal_dendrite or n.type == NeuriteType.apical_dendrite
[ "def", "dendrite_filter", "(", "n", ")", ":", "return", "n", ".", "type", "==", "NeuriteType", ".", "basal_dendrite", "or", "n", ".", "type", "==", "NeuriteType", ".", "apical_dendrite" ]
Select only dendrites
[ "Select", "only", "dendrites" ]
python
train
GoogleCloudPlatform/appengine-gcs-client
python/src/cloudstorage/cloudstorage_api.py
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/python/src/cloudstorage/cloudstorage_api.py#L285-L370
def listbucket(path_prefix, marker=None, prefix=None, max_keys=None, delimiter=None, retry_params=None, _account_id=None): """Returns a GCSFileStat iterator over a bucket. Optional arguments can limit the result to a subset of files under bucket. This function has two modes: 1. List bucket mode...
[ "def", "listbucket", "(", "path_prefix", ",", "marker", "=", "None", ",", "prefix", "=", "None", ",", "max_keys", "=", "None", ",", "delimiter", "=", "None", ",", "retry_params", "=", "None", ",", "_account_id", "=", "None", ")", ":", "if", "prefix", "...
Returns a GCSFileStat iterator over a bucket. Optional arguments can limit the result to a subset of files under bucket. This function has two modes: 1. List bucket mode: Lists all files in the bucket without any concept of hierarchy. GCS doesn't have real directory hierarchies. 2. Directory emulation mo...
[ "Returns", "a", "GCSFileStat", "iterator", "over", "a", "bucket", "." ]
python
train
saltstack/salt
salt/returners/etcd_return.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/returners/etcd_return.py#L196-L209
def get_fun(fun): ''' Return a dict of the last function called for all minions ''' log.debug('sdstack_etcd returner <get_fun> called fun: %s', fun) ret = {} client, path = _get_conn(__opts__) items = client.get('/'.join((path, 'minions'))) for item in items.children: comps = str...
[ "def", "get_fun", "(", "fun", ")", ":", "log", ".", "debug", "(", "'sdstack_etcd returner <get_fun> called fun: %s'", ",", "fun", ")", "ret", "=", "{", "}", "client", ",", "path", "=", "_get_conn", "(", "__opts__", ")", "items", "=", "client", ".", "get", ...
Return a dict of the last function called for all minions
[ "Return", "a", "dict", "of", "the", "last", "function", "called", "for", "all", "minions" ]
python
train
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/client.py
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/client.py#L146-L180
def collection(self, *collection_path): """Get a reference to a collection. For a top-level collection: .. code-block:: python >>> client.collection('top') For a sub-collection: .. code-block:: python >>> client.collection('mydocs/doc/subcol') ...
[ "def", "collection", "(", "self", ",", "*", "collection_path", ")", ":", "if", "len", "(", "collection_path", ")", "==", "1", ":", "path", "=", "collection_path", "[", "0", "]", ".", "split", "(", "_helpers", ".", "DOCUMENT_PATH_DELIMITER", ")", "else", ...
Get a reference to a collection. For a top-level collection: .. code-block:: python >>> client.collection('top') For a sub-collection: .. code-block:: python >>> client.collection('mydocs/doc/subcol') >>> # is the same as >>> client.c...
[ "Get", "a", "reference", "to", "a", "collection", "." ]
python
train
googleads/googleads-python-lib
examples/adwords/v201809/remarketing/upload_offline_data.py
https://github.com/googleads/googleads-python-lib/blob/aa3b1b474b0f9789ca55ca46f4b2b57aeae38874/examples/adwords/v201809/remarketing/upload_offline_data.py#L216-L238
def _GetFieldPathElementIndex(api_error, field): """Retrieve the index of a given field in the api_error's fieldPathElements. Args: api_error: a dict containing a partialFailureError returned from the AdWords API. field: a str field for which this determines the index in the api_error's fieldPa...
[ "def", "_GetFieldPathElementIndex", "(", "api_error", ",", "field", ")", ":", "field_path_elements", "=", "api_error", "[", "'fieldPathElements'", "]", "if", "field_path_elements", ":", "found_index", "=", "[", "field_path_element", "[", "'index'", "]", "for", "fiel...
Retrieve the index of a given field in the api_error's fieldPathElements. Args: api_error: a dict containing a partialFailureError returned from the AdWords API. field: a str field for which this determines the index in the api_error's fieldPathElements. Returns: An int index of the field ...
[ "Retrieve", "the", "index", "of", "a", "given", "field", "in", "the", "api_error", "s", "fieldPathElements", "." ]
python
train
DAI-Lab/Copulas
copulas/multivariate/gaussian.py
https://github.com/DAI-Lab/Copulas/blob/821df61c3d36a6b81ef2883935f935c2eaaa862c/copulas/multivariate/gaussian.py#L174-L193
def cumulative_distribution(self, X): """Computes the cumulative distribution function for the copula Args: X: `numpy.ndarray` or `pandas.DataFrame` Returns: np.array: cumulative probability """ self.check_fit() # Wrapper for pdf to accept vecto...
[ "def", "cumulative_distribution", "(", "self", ",", "X", ")", ":", "self", ".", "check_fit", "(", ")", "# Wrapper for pdf to accept vector as args", "def", "func", "(", "*", "args", ")", ":", "return", "self", ".", "probability_density", "(", "list", "(", "arg...
Computes the cumulative distribution function for the copula Args: X: `numpy.ndarray` or `pandas.DataFrame` Returns: np.array: cumulative probability
[ "Computes", "the", "cumulative", "distribution", "function", "for", "the", "copula" ]
python
train
UCL-INGI/INGInious
inginious/frontend/user_manager.py
https://github.com/UCL-INGI/INGInious/blob/cbda9a9c7f2b8e8eb1e6d7d51f0d18092086300c/inginious/frontend/user_manager.py#L479-L483
def get_task_cache(self, username, courseid, taskid): """ Shorthand for get_task_caches([username], courseid, taskid)[username] """ return self.get_task_caches([username], courseid, taskid)[username]
[ "def", "get_task_cache", "(", "self", ",", "username", ",", "courseid", ",", "taskid", ")", ":", "return", "self", ".", "get_task_caches", "(", "[", "username", "]", ",", "courseid", ",", "taskid", ")", "[", "username", "]" ]
Shorthand for get_task_caches([username], courseid, taskid)[username]
[ "Shorthand", "for", "get_task_caches", "(", "[", "username", "]", "courseid", "taskid", ")", "[", "username", "]" ]
python
train
ianlini/flatten-dict
flatten_dict/flatten_dict.py
https://github.com/ianlini/flatten-dict/blob/77a2bf669ea6dc7446b8ad1596dc2a41d4c5a7fa/flatten_dict/flatten_dict.py#L79-L108
def unflatten(d, splitter='tuple', inverse=False): """Unflatten dict-like object. Parameters ---------- d: dict-like object The dict that will be unflattened. splitter: {'tuple', 'path', function} (default: 'tuple') The key splitting method. If a function is given, the function will...
[ "def", "unflatten", "(", "d", ",", "splitter", "=", "'tuple'", ",", "inverse", "=", "False", ")", ":", "if", "isinstance", "(", "splitter", ",", "str", ")", ":", "splitter", "=", "SPLITTER_DICT", "[", "splitter", "]", "unflattened_dict", "=", "{", "}", ...
Unflatten dict-like object. Parameters ---------- d: dict-like object The dict that will be unflattened. splitter: {'tuple', 'path', function} (default: 'tuple') The key splitting method. If a function is given, the function will be used to split. 'tuple': Use each eleme...
[ "Unflatten", "dict", "-", "like", "object", "." ]
python
train
shexSpec/grammar
parsers/python/pyshexc/parser_impl/parser_context.py
https://github.com/shexSpec/grammar/blob/4497cd1f73fa6703bca6e2cb53ba9c120f22e48c/parsers/python/pyshexc/parser_impl/parser_context.py#L125-L131
def shapeexprlabel_to_IRI(self, shapeExprLabel: ShExDocParser.ShapeExprLabelContext) \ -> Union[ShExJ.BNODE, ShExJ.IRIREF]: """ shapeExprLabel: iri | blankNode """ if shapeExprLabel.iri(): return self.iri_to_iriref(shapeExprLabel.iri()) else: return ShExJ.BNOD...
[ "def", "shapeexprlabel_to_IRI", "(", "self", ",", "shapeExprLabel", ":", "ShExDocParser", ".", "ShapeExprLabelContext", ")", "->", "Union", "[", "ShExJ", ".", "BNODE", ",", "ShExJ", ".", "IRIREF", "]", ":", "if", "shapeExprLabel", ".", "iri", "(", ")", ":", ...
shapeExprLabel: iri | blankNode
[ "shapeExprLabel", ":", "iri", "|", "blankNode" ]
python
train
tomplus/kubernetes_asyncio
kubernetes_asyncio/client/api/policy_v1beta1_api.py
https://github.com/tomplus/kubernetes_asyncio/blob/f9ab15317ec921409714c7afef11aeb0f579985d/kubernetes_asyncio/client/api/policy_v1beta1_api.py#L35-L59
def create_namespaced_pod_disruption_budget(self, namespace, body, **kwargs): # noqa: E501 """create_namespaced_pod_disruption_budget # noqa: E501 create a PodDisruptionBudget # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, ...
[ "def", "create_namespaced_pod_disruption_budget", "(", "self", ",", "namespace", ",", "body", ",", "*", "*", "kwargs", ")", ":", "# noqa: E501", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", "...
create_namespaced_pod_disruption_budget # noqa: E501 create a PodDisruptionBudget # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_namespaced_pod_disruption_budget(namespace, ...
[ "create_namespaced_pod_disruption_budget", "#", "noqa", ":", "E501" ]
python
train
SKA-ScienceDataProcessor/integration-prototype
sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py
https://github.com/SKA-ScienceDataProcessor/integration-prototype/blob/8c8006de6ad71dcd44114b0338780738079c87d4/sip/execution_control/docker_api/sip_docker_swarm/docker_swarm_client.py#L270-L288
def get_service_details(self, service_id: str) -> dict: """Get details of a service. Only the manager nodes can retrieve service details Args: service_id (string): List of service id Returns: dict, details of the service """ # Raise an exceptio...
[ "def", "get_service_details", "(", "self", ",", "service_id", ":", "str", ")", "->", "dict", ":", "# Raise an exception if we are not a manager", "if", "not", "self", ".", "_manager", ":", "raise", "RuntimeError", "(", "'Only the Swarm manager node can retrieve all'", "...
Get details of a service. Only the manager nodes can retrieve service details Args: service_id (string): List of service id Returns: dict, details of the service
[ "Get", "details", "of", "a", "service", "." ]
python
train
caseyjlaw/rtpipe
rtpipe/parsecands.py
https://github.com/caseyjlaw/rtpipe/blob/ac33e4332cf215091a63afbb3137850876d73ec0/rtpipe/parsecands.py#L339-L368
def split_candidates(candsfile, featind1, featind2, candsfile1, candsfile2): """ Split features from one candsfile into two new candsfiles featind1/2 is list of indices to take from d['features']. New features and updated state dict go to candsfile1/2. """ with open(candsfile, 'rb') as pkl: ...
[ "def", "split_candidates", "(", "candsfile", ",", "featind1", ",", "featind2", ",", "candsfile1", ",", "candsfile2", ")", ":", "with", "open", "(", "candsfile", ",", "'rb'", ")", "as", "pkl", ":", "d", "=", "pickle", ".", "load", "(", "pkl", ")", "cand...
Split features from one candsfile into two new candsfiles featind1/2 is list of indices to take from d['features']. New features and updated state dict go to candsfile1/2.
[ "Split", "features", "from", "one", "candsfile", "into", "two", "new", "candsfiles" ]
python
train
7sDream/zhihu-py3
zhihu/author.py
https://github.com/7sDream/zhihu-py3/blob/bcb4aa8325f8b54d3b44bd0bdc959edd9761fcfc/zhihu/author.py#L671-L680
def last_activity_time(self): """获取用户最后一次活动的时间 :return: 用户最后一次活动的时间,返回值为 unix 时间戳 :rtype: int """ self._make_soup() act = self.soup.find( 'div', class_='zm-profile-section-item zm-item clearfix') return int(act['data-time']) if act is not None else -1
[ "def", "last_activity_time", "(", "self", ")", ":", "self", ".", "_make_soup", "(", ")", "act", "=", "self", ".", "soup", ".", "find", "(", "'div'", ",", "class_", "=", "'zm-profile-section-item zm-item clearfix'", ")", "return", "int", "(", "act", "[", "'...
获取用户最后一次活动的时间 :return: 用户最后一次活动的时间,返回值为 unix 时间戳 :rtype: int
[ "获取用户最后一次活动的时间" ]
python
train
has2k1/plotnine
plotnine/themes/theme.py
https://github.com/has2k1/plotnine/blob/566e579af705367e584fb27a74e6c5199624ca89/plotnine/themes/theme.py#L292-L312
def theme_set(new): """ Change the current(default) theme Parameters ---------- new : theme New default theme Returns ------- out : theme Previous theme """ if (not isinstance(new, theme) and not issubclass(new, theme)): raise PlotnineError("...
[ "def", "theme_set", "(", "new", ")", ":", "if", "(", "not", "isinstance", "(", "new", ",", "theme", ")", "and", "not", "issubclass", "(", "new", ",", "theme", ")", ")", ":", "raise", "PlotnineError", "(", "\"Expecting object to be a theme\"", ")", "out", ...
Change the current(default) theme Parameters ---------- new : theme New default theme Returns ------- out : theme Previous theme
[ "Change", "the", "current", "(", "default", ")", "theme" ]
python
train
apple/turicreate
deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L25-L31
def begin(self): """Generate the beginning part""" self.out_f.write('\n') for depth, name in enumerate(self.names): self.out_f.write( '{0}namespace {1}\n{0}{{\n'.format(self.prefix(depth), name) )
[ "def", "begin", "(", "self", ")", ":", "self", ".", "out_f", ".", "write", "(", "'\\n'", ")", "for", "depth", ",", "name", "in", "enumerate", "(", "self", ".", "names", ")", ":", "self", ".", "out_f", ".", "write", "(", "'{0}namespace {1}\\n{0}{{\\n'",...
Generate the beginning part
[ "Generate", "the", "beginning", "part" ]
python
train
mlperf/training
reinforcement/tensorflow/minigo/bigtable_input.py
https://github.com/mlperf/training/blob/1c6ae725a81d15437a2b2df05cac0673fde5c3a4/reinforcement/tensorflow/minigo/bigtable_input.py#L189-L205
def _delete_rows(args): """Delete the given row keys from the given Bigtable. The args are (BigtableSpec, row_keys), but are passed as a single argument in order to work with multiprocessing.Pool.map. This is also the reason why this is a top-level function instead of a method. """ btspec...
[ "def", "_delete_rows", "(", "args", ")", ":", "btspec", ",", "row_keys", "=", "args", "bt_table", "=", "bigtable", ".", "Client", "(", "btspec", ".", "project", ")", ".", "instance", "(", "btspec", ".", "instance", ")", ".", "table", "(", "btspec", "."...
Delete the given row keys from the given Bigtable. The args are (BigtableSpec, row_keys), but are passed as a single argument in order to work with multiprocessing.Pool.map. This is also the reason why this is a top-level function instead of a method.
[ "Delete", "the", "given", "row", "keys", "from", "the", "given", "Bigtable", "." ]
python
train
urschrei/pyzotero
pyzotero/zotero.py
https://github.com/urschrei/pyzotero/blob/b378966b30146a952f7953c23202fb5a1ddf81d9/pyzotero/zotero.py#L895-L907
def item_template(self, itemtype): """ Get a template for a new item """ # if we have a template and it hasn't been updated since we stored it template_name = "item_template_" + itemtype query_string = "/items/new?itemType={i}".format(i=itemtype) if self.templates.get(tem...
[ "def", "item_template", "(", "self", ",", "itemtype", ")", ":", "# if we have a template and it hasn't been updated since we stored it", "template_name", "=", "\"item_template_\"", "+", "itemtype", "query_string", "=", "\"/items/new?itemType={i}\"", ".", "format", "(", "i", ...
Get a template for a new item
[ "Get", "a", "template", "for", "a", "new", "item" ]
python
valid
AshleySetter/optoanalysis
optoanalysis/optoanalysis/optoanalysis.py
https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/optoanalysis.py#L627-L699
def get_fit_auto(self, CentralFreq, MaxWidth=15000, MinWidth=500, WidthIntervals=500, MakeFig=True, show_fig=True, silent=False): """ Tries a range of regions to search for peaks and runs the one with the least error and returns the parameters with the least errors. Parameters -...
[ "def", "get_fit_auto", "(", "self", ",", "CentralFreq", ",", "MaxWidth", "=", "15000", ",", "MinWidth", "=", "500", ",", "WidthIntervals", "=", "500", ",", "MakeFig", "=", "True", ",", "show_fig", "=", "True", ",", "silent", "=", "False", ")", ":", "Mi...
Tries a range of regions to search for peaks and runs the one with the least error and returns the parameters with the least errors. Parameters ---------- CentralFreq : float The central frequency to use for the fittings. MaxWidth : float, optional The ma...
[ "Tries", "a", "range", "of", "regions", "to", "search", "for", "peaks", "and", "runs", "the", "one", "with", "the", "least", "error", "and", "returns", "the", "parameters", "with", "the", "least", "errors", "." ]
python
train
tensorflow/tensor2tensor
tensor2tensor/utils/optimize.py
https://github.com/tensorflow/tensor2tensor/blob/272500b6efe353aeb638d2745ed56e519462ca31/tensor2tensor/utils/optimize.py#L348-L373
def get_variable_initializer(hparams): """Get variable initializer from hparams.""" if not hparams.initializer: return None mlperf_log.transformer_print(key=mlperf_log.MODEL_HP_INITIALIZER_GAIN, value=hparams.initializer_gain, hparams=hparams) ...
[ "def", "get_variable_initializer", "(", "hparams", ")", ":", "if", "not", "hparams", ".", "initializer", ":", "return", "None", "mlperf_log", ".", "transformer_print", "(", "key", "=", "mlperf_log", ".", "MODEL_HP_INITIALIZER_GAIN", ",", "value", "=", "hparams", ...
Get variable initializer from hparams.
[ "Get", "variable", "initializer", "from", "hparams", "." ]
python
train
scanny/python-pptx
pptx/oxml/shapes/picture.py
https://github.com/scanny/python-pptx/blob/d6ab8234f8b03953d2f831ff9394b1852db34130/pptx/oxml/shapes/picture.py#L67-L76
def new_pic(cls, id_, name, desc, rId, left, top, width, height): """ Return a new ``<p:pic>`` element tree configured with the supplied parameters. """ xml = cls._pic_tmpl() % ( id_, name, desc, rId, left, top, width, height ) pic = parse_xml(xml) ...
[ "def", "new_pic", "(", "cls", ",", "id_", ",", "name", ",", "desc", ",", "rId", ",", "left", ",", "top", ",", "width", ",", "height", ")", ":", "xml", "=", "cls", ".", "_pic_tmpl", "(", ")", "%", "(", "id_", ",", "name", ",", "desc", ",", "rI...
Return a new ``<p:pic>`` element tree configured with the supplied parameters.
[ "Return", "a", "new", "<p", ":", "pic", ">", "element", "tree", "configured", "with", "the", "supplied", "parameters", "." ]
python
train
Scille/autobahn-sync
autobahn_sync/core.py
https://github.com/Scille/autobahn-sync/blob/d75fceff0d1aee61fa6dd0168eb1cd40794ad827/autobahn_sync/core.py#L91-L110
def run(self, url=DEFAULT_AUTOBAHN_ROUTER, realm=DEFAULT_AUTOBAHN_REALM, authmethods=None, authid=None, authrole=None, authextra=None, blocking=False, callback=None, **kwargs): """ Start the background twisted thread and create the WAMP connection :param blocking: If ``F...
[ "def", "run", "(", "self", ",", "url", "=", "DEFAULT_AUTOBAHN_ROUTER", ",", "realm", "=", "DEFAULT_AUTOBAHN_REALM", ",", "authmethods", "=", "None", ",", "authid", "=", "None", ",", "authrole", "=", "None", ",", "authextra", "=", "None", ",", "blocking", "...
Start the background twisted thread and create the WAMP connection :param blocking: If ``False`` (default) this method will spawn a new thread that will be used to run the callback events (e.i. registered and subscribed functions). If ``True`` this method will not returns and use the cu...
[ "Start", "the", "background", "twisted", "thread", "and", "create", "the", "WAMP", "connection" ]
python
train
rwl/pylon
pylon/case.py
https://github.com/rwl/pylon/blob/916514255db1ae1661406f0283df756baf960d14/pylon/case.py#L940-L944
def save_psse(self, fd): """ Serialize the case as a PSS/E data file. """ from pylon.io import PSSEWriter return PSSEWriter(self).write(fd)
[ "def", "save_psse", "(", "self", ",", "fd", ")", ":", "from", "pylon", ".", "io", "import", "PSSEWriter", "return", "PSSEWriter", "(", "self", ")", ".", "write", "(", "fd", ")" ]
Serialize the case as a PSS/E data file.
[ "Serialize", "the", "case", "as", "a", "PSS", "/", "E", "data", "file", "." ]
python
train
elastic/elasticsearch-py
elasticsearch/client/nodes.py
https://github.com/elastic/elasticsearch-py/blob/2aab285c8f506f3863cbdaba3c90a685c510ba00/elasticsearch/client/nodes.py#L46-L82
def stats(self, node_id=None, metric=None, index_metric=None, params=None): """ The cluster nodes stats API allows to retrieve one or more (or all) of the cluster nodes statistics. `<https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html>`_ :arg...
[ "def", "stats", "(", "self", ",", "node_id", "=", "None", ",", "metric", "=", "None", ",", "index_metric", "=", "None", ",", "params", "=", "None", ")", ":", "return", "self", ".", "transport", ".", "perform_request", "(", "\"GET\"", ",", "_make_path", ...
The cluster nodes stats API allows to retrieve one or more (or all) of the cluster nodes statistics. `<https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html>`_ :arg node_id: A comma-separated list of node IDs or names to limit the returned informat...
[ "The", "cluster", "nodes", "stats", "API", "allows", "to", "retrieve", "one", "or", "more", "(", "or", "all", ")", "of", "the", "cluster", "nodes", "statistics", ".", "<https", ":", "//", "www", ".", "elastic", ".", "co", "/", "guide", "/", "en", "/"...
python
train
saltstack/salt
salt/engines/http_logstash.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/engines/http_logstash.py#L77-L119
def start(url, funs=None, tags=None): ''' Listen to salt events and forward them to logstash. url The Logstash endpoint. funs: ``None`` A list of functions to be compared against, looking into the ``fun`` field from the event data. This option helps to select the events ...
[ "def", "start", "(", "url", ",", "funs", "=", "None", ",", "tags", "=", "None", ")", ":", "if", "__opts__", ".", "get", "(", "'id'", ")", ".", "endswith", "(", "'_master'", ")", ":", "instance", "=", "'master'", "else", ":", "instance", "=", "'mini...
Listen to salt events and forward them to logstash. url The Logstash endpoint. funs: ``None`` A list of functions to be compared against, looking into the ``fun`` field from the event data. This option helps to select the events generated by one or more functions. If an...
[ "Listen", "to", "salt", "events", "and", "forward", "them", "to", "logstash", "." ]
python
train
DLR-RM/RAFCON
source/rafcon/gui/controllers/state_editor/outcomes.py
https://github.com/DLR-RM/RAFCON/blob/24942ef1a904531f49ab8830a1dbb604441be498/source/rafcon/gui/controllers/state_editor/outcomes.py#L384-L388
def paste_action_callback(self, *event): """Callback method for paste action""" if react_to_event(self.view, self.oc_list_ctrl.tree_view, event) and self.oc_list_ctrl.active_entry_widget is None: global_clipboard.paste(self.model, limited=['outcomes']) return True
[ "def", "paste_action_callback", "(", "self", ",", "*", "event", ")", ":", "if", "react_to_event", "(", "self", ".", "view", ",", "self", ".", "oc_list_ctrl", ".", "tree_view", ",", "event", ")", "and", "self", ".", "oc_list_ctrl", ".", "active_entry_widget",...
Callback method for paste action
[ "Callback", "method", "for", "paste", "action" ]
python
train
jlinn/pyflare
pyflare/hosting.py
https://github.com/jlinn/pyflare/blob/1108e82a9622d1aa6d92d4c4797744ff3cf41f68/pyflare/hosting.py#L129-L158
def user_auth( self, cloudflare_email=None, cloudflare_pass=None, unique_id=None ): """ Get user_key based on either his email and password or unique_id. :param cloudflare_email: email associated with user :type cloudflare_email: str ...
[ "def", "user_auth", "(", "self", ",", "cloudflare_email", "=", "None", ",", "cloudflare_pass", "=", "None", ",", "unique_id", "=", "None", ")", ":", "if", "not", "(", "cloudflare_email", "and", "cloudflare_pass", ")", "and", "not", "unique_id", ":", "raise",...
Get user_key based on either his email and password or unique_id. :param cloudflare_email: email associated with user :type cloudflare_email: str :param cloudflare_pass: pass associated with user :type cloudflare_pass: str :param unique_id: unique id asso...
[ "Get", "user_key", "based", "on", "either", "his", "email", "and", "password", "or", "unique_id", "." ]
python
train
Diviyan-Kalainathan/CausalDiscoveryToolbox
cdt/independence/graph/model.py
https://github.com/Diviyan-Kalainathan/CausalDiscoveryToolbox/blob/be228b078ba9eb76c01b3ccba9a1c0ad9e9e5ed1/cdt/independence/graph/model.py#L102-L142
def predict(self, df_data, threshold=0.05, **kwargs): """Predict the skeleton of the graph from raw data. Returns iteratively the feature selection algorithm on each node. Args: df_data (pandas.DataFrame): data to construct a graph from threshold (float): cutoff value f...
[ "def", "predict", "(", "self", ",", "df_data", ",", "threshold", "=", "0.05", ",", "*", "*", "kwargs", ")", ":", "nb_jobs", "=", "kwargs", ".", "get", "(", "\"nb_jobs\"", ",", "SETTINGS", ".", "NB_JOBS", ")", "list_nodes", "=", "list", "(", "df_data", ...
Predict the skeleton of the graph from raw data. Returns iteratively the feature selection algorithm on each node. Args: df_data (pandas.DataFrame): data to construct a graph from threshold (float): cutoff value for feature selection scores kwargs (dict): additional...
[ "Predict", "the", "skeleton", "of", "the", "graph", "from", "raw", "data", "." ]
python
valid
ultrabug/py3status
py3status/modules/spotify.py
https://github.com/ultrabug/py3status/blob/4c105f1b44f7384ca4f7da5f821a47e468c7dee2/py3status/modules/spotify.py#L171-L177
def _sanitize_title(self, title): """ Remove redunant meta data from title and return it """ title = re.sub(self.inside_brackets, "", title) title = re.sub(self.after_delimiter, "", title) return title.strip()
[ "def", "_sanitize_title", "(", "self", ",", "title", ")", ":", "title", "=", "re", ".", "sub", "(", "self", ".", "inside_brackets", ",", "\"\"", ",", "title", ")", "title", "=", "re", ".", "sub", "(", "self", ".", "after_delimiter", ",", "\"\"", ",",...
Remove redunant meta data from title and return it
[ "Remove", "redunant", "meta", "data", "from", "title", "and", "return", "it" ]
python
train
avanwyk/cipy
cipy/algorithms/pso/functions.py
https://github.com/avanwyk/cipy/blob/98450dd01767b3615c113e50dc396f135e177b29/cipy/algorithms/pso/functions.py#L202-L216
def gbest_idx(swarm): """ gbest Neighbourhood topology function. Args: swarm: list: The list of particles. Returns: int: The index of the gbest particle. """ best = 0 cmp = comparator(swarm[best].best_fitness) for (idx, particle) in enumerate(swarm): if cmp(particle...
[ "def", "gbest_idx", "(", "swarm", ")", ":", "best", "=", "0", "cmp", "=", "comparator", "(", "swarm", "[", "best", "]", ".", "best_fitness", ")", "for", "(", "idx", ",", "particle", ")", "in", "enumerate", "(", "swarm", ")", ":", "if", "cmp", "(", ...
gbest Neighbourhood topology function. Args: swarm: list: The list of particles. Returns: int: The index of the gbest particle.
[ "gbest", "Neighbourhood", "topology", "function", "." ]
python
train
JukeboxPipeline/jukebox-core
src/jukeboxcore/addons/guerilla/guerillamgmt.py
https://github.com/JukeboxPipeline/jukebox-core/blob/bac2280ca49940355270e4b69400ce9976ab2e6f/src/jukeboxcore/addons/guerilla/guerillamgmt.py#L2256-L2270
def task_remove_user(self, *args, **kwargs): """Remove the selected user from the task :returns: None :rtype: None :raises: None """ if not self.cur_task: return i = self.task_user_tablev.currentIndex() item = i.internalPointer() if it...
[ "def", "task_remove_user", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "cur_task", ":", "return", "i", "=", "self", ".", "task_user_tablev", ".", "currentIndex", "(", ")", "item", "=", "i", ".", "intern...
Remove the selected user from the task :returns: None :rtype: None :raises: None
[ "Remove", "the", "selected", "user", "from", "the", "task" ]
python
train
acsone/setuptools-odoo
setuptools_odoo/core.py
https://github.com/acsone/setuptools-odoo/blob/cc4d7a63cf99fb3651c8c92f66f7dd13bf2afe6b/setuptools_odoo/core.py#L98-L120
def _get_version(addon_dir, manifest, odoo_version_override=None, git_post_version=True): """ Get addon version information from an addon directory """ version = manifest.get('version') if not version: warn("No version in manifest in %s" % addon_dir) version = '0.0.0' if...
[ "def", "_get_version", "(", "addon_dir", ",", "manifest", ",", "odoo_version_override", "=", "None", ",", "git_post_version", "=", "True", ")", ":", "version", "=", "manifest", ".", "get", "(", "'version'", ")", "if", "not", "version", ":", "warn", "(", "\...
Get addon version information from an addon directory
[ "Get", "addon", "version", "information", "from", "an", "addon", "directory" ]
python
train
chaoss/grimoirelab-manuscripts
manuscripts/esquery.py
https://github.com/chaoss/grimoirelab-manuscripts/blob/94a3ad4f11bfbcd6c5190e01cb5d3e47a5187cd9/manuscripts/esquery.py#L136-L156
def __get_query_agg_terms(cls, field, agg_id=None): """ Create a es_dsl aggregation object based on a term. :param field: field to be used to aggregate :return: a tuple with the aggregation id and es_dsl aggregation object. Ex: { "terms": { ...
[ "def", "__get_query_agg_terms", "(", "cls", ",", "field", ",", "agg_id", "=", "None", ")", ":", "if", "not", "agg_id", ":", "agg_id", "=", "cls", ".", "AGGREGATION_ID", "query_agg", "=", "A", "(", "\"terms\"", ",", "field", "=", "field", ",", "size", "...
Create a es_dsl aggregation object based on a term. :param field: field to be used to aggregate :return: a tuple with the aggregation id and es_dsl aggregation object. Ex: { "terms": { "field": <field>, "size:": <size>,...
[ "Create", "a", "es_dsl", "aggregation", "object", "based", "on", "a", "term", "." ]
python
train
jerith/txTwitter
txtwitter/twitter.py
https://github.com/jerith/txTwitter/blob/f07afd21184cd1bee697737bf98fd143378dbdff/txtwitter/twitter.py#L904-L921
def direct_messages_destroy(self, id, include_entities=None): """ Destroys the direct message with the given id. https://dev.twitter.com/docs/api/1.1/post/direct_messages/destroy :param str id: (*required*) The ID of the direct message. :param bool include_entities:...
[ "def", "direct_messages_destroy", "(", "self", ",", "id", ",", "include_entities", "=", "None", ")", ":", "params", "=", "{", "}", "set_str_param", "(", "params", ",", "'id'", ",", "id", ")", "set_bool_param", "(", "params", ",", "'include_entities'", ",", ...
Destroys the direct message with the given id. https://dev.twitter.com/docs/api/1.1/post/direct_messages/destroy :param str id: (*required*) The ID of the direct message. :param bool include_entities: The entities node will not be included when set to ``False``. ...
[ "Destroys", "the", "direct", "message", "with", "the", "given", "id", "." ]
python
train
joeferraro/mm
mm/sforce/base.py
https://github.com/joeferraro/mm/blob/43dce48a2249faab4d872c228ada9fbdbeec147b/mm/sforce/base.py#L187-L209
def _handleResultTyping(self, result): ''' If any of the following calls return a single result, and self._strictResultTyping is true, return the single result, rather than [(SaveResult) {...}]: convertLead() create() delete() emptyRecycleBin() invalidateSessions() merge...
[ "def", "_handleResultTyping", "(", "self", ",", "result", ")", ":", "if", "self", ".", "_strictResultTyping", "==", "False", "and", "len", "(", "result", ")", "==", "1", ":", "return", "result", "[", "0", "]", "else", ":", "return", "result" ]
If any of the following calls return a single result, and self._strictResultTyping is true, return the single result, rather than [(SaveResult) {...}]: convertLead() create() delete() emptyRecycleBin() invalidateSessions() merge() process() retrieve() undelete(...
[ "If", "any", "of", "the", "following", "calls", "return", "a", "single", "result", "and", "self", ".", "_strictResultTyping", "is", "true", "return", "the", "single", "result", "rather", "than", "[", "(", "SaveResult", ")", "{", "...", "}", "]", ":" ]
python
train
pymc-devs/pymc
pymc/distributions.py
https://github.com/pymc-devs/pymc/blob/c6e530210bff4c0d7189b35b2c971bc53f93f7cd/pymc/distributions.py#L1841-L1863
def rmultivariate_hypergeometric(n, m, size=None): """ Random multivariate hypergeometric variates. Parameters: - `n` : Number of draws. - `m` : Number of items in each categoy. """ N = len(m) urn = np.repeat(np.arange(N), m) if size: draw = np.array([[urn[i] for i in ...
[ "def", "rmultivariate_hypergeometric", "(", "n", ",", "m", ",", "size", "=", "None", ")", ":", "N", "=", "len", "(", "m", ")", "urn", "=", "np", ".", "repeat", "(", "np", ".", "arange", "(", "N", ")", ",", "m", ")", "if", "size", ":", "draw", ...
Random multivariate hypergeometric variates. Parameters: - `n` : Number of draws. - `m` : Number of items in each categoy.
[ "Random", "multivariate", "hypergeometric", "variates", "." ]
python
train
wummel/linkchecker
third_party/dnspython/dns/resolver.py
https://github.com/wummel/linkchecker/blob/c2ce810c3fb00b895a841a7be6b2e78c64e7b042/third_party/dnspython/dns/resolver.py#L410-L429
def read_local_ifaddrs (self): """ IP addresses for all active interfaces. @return: list of IP addresses @rtype: list of strings """ if os.name != 'posix': # only POSIX is supported right now return [] try: from linkcheck.networ...
[ "def", "read_local_ifaddrs", "(", "self", ")", ":", "if", "os", ".", "name", "!=", "'posix'", ":", "# only POSIX is supported right now", "return", "[", "]", "try", ":", "from", "linkcheck", ".", "network", "import", "IfConfig", "except", "ImportError", ":", "...
IP addresses for all active interfaces. @return: list of IP addresses @rtype: list of strings
[ "IP", "addresses", "for", "all", "active", "interfaces", "." ]
python
train
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/core/oinspect.py
https://github.com/cloud9ers/gurumate/blob/075dc74d1ee62a8c6b7a8bf2b271364f01629d1e/environment/lib/python2.7/site-packages/IPython/core/oinspect.py#L344-L365
def pdef(self, obj, oname=''): """Print the definition header for any callable object. If the object is a class, print the constructor information.""" if not callable(obj): print 'Object is not callable.' return header = '' if inspect.isclass(obj): ...
[ "def", "pdef", "(", "self", ",", "obj", ",", "oname", "=", "''", ")", ":", "if", "not", "callable", "(", "obj", ")", ":", "print", "'Object is not callable.'", "return", "header", "=", "''", "if", "inspect", ".", "isclass", "(", "obj", ")", ":", "hea...
Print the definition header for any callable object. If the object is a class, print the constructor information.
[ "Print", "the", "definition", "header", "for", "any", "callable", "object", "." ]
python
test
influxdata/influxdb-python
influxdb/influxdb08/client.py
https://github.com/influxdata/influxdb-python/blob/d5d12499f3755199d5eedd8b363450f1cf4073bd/influxdb/influxdb08/client.py#L364-L374
def delete_points(self, name): """Delete an entire series.""" url = "db/{0}/series/{1}".format(self._database, name) self.request( url=url, method='DELETE', expected_response_code=204 ) return True
[ "def", "delete_points", "(", "self", ",", "name", ")", ":", "url", "=", "\"db/{0}/series/{1}\"", ".", "format", "(", "self", ".", "_database", ",", "name", ")", "self", ".", "request", "(", "url", "=", "url", ",", "method", "=", "'DELETE'", ",", "expec...
Delete an entire series.
[ "Delete", "an", "entire", "series", "." ]
python
train
dwavesystems/dimod
dimod/utilities.py
https://github.com/dwavesystems/dimod/blob/beff1b7f86b559d923ac653c1de6d593876d6d38/dimod/utilities.py#L26-L87
def ising_energy(sample, h, J, offset=0.0): """Calculate the energy for the specified sample of an Ising model. Energy of a sample for a binary quadratic model is defined as a sum, offset by the constant energy offset associated with the model, of the sample multipled by the linear bias of the variable...
[ "def", "ising_energy", "(", "sample", ",", "h", ",", "J", ",", "offset", "=", "0.0", ")", ":", "# add the contribution from the linear biases", "for", "v", "in", "h", ":", "offset", "+=", "h", "[", "v", "]", "*", "sample", "[", "v", "]", "# add the contr...
Calculate the energy for the specified sample of an Ising model. Energy of a sample for a binary quadratic model is defined as a sum, offset by the constant energy offset associated with the model, of the sample multipled by the linear bias of the variable and all its interactions. For an Ising model, ...
[ "Calculate", "the", "energy", "for", "the", "specified", "sample", "of", "an", "Ising", "model", "." ]
python
train
googledatalab/pydatalab
google/datalab/storage/commands/_storage.py
https://github.com/googledatalab/pydatalab/blob/d9031901d5bca22fe0d5925d204e6698df9852e1/google/datalab/storage/commands/_storage.py#L286-L288
def _gcs_get_keys(bucket, pattern): """ Get names of all Google Cloud Storage keys in a specified bucket that match a pattern. """ return [obj for obj in list(bucket.objects()) if fnmatch.fnmatch(obj.metadata.name, pattern)]
[ "def", "_gcs_get_keys", "(", "bucket", ",", "pattern", ")", ":", "return", "[", "obj", "for", "obj", "in", "list", "(", "bucket", ".", "objects", "(", ")", ")", "if", "fnmatch", ".", "fnmatch", "(", "obj", ".", "metadata", ".", "name", ",", "pattern"...
Get names of all Google Cloud Storage keys in a specified bucket that match a pattern.
[ "Get", "names", "of", "all", "Google", "Cloud", "Storage", "keys", "in", "a", "specified", "bucket", "that", "match", "a", "pattern", "." ]
python
train
tanghaibao/goatools
goatools/grouper/grprplt.py
https://github.com/tanghaibao/goatools/blob/407682e573a108864a79031f8ca19ee3bf377626/goatools/grouper/grprplt.py#L31-L34
def plot_sections(self, fout_dir=".", **kws_usr): """Plot groups of GOs which have been placed in sections.""" kws_plt, _ = self._get_kws_plt(None, **kws_usr) PltGroupedGos(self).plot_sections(fout_dir, **kws_plt)
[ "def", "plot_sections", "(", "self", ",", "fout_dir", "=", "\".\"", ",", "*", "*", "kws_usr", ")", ":", "kws_plt", ",", "_", "=", "self", ".", "_get_kws_plt", "(", "None", ",", "*", "*", "kws_usr", ")", "PltGroupedGos", "(", "self", ")", ".", "plot_s...
Plot groups of GOs which have been placed in sections.
[ "Plot", "groups", "of", "GOs", "which", "have", "been", "placed", "in", "sections", "." ]
python
train
inspirehep/inspire-query-parser
inspire_query_parser/parser.py
https://github.com/inspirehep/inspire-query-parser/blob/9dde20d7caef89a48bb419b866f4535c88cfc00d/inspire_query_parser/parser.py#L303-L358
def parse(cls, parser, text, pos): """Imitates parsing a list grammar. Specifically, this grammar = [ SimpleValueUnit.date_specifiers_regex, SimpleValueUnit.arxiv_token_regex, SimpleValueUnit.token_regex, SimpleValueUnit.parenthesized_token_gramma...
[ "def", "parse", "(", "cls", ",", "parser", ",", "text", ",", "pos", ")", ":", "found", "=", "False", "# Attempt to parse date specifier", "match", "=", "cls", ".", "date_specifiers_regex", ".", "match", "(", "text", ")", "if", "match", ":", "remaining_text",...
Imitates parsing a list grammar. Specifically, this grammar = [ SimpleValueUnit.date_specifiers_regex, SimpleValueUnit.arxiv_token_regex, SimpleValueUnit.token_regex, SimpleValueUnit.parenthesized_token_grammar ]. Parses plaintext which m...
[ "Imitates", "parsing", "a", "list", "grammar", "." ]
python
train
jazzband/django-axes
axes/handlers/base.py
https://github.com/jazzband/django-axes/blob/3e215a174030e43e7ab8c2a79c395eb0eeddc667/axes/handlers/base.py#L81-L92
def is_whitelisted(self, request: AxesHttpRequest, credentials: dict = None) -> bool: # pylint: disable=unused-argument """ Checks if the request or given credentials are whitelisted for access. """ if is_client_ip_address_whitelisted(request): return True if is_cl...
[ "def", "is_whitelisted", "(", "self", ",", "request", ":", "AxesHttpRequest", ",", "credentials", ":", "dict", "=", "None", ")", "->", "bool", ":", "# pylint: disable=unused-argument", "if", "is_client_ip_address_whitelisted", "(", "request", ")", ":", "return", "...
Checks if the request or given credentials are whitelisted for access.
[ "Checks", "if", "the", "request", "or", "given", "credentials", "are", "whitelisted", "for", "access", "." ]
python
train
ejeschke/ginga
ginga/ImageView.py
https://github.com/ejeschke/ginga/blob/a78c893ec6f37a837de851947e9bb4625c597915/ginga/ImageView.py#L1298-L1324
def redraw_data(self, whence=0): """Render image from RGB map and redraw private canvas. .. note:: Do not call this method unless you are implementing a subclass. Parameters ---------- whence See :meth:`get_rgb_object`. """ if not self....
[ "def", "redraw_data", "(", "self", ",", "whence", "=", "0", ")", ":", "if", "not", "self", ".", "_imgwin_set", ":", "# window has not been realized yet", "return", "if", "not", "self", ".", "_self_scaling", ":", "rgbobj", "=", "self", ".", "get_rgb_object", ...
Render image from RGB map and redraw private canvas. .. note:: Do not call this method unless you are implementing a subclass. Parameters ---------- whence See :meth:`get_rgb_object`.
[ "Render", "image", "from", "RGB", "map", "and", "redraw", "private", "canvas", "." ]
python
train
gwastro/pycbc
pycbc/events/ranking.py
https://github.com/gwastro/pycbc/blob/7a64cdd104d263f1b6ea0b01e6841837d05a4cb3/pycbc/events/ranking.py#L112-L133
def get_newsnr_sgveto_psdvar(trigs): """ Calculate newsnr re-weighted by the sine-gaussian veto and psd variation statistic Parameters ---------- trigs: dict of numpy.ndarrays Dictionary holding single detector trigger information. 'chisq_dof', 'snr', 'chisq' and 'psd_var_val' are r...
[ "def", "get_newsnr_sgveto_psdvar", "(", "trigs", ")", ":", "dof", "=", "2.", "*", "trigs", "[", "'chisq_dof'", "]", "[", ":", "]", "-", "2.", "nsnr_sg_psd", "=", "newsnr_sgveto_psdvar", "(", "trigs", "[", "'snr'", "]", "[", ":", "]", ",", "trigs", "[",...
Calculate newsnr re-weighted by the sine-gaussian veto and psd variation statistic Parameters ---------- trigs: dict of numpy.ndarrays Dictionary holding single detector trigger information. 'chisq_dof', 'snr', 'chisq' and 'psd_var_val' are required keys Returns ------- numpy....
[ "Calculate", "newsnr", "re", "-", "weighted", "by", "the", "sine", "-", "gaussian", "veto", "and", "psd", "variation", "statistic" ]
python
train
inasafe/inasafe
safe/gui/tools/osm_downloader_dialog.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/osm_downloader_dialog.py#L140-L155
def update_helper_political_level(self): """To update the helper about the country and the admin_level.""" current_country = self.country_comboBox.currentText() index = self.admin_level_comboBox.currentIndex() current_level = self.admin_level_comboBox.itemData(index) content = No...
[ "def", "update_helper_political_level", "(", "self", ")", ":", "current_country", "=", "self", ".", "country_comboBox", ".", "currentText", "(", ")", "index", "=", "self", ".", "admin_level_comboBox", ".", "currentIndex", "(", ")", "current_level", "=", "self", ...
To update the helper about the country and the admin_level.
[ "To", "update", "the", "helper", "about", "the", "country", "and", "the", "admin_level", "." ]
python
train
taizilongxu/douban.fm
doubanfm/API/login.py
https://github.com/taizilongxu/douban.fm/blob/d65126d3bd3e12d8a7109137caff8da0efc22b2f/doubanfm/API/login.py#L20-L35
def win_login(): """登陆界面""" email = input(EMAIL_INFO) password = getpass.getpass(PASS_INFO) captcha_id = get_captcha_id() get_capthca_pic(captcha_id) file = '/tmp/captcha_pic.jpg' try: from subprocess import call from os.path import expanduser call([expanduser('~') + ...
[ "def", "win_login", "(", ")", ":", "email", "=", "input", "(", "EMAIL_INFO", ")", "password", "=", "getpass", ".", "getpass", "(", "PASS_INFO", ")", "captcha_id", "=", "get_captcha_id", "(", ")", "get_capthca_pic", "(", "captcha_id", ")", "file", "=", "'/t...
登陆界面
[ "登陆界面" ]
python
train
ekmmetering/ekmmeters
ekmmeters.py
https://github.com/ekmmetering/ekmmeters/blob/b3748bdf30263bfa46ea40157bdf8df2522e1904/ekmmeters.py#L2231-L2309
def setTime(self, yy, mm, dd, hh, minutes, ss, password="00000000"): """ Serial set time with day of week calculation. Args: yy (int): Last two digits of year. mm (int): Month 1-12. dd (int): Day 1-31 hh (int): Hour 0 to 23. minutes (int): Min...
[ "def", "setTime", "(", "self", ",", "yy", ",", "mm", ",", "dd", ",", "hh", ",", "minutes", ",", "ss", ",", "password", "=", "\"00000000\"", ")", ":", "result", "=", "False", "self", ".", "setContext", "(", "\"setTime\"", ")", "try", ":", "if", "mm"...
Serial set time with day of week calculation. Args: yy (int): Last two digits of year. mm (int): Month 1-12. dd (int): Day 1-31 hh (int): Hour 0 to 23. minutes (int): Minutes 0 to 59. ss (int): Seconds 0 to 59. password (str): ...
[ "Serial", "set", "time", "with", "day", "of", "week", "calculation", "." ]
python
test
ramrod-project/database-brain
schema/brain/checks.py
https://github.com/ramrod-project/database-brain/blob/b024cb44f34cabb9d80af38271ddb65c25767083/schema/brain/checks.py#L31-L43
def special_typechecking(value, msg): """ Special Typechecking not available via protocol itself :param value: <dict> :param msg: <proto object> :return: <bool> """ result = True if msg.DESCRIPTOR.name == TARGET: result &= special_target_typecheck(value) elif msg.DESCRIPTOR.n...
[ "def", "special_typechecking", "(", "value", ",", "msg", ")", ":", "result", "=", "True", "if", "msg", ".", "DESCRIPTOR", ".", "name", "==", "TARGET", ":", "result", "&=", "special_target_typecheck", "(", "value", ")", "elif", "msg", ".", "DESCRIPTOR", "."...
Special Typechecking not available via protocol itself :param value: <dict> :param msg: <proto object> :return: <bool>
[ "Special", "Typechecking", "not", "available", "via", "protocol", "itself", ":", "param", "value", ":", "<dict", ">", ":", "param", "msg", ":", "<proto", "object", ">", ":", "return", ":", "<bool", ">" ]
python
train
calmjs/calmjs
src/calmjs/indexer.py
https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/indexer.py#L31-L45
def resource_filename_mod_dist(module_name, dist): """ Given a module name and a distribution, attempt to resolve the actual path to the module. """ try: return pkg_resources.resource_filename( dist.as_requirement(), join(*module_name.split('.'))) except pkg_resources.Distri...
[ "def", "resource_filename_mod_dist", "(", "module_name", ",", "dist", ")", ":", "try", ":", "return", "pkg_resources", ".", "resource_filename", "(", "dist", ".", "as_requirement", "(", ")", ",", "join", "(", "*", "module_name", ".", "split", "(", "'.'", ")"...
Given a module name and a distribution, attempt to resolve the actual path to the module.
[ "Given", "a", "module", "name", "and", "a", "distribution", "attempt", "to", "resolve", "the", "actual", "path", "to", "the", "module", "." ]
python
train
inasafe/inasafe
safe/definitions/utilities.py
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/definitions/utilities.py#L493-L565
def override_component_template(component, template_path): """Override a default component with a new component with given template. :param component: Component as dictionary. :type component: dict :param template_path: Custom template path that will be used. :type template_path: str :returns...
[ "def", "override_component_template", "(", "component", ",", "template_path", ")", ":", "copy_component", "=", "deepcopy", "(", "component", ")", "template_directory", ",", "template_filename", "=", "split", "(", "template_path", ")", "file_name", ",", "file_format", ...
Override a default component with a new component with given template. :param component: Component as dictionary. :type component: dict :param template_path: Custom template path that will be used. :type template_path: str :returns: New report component. :rtype: dict
[ "Override", "a", "default", "component", "with", "a", "new", "component", "with", "given", "template", "." ]
python
train
pgmpy/pgmpy
pgmpy/sampling/Sampling.py
https://github.com/pgmpy/pgmpy/blob/9381a66aba3c3871d3ccd00672b148d17d63239e/pgmpy/sampling/Sampling.py#L163-L233
def likelihood_weighted_sample(self, evidence=None, size=1, return_type="dataframe"): """ Generates weighted sample(s) from joint distribution of the bayesian network, that comply with the given evidence. 'Probabilistic Graphical Model Principles and Techniques', Koller and Fried...
[ "def", "likelihood_weighted_sample", "(", "self", ",", "evidence", "=", "None", ",", "size", "=", "1", ",", "return_type", "=", "\"dataframe\"", ")", ":", "types", "=", "[", "(", "var_name", ",", "'int'", ")", "for", "var_name", "in", "self", ".", "topol...
Generates weighted sample(s) from joint distribution of the bayesian network, that comply with the given evidence. 'Probabilistic Graphical Model Principles and Techniques', Koller and Friedman, Algorithm 12.2 pp 493. Parameters ---------- evidence: list of `pgmpy.factor...
[ "Generates", "weighted", "sample", "(", "s", ")", "from", "joint", "distribution", "of", "the", "bayesian", "network", "that", "comply", "with", "the", "given", "evidence", ".", "Probabilistic", "Graphical", "Model", "Principles", "and", "Techniques", "Koller", ...
python
train
LordDarkula/chess_py
chess_py/core/algebraic/location.py
https://github.com/LordDarkula/chess_py/blob/14bebc2f8c49ae25c59375cc83d0b38d8ff7281d/chess_py/core/algebraic/location.py#L63-L76
def from_string(cls, alg_str): """ Creates a location from a two character string consisting of the file then rank written in algebraic notation. Examples: e4, b5, a7 :type: alg_str: str :rtype: Location """ try: return cls(int(alg_s...
[ "def", "from_string", "(", "cls", ",", "alg_str", ")", ":", "try", ":", "return", "cls", "(", "int", "(", "alg_str", "[", "1", "]", ")", "-", "1", ",", "ord", "(", "alg_str", "[", "0", "]", ")", "-", "97", ")", "except", "ValueError", "as", "e"...
Creates a location from a two character string consisting of the file then rank written in algebraic notation. Examples: e4, b5, a7 :type: alg_str: str :rtype: Location
[ "Creates", "a", "location", "from", "a", "two", "character", "string", "consisting", "of", "the", "file", "then", "rank", "written", "in", "algebraic", "notation", ".", "Examples", ":", "e4", "b5", "a7" ]
python
train
jxtech/wechatpy
wechatpy/client/api/shakearound.py
https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/shakearound.py#L186-L216
def search_pages(self, page_ids=None, begin=0, count=10): """ 查询页面列表 详情请参考 http://mp.weixin.qq.com/wiki/5/6626199ea8757c752046d8e46cf13251.html :param page_ids: 指定页面的id列表 :param begin: 页面列表的起始索引值 :param count: 待查询的页面个数 :return: 页面查询结果信息 """ ...
[ "def", "search_pages", "(", "self", ",", "page_ids", "=", "None", ",", "begin", "=", "0", ",", "count", "=", "10", ")", ":", "if", "not", "page_ids", ":", "data", "=", "{", "'type'", ":", "2", ",", "'begin'", ":", "begin", ",", "'count'", ":", "c...
查询页面列表 详情请参考 http://mp.weixin.qq.com/wiki/5/6626199ea8757c752046d8e46cf13251.html :param page_ids: 指定页面的id列表 :param begin: 页面列表的起始索引值 :param count: 待查询的页面个数 :return: 页面查询结果信息
[ "查询页面列表", "详情请参考", "http", ":", "//", "mp", ".", "weixin", ".", "qq", ".", "com", "/", "wiki", "/", "5", "/", "6626199ea8757c752046d8e46cf13251", ".", "html" ]
python
train
nugget/python-insteonplm
insteonplm/tools.py
https://github.com/nugget/python-insteonplm/blob/65548041f1b0729ae1ae904443dd81b0c6cbf1bf/insteonplm/tools.py#L328-L332
def kpl_status(self, address, group): """Get the status of a KPL button.""" addr = Address(address) device = self.plm.devices[addr.id] device.states[group].async_refresh_state()
[ "def", "kpl_status", "(", "self", ",", "address", ",", "group", ")", ":", "addr", "=", "Address", "(", "address", ")", "device", "=", "self", ".", "plm", ".", "devices", "[", "addr", ".", "id", "]", "device", ".", "states", "[", "group", "]", ".", ...
Get the status of a KPL button.
[ "Get", "the", "status", "of", "a", "KPL", "button", "." ]
python
train
nicolargo/glances
glances/plugins/glances_plugin.py
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L485-L487
def get_json_views(self, item=None, key=None, option=None): """Return the views (in JSON).""" return self._json_dumps(self.get_views(item, key, option))
[ "def", "get_json_views", "(", "self", ",", "item", "=", "None", ",", "key", "=", "None", ",", "option", "=", "None", ")", ":", "return", "self", ".", "_json_dumps", "(", "self", ".", "get_views", "(", "item", ",", "key", ",", "option", ")", ")" ]
Return the views (in JSON).
[ "Return", "the", "views", "(", "in", "JSON", ")", "." ]
python
train
twisted/mantissa
xmantissa/people.py
https://github.com/twisted/mantissa/blob/53e5502aba23ce99be78b27f923a276593033fe8/xmantissa/people.py#L1509-L1524
def pluginTabbedPane(self, request, tag): """ Render a L{tabbedPane.TabbedPaneFragment} with an entry for each item in L{plugins}. """ iq = inevow.IQ(tag) tabNames = [ _organizerPluginName(p).encode('ascii') # gunk for p in self.plugins] ...
[ "def", "pluginTabbedPane", "(", "self", ",", "request", ",", "tag", ")", ":", "iq", "=", "inevow", ".", "IQ", "(", "tag", ")", "tabNames", "=", "[", "_organizerPluginName", "(", "p", ")", ".", "encode", "(", "'ascii'", ")", "# gunk", "for", "p", "in"...
Render a L{tabbedPane.TabbedPaneFragment} with an entry for each item in L{plugins}.
[ "Render", "a", "L", "{", "tabbedPane", ".", "TabbedPaneFragment", "}", "with", "an", "entry", "for", "each", "item", "in", "L", "{", "plugins", "}", "." ]
python
train
yoannMoreau/landsat_theia
python/gs_helper.py
https://github.com/yoannMoreau/landsat_theia/blob/d23831417dfb6d0da8c9ef5c121f3a731f4eec94/python/gs_helper.py#L26-L50
def single_download(self,username,password,download ,name,ZIP_DIR): """ Download single image from Landsat on Google Storage Arguments: row - string in this format xxx, e.g. 003 path - string in this format xxx, e.g. 003 name - zip file name without .tar.bz e.g. LT81...
[ "def", "single_download", "(", "self", ",", "username", ",", "password", ",", "download", ",", "name", ",", "ZIP_DIR", ")", ":", "try", ":", "request", "=", "urllib2", ".", "Request", "(", "download", ")", "base64string", "=", "base64", ".", "encodestring"...
Download single image from Landsat on Google Storage Arguments: row - string in this format xxx, e.g. 003 path - string in this format xxx, e.g. 003 name - zip file name without .tar.bz e.g. LT81360082013127LGN01 sat_type - e.g. L7, L8, ...
[ "Download", "single", "image", "from", "Landsat", "on", "Google", "Storage", "Arguments", ":", "row", "-", "string", "in", "this", "format", "xxx", "e", ".", "g", ".", "003", "path", "-", "string", "in", "this", "format", "xxx", "e", ".", "g", ".", "...
python
train
Bogdanp/dramatiq
dramatiq/worker.py
https://github.com/Bogdanp/dramatiq/blob/a8cc2728478e794952a5a50c3fb19ec455fe91b6/dramatiq/worker.py#L93-L100
def pause(self): """Pauses all the worker threads. """ for child in chain(self.consumers.values(), self.workers): child.pause() for child in chain(self.consumers.values(), self.workers): child.paused_event.wait()
[ "def", "pause", "(", "self", ")", ":", "for", "child", "in", "chain", "(", "self", ".", "consumers", ".", "values", "(", ")", ",", "self", ".", "workers", ")", ":", "child", ".", "pause", "(", ")", "for", "child", "in", "chain", "(", "self", ".",...
Pauses all the worker threads.
[ "Pauses", "all", "the", "worker", "threads", "." ]
python
train
bcbio/bcbio-nextgen
bcbio/galaxy/nglims.py
https://github.com/bcbio/bcbio-nextgen/blob/6a9348c0054ccd5baffd22f1bb7d0422f6978b20/bcbio/galaxy/nglims.py#L106-L122
def _relative_paths(xs, base_path): """Adjust paths to be relative to the provided base path. """ if isinstance(xs, six.string_types): if xs.startswith(base_path): return xs.replace(base_path + "/", "", 1) else: return xs elif isinstance(xs, (list, tuple)): ...
[ "def", "_relative_paths", "(", "xs", ",", "base_path", ")", ":", "if", "isinstance", "(", "xs", ",", "six", ".", "string_types", ")", ":", "if", "xs", ".", "startswith", "(", "base_path", ")", ":", "return", "xs", ".", "replace", "(", "base_path", "+",...
Adjust paths to be relative to the provided base path.
[ "Adjust", "paths", "to", "be", "relative", "to", "the", "provided", "base", "path", "." ]
python
train
estnltk/estnltk
estnltk/dividing.py
https://github.com/estnltk/estnltk/blob/28ae334a68a0673072febc318635f04da0dcc54a/estnltk/dividing.py#L338-L355
def divide(elements, by, translate=False, sep=' '): """Divide lists `elements` and `by`. All elements are grouped into N bins, where N denotes the elements in `by` list. Parameters ---------- elements: list of dict Elements to be grouped into bins. by: list of dict Elements defi...
[ "def", "divide", "(", "elements", ",", "by", ",", "translate", "=", "False", ",", "sep", "=", "' '", ")", ":", "outer_spans", "=", "[", "spans", "(", "elem", ")", "for", "elem", "in", "by", "]", "return", "divide_by_spans", "(", "elements", ",", "out...
Divide lists `elements` and `by`. All elements are grouped into N bins, where N denotes the elements in `by` list. Parameters ---------- elements: list of dict Elements to be grouped into bins. by: list of dict Elements defining the bins. translate: bool (default: False) ...
[ "Divide", "lists", "elements", "and", "by", ".", "All", "elements", "are", "grouped", "into", "N", "bins", "where", "N", "denotes", "the", "elements", "in", "by", "list", "." ]
python
train
Nic30/hwt
hwt/hdl/statements.py
https://github.com/Nic30/hwt/blob/8cbb399e326da3b22c233b98188a9d08dec057e6/hwt/hdl/statements.py#L445-L453
def _on_parent_event_dependent(self): """ After parrent statement become event dependent propagate event dependency flag to child statements """ if not self._is_completly_event_dependent: self._is_completly_event_dependent = True for stm in self._iter_stms...
[ "def", "_on_parent_event_dependent", "(", "self", ")", ":", "if", "not", "self", ".", "_is_completly_event_dependent", ":", "self", ".", "_is_completly_event_dependent", "=", "True", "for", "stm", "in", "self", ".", "_iter_stms", "(", ")", ":", "stm", ".", "_o...
After parrent statement become event dependent propagate event dependency flag to child statements
[ "After", "parrent", "statement", "become", "event", "dependent", "propagate", "event", "dependency", "flag", "to", "child", "statements" ]
python
test
RudolfCardinal/pythonlib
cardinal_pythonlib/django/forms.py
https://github.com/RudolfCardinal/pythonlib/blob/0b84cb35f38bd7d8723958dae51b480a829b7227/cardinal_pythonlib/django/forms.py#L52-L64
def clean_nhs_number(x) -> int: """ Returns its parameter as a valid integer NHS number, or raises ``django.forms.ValidationError``. """ try: x = int(x) if not is_valid_nhs_number(x): raise ValueError return x except ValueError: raise forms.ValidationE...
[ "def", "clean_nhs_number", "(", "x", ")", "->", "int", ":", "try", ":", "x", "=", "int", "(", "x", ")", "if", "not", "is_valid_nhs_number", "(", "x", ")", ":", "raise", "ValueError", "return", "x", "except", "ValueError", ":", "raise", "forms", ".", ...
Returns its parameter as a valid integer NHS number, or raises ``django.forms.ValidationError``.
[ "Returns", "its", "parameter", "as", "a", "valid", "integer", "NHS", "number", "or", "raises", "django", ".", "forms", ".", "ValidationError", "." ]
python
train
brocade/pynos
pynos/versions/base/yang/brocade_ras.py
https://github.com/brocade/pynos/blob/bd8a34e98f322de3fc06750827d8bbc3a0c00380/pynos/versions/base/yang/brocade_ras.py#L162-L172
def logging_syslog_client_localip(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") logging = ET.SubElement(config, "logging", xmlns="urn:brocade.com:mgmt:brocade-ras") syslog_client = ET.SubElement(logging, "syslog-client") localip = ET.SubElement...
[ "def", "logging_syslog_client_localip", "(", "self", ",", "*", "*", "kwargs", ")", ":", "config", "=", "ET", ".", "Element", "(", "\"config\"", ")", "logging", "=", "ET", ".", "SubElement", "(", "config", ",", "\"logging\"", ",", "xmlns", "=", "\"urn:broca...
Auto Generated Code
[ "Auto", "Generated", "Code" ]
python
train
Unidata/siphon
siphon/cdmr/ncstream.py
https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/ncstream.py#L281-L297
def reshape_array(data_header, array): """Extract the appropriate array shape from the header. Can handle taking a data header and either bytes containing data or a StructureData instance, which will have binary data as well as some additional information. Parameters ---------- array : :class:...
[ "def", "reshape_array", "(", "data_header", ",", "array", ")", ":", "shape", "=", "tuple", "(", "r", ".", "size", "for", "r", "in", "data_header", ".", "section", ".", "range", ")", "if", "shape", ":", "return", "array", ".", "reshape", "(", "*", "sh...
Extract the appropriate array shape from the header. Can handle taking a data header and either bytes containing data or a StructureData instance, which will have binary data as well as some additional information. Parameters ---------- array : :class:`numpy.ndarray` data_header : Data
[ "Extract", "the", "appropriate", "array", "shape", "from", "the", "header", "." ]
python
train
pymupdf/PyMuPDF
fitz/fitz.py
https://github.com/pymupdf/PyMuPDF/blob/917f2d83482510e26ba0ff01fd2392c26f3a8e90/fitz/fitz.py#L2105-L2118
def authenticate(self, password): """Decrypt document with a password.""" if self.isClosed: raise ValueError("operation illegal for closed doc") val = _fitz.Document_authenticate(self, password) if val: # the doc is decrypted successfully and we init the outline ...
[ "def", "authenticate", "(", "self", ",", "password", ")", ":", "if", "self", ".", "isClosed", ":", "raise", "ValueError", "(", "\"operation illegal for closed doc\"", ")", "val", "=", "_fitz", ".", "Document_authenticate", "(", "self", ",", "password", ")", "i...
Decrypt document with a password.
[ "Decrypt", "document", "with", "a", "password", "." ]
python
train
tjguk/networkzero
networkzero/sockets.py
https://github.com/tjguk/networkzero/blob/0e3e81d2e9200b25a83ac07741612283599486d7/networkzero/sockets.py#L204-L232
def _receive_with_timeout(self, socket, timeout_s, use_multipart=False): """Check for socket activity and either return what's received on the socket or time out if timeout_s expires without anything on the socket. This is implemented in loops of self.try_length_ms milliseconds ...
[ "def", "_receive_with_timeout", "(", "self", ",", "socket", ",", "timeout_s", ",", "use_multipart", "=", "False", ")", ":", "if", "timeout_s", "is", "config", ".", "FOREVER", ":", "timeout_ms", "=", "config", ".", "FOREVER", "else", ":", "timeout_ms", "=", ...
Check for socket activity and either return what's received on the socket or time out if timeout_s expires without anything on the socket. This is implemented in loops of self.try_length_ms milliseconds to allow Ctrl-C handling to take place.
[ "Check", "for", "socket", "activity", "and", "either", "return", "what", "s", "received", "on", "the", "socket", "or", "time", "out", "if", "timeout_s", "expires", "without", "anything", "on", "the", "socket", ".", "This", "is", "implemented", "in", "loops",...
python
train
ZELLMECHANIK-DRESDEN/dclab
dclab/cli.py
https://github.com/ZELLMECHANIK-DRESDEN/dclab/blob/79002c4356e7020c2ba73ab0a3819c9abd4affec/dclab/cli.py#L105-L119
def verify_dataset(): """Perform checks on experimental datasets""" parser = verify_dataset_parser() args = parser.parse_args() path_in = pathlib.Path(args.path).resolve() viol, aler, info = load.check_dataset(path_in) print_info("Checking {}".format(path_in)) for inf in info: print_...
[ "def", "verify_dataset", "(", ")", ":", "parser", "=", "verify_dataset_parser", "(", ")", "args", "=", "parser", ".", "parse_args", "(", ")", "path_in", "=", "pathlib", ".", "Path", "(", "args", ".", "path", ")", ".", "resolve", "(", ")", "viol", ",", ...
Perform checks on experimental datasets
[ "Perform", "checks", "on", "experimental", "datasets" ]
python
train
juju/python-libjuju
juju/controller.py
https://github.com/juju/python-libjuju/blob/58f0011f4c57cd68830258952fa952eaadca6b38/juju/controller.py#L387-L396
async def destroy(self, destroy_all_models=False): """Destroy this controller. :param bool destroy_all_models: Destroy all hosted models in the controller. """ controller_facade = client.ControllerFacade.from_connection( self.connection()) return await c...
[ "async", "def", "destroy", "(", "self", ",", "destroy_all_models", "=", "False", ")", ":", "controller_facade", "=", "client", ".", "ControllerFacade", ".", "from_connection", "(", "self", ".", "connection", "(", ")", ")", "return", "await", "controller_facade",...
Destroy this controller. :param bool destroy_all_models: Destroy all hosted models in the controller.
[ "Destroy", "this", "controller", "." ]
python
train
saltstack/salt
salt/states/service.py
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/service.py#L706-L788
def masked(name, runtime=False): ''' .. versionadded:: 2017.7.0 .. note:: This state is only available on minions which use systemd_. Ensures that the named service is masked (i.e. prevented from being started). name Name of the service to mask runtime : False By ...
[ "def", "masked", "(", "name", ",", "runtime", "=", "False", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "if", "'service.masked'", "not", "in", "_...
.. versionadded:: 2017.7.0 .. note:: This state is only available on minions which use systemd_. Ensures that the named service is masked (i.e. prevented from being started). name Name of the service to mask runtime : False By default, this state will manage an indefinite...
[ "..", "versionadded", "::", "2017", ".", "7", ".", "0" ]
python
train
jplusplus/statscraper
statscraper/base_scraper.py
https://github.com/jplusplus/statscraper/blob/932ec048b23d15b3dbdaf829facc55fd78ec0109/statscraper/base_scraper.py#L514-L519
def on(cls, hook): """Hook decorator.""" def decorator(function_): cls._hooks[hook].append(function_) return function_ return decorator
[ "def", "on", "(", "cls", ",", "hook", ")", ":", "def", "decorator", "(", "function_", ")", ":", "cls", ".", "_hooks", "[", "hook", "]", ".", "append", "(", "function_", ")", "return", "function_", "return", "decorator" ]
Hook decorator.
[ "Hook", "decorator", "." ]
python
train
mozilla/treeherder
treeherder/etl/artifact.py
https://github.com/mozilla/treeherder/blob/cc47bdec872e5c668d0f01df89517390a164cda3/treeherder/etl/artifact.py#L19-L45
def store_job_info_artifact(job, job_info_artifact): """ Store the contents of the job info artifact in job details """ job_details = json.loads(job_info_artifact['blob'])['job_details'] for job_detail in job_details: job_detail_dict = { 'title': job_detail.get('title'), ...
[ "def", "store_job_info_artifact", "(", "job", ",", "job_info_artifact", ")", ":", "job_details", "=", "json", ".", "loads", "(", "job_info_artifact", "[", "'blob'", "]", ")", "[", "'job_details'", "]", "for", "job_detail", "in", "job_details", ":", "job_detail_d...
Store the contents of the job info artifact in job details
[ "Store", "the", "contents", "of", "the", "job", "info", "artifact", "in", "job", "details" ]
python
train
gem/oq-engine
openquake/calculators/ucerf_base.py
https://github.com/gem/oq-engine/blob/8294553a0b8aba33fd96437a35065d03547d0040/openquake/calculators/ucerf_base.py#L297-L317
def get_background_sids(self, src_filter): """ We can apply the filtering of the background sites as a pre-processing step - this is done here rather than in the sampling of the ruptures themselves """ branch_key = self.idx_set["grid_key"] idist = src_filter.integ...
[ "def", "get_background_sids", "(", "self", ",", "src_filter", ")", ":", "branch_key", "=", "self", ".", "idx_set", "[", "\"grid_key\"", "]", "idist", "=", "src_filter", ".", "integration_distance", "(", "DEFAULT_TRT", ")", "with", "h5py", ".", "File", "(", "...
We can apply the filtering of the background sites as a pre-processing step - this is done here rather than in the sampling of the ruptures themselves
[ "We", "can", "apply", "the", "filtering", "of", "the", "background", "sites", "as", "a", "pre", "-", "processing", "step", "-", "this", "is", "done", "here", "rather", "than", "in", "the", "sampling", "of", "the", "ruptures", "themselves" ]
python
train
mrstephenneal/pdfconduit
pdf/convert/pdf2img.py
https://github.com/mrstephenneal/pdfconduit/blob/993421cc087eefefe01ff09afabd893bcc2718ec/pdf/convert/pdf2img.py#L51-L79
def _get_page_data(self, pno, zoom=0): """ Return a PNG image for a document page number. If zoom is other than 0, one of the 4 page quadrants are zoomed-in instead and the corresponding clip returned. """ dlist = self.dlist_tab[pno] # get display list if not dlist: # c...
[ "def", "_get_page_data", "(", "self", ",", "pno", ",", "zoom", "=", "0", ")", ":", "dlist", "=", "self", ".", "dlist_tab", "[", "pno", "]", "# get display list", "if", "not", "dlist", ":", "# create if not yet there", "self", ".", "dlist_tab", "[", "pno", ...
Return a PNG image for a document page number. If zoom is other than 0, one of the 4 page quadrants are zoomed-in instead and the corresponding clip returned.
[ "Return", "a", "PNG", "image", "for", "a", "document", "page", "number", ".", "If", "zoom", "is", "other", "than", "0", "one", "of", "the", "4", "page", "quadrants", "are", "zoomed", "-", "in", "instead", "and", "the", "corresponding", "clip", "returned"...
python
train
senaite/senaite.core
bika/lims/content/abstractroutineanalysis.py
https://github.com/senaite/senaite.core/blob/7602ce2ea2f9e81eb34e20ce17b98a3e70713f85/bika/lims/content/abstractroutineanalysis.py#L371-L393
def getResultsRange(self): """Returns the valid result range for this routine analysis based on the results ranges defined in the Analysis Request this routine analysis is assigned to. A routine analysis will be considered out of range if it result falls out of the range defined...
[ "def", "getResultsRange", "(", "self", ")", ":", "specs", "=", "ResultsRangeDict", "(", ")", "analysis_request", "=", "self", ".", "getRequest", "(", ")", "if", "not", "analysis_request", ":", "return", "specs", "keyword", "=", "self", ".", "getKeyword", "("...
Returns the valid result range for this routine analysis based on the results ranges defined in the Analysis Request this routine analysis is assigned to. A routine analysis will be considered out of range if it result falls out of the range defined in "min" and "max". If there are valu...
[ "Returns", "the", "valid", "result", "range", "for", "this", "routine", "analysis", "based", "on", "the", "results", "ranges", "defined", "in", "the", "Analysis", "Request", "this", "routine", "analysis", "is", "assigned", "to", "." ]
python
train
andymccurdy/redis-py
redis/connection.py
https://github.com/andymccurdy/redis-py/blob/cdfe2befbe00db4a3c48c9ddd6d64dea15f6f0db/redis/connection.py#L1034-L1040
def disconnect(self): "Disconnects all connections in the pool" self._checkpid() all_conns = chain(self._available_connections, self._in_use_connections) for connection in all_conns: connection.disconnect()
[ "def", "disconnect", "(", "self", ")", ":", "self", ".", "_checkpid", "(", ")", "all_conns", "=", "chain", "(", "self", ".", "_available_connections", ",", "self", ".", "_in_use_connections", ")", "for", "connection", "in", "all_conns", ":", "connection", "....
Disconnects all connections in the pool
[ "Disconnects", "all", "connections", "in", "the", "pool" ]
python
train
peterbrittain/asciimatics
asciimatics/screen.py
https://github.com/peterbrittain/asciimatics/blob/f471427d7786ce2d5f1eeb2dae0e67d19e46e085/asciimatics/screen.py#L619-L627
def block_transfer(self, buffer, x, y): """ Copy a buffer to the screen double buffer at a specified location. :param buffer: The double buffer to copy :param x: The X origin for where to place it in the Screen :param y: The Y origin for where to place it in the Screen "...
[ "def", "block_transfer", "(", "self", ",", "buffer", ",", "x", ",", "y", ")", ":", "self", ".", "_buffer", ".", "block_transfer", "(", "buffer", ",", "x", ",", "y", ")" ]
Copy a buffer to the screen double buffer at a specified location. :param buffer: The double buffer to copy :param x: The X origin for where to place it in the Screen :param y: The Y origin for where to place it in the Screen
[ "Copy", "a", "buffer", "to", "the", "screen", "double", "buffer", "at", "a", "specified", "location", "." ]
python
train