repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.put_alias
def put_alias(self, using=None, **kwargs): """ Create an alias for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_alias`` unchanged. """ return self._get_connection(using).indices.put_alias(index=self._name, **kwargs)
python
def put_alias(self, using=None, **kwargs): """ Create an alias for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_alias`` unchanged. """ return self._get_connection(using).indices.put_alias(index=self._name, **kwargs)
[ "def", "put_alias", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "put_alias", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "k...
Create an alias for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_alias`` unchanged.
[ "Create", "an", "alias", "for", "the", "index", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L418-L425
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.exists_alias
def exists_alias(self, using=None, **kwargs): """ Return a boolean indicating whether given alias exists for this index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.exists_alias`` unchanged. """ return self._get_connection(using).indices.ex...
python
def exists_alias(self, using=None, **kwargs): """ Return a boolean indicating whether given alias exists for this index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.exists_alias`` unchanged. """ return self._get_connection(using).indices.ex...
[ "def", "exists_alias", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "exists_alias", "(", "index", "=", "self", ".", "_name", ",", "*", "*"...
Return a boolean indicating whether given alias exists for this index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.exists_alias`` unchanged.
[ "Return", "a", "boolean", "indicating", "whether", "given", "alias", "exists", "for", "this", "index", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L427-L434
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.get_alias
def get_alias(self, using=None, **kwargs): """ Retrieve a specified alias. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_alias`` unchanged. """ return self._get_connection(using).indices.get_alias(index=self._name, **kwargs)
python
def get_alias(self, using=None, **kwargs): """ Retrieve a specified alias. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_alias`` unchanged. """ return self._get_connection(using).indices.get_alias(index=self._name, **kwargs)
[ "def", "get_alias", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "get_alias", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "k...
Retrieve a specified alias. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_alias`` unchanged.
[ "Retrieve", "a", "specified", "alias", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L436-L443
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.delete_alias
def delete_alias(self, using=None, **kwargs): """ Delete specific alias. Any additional keyword arguments will be passed to ``Elasticsearch.indices.delete_alias`` unchanged. """ return self._get_connection(using).indices.delete_alias(index=self._name, **kwargs)
python
def delete_alias(self, using=None, **kwargs): """ Delete specific alias. Any additional keyword arguments will be passed to ``Elasticsearch.indices.delete_alias`` unchanged. """ return self._get_connection(using).indices.delete_alias(index=self._name, **kwargs)
[ "def", "delete_alias", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "delete_alias", "(", "index", "=", "self", ".", "_name", ",", "*", "*"...
Delete specific alias. Any additional keyword arguments will be passed to ``Elasticsearch.indices.delete_alias`` unchanged.
[ "Delete", "specific", "alias", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L445-L452
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.get_settings
def get_settings(self, using=None, **kwargs): """ Retrieve settings for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_settings`` unchanged. """ return self._get_connection(using).indices.get_settings(index=self._name, **kwargs)
python
def get_settings(self, using=None, **kwargs): """ Retrieve settings for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_settings`` unchanged. """ return self._get_connection(using).indices.get_settings(index=self._name, **kwargs)
[ "def", "get_settings", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "get_settings", "(", "index", "=", "self", ".", "_name", ",", "*", "*"...
Retrieve settings for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_settings`` unchanged.
[ "Retrieve", "settings", "for", "the", "index", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L454-L461
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.put_settings
def put_settings(self, using=None, **kwargs): """ Change specific index level settings in real time. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_settings`` unchanged. """ return self._get_connection(using).indices.put_settings(index=sel...
python
def put_settings(self, using=None, **kwargs): """ Change specific index level settings in real time. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_settings`` unchanged. """ return self._get_connection(using).indices.put_settings(index=sel...
[ "def", "put_settings", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "put_settings", "(", "index", "=", "self", ".", "_name", ",", "*", "*"...
Change specific index level settings in real time. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_settings`` unchanged.
[ "Change", "specific", "index", "level", "settings", "in", "real", "time", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L463-L470
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.stats
def stats(self, using=None, **kwargs): """ Retrieve statistics on different operations happening on the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.stats`` unchanged. """ return self._get_connection(using).indices.stats(index=self._n...
python
def stats(self, using=None, **kwargs): """ Retrieve statistics on different operations happening on the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.stats`` unchanged. """ return self._get_connection(using).indices.stats(index=self._n...
[ "def", "stats", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "stats", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwargs", ...
Retrieve statistics on different operations happening on the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.stats`` unchanged.
[ "Retrieve", "statistics", "on", "different", "operations", "happening", "on", "the", "index", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L472-L479
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.segments
def segments(self, using=None, **kwargs): """ Provide low level segments information that a Lucene index (shard level) is built with. Any additional keyword arguments will be passed to ``Elasticsearch.indices.segments`` unchanged. """ return self._get_connection(...
python
def segments(self, using=None, **kwargs): """ Provide low level segments information that a Lucene index (shard level) is built with. Any additional keyword arguments will be passed to ``Elasticsearch.indices.segments`` unchanged. """ return self._get_connection(...
[ "def", "segments", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "segments", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwa...
Provide low level segments information that a Lucene index (shard level) is built with. Any additional keyword arguments will be passed to ``Elasticsearch.indices.segments`` unchanged.
[ "Provide", "low", "level", "segments", "information", "that", "a", "Lucene", "index", "(", "shard", "level", ")", "is", "built", "with", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L481-L489
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.validate_query
def validate_query(self, using=None, **kwargs): """ Validate a potentially expensive query without executing it. Any additional keyword arguments will be passed to ``Elasticsearch.indices.validate_query`` unchanged. """ return self._get_connection(using).indices.validate...
python
def validate_query(self, using=None, **kwargs): """ Validate a potentially expensive query without executing it. Any additional keyword arguments will be passed to ``Elasticsearch.indices.validate_query`` unchanged. """ return self._get_connection(using).indices.validate...
[ "def", "validate_query", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "validate_query", "(", "index", "=", "self", ".", "_name", ",", "*", ...
Validate a potentially expensive query without executing it. Any additional keyword arguments will be passed to ``Elasticsearch.indices.validate_query`` unchanged.
[ "Validate", "a", "potentially", "expensive", "query", "without", "executing", "it", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L491-L498
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.clear_cache
def clear_cache(self, using=None, **kwargs): """ Clear all caches or specific cached associated with the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.clear_cache`` unchanged. """ return self._get_connection(using).indices.clear_cache(...
python
def clear_cache(self, using=None, **kwargs): """ Clear all caches or specific cached associated with the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.clear_cache`` unchanged. """ return self._get_connection(using).indices.clear_cache(...
[ "def", "clear_cache", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "clear_cache", "(", "index", "=", "self", ".", "_name", ",", "*", "*", ...
Clear all caches or specific cached associated with the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.clear_cache`` unchanged.
[ "Clear", "all", "caches", "or", "specific", "cached", "associated", "with", "the", "index", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L500-L507
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.recovery
def recovery(self, using=None, **kwargs): """ The indices recovery API provides insight into on-going shard recoveries for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.recovery`` unchanged. """ return self._get_connection(...
python
def recovery(self, using=None, **kwargs): """ The indices recovery API provides insight into on-going shard recoveries for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.recovery`` unchanged. """ return self._get_connection(...
[ "def", "recovery", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "recovery", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwa...
The indices recovery API provides insight into on-going shard recoveries for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.recovery`` unchanged.
[ "The", "indices", "recovery", "API", "provides", "insight", "into", "on", "-", "going", "shard", "recoveries", "for", "the", "index", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L509-L517
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.upgrade
def upgrade(self, using=None, **kwargs): """ Upgrade the index to the latest format. Any additional keyword arguments will be passed to ``Elasticsearch.indices.upgrade`` unchanged. """ return self._get_connection(using).indices.upgrade(index=self._name, **kwargs)
python
def upgrade(self, using=None, **kwargs): """ Upgrade the index to the latest format. Any additional keyword arguments will be passed to ``Elasticsearch.indices.upgrade`` unchanged. """ return self._get_connection(using).indices.upgrade(index=self._name, **kwargs)
[ "def", "upgrade", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "upgrade", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwarg...
Upgrade the index to the latest format. Any additional keyword arguments will be passed to ``Elasticsearch.indices.upgrade`` unchanged.
[ "Upgrade", "the", "index", "to", "the", "latest", "format", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L519-L526
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.get_upgrade
def get_upgrade(self, using=None, **kwargs): """ Monitor how much of the index is upgraded. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_upgrade`` unchanged. """ return self._get_connection(using).indices.get_upgrade(index=self._name, **...
python
def get_upgrade(self, using=None, **kwargs): """ Monitor how much of the index is upgraded. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_upgrade`` unchanged. """ return self._get_connection(using).indices.get_upgrade(index=self._name, **...
[ "def", "get_upgrade", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "get_upgrade", "(", "index", "=", "self", ".", "_name", ",", "*", "*", ...
Monitor how much of the index is upgraded. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_upgrade`` unchanged.
[ "Monitor", "how", "much", "of", "the", "index", "is", "upgraded", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L528-L535
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.flush_synced
def flush_synced(self, using=None, **kwargs): """ Perform a normal flush, then add a generated unique marker (sync_id) to all shards. Any additional keyword arguments will be passed to ``Elasticsearch.indices.flush_synced`` unchanged. """ return self._get_connect...
python
def flush_synced(self, using=None, **kwargs): """ Perform a normal flush, then add a generated unique marker (sync_id) to all shards. Any additional keyword arguments will be passed to ``Elasticsearch.indices.flush_synced`` unchanged. """ return self._get_connect...
[ "def", "flush_synced", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "flush_synced", "(", "index", "=", "self", ".", "_name", ",", "*", "*"...
Perform a normal flush, then add a generated unique marker (sync_id) to all shards. Any additional keyword arguments will be passed to ``Elasticsearch.indices.flush_synced`` unchanged.
[ "Perform", "a", "normal", "flush", "then", "add", "a", "generated", "unique", "marker", "(", "sync_id", ")", "to", "all", "shards", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L537-L545
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.shard_stores
def shard_stores(self, using=None, **kwargs): """ Provides store information for shard copies of the index. Store information reports on which nodes shard copies exist, the shard copy version, indicating how recent they are, and any exceptions encountered while opening the shard ...
python
def shard_stores(self, using=None, **kwargs): """ Provides store information for shard copies of the index. Store information reports on which nodes shard copies exist, the shard copy version, indicating how recent they are, and any exceptions encountered while opening the shard ...
[ "def", "shard_stores", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "shard_stores", "(", "index", "=", "self", ".", "_name", ",", "*", "*"...
Provides store information for shard copies of the index. Store information reports on which nodes shard copies exist, the shard copy version, indicating how recent they are, and any exceptions encountered while opening the shard index or from earlier engine failure. Any additional keyw...
[ "Provides", "store", "information", "for", "shard", "copies", "of", "the", "index", ".", "Store", "information", "reports", "on", "which", "nodes", "shard", "copies", "exist", "the", "shard", "copy", "version", "indicating", "how", "recent", "they", "are", "an...
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L547-L557
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.forcemerge
def forcemerge(self, using=None, **kwargs): """ The force merge API allows to force merging of the index through an API. The merge relates to the number of segments a Lucene index holds within each shard. The force merge operation allows to reduce the number of segments by mergin...
python
def forcemerge(self, using=None, **kwargs): """ The force merge API allows to force merging of the index through an API. The merge relates to the number of segments a Lucene index holds within each shard. The force merge operation allows to reduce the number of segments by mergin...
[ "def", "forcemerge", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "forcemerge", "(", "index", "=", "self", ".", "_name", ",", "*", "*", ...
The force merge API allows to force merging of the index through an API. The merge relates to the number of segments a Lucene index holds within each shard. The force merge operation allows to reduce the number of segments by merging them. This call will block until the merge is complet...
[ "The", "force", "merge", "API", "allows", "to", "force", "merging", "of", "the", "index", "through", "an", "API", ".", "The", "merge", "relates", "to", "the", "number", "of", "segments", "a", "Lucene", "index", "holds", "within", "each", "shard", ".", "T...
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L559-L573
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/index.py
Index.shrink
def shrink(self, using=None, **kwargs): """ The shrink index API allows you to shrink an existing index into a new index with fewer primary shards. The number of primary shards in the target index must be a factor of the shards in the source index. For example an index with 8 pri...
python
def shrink(self, using=None, **kwargs): """ The shrink index API allows you to shrink an existing index into a new index with fewer primary shards. The number of primary shards in the target index must be a factor of the shards in the source index. For example an index with 8 pri...
[ "def", "shrink", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "shrink", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwargs"...
The shrink index API allows you to shrink an existing index into a new index with fewer primary shards. The number of primary shards in the target index must be a factor of the shards in the source index. For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary sha...
[ "The", "shrink", "index", "API", "allows", "you", "to", "shrink", "an", "existing", "index", "into", "a", "new", "index", "with", "fewer", "primary", "shards", ".", "The", "number", "of", "primary", "shards", "in", "the", "target", "index", "must", "be", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L575-L590
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/connections.py
Connections.configure
def configure(self, **kwargs): """ Configure multiple connections at once, useful for passing in config dictionaries obtained from other sources, like Django's settings or a configuration management tool. Example:: connections.configure( default={'ho...
python
def configure(self, **kwargs): """ Configure multiple connections at once, useful for passing in config dictionaries obtained from other sources, like Django's settings or a configuration management tool. Example:: connections.configure( default={'ho...
[ "def", "configure", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "k", "in", "list", "(", "self", ".", "_conns", ")", ":", "# try and preserve existing client to keep the persistent connections alive", "if", "k", "in", "self", ".", "_kwargs", "and", "...
Configure multiple connections at once, useful for passing in config dictionaries obtained from other sources, like Django's settings or a configuration management tool. Example:: connections.configure( default={'hosts': 'localhost'}, dev={'hosts': [...
[ "Configure", "multiple", "connections", "at", "once", "useful", "for", "passing", "in", "config", "dictionaries", "obtained", "from", "other", "sources", "like", "Django", "s", "settings", "or", "a", "configuration", "management", "tool", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/connections.py#L16-L37
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/connections.py
Connections.remove_connection
def remove_connection(self, alias): """ Remove connection from the registry. Raises ``KeyError`` if connection wasn't found. """ errors = 0 for d in (self._conns, self._kwargs): try: del d[alias] except KeyError: err...
python
def remove_connection(self, alias): """ Remove connection from the registry. Raises ``KeyError`` if connection wasn't found. """ errors = 0 for d in (self._conns, self._kwargs): try: del d[alias] except KeyError: err...
[ "def", "remove_connection", "(", "self", ",", "alias", ")", ":", "errors", "=", "0", "for", "d", "in", "(", "self", ".", "_conns", ",", "self", ".", "_kwargs", ")", ":", "try", ":", "del", "d", "[", "alias", "]", "except", "KeyError", ":", "errors"...
Remove connection from the registry. Raises ``KeyError`` if connection wasn't found.
[ "Remove", "connection", "from", "the", "registry", ".", "Raises", "KeyError", "if", "connection", "wasn", "t", "found", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/connections.py#L45-L58
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/connections.py
Connections.create_connection
def create_connection(self, alias='default', **kwargs): """ Construct an instance of ``elasticsearch.Elasticsearch`` and register it under given alias. """ kwargs.setdefault('serializer', serializer) conn = self._conns[alias] = Elasticsearch(**kwargs) return conn
python
def create_connection(self, alias='default', **kwargs): """ Construct an instance of ``elasticsearch.Elasticsearch`` and register it under given alias. """ kwargs.setdefault('serializer', serializer) conn = self._conns[alias] = Elasticsearch(**kwargs) return conn
[ "def", "create_connection", "(", "self", ",", "alias", "=", "'default'", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'serializer'", ",", "serializer", ")", "conn", "=", "self", ".", "_conns", "[", "alias", "]", "=", "Elasticsear...
Construct an instance of ``elasticsearch.Elasticsearch`` and register it under given alias.
[ "Construct", "an", "instance", "of", "elasticsearch", ".", "Elasticsearch", "and", "register", "it", "under", "given", "alias", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/connections.py#L60-L67
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/connections.py
Connections.get_connection
def get_connection(self, alias='default'): """ Retrieve a connection, construct it if necessary (only configuration was passed to us). If a non-string alias has been passed through we assume it's already a client instance and will just return it as-is. Raises ``KeyError`` if no ...
python
def get_connection(self, alias='default'): """ Retrieve a connection, construct it if necessary (only configuration was passed to us). If a non-string alias has been passed through we assume it's already a client instance and will just return it as-is. Raises ``KeyError`` if no ...
[ "def", "get_connection", "(", "self", ",", "alias", "=", "'default'", ")", ":", "# do not check isinstance(Elasticsearch) so that people can wrap their", "# clients", "if", "not", "isinstance", "(", "alias", ",", "string_types", ")", ":", "return", "alias", "# connectio...
Retrieve a connection, construct it if necessary (only configuration was passed to us). If a non-string alias has been passed through we assume it's already a client instance and will just return it as-is. Raises ``KeyError`` if no client (or its definition) is registered under the alia...
[ "Retrieve", "a", "connection", "construct", "it", "if", "necessary", "(", "only", "configuration", "was", "passed", "to", "us", ")", ".", "If", "a", "non", "-", "string", "alias", "has", "been", "passed", "through", "we", "assume", "it", "s", "already", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/connections.py#L69-L94
train
elastic/elasticsearch-dsl-py
examples/alias_migration.py
setup
def setup(): """ Create the index template in elasticsearch specifying the mappings and any settings to be used. This can be run at any time, ideally at every new code deploy. """ # create an index template index_template = BlogPost._index.as_template(ALIAS, PATTERN) # upload the templat...
python
def setup(): """ Create the index template in elasticsearch specifying the mappings and any settings to be used. This can be run at any time, ideally at every new code deploy. """ # create an index template index_template = BlogPost._index.as_template(ALIAS, PATTERN) # upload the templat...
[ "def", "setup", "(", ")", ":", "# create an index template", "index_template", "=", "BlogPost", ".", "_index", ".", "as_template", "(", "ALIAS", ",", "PATTERN", ")", "# upload the template into elasticsearch", "# potentially overriding the one already there", "index_template"...
Create the index template in elasticsearch specifying the mappings and any settings to be used. This can be run at any time, ideally at every new code deploy.
[ "Create", "the", "index", "template", "in", "elasticsearch", "specifying", "the", "mappings", "and", "any", "settings", "to", "be", "used", ".", "This", "can", "be", "run", "at", "any", "time", "ideally", "at", "every", "new", "code", "deploy", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/examples/alias_migration.py#L54-L68
train
elastic/elasticsearch-dsl-py
examples/alias_migration.py
migrate
def migrate(move_data=True, update_alias=True): """ Upgrade function that creates a new index for the data. Optionally it also can (and by default will) reindex previous copy of the data into the new index (specify ``move_data=False`` to skip this step) and update the alias to point to the latest in...
python
def migrate(move_data=True, update_alias=True): """ Upgrade function that creates a new index for the data. Optionally it also can (and by default will) reindex previous copy of the data into the new index (specify ``move_data=False`` to skip this step) and update the alias to point to the latest in...
[ "def", "migrate", "(", "move_data", "=", "True", ",", "update_alias", "=", "True", ")", ":", "# construct a new index name by appending current timestamp", "next_index", "=", "PATTERN", ".", "replace", "(", "'*'", ",", "datetime", ".", "now", "(", ")", ".", "str...
Upgrade function that creates a new index for the data. Optionally it also can (and by default will) reindex previous copy of the data into the new index (specify ``move_data=False`` to skip this step) and update the alias to point to the latest index (set ``update_alias=False`` to skip). Note that whi...
[ "Upgrade", "function", "that", "creates", "a", "new", "index", "for", "the", "data", ".", "Optionally", "it", "also", "can", "(", "and", "by", "default", "will", ")", "reindex", "previous", "copy", "of", "the", "data", "into", "the", "new", "index", "(",...
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/examples/alias_migration.py#L70-L106
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/analysis.py
CustomAnalyzer.simulate
def simulate(self, text, using='default', explain=False, attributes=None): """ Use the Analyze API of elasticsearch to test the outcome of this analyzer. :arg text: Text to be analyzed :arg using: connection alias to use, defaults to ``'default'`` :arg explain: will output all t...
python
def simulate(self, text, using='default', explain=False, attributes=None): """ Use the Analyze API of elasticsearch to test the outcome of this analyzer. :arg text: Text to be analyzed :arg using: connection alias to use, defaults to ``'default'`` :arg explain: will output all t...
[ "def", "simulate", "(", "self", ",", "text", ",", "using", "=", "'default'", ",", "explain", "=", "False", ",", "attributes", "=", "None", ")", ":", "es", "=", "connections", ".", "get_connection", "(", "using", ")", "body", "=", "{", "'text'", ":", ...
Use the Analyze API of elasticsearch to test the outcome of this analyzer. :arg text: Text to be analyzed :arg using: connection alias to use, defaults to ``'default'`` :arg explain: will output all token attributes for each token. You can filter token attributes you want to output ...
[ "Use", "the", "Analyze", "API", "of", "elasticsearch", "to", "test", "the", "outcome", "of", "this", "analyzer", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/analysis.py#L85-L120
train
elastic/elasticsearch-dsl-py
examples/parent_child.py
Question.get_answers
def get_answers(self): """ Get answers either from inner_hits already present or by searching elasticsearch. """ if 'inner_hits' in self.meta and 'answer' in self.meta.inner_hits: return self.meta.inner_hits.answer.hits return list(self.search_answers())
python
def get_answers(self): """ Get answers either from inner_hits already present or by searching elasticsearch. """ if 'inner_hits' in self.meta and 'answer' in self.meta.inner_hits: return self.meta.inner_hits.answer.hits return list(self.search_answers())
[ "def", "get_answers", "(", "self", ")", ":", "if", "'inner_hits'", "in", "self", ".", "meta", "and", "'answer'", "in", "self", ".", "meta", ".", "inner_hits", ":", "return", "self", ".", "meta", ".", "inner_hits", ".", "answer", ".", "hits", "return", ...
Get answers either from inner_hits already present or by searching elasticsearch.
[ "Get", "answers", "either", "from", "inner_hits", "already", "present", "or", "by", "searching", "elasticsearch", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/examples/parent_child.py#L130-L137
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/faceted_search.py
Facet.get_aggregation
def get_aggregation(self): """ Return the aggregation object. """ agg = A(self.agg_type, **self._params) if self._metric: agg.metric('metric', self._metric) return agg
python
def get_aggregation(self): """ Return the aggregation object. """ agg = A(self.agg_type, **self._params) if self._metric: agg.metric('metric', self._metric) return agg
[ "def", "get_aggregation", "(", "self", ")", ":", "agg", "=", "A", "(", "self", ".", "agg_type", ",", "*", "*", "self", ".", "_params", ")", "if", "self", ".", "_metric", ":", "agg", ".", "metric", "(", "'metric'", ",", "self", ".", "_metric", ")", ...
Return the aggregation object.
[ "Return", "the", "aggregation", "object", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L30-L37
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/faceted_search.py
Facet.add_filter
def add_filter(self, filter_values): """ Construct a filter. """ if not filter_values: return f = self.get_value_filter(filter_values[0]) for v in filter_values[1:]: f |= self.get_value_filter(v) return f
python
def add_filter(self, filter_values): """ Construct a filter. """ if not filter_values: return f = self.get_value_filter(filter_values[0]) for v in filter_values[1:]: f |= self.get_value_filter(v) return f
[ "def", "add_filter", "(", "self", ",", "filter_values", ")", ":", "if", "not", "filter_values", ":", "return", "f", "=", "self", ".", "get_value_filter", "(", "filter_values", "[", "0", "]", ")", "for", "v", "in", "filter_values", "[", "1", ":", "]", "...
Construct a filter.
[ "Construct", "a", "filter", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L39-L49
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/faceted_search.py
Facet.get_values
def get_values(self, data, filter_values): """ Turn the raw bucket data into a list of tuples containing the key, number of documents and a flag indicating whether this value has been selected or not. """ out = [] for bucket in data.buckets: key = self...
python
def get_values(self, data, filter_values): """ Turn the raw bucket data into a list of tuples containing the key, number of documents and a flag indicating whether this value has been selected or not. """ out = [] for bucket in data.buckets: key = self...
[ "def", "get_values", "(", "self", ",", "data", ",", "filter_values", ")", ":", "out", "=", "[", "]", "for", "bucket", "in", "data", ".", "buckets", ":", "key", "=", "self", ".", "get_value", "(", "bucket", ")", "out", ".", "append", "(", "(", "key"...
Turn the raw bucket data into a list of tuples containing the key, number of documents and a flag indicating whether this value has been selected or not.
[ "Turn", "the", "raw", "bucket", "data", "into", "a", "list", "of", "tuples", "containing", "the", "key", "number", "of", "documents", "and", "a", "flag", "indicating", "whether", "this", "value", "has", "been", "selected", "or", "not", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L77-L91
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/faceted_search.py
FacetedSearch.add_filter
def add_filter(self, name, filter_values): """ Add a filter for a facet. """ # normalize the value into a list if not isinstance(filter_values, (tuple, list)): if filter_values is None: return filter_values = [filter_values, ] # re...
python
def add_filter(self, name, filter_values): """ Add a filter for a facet. """ # normalize the value into a list if not isinstance(filter_values, (tuple, list)): if filter_values is None: return filter_values = [filter_values, ] # re...
[ "def", "add_filter", "(", "self", ",", "name", ",", "filter_values", ")", ":", "# normalize the value into a list", "if", "not", "isinstance", "(", "filter_values", ",", "(", "tuple", ",", "list", ")", ")", ":", "if", "filter_values", "is", "None", ":", "ret...
Add a filter for a facet.
[ "Add", "a", "filter", "for", "a", "facet", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L283-L301
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/faceted_search.py
FacetedSearch.search
def search(self): """ Returns the base Search object to which the facets are added. You can customize the query by overriding this method and returning a modified search object. """ s = Search(doc_type=self.doc_types, index=self.index, using=self.using) return s....
python
def search(self): """ Returns the base Search object to which the facets are added. You can customize the query by overriding this method and returning a modified search object. """ s = Search(doc_type=self.doc_types, index=self.index, using=self.using) return s....
[ "def", "search", "(", "self", ")", ":", "s", "=", "Search", "(", "doc_type", "=", "self", ".", "doc_types", ",", "index", "=", "self", ".", "index", ",", "using", "=", "self", ".", "using", ")", "return", "s", ".", "response_class", "(", "FacetedResp...
Returns the base Search object to which the facets are added. You can customize the query by overriding this method and returning a modified search object.
[ "Returns", "the", "base", "Search", "object", "to", "which", "the", "facets", "are", "added", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L303-L311
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/faceted_search.py
FacetedSearch.query
def query(self, search, query): """ Add query part to ``search``. Override this if you wish to customize the query used. """ if query: if self.fields: return search.query('multi_match', fields=self.fields, query=query) else: ...
python
def query(self, search, query): """ Add query part to ``search``. Override this if you wish to customize the query used. """ if query: if self.fields: return search.query('multi_match', fields=self.fields, query=query) else: ...
[ "def", "query", "(", "self", ",", "search", ",", "query", ")", ":", "if", "query", ":", "if", "self", ".", "fields", ":", "return", "search", ".", "query", "(", "'multi_match'", ",", "fields", "=", "self", ".", "fields", ",", "query", "=", "query", ...
Add query part to ``search``. Override this if you wish to customize the query used.
[ "Add", "query", "part", "to", "search", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L313-L324
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/faceted_search.py
FacetedSearch.aggregate
def aggregate(self, search): """ Add aggregations representing the facets selected, including potential filters. """ for f, facet in iteritems(self.facets): agg = facet.get_aggregation() agg_filter = MatchAll() for field, filter in iteritems(se...
python
def aggregate(self, search): """ Add aggregations representing the facets selected, including potential filters. """ for f, facet in iteritems(self.facets): agg = facet.get_aggregation() agg_filter = MatchAll() for field, filter in iteritems(se...
[ "def", "aggregate", "(", "self", ",", "search", ")", ":", "for", "f", ",", "facet", "in", "iteritems", "(", "self", ".", "facets", ")", ":", "agg", "=", "facet", ".", "get_aggregation", "(", ")", "agg_filter", "=", "MatchAll", "(", ")", "for", "field...
Add aggregations representing the facets selected, including potential filters.
[ "Add", "aggregations", "representing", "the", "facets", "selected", "including", "potential", "filters", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L326-L342
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/faceted_search.py
FacetedSearch.filter
def filter(self, search): """ Add a ``post_filter`` to the search request narrowing the results based on the facet filters. """ if not self._filters: return search post_filter = MatchAll() for f in itervalues(self._filters): post_filter &=...
python
def filter(self, search): """ Add a ``post_filter`` to the search request narrowing the results based on the facet filters. """ if not self._filters: return search post_filter = MatchAll() for f in itervalues(self._filters): post_filter &=...
[ "def", "filter", "(", "self", ",", "search", ")", ":", "if", "not", "self", ".", "_filters", ":", "return", "search", "post_filter", "=", "MatchAll", "(", ")", "for", "f", "in", "itervalues", "(", "self", ".", "_filters", ")", ":", "post_filter", "&=",...
Add a ``post_filter`` to the search request narrowing the results based on the facet filters.
[ "Add", "a", "post_filter", "to", "the", "search", "request", "narrowing", "the", "results", "based", "on", "the", "facet", "filters", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L344-L355
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/faceted_search.py
FacetedSearch.highlight
def highlight(self, search): """ Add highlighting for all the fields """ return search.highlight(*(f if '^' not in f else f.split('^', 1)[0] for f in self.fields))
python
def highlight(self, search): """ Add highlighting for all the fields """ return search.highlight(*(f if '^' not in f else f.split('^', 1)[0] for f in self.fields))
[ "def", "highlight", "(", "self", ",", "search", ")", ":", "return", "search", ".", "highlight", "(", "*", "(", "f", "if", "'^'", "not", "in", "f", "else", "f", ".", "split", "(", "'^'", ",", "1", ")", "[", "0", "]", "for", "f", "in", "self", ...
Add highlighting for all the fields
[ "Add", "highlighting", "for", "all", "the", "fields" ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L357-L362
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/faceted_search.py
FacetedSearch.sort
def sort(self, search): """ Add sorting information to the request. """ if self._sort: search = search.sort(*self._sort) return search
python
def sort(self, search): """ Add sorting information to the request. """ if self._sort: search = search.sort(*self._sort) return search
[ "def", "sort", "(", "self", ",", "search", ")", ":", "if", "self", ".", "_sort", ":", "search", "=", "search", ".", "sort", "(", "*", "self", ".", "_sort", ")", "return", "search" ]
Add sorting information to the request.
[ "Add", "sorting", "information", "to", "the", "request", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L364-L370
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/faceted_search.py
FacetedSearch.build_search
def build_search(self): """ Construct the ``Search`` object. """ s = self.search() s = self.query(s, self._query) s = self.filter(s) if self.fields: s = self.highlight(s) s = self.sort(s) self.aggregate(s) return s
python
def build_search(self): """ Construct the ``Search`` object. """ s = self.search() s = self.query(s, self._query) s = self.filter(s) if self.fields: s = self.highlight(s) s = self.sort(s) self.aggregate(s) return s
[ "def", "build_search", "(", "self", ")", ":", "s", "=", "self", ".", "search", "(", ")", "s", "=", "self", ".", "query", "(", "s", ",", "self", ".", "_query", ")", "s", "=", "self", ".", "filter", "(", "s", ")", "if", "self", ".", "fields", "...
Construct the ``Search`` object.
[ "Construct", "the", "Search", "object", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L372-L383
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/faceted_search.py
FacetedSearch.execute
def execute(self): """ Execute the search and return the response. """ r = self._s.execute() r._faceted_search = self return r
python
def execute(self): """ Execute the search and return the response. """ r = self._s.execute() r._faceted_search = self return r
[ "def", "execute", "(", "self", ")", ":", "r", "=", "self", ".", "_s", ".", "execute", "(", ")", "r", ".", "_faceted_search", "=", "self", "return", "r" ]
Execute the search and return the response.
[ "Execute", "the", "search", "and", "return", "the", "response", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L385-L391
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Request.params
def params(self, **kwargs): """ Specify query params to be used when executing the search. All the keyword arguments will override the current values. See https://elasticsearch-py.readthedocs.io/en/master/api.html#elasticsearch.Elasticsearch.search for all available parameters. ...
python
def params(self, **kwargs): """ Specify query params to be used when executing the search. All the keyword arguments will override the current values. See https://elasticsearch-py.readthedocs.io/en/master/api.html#elasticsearch.Elasticsearch.search for all available parameters. ...
[ "def", "params", "(", "self", ",", "*", "*", "kwargs", ")", ":", "s", "=", "self", ".", "_clone", "(", ")", "s", ".", "_params", ".", "update", "(", "kwargs", ")", "return", "s" ]
Specify query params to be used when executing the search. All the keyword arguments will override the current values. See https://elasticsearch-py.readthedocs.io/en/master/api.html#elasticsearch.Elasticsearch.search for all available parameters. Example:: s = Search() ...
[ "Specify", "query", "params", "to", "be", "used", "when", "executing", "the", "search", ".", "All", "the", "keyword", "arguments", "will", "override", "the", "current", "values", ".", "See", "https", ":", "//", "elasticsearch", "-", "py", ".", "readthedocs",...
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L131-L145
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Request.index
def index(self, *index): """ Set the index for the search. If called empty it will remove all information. Example: s = Search() s = s.index('twitter-2015.01.01', 'twitter-2015.01.02') s = s.index(['twitter-2015.01.01', 'twitter-2015.01.02']) """ ...
python
def index(self, *index): """ Set the index for the search. If called empty it will remove all information. Example: s = Search() s = s.index('twitter-2015.01.01', 'twitter-2015.01.02') s = s.index(['twitter-2015.01.01', 'twitter-2015.01.02']) """ ...
[ "def", "index", "(", "self", ",", "*", "index", ")", ":", "# .index() resets", "s", "=", "self", ".", "_clone", "(", ")", "if", "not", "index", ":", "s", ".", "_index", "=", "None", "else", ":", "indexes", "=", "[", "]", "for", "i", "in", "index"...
Set the index for the search. If called empty it will remove all information. Example: s = Search() s = s.index('twitter-2015.01.01', 'twitter-2015.01.02') s = s.index(['twitter-2015.01.01', 'twitter-2015.01.02'])
[ "Set", "the", "index", "for", "the", "search", ".", "If", "called", "empty", "it", "will", "remove", "all", "information", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L147-L173
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Request.doc_type
def doc_type(self, *doc_type, **kwargs): """ Set the type to search through. You can supply a single value or multiple. Values can be strings or subclasses of ``Document``. You can also pass in any keyword arguments, mapping a doc_type to a callback that should be used instead o...
python
def doc_type(self, *doc_type, **kwargs): """ Set the type to search through. You can supply a single value or multiple. Values can be strings or subclasses of ``Document``. You can also pass in any keyword arguments, mapping a doc_type to a callback that should be used instead o...
[ "def", "doc_type", "(", "self", ",", "*", "doc_type", ",", "*", "*", "kwargs", ")", ":", "# .doc_type() resets", "s", "=", "self", ".", "_clone", "(", ")", "if", "not", "doc_type", "and", "not", "kwargs", ":", "s", ".", "_doc_type", "=", "[", "]", ...
Set the type to search through. You can supply a single value or multiple. Values can be strings or subclasses of ``Document``. You can also pass in any keyword arguments, mapping a doc_type to a callback that should be used instead of the Hit class. If no doc_type is supplied any info...
[ "Set", "the", "type", "to", "search", "through", ".", "You", "can", "supply", "a", "single", "value", "or", "multiple", ".", "Values", "can", "be", "strings", "or", "subclasses", "of", "Document", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L225-L249
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Request.using
def using(self, client): """ Associate the search request with an elasticsearch client. A fresh copy will be returned with current instance remaining unchanged. :arg client: an instance of ``elasticsearch.Elasticsearch`` to use or an alias to look up in ``elasticsearch_dsl.c...
python
def using(self, client): """ Associate the search request with an elasticsearch client. A fresh copy will be returned with current instance remaining unchanged. :arg client: an instance of ``elasticsearch.Elasticsearch`` to use or an alias to look up in ``elasticsearch_dsl.c...
[ "def", "using", "(", "self", ",", "client", ")", ":", "s", "=", "self", ".", "_clone", "(", ")", "s", ".", "_using", "=", "client", "return", "s" ]
Associate the search request with an elasticsearch client. A fresh copy will be returned with current instance remaining unchanged. :arg client: an instance of ``elasticsearch.Elasticsearch`` to use or an alias to look up in ``elasticsearch_dsl.connections``
[ "Associate", "the", "search", "request", "with", "an", "elasticsearch", "client", ".", "A", "fresh", "copy", "will", "be", "returned", "with", "current", "instance", "remaining", "unchanged", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L251-L262
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Request.extra
def extra(self, **kwargs): """ Add extra keys to the request body. Mostly here for backwards compatibility. """ s = self._clone() if 'from_' in kwargs: kwargs['from'] = kwargs.pop('from_') s._extra.update(kwargs) return s
python
def extra(self, **kwargs): """ Add extra keys to the request body. Mostly here for backwards compatibility. """ s = self._clone() if 'from_' in kwargs: kwargs['from'] = kwargs.pop('from_') s._extra.update(kwargs) return s
[ "def", "extra", "(", "self", ",", "*", "*", "kwargs", ")", ":", "s", "=", "self", ".", "_clone", "(", ")", "if", "'from_'", "in", "kwargs", ":", "kwargs", "[", "'from'", "]", "=", "kwargs", ".", "pop", "(", "'from_'", ")", "s", ".", "_extra", "...
Add extra keys to the request body. Mostly here for backwards compatibility.
[ "Add", "extra", "keys", "to", "the", "request", "body", ".", "Mostly", "here", "for", "backwards", "compatibility", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L264-L273
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Search._clone
def _clone(self): """ Return a clone of the current search request. Performs a shallow copy of all the underlying objects. Used internally by most state modifying APIs. """ s = super(Search, self)._clone() s._response_class = self._response_class s._sort ...
python
def _clone(self): """ Return a clone of the current search request. Performs a shallow copy of all the underlying objects. Used internally by most state modifying APIs. """ s = super(Search, self)._clone() s._response_class = self._response_class s._sort ...
[ "def", "_clone", "(", "self", ")", ":", "s", "=", "super", "(", "Search", ",", "self", ")", ".", "_clone", "(", ")", "s", ".", "_response_class", "=", "self", ".", "_response_class", "s", ".", "_sort", "=", "self", ".", "_sort", "[", ":", "]", "s...
Return a clone of the current search request. Performs a shallow copy of all the underlying objects. Used internally by most state modifying APIs.
[ "Return", "a", "clone", "of", "the", "current", "search", "request", ".", "Performs", "a", "shallow", "copy", "of", "all", "the", "underlying", "objects", ".", "Used", "internally", "by", "most", "state", "modifying", "APIs", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L379-L401
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Search.response_class
def response_class(self, cls): """ Override the default wrapper used for the response. """ s = self._clone() s._response_class = cls return s
python
def response_class(self, cls): """ Override the default wrapper used for the response. """ s = self._clone() s._response_class = cls return s
[ "def", "response_class", "(", "self", ",", "cls", ")", ":", "s", "=", "self", ".", "_clone", "(", ")", "s", ".", "_response_class", "=", "cls", "return", "s" ]
Override the default wrapper used for the response.
[ "Override", "the", "default", "wrapper", "used", "for", "the", "response", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L403-L409
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Search.update_from_dict
def update_from_dict(self, d): """ Apply options from a serialized body to the current instance. Modifies the object in-place. Used mostly by ``from_dict``. """ d = d.copy() if 'query' in d: self.query._proxied = Q(d.pop('query')) if 'post_filter' in d...
python
def update_from_dict(self, d): """ Apply options from a serialized body to the current instance. Modifies the object in-place. Used mostly by ``from_dict``. """ d = d.copy() if 'query' in d: self.query._proxied = Q(d.pop('query')) if 'post_filter' in d...
[ "def", "update_from_dict", "(", "self", ",", "d", ")", ":", "d", "=", "d", ".", "copy", "(", ")", "if", "'query'", "in", "d", ":", "self", ".", "query", ".", "_proxied", "=", "Q", "(", "d", ".", "pop", "(", "'query'", ")", ")", "if", "'post_fil...
Apply options from a serialized body to the current instance. Modifies the object in-place. Used mostly by ``from_dict``.
[ "Apply", "options", "from", "a", "serialized", "body", "to", "the", "current", "instance", ".", "Modifies", "the", "object", "in", "-", "place", ".", "Used", "mostly", "by", "from_dict", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L411-L445
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Search.script_fields
def script_fields(self, **kwargs): """ Define script fields to be calculated on hits. See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-script-fields.html for more details. Example:: s = Search() s = s.script_fields(times...
python
def script_fields(self, **kwargs): """ Define script fields to be calculated on hits. See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-script-fields.html for more details. Example:: s = Search() s = s.script_fields(times...
[ "def", "script_fields", "(", "self", ",", "*", "*", "kwargs", ")", ":", "s", "=", "self", ".", "_clone", "(", ")", "for", "name", "in", "kwargs", ":", "if", "isinstance", "(", "kwargs", "[", "name", "]", ",", "string_types", ")", ":", "kwargs", "["...
Define script fields to be calculated on hits. See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-script-fields.html for more details. Example:: s = Search() s = s.script_fields(times_two="doc['field'].value * 2") s = s.script...
[ "Define", "script", "fields", "to", "be", "calculated", "on", "hits", ".", "See", "https", ":", "//", "www", ".", "elastic", ".", "co", "/", "guide", "/", "en", "/", "elasticsearch", "/", "reference", "/", "current", "/", "search", "-", "request", "-",...
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L447-L472
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Search.source
def source(self, fields=None, **kwargs): """ Selectively control how the _source field is returned. :arg fields: wildcard string, array of wildcards, or dictionary of includes and excludes If ``fields`` is None, the entire document will be returned for each hit. If fields is a...
python
def source(self, fields=None, **kwargs): """ Selectively control how the _source field is returned. :arg fields: wildcard string, array of wildcards, or dictionary of includes and excludes If ``fields`` is None, the entire document will be returned for each hit. If fields is a...
[ "def", "source", "(", "self", ",", "fields", "=", "None", ",", "*", "*", "kwargs", ")", ":", "s", "=", "self", ".", "_clone", "(", ")", "if", "fields", "and", "kwargs", ":", "raise", "ValueError", "(", "\"You cannot specify fields and kwargs at the same time...
Selectively control how the _source field is returned. :arg fields: wildcard string, array of wildcards, or dictionary of includes and excludes If ``fields`` is None, the entire document will be returned for each hit. If fields is a dictionary with keys of 'include' and/or 'exclude' t...
[ "Selectively", "control", "how", "the", "_source", "field", "is", "returned", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L474-L517
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Search.sort
def sort(self, *keys): """ Add sorting information to the search request. If called without arguments it will remove all sort requirements. Otherwise it will replace them. Acceptable arguments are:: 'some.field' '-some.other.field' {'different.field':...
python
def sort(self, *keys): """ Add sorting information to the search request. If called without arguments it will remove all sort requirements. Otherwise it will replace them. Acceptable arguments are:: 'some.field' '-some.other.field' {'different.field':...
[ "def", "sort", "(", "self", ",", "*", "keys", ")", ":", "s", "=", "self", ".", "_clone", "(", ")", "s", ".", "_sort", "=", "[", "]", "for", "k", "in", "keys", ":", "if", "isinstance", "(", "k", ",", "string_types", ")", "and", "k", ".", "star...
Add sorting information to the search request. If called without arguments it will remove all sort requirements. Otherwise it will replace them. Acceptable arguments are:: 'some.field' '-some.other.field' {'different.field': {'any': 'dict'}} so for example::...
[ "Add", "sorting", "information", "to", "the", "search", "request", ".", "If", "called", "without", "arguments", "it", "will", "remove", "all", "sort", "requirements", ".", "Otherwise", "it", "will", "replace", "them", ".", "Acceptable", "arguments", "are", "::...
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L519-L550
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Search.highlight_options
def highlight_options(self, **kwargs): """ Update the global highlighting options used for this request. For example:: s = Search() s = s.highlight_options(order='score') """ s = self._clone() s._highlight_opts.update(kwargs) return s
python
def highlight_options(self, **kwargs): """ Update the global highlighting options used for this request. For example:: s = Search() s = s.highlight_options(order='score') """ s = self._clone() s._highlight_opts.update(kwargs) return s
[ "def", "highlight_options", "(", "self", ",", "*", "*", "kwargs", ")", ":", "s", "=", "self", ".", "_clone", "(", ")", "s", ".", "_highlight_opts", ".", "update", "(", "kwargs", ")", "return", "s" ]
Update the global highlighting options used for this request. For example:: s = Search() s = s.highlight_options(order='score')
[ "Update", "the", "global", "highlighting", "options", "used", "for", "this", "request", ".", "For", "example", "::" ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L552-L562
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Search.highlight
def highlight(self, *fields, **kwargs): """ Request highlighting of some fields. All keyword arguments passed in will be used as parameters for all the fields in the ``fields`` parameter. Example:: Search().highlight('title', 'body', fragment_size=50) will produce the equiv...
python
def highlight(self, *fields, **kwargs): """ Request highlighting of some fields. All keyword arguments passed in will be used as parameters for all the fields in the ``fields`` parameter. Example:: Search().highlight('title', 'body', fragment_size=50) will produce the equiv...
[ "def", "highlight", "(", "self", ",", "*", "fields", ",", "*", "*", "kwargs", ")", ":", "s", "=", "self", ".", "_clone", "(", ")", "for", "f", "in", "fields", ":", "s", ".", "_highlight", "[", "f", "]", "=", "kwargs", "return", "s" ]
Request highlighting of some fields. All keyword arguments passed in will be used as parameters for all the fields in the ``fields`` parameter. Example:: Search().highlight('title', 'body', fragment_size=50) will produce the equivalent of:: { "highlight": { ...
[ "Request", "highlighting", "of", "some", "fields", ".", "All", "keyword", "arguments", "passed", "in", "will", "be", "used", "as", "parameters", "for", "all", "the", "fields", "in", "the", "fields", "parameter", ".", "Example", "::" ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L564-L601
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Search.suggest
def suggest(self, name, text, **kwargs): """ Add a suggestions request to the search. :arg name: name of the suggestion :arg text: text to suggest on All keyword arguments will be added to the suggestions body. For example:: s = Search() s = s.suggest('...
python
def suggest(self, name, text, **kwargs): """ Add a suggestions request to the search. :arg name: name of the suggestion :arg text: text to suggest on All keyword arguments will be added to the suggestions body. For example:: s = Search() s = s.suggest('...
[ "def", "suggest", "(", "self", ",", "name", ",", "text", ",", "*", "*", "kwargs", ")", ":", "s", "=", "self", ".", "_clone", "(", ")", "s", ".", "_suggest", "[", "name", "]", "=", "{", "'text'", ":", "text", "}", "s", ".", "_suggest", "[", "n...
Add a suggestions request to the search. :arg name: name of the suggestion :arg text: text to suggest on All keyword arguments will be added to the suggestions body. For example:: s = Search() s = s.suggest('suggestion-1', 'Elasticsearch', term={'field': 'body'})
[ "Add", "a", "suggestions", "request", "to", "the", "search", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L603-L618
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Search.to_dict
def to_dict(self, count=False, **kwargs): """ Serialize the search into the dictionary that will be sent over as the request's body. :arg count: a flag to specify if we are interested in a body for count - no aggregations, no pagination bounds etc. All additional ke...
python
def to_dict(self, count=False, **kwargs): """ Serialize the search into the dictionary that will be sent over as the request's body. :arg count: a flag to specify if we are interested in a body for count - no aggregations, no pagination bounds etc. All additional ke...
[ "def", "to_dict", "(", "self", ",", "count", "=", "False", ",", "*", "*", "kwargs", ")", ":", "d", "=", "{", "}", "if", "self", ".", "query", ":", "d", "[", "\"query\"", "]", "=", "self", ".", "query", ".", "to_dict", "(", ")", "# count request d...
Serialize the search into the dictionary that will be sent over as the request's body. :arg count: a flag to specify if we are interested in a body for count - no aggregations, no pagination bounds etc. All additional keyword arguments will be included into the dictionary.
[ "Serialize", "the", "search", "into", "the", "dictionary", "that", "will", "be", "sent", "over", "as", "the", "request", "s", "body", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L620-L662
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Search.count
def count(self): """ Return the number of hits matching the query and filters. Note that only the actual number is returned. """ if hasattr(self, '_response'): return self._response.hits.total es = connections.get_connection(self._using) d = self.to_...
python
def count(self): """ Return the number of hits matching the query and filters. Note that only the actual number is returned. """ if hasattr(self, '_response'): return self._response.hits.total es = connections.get_connection(self._using) d = self.to_...
[ "def", "count", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'_response'", ")", ":", "return", "self", ".", "_response", ".", "hits", ".", "total", "es", "=", "connections", ".", "get_connection", "(", "self", ".", "_using", ")", "d", "...
Return the number of hits matching the query and filters. Note that only the actual number is returned.
[ "Return", "the", "number", "of", "hits", "matching", "the", "query", "and", "filters", ".", "Note", "that", "only", "the", "actual", "number", "is", "returned", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L664-L680
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Search.execute
def execute(self, ignore_cache=False): """ Execute the search and return an instance of ``Response`` wrapping all the data. :arg ignore_cache: if set to ``True``, consecutive calls will hit ES, while cached result will be ignored. Defaults to `False` """ if i...
python
def execute(self, ignore_cache=False): """ Execute the search and return an instance of ``Response`` wrapping all the data. :arg ignore_cache: if set to ``True``, consecutive calls will hit ES, while cached result will be ignored. Defaults to `False` """ if i...
[ "def", "execute", "(", "self", ",", "ignore_cache", "=", "False", ")", ":", "if", "ignore_cache", "or", "not", "hasattr", "(", "self", ",", "'_response'", ")", ":", "es", "=", "connections", ".", "get_connection", "(", "self", ".", "_using", ")", "self",...
Execute the search and return an instance of ``Response`` wrapping all the data. :arg ignore_cache: if set to ``True``, consecutive calls will hit ES, while cached result will be ignored. Defaults to `False`
[ "Execute", "the", "search", "and", "return", "an", "instance", "of", "Response", "wrapping", "all", "the", "data", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L682-L701
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Search.scan
def scan(self): """ Turn the search into a scan search and return a generator that will iterate over all the documents matching the query. Use ``params`` method to specify any additional arguments you with to pass to the underlying ``scan`` helper from ``elasticsearch-py`` - ...
python
def scan(self): """ Turn the search into a scan search and return a generator that will iterate over all the documents matching the query. Use ``params`` method to specify any additional arguments you with to pass to the underlying ``scan`` helper from ``elasticsearch-py`` - ...
[ "def", "scan", "(", "self", ")", ":", "es", "=", "connections", ".", "get_connection", "(", "self", ".", "_using", ")", "for", "hit", "in", "scan", "(", "es", ",", "query", "=", "self", ".", "to_dict", "(", ")", ",", "index", "=", "self", ".", "_...
Turn the search into a scan search and return a generator that will iterate over all the documents matching the query. Use ``params`` method to specify any additional arguments you with to pass to the underlying ``scan`` helper from ``elasticsearch-py`` - https://elasticsearch-py.readth...
[ "Turn", "the", "search", "into", "a", "scan", "search", "and", "return", "a", "generator", "that", "will", "iterate", "over", "all", "the", "documents", "matching", "the", "query", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L703-L721
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
Search.delete
def delete(self): """ delete() executes the query by delegating to delete_by_query() """ es = connections.get_connection(self._using) return AttrDict( es.delete_by_query( index=self._index, body=self.to_dict(), **self....
python
def delete(self): """ delete() executes the query by delegating to delete_by_query() """ es = connections.get_connection(self._using) return AttrDict( es.delete_by_query( index=self._index, body=self.to_dict(), **self....
[ "def", "delete", "(", "self", ")", ":", "es", "=", "connections", ".", "get_connection", "(", "self", ".", "_using", ")", "return", "AttrDict", "(", "es", ".", "delete_by_query", "(", "index", "=", "self", ".", "_index", ",", "body", "=", "self", ".", ...
delete() executes the query by delegating to delete_by_query()
[ "delete", "()", "executes", "the", "query", "by", "delegating", "to", "delete_by_query", "()" ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L723-L736
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
MultiSearch.add
def add(self, search): """ Adds a new :class:`~elasticsearch_dsl.Search` object to the request:: ms = MultiSearch(index='my-index') ms = ms.add(Search(doc_type=Category).filter('term', category='python')) ms = ms.add(Search(doc_type=Blog)) """ ms = se...
python
def add(self, search): """ Adds a new :class:`~elasticsearch_dsl.Search` object to the request:: ms = MultiSearch(index='my-index') ms = ms.add(Search(doc_type=Category).filter('term', category='python')) ms = ms.add(Search(doc_type=Blog)) """ ms = se...
[ "def", "add", "(", "self", ",", "search", ")", ":", "ms", "=", "self", ".", "_clone", "(", ")", "ms", ".", "_searches", ".", "append", "(", "search", ")", "return", "ms" ]
Adds a new :class:`~elasticsearch_dsl.Search` object to the request:: ms = MultiSearch(index='my-index') ms = ms.add(Search(doc_type=Category).filter('term', category='python')) ms = ms.add(Search(doc_type=Blog))
[ "Adds", "a", "new", ":", "class", ":", "~elasticsearch_dsl", ".", "Search", "object", "to", "the", "request", "::" ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L759-L769
train
elastic/elasticsearch-dsl-py
elasticsearch_dsl/search.py
MultiSearch.execute
def execute(self, ignore_cache=False, raise_on_error=True): """ Execute the multi search request and return a list of search results. """ if ignore_cache or not hasattr(self, '_response'): es = connections.get_connection(self._using) responses = es.msearch( ...
python
def execute(self, ignore_cache=False, raise_on_error=True): """ Execute the multi search request and return a list of search results. """ if ignore_cache or not hasattr(self, '_response'): es = connections.get_connection(self._using) responses = es.msearch( ...
[ "def", "execute", "(", "self", ",", "ignore_cache", "=", "False", ",", "raise_on_error", "=", "True", ")", ":", "if", "ignore_cache", "or", "not", "hasattr", "(", "self", ",", "'_response'", ")", ":", "es", "=", "connections", ".", "get_connection", "(", ...
Execute the multi search request and return a list of search results.
[ "Execute", "the", "multi", "search", "request", "and", "return", "a", "list", "of", "search", "results", "." ]
874b52472fc47b601de0e5fa0e4300e21aff0085
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L784-L809
train
paramiko/paramiko
setup_helper.py
make_tarball
def make_tarball( base_name, base_dir, compress="gzip", verbose=0, dry_run=0, owner=None, group=None, ): """Create a tar file from all the files under 'base_dir'. This file may be compressed. :param compress: Compression algorithms. Supported algorithms are: 'gzip': (the...
python
def make_tarball( base_name, base_dir, compress="gzip", verbose=0, dry_run=0, owner=None, group=None, ): """Create a tar file from all the files under 'base_dir'. This file may be compressed. :param compress: Compression algorithms. Supported algorithms are: 'gzip': (the...
[ "def", "make_tarball", "(", "base_name", ",", "base_dir", ",", "compress", "=", "\"gzip\"", ",", "verbose", "=", "0", ",", "dry_run", "=", "0", ",", "owner", "=", "None", ",", "group", "=", "None", ",", ")", ":", "# XXX GNU tar 1.13 has a nifty option to add...
Create a tar file from all the files under 'base_dir'. This file may be compressed. :param compress: Compression algorithms. Supported algorithms are: 'gzip': (the default) 'compress' 'bzip2' None For 'gzip' and 'bzip2' the internal tarfile module will be used. For 'comp...
[ "Create", "a", "tar", "file", "from", "all", "the", "files", "under", "base_dir", ".", "This", "file", "may", "be", "compressed", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/setup_helper.py#L70-L153
train
paramiko/paramiko
paramiko/kex_gss.py
KexGSSGroup1.start_kex
def start_kex(self): """ Start the GSS-API / SSPI Authenticated Diffie-Hellman Key Exchange. """ self._generate_x() if self.transport.server_mode: # compute f = g^x mod p, but don't send it yet self.f = pow(self.G, self.x, self.P) self.transpor...
python
def start_kex(self): """ Start the GSS-API / SSPI Authenticated Diffie-Hellman Key Exchange. """ self._generate_x() if self.transport.server_mode: # compute f = g^x mod p, but don't send it yet self.f = pow(self.G, self.x, self.P) self.transpor...
[ "def", "start_kex", "(", "self", ")", ":", "self", ".", "_generate_x", "(", ")", "if", "self", ".", "transport", ".", "server_mode", ":", "# compute f = g^x mod p, but don't send it yet", "self", ".", "f", "=", "pow", "(", "self", ".", "G", ",", "self", "....
Start the GSS-API / SSPI Authenticated Diffie-Hellman Key Exchange.
[ "Start", "the", "GSS", "-", "API", "/", "SSPI", "Authenticated", "Diffie", "-", "Hellman", "Key", "Exchange", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L91-L115
train
paramiko/paramiko
paramiko/kex_gss.py
KexGSSGroup1.parse_next
def parse_next(self, ptype, m): """ Parse the next packet. :param ptype: The (string) type of the incoming packet :param `.Message` m: The paket content """ if self.transport.server_mode and (ptype == MSG_KEXGSS_INIT): return self._parse_kexgss_init(m) ...
python
def parse_next(self, ptype, m): """ Parse the next packet. :param ptype: The (string) type of the incoming packet :param `.Message` m: The paket content """ if self.transport.server_mode and (ptype == MSG_KEXGSS_INIT): return self._parse_kexgss_init(m) ...
[ "def", "parse_next", "(", "self", ",", "ptype", ",", "m", ")", ":", "if", "self", ".", "transport", ".", "server_mode", "and", "(", "ptype", "==", "MSG_KEXGSS_INIT", ")", ":", "return", "self", ".", "_parse_kexgss_init", "(", "m", ")", "elif", "not", "...
Parse the next packet. :param ptype: The (string) type of the incoming packet :param `.Message` m: The paket content
[ "Parse", "the", "next", "packet", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L117-L135
train
paramiko/paramiko
paramiko/kex_gss.py
KexGSSGroup1._parse_kexgss_hostkey
def _parse_kexgss_hostkey(self, m): """ Parse the SSH2_MSG_KEXGSS_HOSTKEY message (client mode). :param `.Message` m: The content of the SSH2_MSG_KEXGSS_HOSTKEY message """ # client mode host_key = m.get_string() self.transport.host_key = host_key sig = m...
python
def _parse_kexgss_hostkey(self, m): """ Parse the SSH2_MSG_KEXGSS_HOSTKEY message (client mode). :param `.Message` m: The content of the SSH2_MSG_KEXGSS_HOSTKEY message """ # client mode host_key = m.get_string() self.transport.host_key = host_key sig = m...
[ "def", "_parse_kexgss_hostkey", "(", "self", ",", "m", ")", ":", "# client mode", "host_key", "=", "m", ".", "get_string", "(", ")", "self", ".", "transport", ".", "host_key", "=", "host_key", "sig", "=", "m", ".", "get_string", "(", ")", "self", ".", ...
Parse the SSH2_MSG_KEXGSS_HOSTKEY message (client mode). :param `.Message` m: The content of the SSH2_MSG_KEXGSS_HOSTKEY message
[ "Parse", "the", "SSH2_MSG_KEXGSS_HOSTKEY", "message", "(", "client", "mode", ")", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L155-L166
train
paramiko/paramiko
paramiko/kex_gss.py
KexGSSGroup1._parse_kexgss_continue
def _parse_kexgss_continue(self, m): """ Parse the SSH2_MSG_KEXGSS_CONTINUE message. :param `.Message` m: The content of the SSH2_MSG_KEXGSS_CONTINUE message """ if not self.transport.server_mode: srv_token = m.get_string() m = Message() ...
python
def _parse_kexgss_continue(self, m): """ Parse the SSH2_MSG_KEXGSS_CONTINUE message. :param `.Message` m: The content of the SSH2_MSG_KEXGSS_CONTINUE message """ if not self.transport.server_mode: srv_token = m.get_string() m = Message() ...
[ "def", "_parse_kexgss_continue", "(", "self", ",", "m", ")", ":", "if", "not", "self", ".", "transport", ".", "server_mode", ":", "srv_token", "=", "m", ".", "get_string", "(", ")", "m", "=", "Message", "(", ")", "m", ".", "add_byte", "(", "c_MSG_KEXGS...
Parse the SSH2_MSG_KEXGSS_CONTINUE message. :param `.Message` m: The content of the SSH2_MSG_KEXGSS_CONTINUE message
[ "Parse", "the", "SSH2_MSG_KEXGSS_CONTINUE", "message", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L168-L189
train
paramiko/paramiko
paramiko/kex_gss.py
KexGSSGroup1._parse_kexgss_complete
def _parse_kexgss_complete(self, m): """ Parse the SSH2_MSG_KEXGSS_COMPLETE message (client mode). :param `.Message` m: The content of the SSH2_MSG_KEXGSS_COMPLETE message """ # client mode if self.transport.host_key is None: self.transport.host_k...
python
def _parse_kexgss_complete(self, m): """ Parse the SSH2_MSG_KEXGSS_COMPLETE message (client mode). :param `.Message` m: The content of the SSH2_MSG_KEXGSS_COMPLETE message """ # client mode if self.transport.host_key is None: self.transport.host_k...
[ "def", "_parse_kexgss_complete", "(", "self", ",", "m", ")", ":", "# client mode", "if", "self", ".", "transport", ".", "host_key", "is", "None", ":", "self", ".", "transport", ".", "host_key", "=", "NullHostKey", "(", ")", "self", ".", "f", "=", "m", ...
Parse the SSH2_MSG_KEXGSS_COMPLETE message (client mode). :param `.Message` m: The content of the SSH2_MSG_KEXGSS_COMPLETE message
[ "Parse", "the", "SSH2_MSG_KEXGSS_COMPLETE", "message", "(", "client", "mode", ")", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L191-L234
train
paramiko/paramiko
paramiko/kex_gss.py
KexGSSGroup1._parse_kexgss_init
def _parse_kexgss_init(self, m): """ Parse the SSH2_MSG_KEXGSS_INIT message (server mode). :param `.Message` m: The content of the SSH2_MSG_KEXGSS_INIT message """ # server mode client_token = m.get_string() self.e = m.get_mpint() if (self.e < 1) or (self...
python
def _parse_kexgss_init(self, m): """ Parse the SSH2_MSG_KEXGSS_INIT message (server mode). :param `.Message` m: The content of the SSH2_MSG_KEXGSS_INIT message """ # server mode client_token = m.get_string() self.e = m.get_mpint() if (self.e < 1) or (self...
[ "def", "_parse_kexgss_init", "(", "self", ",", "m", ")", ":", "# server mode", "client_token", "=", "m", ".", "get_string", "(", ")", "self", ".", "e", "=", "m", ".", "get_mpint", "(", ")", "if", "(", "self", ".", "e", "<", "1", ")", "or", "(", "...
Parse the SSH2_MSG_KEXGSS_INIT message (server mode). :param `.Message` m: The content of the SSH2_MSG_KEXGSS_INIT message
[ "Parse", "the", "SSH2_MSG_KEXGSS_INIT", "message", "(", "server", "mode", ")", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L236-L290
train
paramiko/paramiko
paramiko/kex_gss.py
KexGSSGex.start_kex
def start_kex(self): """ Start the GSS-API / SSPI Authenticated Diffie-Hellman Group Exchange """ if self.transport.server_mode: self.transport._expect_packet(MSG_KEXGSS_GROUPREQ) return # request a bit range: we accept (min_bits) to (max_bits), but prefer...
python
def start_kex(self): """ Start the GSS-API / SSPI Authenticated Diffie-Hellman Group Exchange """ if self.transport.server_mode: self.transport._expect_packet(MSG_KEXGSS_GROUPREQ) return # request a bit range: we accept (min_bits) to (max_bits), but prefer...
[ "def", "start_kex", "(", "self", ")", ":", "if", "self", ".", "transport", ".", "server_mode", ":", "self", ".", "transport", ".", "_expect_packet", "(", "MSG_KEXGSS_GROUPREQ", ")", "return", "# request a bit range: we accept (min_bits) to (max_bits), but prefer", "# (p...
Start the GSS-API / SSPI Authenticated Diffie-Hellman Group Exchange
[ "Start", "the", "GSS", "-", "API", "/", "SSPI", "Authenticated", "Diffie", "-", "Hellman", "Group", "Exchange" ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L353-L370
train
paramiko/paramiko
paramiko/kex_gss.py
KexGSSGex.parse_next
def parse_next(self, ptype, m): """ Parse the next packet. :param ptype: The (string) type of the incoming packet :param `.Message` m: The paket content """ if ptype == MSG_KEXGSS_GROUPREQ: return self._parse_kexgss_groupreq(m) elif ptype == MSG_KEXGS...
python
def parse_next(self, ptype, m): """ Parse the next packet. :param ptype: The (string) type of the incoming packet :param `.Message` m: The paket content """ if ptype == MSG_KEXGSS_GROUPREQ: return self._parse_kexgss_groupreq(m) elif ptype == MSG_KEXGS...
[ "def", "parse_next", "(", "self", ",", "ptype", ",", "m", ")", ":", "if", "ptype", "==", "MSG_KEXGSS_GROUPREQ", ":", "return", "self", ".", "_parse_kexgss_groupreq", "(", "m", ")", "elif", "ptype", "==", "MSG_KEXGSS_GROUP", ":", "return", "self", ".", "_pa...
Parse the next packet. :param ptype: The (string) type of the incoming packet :param `.Message` m: The paket content
[ "Parse", "the", "next", "packet", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L372-L394
train
paramiko/paramiko
paramiko/kex_gss.py
KexGSSGex._parse_kexgss_group
def _parse_kexgss_group(self, m): """ Parse the SSH2_MSG_KEXGSS_GROUP message (client mode). :param `Message` m: The content of the SSH2_MSG_KEXGSS_GROUP message """ self.p = m.get_mpint() self.g = m.get_mpint() # reject if p's bit length < 1024 or > 8192 ...
python
def _parse_kexgss_group(self, m): """ Parse the SSH2_MSG_KEXGSS_GROUP message (client mode). :param `Message` m: The content of the SSH2_MSG_KEXGSS_GROUP message """ self.p = m.get_mpint() self.g = m.get_mpint() # reject if p's bit length < 1024 or > 8192 ...
[ "def", "_parse_kexgss_group", "(", "self", ",", "m", ")", ":", "self", ".", "p", "=", "m", ".", "get_mpint", "(", ")", "self", ".", "g", "=", "m", ".", "get_mpint", "(", ")", "# reject if p's bit length < 1024 or > 8192", "bitlen", "=", "util", ".", "bit...
Parse the SSH2_MSG_KEXGSS_GROUP message (client mode). :param `Message` m: The content of the SSH2_MSG_KEXGSS_GROUP message
[ "Parse", "the", "SSH2_MSG_KEXGSS_GROUP", "message", "(", "client", "mode", ")", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L460-L491
train
paramiko/paramiko
paramiko/kex_gss.py
KexGSSGex._parse_kexgss_complete
def _parse_kexgss_complete(self, m): """ Parse the SSH2_MSG_KEXGSS_COMPLETE message (client mode). :param `Message` m: The content of the SSH2_MSG_KEXGSS_COMPLETE message """ if self.transport.host_key is None: self.transport.host_key = NullHostKey() self.f =...
python
def _parse_kexgss_complete(self, m): """ Parse the SSH2_MSG_KEXGSS_COMPLETE message (client mode). :param `Message` m: The content of the SSH2_MSG_KEXGSS_COMPLETE message """ if self.transport.host_key is None: self.transport.host_key = NullHostKey() self.f =...
[ "def", "_parse_kexgss_complete", "(", "self", ",", "m", ")", ":", "if", "self", ".", "transport", ".", "host_key", "is", "None", ":", "self", ".", "transport", ".", "host_key", "=", "NullHostKey", "(", ")", "self", ".", "f", "=", "m", ".", "get_mpint",...
Parse the SSH2_MSG_KEXGSS_COMPLETE message (client mode). :param `Message` m: The content of the SSH2_MSG_KEXGSS_COMPLETE message
[ "Parse", "the", "SSH2_MSG_KEXGSS_COMPLETE", "message", "(", "client", "mode", ")", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L590-L638
train
paramiko/paramiko
paramiko/kex_gss.py
KexGSSGex._parse_kexgss_error
def _parse_kexgss_error(self, m): """ Parse the SSH2_MSG_KEXGSS_ERROR message (client mode). The server may send a GSS-API error message. if it does, we display the error by throwing an exception (client mode). :param `Message` m: The content of the SSH2_MSG_KEXGSS_ERROR messag...
python
def _parse_kexgss_error(self, m): """ Parse the SSH2_MSG_KEXGSS_ERROR message (client mode). The server may send a GSS-API error message. if it does, we display the error by throwing an exception (client mode). :param `Message` m: The content of the SSH2_MSG_KEXGSS_ERROR messag...
[ "def", "_parse_kexgss_error", "(", "self", ",", "m", ")", ":", "maj_status", "=", "m", ".", "get_int", "(", ")", "min_status", "=", "m", ".", "get_int", "(", ")", "err_msg", "=", "m", ".", "get_string", "(", ")", "m", ".", "get_string", "(", ")", "...
Parse the SSH2_MSG_KEXGSS_ERROR message (client mode). The server may send a GSS-API error message. if it does, we display the error by throwing an exception (client mode). :param `Message` m: The content of the SSH2_MSG_KEXGSS_ERROR message :raise SSHException: Contains GSS-API major ...
[ "Parse", "the", "SSH2_MSG_KEXGSS_ERROR", "message", "(", "client", "mode", ")", ".", "The", "server", "may", "send", "a", "GSS", "-", "API", "error", "message", ".", "if", "it", "does", "we", "display", "the", "error", "by", "throwing", "an", "exception", ...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L640-L663
train
paramiko/paramiko
paramiko/sftp_attr.py
SFTPAttributes.from_stat
def from_stat(cls, obj, filename=None): """ Create an `.SFTPAttributes` object from an existing ``stat`` object (an object returned by `os.stat`). :param object obj: an object returned by `os.stat` (or equivalent). :param str filename: the filename associated with this file. ...
python
def from_stat(cls, obj, filename=None): """ Create an `.SFTPAttributes` object from an existing ``stat`` object (an object returned by `os.stat`). :param object obj: an object returned by `os.stat` (or equivalent). :param str filename: the filename associated with this file. ...
[ "def", "from_stat", "(", "cls", ",", "obj", ",", "filename", "=", "None", ")", ":", "attr", "=", "cls", "(", ")", "attr", ".", "st_size", "=", "obj", ".", "st_size", "attr", ".", "st_uid", "=", "obj", ".", "st_uid", "attr", ".", "st_gid", "=", "o...
Create an `.SFTPAttributes` object from an existing ``stat`` object (an object returned by `os.stat`). :param object obj: an object returned by `os.stat` (or equivalent). :param str filename: the filename associated with this file. :return: new `.SFTPAttributes` object with the same att...
[ "Create", "an", ".", "SFTPAttributes", "object", "from", "an", "existing", "stat", "object", "(", "an", "object", "returned", "by", "os", ".", "stat", ")", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_attr.py#L64-L82
train
paramiko/paramiko
paramiko/rsakey.py
RSAKey.generate
def generate(bits, progress_func=None): """ Generate a new private RSA key. This factory function can be used to generate a new host key or authentication key. :param int bits: number of bits the generated key should be. :param progress_func: Unused :return: new `.RSAKe...
python
def generate(bits, progress_func=None): """ Generate a new private RSA key. This factory function can be used to generate a new host key or authentication key. :param int bits: number of bits the generated key should be. :param progress_func: Unused :return: new `.RSAKe...
[ "def", "generate", "(", "bits", ",", "progress_func", "=", "None", ")", ":", "key", "=", "rsa", ".", "generate_private_key", "(", "public_exponent", "=", "65537", ",", "key_size", "=", "bits", ",", "backend", "=", "default_backend", "(", ")", ")", "return"...
Generate a new private RSA key. This factory function can be used to generate a new host key or authentication key. :param int bits: number of bits the generated key should be. :param progress_func: Unused :return: new `.RSAKey` private key
[ "Generate", "a", "new", "private", "RSA", "key", ".", "This", "factory", "function", "can", "be", "used", "to", "generate", "a", "new", "host", "key", "or", "authentication", "key", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/rsakey.py#L158-L170
train
paramiko/paramiko
paramiko/sftp_file.py
SFTPFile._data_in_prefetch_buffers
def _data_in_prefetch_buffers(self, offset): """ if a block of data is present in the prefetch buffers, at the given offset, return the offset of the relevant prefetch buffer. otherwise, return None. this guarantees nothing about the number of bytes collected in the prefetch bu...
python
def _data_in_prefetch_buffers(self, offset): """ if a block of data is present in the prefetch buffers, at the given offset, return the offset of the relevant prefetch buffer. otherwise, return None. this guarantees nothing about the number of bytes collected in the prefetch bu...
[ "def", "_data_in_prefetch_buffers", "(", "self", ",", "offset", ")", ":", "k", "=", "[", "i", "for", "i", "in", "self", ".", "_prefetch_data", ".", "keys", "(", ")", "if", "i", "<=", "offset", "]", "if", "len", "(", "k", ")", "==", "0", ":", "ret...
if a block of data is present in the prefetch buffers, at the given offset, return the offset of the relevant prefetch buffer. otherwise, return None. this guarantees nothing about the number of bytes collected in the prefetch buffer so far.
[ "if", "a", "block", "of", "data", "is", "present", "in", "the", "prefetch", "buffers", "at", "the", "given", "offset", "return", "the", "offset", "of", "the", "relevant", "prefetch", "buffer", ".", "otherwise", "return", "None", ".", "this", "guarantees", ...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L132-L147
train
paramiko/paramiko
paramiko/sftp_file.py
SFTPFile.seek
def seek(self, offset, whence=0): """ Set the file's current position. See `file.seek` for details. """ self.flush() if whence == self.SEEK_SET: self._realpos = self._pos = offset elif whence == self.SEEK_CUR: self._pos += offset ...
python
def seek(self, offset, whence=0): """ Set the file's current position. See `file.seek` for details. """ self.flush() if whence == self.SEEK_SET: self._realpos = self._pos = offset elif whence == self.SEEK_CUR: self._pos += offset ...
[ "def", "seek", "(", "self", ",", "offset", ",", "whence", "=", "0", ")", ":", "self", ".", "flush", "(", ")", "if", "whence", "==", "self", ".", "SEEK_SET", ":", "self", ".", "_realpos", "=", "self", ".", "_pos", "=", "offset", "elif", "whence", ...
Set the file's current position. See `file.seek` for details.
[ "Set", "the", "file", "s", "current", "position", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L258-L272
train
paramiko/paramiko
paramiko/sftp_file.py
SFTPFile.stat
def stat(self): """ Retrieve information about this file from the remote system. This is exactly like `.SFTPClient.stat`, except that it operates on an already-open file. :returns: an `.SFTPAttributes` object containing attributes about this file. """ ...
python
def stat(self): """ Retrieve information about this file from the remote system. This is exactly like `.SFTPClient.stat`, except that it operates on an already-open file. :returns: an `.SFTPAttributes` object containing attributes about this file. """ ...
[ "def", "stat", "(", "self", ")", ":", "t", ",", "msg", "=", "self", ".", "sftp", ".", "_request", "(", "CMD_FSTAT", ",", "self", ".", "handle", ")", "if", "t", "!=", "CMD_ATTRS", ":", "raise", "SFTPError", "(", "\"Expected attributes\"", ")", "return",...
Retrieve information about this file from the remote system. This is exactly like `.SFTPClient.stat`, except that it operates on an already-open file. :returns: an `.SFTPAttributes` object containing attributes about this file.
[ "Retrieve", "information", "about", "this", "file", "from", "the", "remote", "system", ".", "This", "is", "exactly", "like", ".", "SFTPClient", ".", "stat", "except", "that", "it", "operates", "on", "an", "already", "-", "open", "file", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L274-L286
train
paramiko/paramiko
paramiko/sftp_file.py
SFTPFile.truncate
def truncate(self, size): """ Change the size of this file. This usually extends or shrinks the size of the file, just like the ``truncate()`` method on Python file objects. :param size: the new size of the file """ self.sftp._log( DEBUG, "truncate({...
python
def truncate(self, size): """ Change the size of this file. This usually extends or shrinks the size of the file, just like the ``truncate()`` method on Python file objects. :param size: the new size of the file """ self.sftp._log( DEBUG, "truncate({...
[ "def", "truncate", "(", "self", ",", "size", ")", ":", "self", ".", "sftp", ".", "_log", "(", "DEBUG", ",", "\"truncate({}, {!r})\"", ".", "format", "(", "hexlify", "(", "self", ".", "handle", ")", ",", "size", ")", ")", "attr", "=", "SFTPAttributes", ...
Change the size of this file. This usually extends or shrinks the size of the file, just like the ``truncate()`` method on Python file objects. :param size: the new size of the file
[ "Change", "the", "size", "of", "this", "file", ".", "This", "usually", "extends", "or", "shrinks", "the", "size", "of", "the", "file", "just", "like", "the", "truncate", "()", "method", "on", "Python", "file", "objects", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L343-L356
train
paramiko/paramiko
paramiko/sftp_file.py
SFTPFile.check
def check(self, hash_algorithm, offset=0, length=0, block_size=0): """ Ask the server for a hash of a section of this file. This can be used to verify a successful upload or download, or for various rsync-like operations. The file is hashed from ``offset``, for ``length`` bytes...
python
def check(self, hash_algorithm, offset=0, length=0, block_size=0): """ Ask the server for a hash of a section of this file. This can be used to verify a successful upload or download, or for various rsync-like operations. The file is hashed from ``offset``, for ``length`` bytes...
[ "def", "check", "(", "self", ",", "hash_algorithm", ",", "offset", "=", "0", ",", "length", "=", "0", ",", "block_size", "=", "0", ")", ":", "t", ",", "msg", "=", "self", ".", "sftp", ".", "_request", "(", "CMD_EXTENDED", ",", "\"check-file\"", ",", ...
Ask the server for a hash of a section of this file. This can be used to verify a successful upload or download, or for various rsync-like operations. The file is hashed from ``offset``, for ``length`` bytes. If ``length`` is 0, the remainder of the file is hashed. Thus, if both ...
[ "Ask", "the", "server", "for", "a", "hash", "of", "a", "section", "of", "this", "file", ".", "This", "can", "be", "used", "to", "verify", "a", "successful", "upload", "or", "download", "or", "for", "various", "rsync", "-", "like", "operations", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L358-L416
train
paramiko/paramiko
paramiko/sftp_file.py
SFTPFile.prefetch
def prefetch(self, file_size=None): """ Pre-fetch the remaining contents of this file in anticipation of future `.read` calls. If reading the entire file, pre-fetching can dramatically improve the download speed by avoiding roundtrip latency. The file's contents are incrementall...
python
def prefetch(self, file_size=None): """ Pre-fetch the remaining contents of this file in anticipation of future `.read` calls. If reading the entire file, pre-fetching can dramatically improve the download speed by avoiding roundtrip latency. The file's contents are incrementall...
[ "def", "prefetch", "(", "self", ",", "file_size", "=", "None", ")", ":", "if", "file_size", "is", "None", ":", "file_size", "=", "self", ".", "stat", "(", ")", ".", "st_size", "# queue up async reads for the rest of the file", "chunks", "=", "[", "]", "n", ...
Pre-fetch the remaining contents of this file in anticipation of future `.read` calls. If reading the entire file, pre-fetching can dramatically improve the download speed by avoiding roundtrip latency. The file's contents are incrementally buffered in a background thread. The prefetch...
[ "Pre", "-", "fetch", "the", "remaining", "contents", "of", "this", "file", "in", "anticipation", "of", "future", ".", "read", "calls", ".", "If", "reading", "the", "entire", "file", "pre", "-", "fetching", "can", "dramatically", "improve", "the", "download",...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L438-L476
train
paramiko/paramiko
paramiko/sftp_file.py
SFTPFile.readv
def readv(self, chunks): """ Read a set of blocks from the file by (offset, length). This is more efficient than doing a series of `.seek` and `.read` calls, since the prefetch machinery is used to retrieve all the requested blocks at once. :param chunks: a ...
python
def readv(self, chunks): """ Read a set of blocks from the file by (offset, length). This is more efficient than doing a series of `.seek` and `.read` calls, since the prefetch machinery is used to retrieve all the requested blocks at once. :param chunks: a ...
[ "def", "readv", "(", "self", ",", "chunks", ")", ":", "self", ".", "sftp", ".", "_log", "(", "DEBUG", ",", "\"readv({}, {!r})\"", ".", "format", "(", "hexlify", "(", "self", ".", "handle", ")", ",", "chunks", ")", ")", "read_chunks", "=", "[", "]", ...
Read a set of blocks from the file by (offset, length). This is more efficient than doing a series of `.seek` and `.read` calls, since the prefetch machinery is used to retrieve all the requested blocks at once. :param chunks: a list of ``(offset, length)`` tuples indicatin...
[ "Read", "a", "set", "of", "blocks", "from", "the", "file", "by", "(", "offset", "length", ")", ".", "This", "is", "more", "efficient", "than", "doing", "a", "series", "of", ".", "seek", "and", ".", "read", "calls", "since", "the", "prefetch", "machiner...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L478-L515
train
paramiko/paramiko
paramiko/sftp_file.py
SFTPFile._check_exception
def _check_exception(self): """if there's a saved exception, raise & clear it""" if self._saved_exception is not None: x = self._saved_exception self._saved_exception = None raise x
python
def _check_exception(self): """if there's a saved exception, raise & clear it""" if self._saved_exception is not None: x = self._saved_exception self._saved_exception = None raise x
[ "def", "_check_exception", "(", "self", ")", ":", "if", "self", ".", "_saved_exception", "is", "not", "None", ":", "x", "=", "self", ".", "_saved_exception", "self", ".", "_saved_exception", "=", "None", "raise", "x" ]
if there's a saved exception, raise & clear it
[ "if", "there", "s", "a", "saved", "exception", "raise", "&", "clear", "it" ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L565-L570
train
paramiko/paramiko
paramiko/channel.py
open_only
def open_only(func): """ Decorator for `.Channel` methods which performs an openness check. :raises: `.SSHException` -- If the wrapped method is called on an unopened `.Channel`. """ @wraps(func) def _check(self, *args, **kwds): if ( self.closed ...
python
def open_only(func): """ Decorator for `.Channel` methods which performs an openness check. :raises: `.SSHException` -- If the wrapped method is called on an unopened `.Channel`. """ @wraps(func) def _check(self, *args, **kwds): if ( self.closed ...
[ "def", "open_only", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "_check", "(", "self", ",", "*", "args", ",", "*", "*", "kwds", ")", ":", "if", "(", "self", ".", "closed", "or", "self", ".", "eof_received", "or", "self", ".", ...
Decorator for `.Channel` methods which performs an openness check. :raises: `.SSHException` -- If the wrapped method is called on an unopened `.Channel`.
[ "Decorator", "for", ".", "Channel", "methods", "which", "performs", "an", "openness", "check", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L54-L74
train
paramiko/paramiko
paramiko/channel.py
Channel.exec_command
def exec_command(self, command): """ Execute a command on the server. If the server allows it, the channel will then be directly connected to the stdin, stdout, and stderr of the command being executed. When the command finishes executing, the channel will be closed and ...
python
def exec_command(self, command): """ Execute a command on the server. If the server allows it, the channel will then be directly connected to the stdin, stdout, and stderr of the command being executed. When the command finishes executing, the channel will be closed and ...
[ "def", "exec_command", "(", "self", ",", "command", ")", ":", "m", "=", "Message", "(", ")", "m", ".", "add_byte", "(", "cMSG_CHANNEL_REQUEST", ")", "m", ".", "add_int", "(", "self", ".", "remote_chanid", ")", "m", ".", "add_string", "(", "\"exec\"", "...
Execute a command on the server. If the server allows it, the channel will then be directly connected to the stdin, stdout, and stderr of the command being executed. When the command finishes executing, the channel will be closed and can't be reused. You must open a new channel if you...
[ "Execute", "a", "command", "on", "the", "server", ".", "If", "the", "server", "allows", "it", "the", "channel", "will", "then", "be", "directly", "connected", "to", "the", "stdin", "stdout", "and", "stderr", "of", "the", "command", "being", "executed", "."...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L233-L257
train
paramiko/paramiko
paramiko/channel.py
Channel.resize_pty
def resize_pty(self, width=80, height=24, width_pixels=0, height_pixels=0): """ Resize the pseudo-terminal. This can be used to change the width and height of the terminal emulation created in a previous `get_pty` call. :param int width: new width (in characters) of the terminal screen...
python
def resize_pty(self, width=80, height=24, width_pixels=0, height_pixels=0): """ Resize the pseudo-terminal. This can be used to change the width and height of the terminal emulation created in a previous `get_pty` call. :param int width: new width (in characters) of the terminal screen...
[ "def", "resize_pty", "(", "self", ",", "width", "=", "80", ",", "height", "=", "24", ",", "width_pixels", "=", "0", ",", "height_pixels", "=", "0", ")", ":", "m", "=", "Message", "(", ")", "m", ".", "add_byte", "(", "cMSG_CHANNEL_REQUEST", ")", "m", ...
Resize the pseudo-terminal. This can be used to change the width and height of the terminal emulation created in a previous `get_pty` call. :param int width: new width (in characters) of the terminal screen :param int height: new height (in characters) of the terminal screen :param int...
[ "Resize", "the", "pseudo", "-", "terminal", ".", "This", "can", "be", "used", "to", "change", "the", "width", "and", "height", "of", "the", "terminal", "emulation", "created", "in", "a", "previous", "get_pty", "call", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L286-L309
train
paramiko/paramiko
paramiko/channel.py
Channel.update_environment
def update_environment(self, environment): """ Updates this channel's remote shell environment. .. note:: This operation is additive - i.e. the current environment is not reset before the given environment variables are set. .. warning:: Servers may ...
python
def update_environment(self, environment): """ Updates this channel's remote shell environment. .. note:: This operation is additive - i.e. the current environment is not reset before the given environment variables are set. .. warning:: Servers may ...
[ "def", "update_environment", "(", "self", ",", "environment", ")", ":", "for", "name", ",", "value", "in", "environment", ".", "items", "(", ")", ":", "try", ":", "self", ".", "set_environment_variable", "(", "name", ",", "value", ")", "except", "SSHExcept...
Updates this channel's remote shell environment. .. note:: This operation is additive - i.e. the current environment is not reset before the given environment variables are set. .. warning:: Servers may silently reject some environment variables; see the ...
[ "Updates", "this", "channel", "s", "remote", "shell", "environment", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L312-L335
train
paramiko/paramiko
paramiko/channel.py
Channel.set_environment_variable
def set_environment_variable(self, name, value): """ Set the value of an environment variable. .. warning:: The server may reject this request depending on its ``AcceptEnv`` setting; such rejections will fail silently (which is common client practice for this...
python
def set_environment_variable(self, name, value): """ Set the value of an environment variable. .. warning:: The server may reject this request depending on its ``AcceptEnv`` setting; such rejections will fail silently (which is common client practice for this...
[ "def", "set_environment_variable", "(", "self", ",", "name", ",", "value", ")", ":", "m", "=", "Message", "(", ")", "m", ".", "add_byte", "(", "cMSG_CHANNEL_REQUEST", ")", "m", ".", "add_int", "(", "self", ".", "remote_chanid", ")", "m", ".", "add_string...
Set the value of an environment variable. .. warning:: The server may reject this request depending on its ``AcceptEnv`` setting; such rejections will fail silently (which is common client practice for this particular request type). Make sure you understand your ...
[ "Set", "the", "value", "of", "an", "environment", "variable", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L338-L362
train
paramiko/paramiko
paramiko/channel.py
Channel.recv_exit_status
def recv_exit_status(self): """ Return the exit status from the process on the server. This is mostly useful for retrieving the results of an `exec_command`. If the command hasn't finished yet, this method will wait until it does, or until the channel is closed. If no exit stat...
python
def recv_exit_status(self): """ Return the exit status from the process on the server. This is mostly useful for retrieving the results of an `exec_command`. If the command hasn't finished yet, this method will wait until it does, or until the channel is closed. If no exit stat...
[ "def", "recv_exit_status", "(", "self", ")", ":", "self", ".", "status_event", ".", "wait", "(", ")", "assert", "self", ".", "status_event", ".", "is_set", "(", ")", "return", "self", ".", "exit_status" ]
Return the exit status from the process on the server. This is mostly useful for retrieving the results of an `exec_command`. If the command hasn't finished yet, this method will wait until it does, or until the channel is closed. If no exit status is provided by the server, -1 is retu...
[ "Return", "the", "exit", "status", "from", "the", "process", "on", "the", "server", ".", "This", "is", "mostly", "useful", "for", "retrieving", "the", "results", "of", "an", "exec_command", ".", "If", "the", "command", "hasn", "t", "finished", "yet", "this...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L379-L404
train
paramiko/paramiko
paramiko/channel.py
Channel.request_x11
def request_x11( self, screen_number=0, auth_protocol=None, auth_cookie=None, single_connection=False, handler=None, ): """ Request an x11 session on this channel. If the server allows it, further x11 requests can be made from the server to th...
python
def request_x11( self, screen_number=0, auth_protocol=None, auth_cookie=None, single_connection=False, handler=None, ): """ Request an x11 session on this channel. If the server allows it, further x11 requests can be made from the server to th...
[ "def", "request_x11", "(", "self", ",", "screen_number", "=", "0", ",", "auth_protocol", "=", "None", ",", "auth_cookie", "=", "None", ",", "single_connection", "=", "False", ",", "handler", "=", "None", ",", ")", ":", "if", "auth_protocol", "is", "None", ...
Request an x11 session on this channel. If the server allows it, further x11 requests can be made from the server to the client, when an x11 application is run in a shell session. From :rfc:`4254`:: It is RECOMMENDED that the 'x11 authentication cookie' that is sent be...
[ "Request", "an", "x11", "session", "on", "this", "channel", ".", "If", "the", "server", "allows", "it", "further", "x11", "requests", "can", "be", "made", "from", "the", "server", "to", "the", "client", "when", "an", "x11", "application", "is", "run", "i...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L428-L492
train
paramiko/paramiko
paramiko/channel.py
Channel.request_forward_agent
def request_forward_agent(self, handler): """ Request for a forward SSH Agent on this channel. This is only valid for an ssh-agent from OpenSSH !!! :param handler: a required callable handler to use for incoming SSH Agent connections :return: True if we ...
python
def request_forward_agent(self, handler): """ Request for a forward SSH Agent on this channel. This is only valid for an ssh-agent from OpenSSH !!! :param handler: a required callable handler to use for incoming SSH Agent connections :return: True if we ...
[ "def", "request_forward_agent", "(", "self", ",", "handler", ")", ":", "m", "=", "Message", "(", ")", "m", ".", "add_byte", "(", "cMSG_CHANNEL_REQUEST", ")", "m", ".", "add_int", "(", "self", ".", "remote_chanid", ")", "m", ".", "add_string", "(", "\"aut...
Request for a forward SSH Agent on this channel. This is only valid for an ssh-agent from OpenSSH !!! :param handler: a required callable handler to use for incoming SSH Agent connections :return: True if we are ok, else False (at that time we always return ...
[ "Request", "for", "a", "forward", "SSH", "Agent", "on", "this", "channel", ".", "This", "is", "only", "valid", "for", "an", "ssh", "-", "agent", "from", "OpenSSH", "!!!" ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L495-L516
train
paramiko/paramiko
paramiko/channel.py
Channel.set_combine_stderr
def set_combine_stderr(self, combine): """ Set whether stderr should be combined into stdout on this channel. The default is ``False``, but in some cases it may be convenient to have both streams combined. If this is ``False``, and `exec_command` is called (or ``invoke_shell`` ...
python
def set_combine_stderr(self, combine): """ Set whether stderr should be combined into stdout on this channel. The default is ``False``, but in some cases it may be convenient to have both streams combined. If this is ``False``, and `exec_command` is called (or ``invoke_shell`` ...
[ "def", "set_combine_stderr", "(", "self", ",", "combine", ")", ":", "data", "=", "bytes", "(", ")", "self", ".", "lock", ".", "acquire", "(", ")", "try", ":", "old", "=", "self", ".", "combine_stderr", "self", ".", "combine_stderr", "=", "combine", "if...
Set whether stderr should be combined into stdout on this channel. The default is ``False``, but in some cases it may be convenient to have both streams combined. If this is ``False``, and `exec_command` is called (or ``invoke_shell`` with no pty), output to stderr will not show up thro...
[ "Set", "whether", "stderr", "should", "be", "combined", "into", "stdout", "on", "this", "channel", ".", "The", "default", "is", "False", "but", "in", "some", "cases", "it", "may", "be", "convenient", "to", "have", "both", "streams", "combined", "." ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L551-L584
train
paramiko/paramiko
paramiko/channel.py
Channel.close
def close(self): """ Close the channel. All future read/write operations on the channel will fail. The remote end will receive no more data (after queued data is flushed). Channels are automatically closed when their `.Transport` is closed or when they are garbage collected. ...
python
def close(self): """ Close the channel. All future read/write operations on the channel will fail. The remote end will receive no more data (after queued data is flushed). Channels are automatically closed when their `.Transport` is closed or when they are garbage collected. ...
[ "def", "close", "(", "self", ")", ":", "self", ".", "lock", ".", "acquire", "(", ")", "try", ":", "# only close the pipe when the user explicitly closes the channel.", "# otherwise they will get unpleasant surprises. (and do it before", "# checking self.closed, since the remote ho...
Close the channel. All future read/write operations on the channel will fail. The remote end will receive no more data (after queued data is flushed). Channels are automatically closed when their `.Transport` is closed or when they are garbage collected.
[ "Close", "the", "channel", ".", "All", "future", "read", "/", "write", "operations", "on", "the", "channel", "will", "fail", ".", "The", "remote", "end", "will", "receive", "no", "more", "data", "(", "after", "queued", "data", "is", "flushed", ")", ".", ...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L647-L671
train
paramiko/paramiko
paramiko/channel.py
Channel.send_ready
def send_ready(self): """ Returns true if data can be written to this channel without blocking. This means the channel is either closed (so any write attempt would return immediately) or there is at least one byte of space in the outbound buffer. If there is at least one byte of ...
python
def send_ready(self): """ Returns true if data can be written to this channel without blocking. This means the channel is either closed (so any write attempt would return immediately) or there is at least one byte of space in the outbound buffer. If there is at least one byte of ...
[ "def", "send_ready", "(", "self", ")", ":", "self", ".", "lock", ".", "acquire", "(", ")", "try", ":", "if", "self", ".", "closed", "or", "self", ".", "eof_sent", ":", "return", "True", "return", "self", ".", "out_window_size", ">", "0", "finally", "...
Returns true if data can be written to this channel without blocking. This means the channel is either closed (so any write attempt would return immediately) or there is at least one byte of space in the outbound buffer. If there is at least one byte of space in the outbound buffer, a `s...
[ "Returns", "true", "if", "data", "can", "be", "written", "to", "this", "channel", "without", "blocking", ".", "This", "means", "the", "channel", "is", "either", "closed", "(", "so", "any", "write", "attempt", "would", "return", "immediately", ")", "or", "t...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L762-L781
train
paramiko/paramiko
paramiko/channel.py
Channel.send
def send(self, s): """ Send data to the channel. Returns the number of bytes sent, or 0 if the channel stream is closed. Applications are responsible for checking that all data has been sent: if only some of the data was transmitted, the application needs to attempt delivery of...
python
def send(self, s): """ Send data to the channel. Returns the number of bytes sent, or 0 if the channel stream is closed. Applications are responsible for checking that all data has been sent: if only some of the data was transmitted, the application needs to attempt delivery of...
[ "def", "send", "(", "self", ",", "s", ")", ":", "m", "=", "Message", "(", ")", "m", ".", "add_byte", "(", "cMSG_CHANNEL_DATA", ")", "m", ".", "add_int", "(", "self", ".", "remote_chanid", ")", "return", "self", ".", "_send", "(", "s", ",", "m", "...
Send data to the channel. Returns the number of bytes sent, or 0 if the channel stream is closed. Applications are responsible for checking that all data has been sent: if only some of the data was transmitted, the application needs to attempt delivery of the remaining data. :...
[ "Send", "data", "to", "the", "channel", ".", "Returns", "the", "number", "of", "bytes", "sent", "or", "0", "if", "the", "channel", "stream", "is", "closed", ".", "Applications", "are", "responsible", "for", "checking", "that", "all", "data", "has", "been",...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L783-L801
train
paramiko/paramiko
paramiko/channel.py
Channel.send_stderr
def send_stderr(self, s): """ Send data to the channel on the "stderr" stream. This is normally only used by servers to send output from shell commands -- clients won't use this. Returns the number of bytes sent, or 0 if the channel stream is closed. Applications are responsib...
python
def send_stderr(self, s): """ Send data to the channel on the "stderr" stream. This is normally only used by servers to send output from shell commands -- clients won't use this. Returns the number of bytes sent, or 0 if the channel stream is closed. Applications are responsib...
[ "def", "send_stderr", "(", "self", ",", "s", ")", ":", "m", "=", "Message", "(", ")", "m", ".", "add_byte", "(", "cMSG_CHANNEL_EXTENDED_DATA", ")", "m", ".", "add_int", "(", "self", ".", "remote_chanid", ")", "m", ".", "add_int", "(", "1", ")", "retu...
Send data to the channel on the "stderr" stream. This is normally only used by servers to send output from shell commands -- clients won't use this. Returns the number of bytes sent, or 0 if the channel stream is closed. Applications are responsible for checking that all data has been...
[ "Send", "data", "to", "the", "channel", "on", "the", "stderr", "stream", ".", "This", "is", "normally", "only", "used", "by", "servers", "to", "send", "output", "from", "shell", "commands", "--", "clients", "won", "t", "use", "this", ".", "Returns", "the...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L803-L825
train
paramiko/paramiko
paramiko/channel.py
Channel.sendall
def sendall(self, s): """ Send data to the channel, without allowing partial results. Unlike `send`, this method continues to send data from the given string until either all data has been sent or an error occurs. Nothing is returned. :param str s: data to send. :rais...
python
def sendall(self, s): """ Send data to the channel, without allowing partial results. Unlike `send`, this method continues to send data from the given string until either all data has been sent or an error occurs. Nothing is returned. :param str s: data to send. :rais...
[ "def", "sendall", "(", "self", ",", "s", ")", ":", "while", "s", ":", "sent", "=", "self", ".", "send", "(", "s", ")", "s", "=", "s", "[", "sent", ":", "]", "return", "None" ]
Send data to the channel, without allowing partial results. Unlike `send`, this method continues to send data from the given string until either all data has been sent or an error occurs. Nothing is returned. :param str s: data to send. :raises socket.timeout: if sending ...
[ "Send", "data", "to", "the", "channel", "without", "allowing", "partial", "results", ".", "Unlike", "send", "this", "method", "continues", "to", "send", "data", "from", "the", "given", "string", "until", "either", "all", "data", "has", "been", "sent", "or", ...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L827-L848
train
paramiko/paramiko
paramiko/channel.py
Channel.sendall_stderr
def sendall_stderr(self, s): """ Send data to the channel's "stderr" stream, without allowing partial results. Unlike `send_stderr`, this method continues to send data from the given string until all data has been sent or an error occurs. Nothing is returned. :param str...
python
def sendall_stderr(self, s): """ Send data to the channel's "stderr" stream, without allowing partial results. Unlike `send_stderr`, this method continues to send data from the given string until all data has been sent or an error occurs. Nothing is returned. :param str...
[ "def", "sendall_stderr", "(", "self", ",", "s", ")", ":", "while", "s", ":", "sent", "=", "self", ".", "send_stderr", "(", "s", ")", "s", "=", "s", "[", "sent", ":", "]", "return", "None" ]
Send data to the channel's "stderr" stream, without allowing partial results. Unlike `send_stderr`, this method continues to send data from the given string until all data has been sent or an error occurs. Nothing is returned. :param str s: data to send to the client as "stderr" output...
[ "Send", "data", "to", "the", "channel", "s", "stderr", "stream", "without", "allowing", "partial", "results", ".", "Unlike", "send_stderr", "this", "method", "continues", "to", "send", "data", "from", "the", "given", "string", "until", "all", "data", "has", ...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L850-L869
train
paramiko/paramiko
paramiko/channel.py
Channel.fileno
def fileno(self): """ Returns an OS-level file descriptor which can be used for polling, but but not for reading or writing. This is primarily to allow Python's ``select`` module to work. The first time ``fileno`` is called on a channel, a pipe is created to simulate re...
python
def fileno(self): """ Returns an OS-level file descriptor which can be used for polling, but but not for reading or writing. This is primarily to allow Python's ``select`` module to work. The first time ``fileno`` is called on a channel, a pipe is created to simulate re...
[ "def", "fileno", "(", "self", ")", ":", "self", ".", "lock", ".", "acquire", "(", ")", "try", ":", "if", "self", ".", "_pipe", "is", "not", "None", ":", "return", "self", ".", "_pipe", ".", "fileno", "(", ")", "# create the pipe and feed in any existing ...
Returns an OS-level file descriptor which can be used for polling, but but not for reading or writing. This is primarily to allow Python's ``select`` module to work. The first time ``fileno`` is called on a channel, a pipe is created to simulate real OS-level file descriptor (FD) behav...
[ "Returns", "an", "OS", "-", "level", "file", "descriptor", "which", "can", "be", "used", "for", "polling", "but", "but", "not", "for", "reading", "or", "writing", ".", "This", "is", "primarily", "to", "allow", "Python", "s", "select", "module", "to", "wo...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L898-L926
train
paramiko/paramiko
paramiko/channel.py
Channel.shutdown
def shutdown(self, how): """ Shut down one or both halves of the connection. If ``how`` is 0, further receives are disallowed. If ``how`` is 1, further sends are disallowed. If ``how`` is 2, further sends and receives are disallowed. This closes the stream in one or both dire...
python
def shutdown(self, how): """ Shut down one or both halves of the connection. If ``how`` is 0, further receives are disallowed. If ``how`` is 1, further sends are disallowed. If ``how`` is 2, further sends and receives are disallowed. This closes the stream in one or both dire...
[ "def", "shutdown", "(", "self", ",", "how", ")", ":", "if", "(", "how", "==", "0", ")", "or", "(", "how", "==", "2", ")", ":", "# feign \"read\" shutdown", "self", ".", "eof_received", "=", "1", "if", "(", "how", "==", "1", ")", "or", "(", "how",...
Shut down one or both halves of the connection. If ``how`` is 0, further receives are disallowed. If ``how`` is 1, further sends are disallowed. If ``how`` is 2, further sends and receives are disallowed. This closes the stream in one or both directions. :param int how: ...
[ "Shut", "down", "one", "or", "both", "halves", "of", "the", "connection", ".", "If", "how", "is", "0", "further", "receives", "are", "disallowed", ".", "If", "how", "is", "1", "further", "sends", "are", "disallowed", ".", "If", "how", "is", "2", "furth...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L928-L949
train
paramiko/paramiko
paramiko/channel.py
Channel._wait_for_send_window
def _wait_for_send_window(self, size): """ (You are already holding the lock.) Wait for the send window to open up, and allocate up to ``size`` bytes for transmission. If no space opens up before the timeout, a timeout exception is raised. Returns the number of bytes available ...
python
def _wait_for_send_window(self, size): """ (You are already holding the lock.) Wait for the send window to open up, and allocate up to ``size`` bytes for transmission. If no space opens up before the timeout, a timeout exception is raised. Returns the number of bytes available ...
[ "def", "_wait_for_send_window", "(", "self", ",", "size", ")", ":", "# you are already holding the lock", "if", "self", ".", "closed", "or", "self", ".", "eof_sent", ":", "return", "0", "if", "self", ".", "out_window_size", "==", "0", ":", "# should we block?", ...
(You are already holding the lock.) Wait for the send window to open up, and allocate up to ``size`` bytes for transmission. If no space opens up before the timeout, a timeout exception is raised. Returns the number of bytes available to send (may be less than requested).
[ "(", "You", "are", "already", "holding", "the", "lock", ".", ")", "Wait", "for", "the", "send", "window", "to", "open", "up", "and", "allocate", "up", "to", "size", "bytes", "for", "transmission", ".", "If", "no", "space", "opens", "up", "before", "the...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L1278-L1315
train
paramiko/paramiko
paramiko/sftp_server.py
SFTPServer.convert_errno
def convert_errno(e): """ Convert an errno value (as from an ``OSError`` or ``IOError``) into a standard SFTP result code. This is a convenience function for trapping exceptions in server code and returning an appropriate result. :param int e: an errno code, as from ``OSError.e...
python
def convert_errno(e): """ Convert an errno value (as from an ``OSError`` or ``IOError``) into a standard SFTP result code. This is a convenience function for trapping exceptions in server code and returning an appropriate result. :param int e: an errno code, as from ``OSError.e...
[ "def", "convert_errno", "(", "e", ")", ":", "if", "e", "==", "errno", ".", "EACCES", ":", "# permission denied", "return", "SFTP_PERMISSION_DENIED", "elif", "(", "e", "==", "errno", ".", "ENOENT", ")", "or", "(", "e", "==", "errno", ".", "ENOTDIR", ")", ...
Convert an errno value (as from an ``OSError`` or ``IOError``) into a standard SFTP result code. This is a convenience function for trapping exceptions in server code and returning an appropriate result. :param int e: an errno code, as from ``OSError.errno``. :return: an `int` SFTP err...
[ "Convert", "an", "errno", "value", "(", "as", "from", "an", "OSError", "or", "IOError", ")", "into", "a", "standard", "SFTP", "result", "code", ".", "This", "is", "a", "convenience", "function", "for", "trapping", "exceptions", "in", "server", "code", "and...
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_server.py#L180-L196
train
paramiko/paramiko
paramiko/sftp_server.py
SFTPServer._convert_pflags
def _convert_pflags(self, pflags): """convert SFTP-style open() flags to Python's os.open() flags""" if (pflags & SFTP_FLAG_READ) and (pflags & SFTP_FLAG_WRITE): flags = os.O_RDWR elif pflags & SFTP_FLAG_WRITE: flags = os.O_WRONLY else: flags = os.O_RD...
python
def _convert_pflags(self, pflags): """convert SFTP-style open() flags to Python's os.open() flags""" if (pflags & SFTP_FLAG_READ) and (pflags & SFTP_FLAG_WRITE): flags = os.O_RDWR elif pflags & SFTP_FLAG_WRITE: flags = os.O_WRONLY else: flags = os.O_RD...
[ "def", "_convert_pflags", "(", "self", ",", "pflags", ")", ":", "if", "(", "pflags", "&", "SFTP_FLAG_READ", ")", "and", "(", "pflags", "&", "SFTP_FLAG_WRITE", ")", ":", "flags", "=", "os", ".", "O_RDWR", "elif", "pflags", "&", "SFTP_FLAG_WRITE", ":", "fl...
convert SFTP-style open() flags to Python's os.open() flags
[ "convert", "SFTP", "-", "style", "open", "()", "flags", "to", "Python", "s", "os", ".", "open", "()", "flags" ]
cf7d49d66f3b1fbc8b0853518a54050182b3b5eb
https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_server.py#L360-L376
train