partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Question.get_answers | Get answers either from inner_hits already present or by searching
elasticsearch. | examples/parent_child.py | 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):
"""
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()) | [
"Get",
"answers",
"either",
"from",
"inner_hits",
"already",
"present",
"or",
"by",
"searching",
"elasticsearch",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/examples/parent_child.py#L130-L137 | [
"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",
... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Facet.get_aggregation | Return the aggregation object. | elasticsearch_dsl/faceted_search.py | 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):
"""
Return the aggregation object.
"""
agg = A(self.agg_type, **self._params)
if self._metric:
agg.metric('metric', self._metric)
return agg | [
"Return",
"the",
"aggregation",
"object",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L30-L37 | [
"def",
"get_aggregation",
"(",
"self",
")",
":",
"agg",
"=",
"A",
"(",
"self",
".",
"agg_type",
",",
"*",
"*",
"self",
".",
"_params",
")",
"if",
"self",
".",
"_metric",
":",
"agg",
".",
"metric",
"(",
"'metric'",
",",
"self",
".",
"_metric",
")",
... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Facet.add_filter | Construct a filter. | elasticsearch_dsl/faceted_search.py | 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):
"""
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 | [
"Construct",
"a",
"filter",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L39-L49 | [
"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",
":",
"]",
"... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Facet.get_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. | elasticsearch_dsl/faceted_search.py | 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):
"""
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... | [
"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",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L77-L91 | [
"def",
"get_values",
"(",
"self",
",",
"data",
",",
"filter_values",
")",
":",
"out",
"=",
"[",
"]",
"for",
"bucket",
"in",
"data",
".",
"buckets",
":",
"key",
"=",
"self",
".",
"get_value",
"(",
"bucket",
")",
"out",
".",
"append",
"(",
"(",
"key"... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | FacetedSearch.add_filter | Add a filter for a facet. | elasticsearch_dsl/faceted_search.py | 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):
"""
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... | [
"Add",
"a",
"filter",
"for",
"a",
"facet",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L283-L301 | [
"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... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | FacetedSearch.search | 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. | elasticsearch_dsl/faceted_search.py | 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):
"""
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.... | [
"Returns",
"the",
"base",
"Search",
"object",
"to",
"which",
"the",
"facets",
"are",
"added",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L303-L311 | [
"def",
"search",
"(",
"self",
")",
":",
"s",
"=",
"Search",
"(",
"doc_type",
"=",
"self",
".",
"doc_types",
",",
"index",
"=",
"self",
".",
"index",
",",
"using",
"=",
"self",
".",
"using",
")",
"return",
"s",
".",
"response_class",
"(",
"FacetedResp... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | FacetedSearch.query | Add query part to ``search``.
Override this if you wish to customize the query used. | elasticsearch_dsl/faceted_search.py | 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):
"""
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:
... | [
"Add",
"query",
"part",
"to",
"search",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L313-L324 | [
"def",
"query",
"(",
"self",
",",
"search",
",",
"query",
")",
":",
"if",
"query",
":",
"if",
"self",
".",
"fields",
":",
"return",
"search",
".",
"query",
"(",
"'multi_match'",
",",
"fields",
"=",
"self",
".",
"fields",
",",
"query",
"=",
"query",
... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | FacetedSearch.aggregate | Add aggregations representing the facets selected, including potential
filters. | elasticsearch_dsl/faceted_search.py | 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):
"""
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... | [
"Add",
"aggregations",
"representing",
"the",
"facets",
"selected",
"including",
"potential",
"filters",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L326-L342 | [
"def",
"aggregate",
"(",
"self",
",",
"search",
")",
":",
"for",
"f",
",",
"facet",
"in",
"iteritems",
"(",
"self",
".",
"facets",
")",
":",
"agg",
"=",
"facet",
".",
"get_aggregation",
"(",
")",
"agg_filter",
"=",
"MatchAll",
"(",
")",
"for",
"field... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | FacetedSearch.filter | Add a ``post_filter`` to the search request narrowing the results based
on the facet filters. | elasticsearch_dsl/faceted_search.py | 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):
"""
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 &=... | [
"Add",
"a",
"post_filter",
"to",
"the",
"search",
"request",
"narrowing",
"the",
"results",
"based",
"on",
"the",
"facet",
"filters",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L344-L355 | [
"def",
"filter",
"(",
"self",
",",
"search",
")",
":",
"if",
"not",
"self",
".",
"_filters",
":",
"return",
"search",
"post_filter",
"=",
"MatchAll",
"(",
")",
"for",
"f",
"in",
"itervalues",
"(",
"self",
".",
"_filters",
")",
":",
"post_filter",
"&=",... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | FacetedSearch.highlight | Add highlighting for all the fields | elasticsearch_dsl/faceted_search.py | 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):
"""
Add highlighting for all the fields
"""
return search.highlight(*(f if '^' not in f else f.split('^', 1)[0]
for f in self.fields)) | [
"Add",
"highlighting",
"for",
"all",
"the",
"fields"
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L357-L362 | [
"def",
"highlight",
"(",
"self",
",",
"search",
")",
":",
"return",
"search",
".",
"highlight",
"(",
"*",
"(",
"f",
"if",
"'^'",
"not",
"in",
"f",
"else",
"f",
".",
"split",
"(",
"'^'",
",",
"1",
")",
"[",
"0",
"]",
"for",
"f",
"in",
"self",
... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | FacetedSearch.sort | Add sorting information to the request. | elasticsearch_dsl/faceted_search.py | def sort(self, search):
"""
Add sorting information to the request.
"""
if self._sort:
search = search.sort(*self._sort)
return search | def sort(self, search):
"""
Add sorting information to the request.
"""
if self._sort:
search = search.sort(*self._sort)
return search | [
"Add",
"sorting",
"information",
"to",
"the",
"request",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L364-L370 | [
"def",
"sort",
"(",
"self",
",",
"search",
")",
":",
"if",
"self",
".",
"_sort",
":",
"search",
"=",
"search",
".",
"sort",
"(",
"*",
"self",
".",
"_sort",
")",
"return",
"search"
] | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | FacetedSearch.build_search | Construct the ``Search`` object. | elasticsearch_dsl/faceted_search.py | 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):
"""
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 | [
"Construct",
"the",
"Search",
"object",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L372-L383 | [
"def",
"build_search",
"(",
"self",
")",
":",
"s",
"=",
"self",
".",
"search",
"(",
")",
"s",
"=",
"self",
".",
"query",
"(",
"s",
",",
"self",
".",
"_query",
")",
"s",
"=",
"self",
".",
"filter",
"(",
"s",
")",
"if",
"self",
".",
"fields",
"... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | FacetedSearch.execute | Execute the search and return the response. | elasticsearch_dsl/faceted_search.py | def execute(self):
"""
Execute the search and return the response.
"""
r = self._s.execute()
r._faceted_search = self
return r | def execute(self):
"""
Execute the search and return the response.
"""
r = self._s.execute()
r._faceted_search = self
return r | [
"Execute",
"the",
"search",
"and",
"return",
"the",
"response",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/faceted_search.py#L385-L391 | [
"def",
"execute",
"(",
"self",
")",
":",
"r",
"=",
"self",
".",
"_s",
".",
"execute",
"(",
")",
"r",
".",
"_faceted_search",
"=",
"self",
"return",
"r"
] | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Request.params | 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()
... | elasticsearch_dsl/search.py | 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):
"""
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.
... | [
"Specify",
"query",
"params",
"to",
"be",
"used",
"when",
"executing",
"the",
"search",
".",
"All",
"the",
"keyword",
"arguments",
"will",
"override",
"the",
"current",
"values",
".",
"See",
"https",
":",
"//",
"elasticsearch",
"-",
"py",
".",
"readthedocs",... | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L131-L145 | [
"def",
"params",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
"=",
"self",
".",
"_clone",
"(",
")",
"s",
".",
"_params",
".",
"update",
"(",
"kwargs",
")",
"return",
"s"
] | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Request.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']) | elasticsearch_dsl/search.py | 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):
"""
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",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L147-L173 | [
"def",
"index",
"(",
"self",
",",
"*",
"index",
")",
":",
"# .index() resets",
"s",
"=",
"self",
".",
"_clone",
"(",
")",
"if",
"not",
"index",
":",
"s",
".",
"_index",
"=",
"None",
"else",
":",
"indexes",
"=",
"[",
"]",
"for",
"i",
"in",
"index"... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Request.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... | elasticsearch_dsl/search.py | 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):
"""
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... | [
"Set",
"the",
"type",
"to",
"search",
"through",
".",
"You",
"can",
"supply",
"a",
"single",
"value",
"or",
"multiple",
".",
"Values",
"can",
"be",
"strings",
"or",
"subclasses",
"of",
"Document",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L225-L249 | [
"def",
"doc_type",
"(",
"self",
",",
"*",
"doc_type",
",",
"*",
"*",
"kwargs",
")",
":",
"# .doc_type() resets",
"s",
"=",
"self",
".",
"_clone",
"(",
")",
"if",
"not",
"doc_type",
"and",
"not",
"kwargs",
":",
"s",
".",
"_doc_type",
"=",
"[",
"]",
... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Request.using | 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`` | elasticsearch_dsl/search.py | 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):
"""
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... | [
"Associate",
"the",
"search",
"request",
"with",
"an",
"elasticsearch",
"client",
".",
"A",
"fresh",
"copy",
"will",
"be",
"returned",
"with",
"current",
"instance",
"remaining",
"unchanged",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L251-L262 | [
"def",
"using",
"(",
"self",
",",
"client",
")",
":",
"s",
"=",
"self",
".",
"_clone",
"(",
")",
"s",
".",
"_using",
"=",
"client",
"return",
"s"
] | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Request.extra | Add extra keys to the request body. Mostly here for backwards
compatibility. | elasticsearch_dsl/search.py | 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):
"""
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 | [
"Add",
"extra",
"keys",
"to",
"the",
"request",
"body",
".",
"Mostly",
"here",
"for",
"backwards",
"compatibility",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L264-L273 | [
"def",
"extra",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
"=",
"self",
".",
"_clone",
"(",
")",
"if",
"'from_'",
"in",
"kwargs",
":",
"kwargs",
"[",
"'from'",
"]",
"=",
"kwargs",
".",
"pop",
"(",
"'from_'",
")",
"s",
".",
"_extra",
"... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Search._clone | Return a clone of the current search request. Performs a shallow copy
of all the underlying objects. Used internally by most state modifying
APIs. | elasticsearch_dsl/search.py | 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):
"""
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 ... | [
"Return",
"a",
"clone",
"of",
"the",
"current",
"search",
"request",
".",
"Performs",
"a",
"shallow",
"copy",
"of",
"all",
"the",
"underlying",
"objects",
".",
"Used",
"internally",
"by",
"most",
"state",
"modifying",
"APIs",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L379-L401 | [
"def",
"_clone",
"(",
"self",
")",
":",
"s",
"=",
"super",
"(",
"Search",
",",
"self",
")",
".",
"_clone",
"(",
")",
"s",
".",
"_response_class",
"=",
"self",
".",
"_response_class",
"s",
".",
"_sort",
"=",
"self",
".",
"_sort",
"[",
":",
"]",
"s... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Search.response_class | Override the default wrapper used for the response. | elasticsearch_dsl/search.py | 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):
"""
Override the default wrapper used for the response.
"""
s = self._clone()
s._response_class = cls
return s | [
"Override",
"the",
"default",
"wrapper",
"used",
"for",
"the",
"response",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L403-L409 | [
"def",
"response_class",
"(",
"self",
",",
"cls",
")",
":",
"s",
"=",
"self",
".",
"_clone",
"(",
")",
"s",
".",
"_response_class",
"=",
"cls",
"return",
"s"
] | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Search.update_from_dict | Apply options from a serialized body to the current instance. Modifies
the object in-place. Used mostly by ``from_dict``. | elasticsearch_dsl/search.py | 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):
"""
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... | [
"Apply",
"options",
"from",
"a",
"serialized",
"body",
"to",
"the",
"current",
"instance",
".",
"Modifies",
"the",
"object",
"in",
"-",
"place",
".",
"Used",
"mostly",
"by",
"from_dict",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L411-L445 | [
"def",
"update_from_dict",
"(",
"self",
",",
"d",
")",
":",
"d",
"=",
"d",
".",
"copy",
"(",
")",
"if",
"'query'",
"in",
"d",
":",
"self",
".",
"query",
".",
"_proxied",
"=",
"Q",
"(",
"d",
".",
"pop",
"(",
"'query'",
")",
")",
"if",
"'post_fil... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Search.script_fields | 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... | elasticsearch_dsl/search.py | 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):
"""
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... | [
"Define",
"script",
"fields",
"to",
"be",
"calculated",
"on",
"hits",
".",
"See",
"https",
":",
"//",
"www",
".",
"elastic",
".",
"co",
"/",
"guide",
"/",
"en",
"/",
"elasticsearch",
"/",
"reference",
"/",
"current",
"/",
"search",
"-",
"request",
"-",... | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L447-L472 | [
"def",
"script_fields",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
"=",
"self",
".",
"_clone",
"(",
")",
"for",
"name",
"in",
"kwargs",
":",
"if",
"isinstance",
"(",
"kwargs",
"[",
"name",
"]",
",",
"string_types",
")",
":",
"kwargs",
"["... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Search.source | 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... | elasticsearch_dsl/search.py | 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):
"""
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... | [
"Selectively",
"control",
"how",
"the",
"_source",
"field",
"is",
"returned",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L474-L517 | [
"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... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Search.sort | 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::... | elasticsearch_dsl/search.py | 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):
"""
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':... | [
"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",
"::... | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L519-L550 | [
"def",
"sort",
"(",
"self",
",",
"*",
"keys",
")",
":",
"s",
"=",
"self",
".",
"_clone",
"(",
")",
"s",
".",
"_sort",
"=",
"[",
"]",
"for",
"k",
"in",
"keys",
":",
"if",
"isinstance",
"(",
"k",
",",
"string_types",
")",
"and",
"k",
".",
"star... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Search.highlight_options | Update the global highlighting options used for this request. For
example::
s = Search()
s = s.highlight_options(order='score') | elasticsearch_dsl/search.py | 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):
"""
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 | [
"Update",
"the",
"global",
"highlighting",
"options",
"used",
"for",
"this",
"request",
".",
"For",
"example",
"::"
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L552-L562 | [
"def",
"highlight_options",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
"=",
"self",
".",
"_clone",
"(",
")",
"s",
".",
"_highlight_opts",
".",
"update",
"(",
"kwargs",
")",
"return",
"s"
] | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Search.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::
Search().highlight('title', 'body', fragment_size=50)
will produce the equivalent of::
{
"highlight": {
... | elasticsearch_dsl/search.py | 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):
"""
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... | [
"Request",
"highlighting",
"of",
"some",
"fields",
".",
"All",
"keyword",
"arguments",
"passed",
"in",
"will",
"be",
"used",
"as",
"parameters",
"for",
"all",
"the",
"fields",
"in",
"the",
"fields",
"parameter",
".",
"Example",
"::"
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L564-L601 | [
"def",
"highlight",
"(",
"self",
",",
"*",
"fields",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
"=",
"self",
".",
"_clone",
"(",
")",
"for",
"f",
"in",
"fields",
":",
"s",
".",
"_highlight",
"[",
"f",
"]",
"=",
"kwargs",
"return",
"s"
] | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Search.suggest | 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'}) | elasticsearch_dsl/search.py | 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):
"""
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('... | [
"Add",
"a",
"suggestions",
"request",
"to",
"the",
"search",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L603-L618 | [
"def",
"suggest",
"(",
"self",
",",
"name",
",",
"text",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
"=",
"self",
".",
"_clone",
"(",
")",
"s",
".",
"_suggest",
"[",
"name",
"]",
"=",
"{",
"'text'",
":",
"text",
"}",
"s",
".",
"_suggest",
"[",
"n... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Search.to_dict | 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. | elasticsearch_dsl/search.py | 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):
"""
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... | [
"Serialize",
"the",
"search",
"into",
"the",
"dictionary",
"that",
"will",
"be",
"sent",
"over",
"as",
"the",
"request",
"s",
"body",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L620-L662 | [
"def",
"to_dict",
"(",
"self",
",",
"count",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"d",
"=",
"{",
"}",
"if",
"self",
".",
"query",
":",
"d",
"[",
"\"query\"",
"]",
"=",
"self",
".",
"query",
".",
"to_dict",
"(",
")",
"# count request d... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Search.count | Return the number of hits matching the query and filters. Note that
only the actual number is returned. | elasticsearch_dsl/search.py | 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):
"""
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_... | [
"Return",
"the",
"number",
"of",
"hits",
"matching",
"the",
"query",
"and",
"filters",
".",
"Note",
"that",
"only",
"the",
"actual",
"number",
"is",
"returned",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L664-L680 | [
"def",
"count",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'_response'",
")",
":",
"return",
"self",
".",
"_response",
".",
"hits",
".",
"total",
"es",
"=",
"connections",
".",
"get_connection",
"(",
"self",
".",
"_using",
")",
"d",
"... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Search.execute | 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` | elasticsearch_dsl/search.py | 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):
"""
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... | [
"Execute",
"the",
"search",
"and",
"return",
"an",
"instance",
"of",
"Response",
"wrapping",
"all",
"the",
"data",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L682-L701 | [
"def",
"execute",
"(",
"self",
",",
"ignore_cache",
"=",
"False",
")",
":",
"if",
"ignore_cache",
"or",
"not",
"hasattr",
"(",
"self",
",",
"'_response'",
")",
":",
"es",
"=",
"connections",
".",
"get_connection",
"(",
"self",
".",
"_using",
")",
"self",... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Search.scan | 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... | elasticsearch_dsl/search.py | 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):
"""
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`` -
... | [
"Turn",
"the",
"search",
"into",
"a",
"scan",
"search",
"and",
"return",
"a",
"generator",
"that",
"will",
"iterate",
"over",
"all",
"the",
"documents",
"matching",
"the",
"query",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L703-L721 | [
"def",
"scan",
"(",
"self",
")",
":",
"es",
"=",
"connections",
".",
"get_connection",
"(",
"self",
".",
"_using",
")",
"for",
"hit",
"in",
"scan",
"(",
"es",
",",
"query",
"=",
"self",
".",
"to_dict",
"(",
")",
",",
"index",
"=",
"self",
".",
"_... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | Search.delete | delete() executes the query by delegating to delete_by_query() | elasticsearch_dsl/search.py | 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):
"""
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.... | [
"delete",
"()",
"executes",
"the",
"query",
"by",
"delegating",
"to",
"delete_by_query",
"()"
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L723-L736 | [
"def",
"delete",
"(",
"self",
")",
":",
"es",
"=",
"connections",
".",
"get_connection",
"(",
"self",
".",
"_using",
")",
"return",
"AttrDict",
"(",
"es",
".",
"delete_by_query",
"(",
"index",
"=",
"self",
".",
"_index",
",",
"body",
"=",
"self",
".",
... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | MultiSearch.add | 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)) | elasticsearch_dsl/search.py | 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):
"""
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... | [
"Adds",
"a",
"new",
":",
"class",
":",
"~elasticsearch_dsl",
".",
"Search",
"object",
"to",
"the",
"request",
"::"
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L759-L769 | [
"def",
"add",
"(",
"self",
",",
"search",
")",
":",
"ms",
"=",
"self",
".",
"_clone",
"(",
")",
"ms",
".",
"_searches",
".",
"append",
"(",
"search",
")",
"return",
"ms"
] | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | MultiSearch.execute | Execute the multi search request and return a list of search results. | elasticsearch_dsl/search.py | 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):
"""
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(
... | [
"Execute",
"the",
"multi",
"search",
"request",
"and",
"return",
"a",
"list",
"of",
"search",
"results",
"."
] | elastic/elasticsearch-dsl-py | python | https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/search.py#L784-L809 | [
"def",
"execute",
"(",
"self",
",",
"ignore_cache",
"=",
"False",
",",
"raise_on_error",
"=",
"True",
")",
":",
"if",
"ignore_cache",
"or",
"not",
"hasattr",
"(",
"self",
",",
"'_response'",
")",
":",
"es",
"=",
"connections",
".",
"get_connection",
"(",
... | 874b52472fc47b601de0e5fa0e4300e21aff0085 |
train | make_tarball | 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... | setup_helper.py | 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,
):
"""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... | [
"Create",
"a",
"tar",
"file",
"from",
"all",
"the",
"files",
"under",
"base_dir",
".",
"This",
"file",
"may",
"be",
"compressed",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/setup_helper.py#L70-L153 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | KexGSSGroup1.start_kex | Start the GSS-API / SSPI Authenticated Diffie-Hellman Key Exchange. | paramiko/kex_gss.py | 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):
"""
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... | [
"Start",
"the",
"GSS",
"-",
"API",
"/",
"SSPI",
"Authenticated",
"Diffie",
"-",
"Hellman",
"Key",
"Exchange",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L91-L115 | [
"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",
".... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | KexGSSGroup1.parse_next | Parse the next packet.
:param ptype: The (string) type of the incoming packet
:param `.Message` m: The paket content | paramiko/kex_gss.py | 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):
"""
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)
... | [
"Parse",
"the",
"next",
"packet",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L117-L135 | [
"def",
"parse_next",
"(",
"self",
",",
"ptype",
",",
"m",
")",
":",
"if",
"self",
".",
"transport",
".",
"server_mode",
"and",
"(",
"ptype",
"==",
"MSG_KEXGSS_INIT",
")",
":",
"return",
"self",
".",
"_parse_kexgss_init",
"(",
"m",
")",
"elif",
"not",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | KexGSSGroup1._parse_kexgss_hostkey | Parse the SSH2_MSG_KEXGSS_HOSTKEY message (client mode).
:param `.Message` m: The content of the SSH2_MSG_KEXGSS_HOSTKEY message | paramiko/kex_gss.py | 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):
"""
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... | [
"Parse",
"the",
"SSH2_MSG_KEXGSS_HOSTKEY",
"message",
"(",
"client",
"mode",
")",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L155-L166 | [
"def",
"_parse_kexgss_hostkey",
"(",
"self",
",",
"m",
")",
":",
"# client mode",
"host_key",
"=",
"m",
".",
"get_string",
"(",
")",
"self",
".",
"transport",
".",
"host_key",
"=",
"host_key",
"sig",
"=",
"m",
".",
"get_string",
"(",
")",
"self",
".",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | KexGSSGroup1._parse_kexgss_continue | Parse the SSH2_MSG_KEXGSS_CONTINUE message.
:param `.Message` m: The content of the SSH2_MSG_KEXGSS_CONTINUE
message | paramiko/kex_gss.py | 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):
"""
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()
... | [
"Parse",
"the",
"SSH2_MSG_KEXGSS_CONTINUE",
"message",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L168-L189 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | KexGSSGroup1._parse_kexgss_complete | Parse the SSH2_MSG_KEXGSS_COMPLETE message (client mode).
:param `.Message` m: The content of the
SSH2_MSG_KEXGSS_COMPLETE message | paramiko/kex_gss.py | 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):
"""
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... | [
"Parse",
"the",
"SSH2_MSG_KEXGSS_COMPLETE",
"message",
"(",
"client",
"mode",
")",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L191-L234 | [
"def",
"_parse_kexgss_complete",
"(",
"self",
",",
"m",
")",
":",
"# client mode",
"if",
"self",
".",
"transport",
".",
"host_key",
"is",
"None",
":",
"self",
".",
"transport",
".",
"host_key",
"=",
"NullHostKey",
"(",
")",
"self",
".",
"f",
"=",
"m",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | KexGSSGroup1._parse_kexgss_init | Parse the SSH2_MSG_KEXGSS_INIT message (server mode).
:param `.Message` m: The content of the SSH2_MSG_KEXGSS_INIT message | paramiko/kex_gss.py | 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):
"""
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... | [
"Parse",
"the",
"SSH2_MSG_KEXGSS_INIT",
"message",
"(",
"server",
"mode",
")",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L236-L290 | [
"def",
"_parse_kexgss_init",
"(",
"self",
",",
"m",
")",
":",
"# server mode",
"client_token",
"=",
"m",
".",
"get_string",
"(",
")",
"self",
".",
"e",
"=",
"m",
".",
"get_mpint",
"(",
")",
"if",
"(",
"self",
".",
"e",
"<",
"1",
")",
"or",
"(",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | KexGSSGex.start_kex | Start the GSS-API / SSPI Authenticated Diffie-Hellman Group Exchange | paramiko/kex_gss.py | 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):
"""
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... | [
"Start",
"the",
"GSS",
"-",
"API",
"/",
"SSPI",
"Authenticated",
"Diffie",
"-",
"Hellman",
"Group",
"Exchange"
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L353-L370 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | KexGSSGex.parse_next | Parse the next packet.
:param ptype: The (string) type of the incoming packet
:param `.Message` m: The paket content | paramiko/kex_gss.py | 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):
"""
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... | [
"Parse",
"the",
"next",
"packet",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L372-L394 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | KexGSSGex._parse_kexgss_group | Parse the SSH2_MSG_KEXGSS_GROUP message (client mode).
:param `Message` m: The content of the SSH2_MSG_KEXGSS_GROUP message | paramiko/kex_gss.py | 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):
"""
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
... | [
"Parse",
"the",
"SSH2_MSG_KEXGSS_GROUP",
"message",
"(",
"client",
"mode",
")",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L460-L491 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | KexGSSGex._parse_kexgss_complete | Parse the SSH2_MSG_KEXGSS_COMPLETE message (client mode).
:param `Message` m: The content of the SSH2_MSG_KEXGSS_COMPLETE message | paramiko/kex_gss.py | 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):
"""
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 =... | [
"Parse",
"the",
"SSH2_MSG_KEXGSS_COMPLETE",
"message",
"(",
"client",
"mode",
")",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L590-L638 | [
"def",
"_parse_kexgss_complete",
"(",
"self",
",",
"m",
")",
":",
"if",
"self",
".",
"transport",
".",
"host_key",
"is",
"None",
":",
"self",
".",
"transport",
".",
"host_key",
"=",
"NullHostKey",
"(",
")",
"self",
".",
"f",
"=",
"m",
".",
"get_mpint",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | KexGSSGex._parse_kexgss_error | 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 ... | paramiko/kex_gss.py | 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):
"""
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... | [
"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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/kex_gss.py#L640-L663 | [
"def",
"_parse_kexgss_error",
"(",
"self",
",",
"m",
")",
":",
"maj_status",
"=",
"m",
".",
"get_int",
"(",
")",
"min_status",
"=",
"m",
".",
"get_int",
"(",
")",
"err_msg",
"=",
"m",
".",
"get_string",
"(",
")",
"m",
".",
"get_string",
"(",
")",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPAttributes.from_stat | 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... | paramiko/sftp_attr.py | 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):
"""
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.
... | [
"Create",
"an",
".",
"SFTPAttributes",
"object",
"from",
"an",
"existing",
"stat",
"object",
"(",
"an",
"object",
"returned",
"by",
"os",
".",
"stat",
")",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_attr.py#L64-L82 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | RSAKey.generate | 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 | paramiko/rsakey.py | 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):
"""
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... | [
"Generate",
"a",
"new",
"private",
"RSA",
"key",
".",
"This",
"factory",
"function",
"can",
"be",
"used",
"to",
"generate",
"a",
"new",
"host",
"key",
"or",
"authentication",
"key",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/rsakey.py#L158-L170 | [
"def",
"generate",
"(",
"bits",
",",
"progress_func",
"=",
"None",
")",
":",
"key",
"=",
"rsa",
".",
"generate_private_key",
"(",
"public_exponent",
"=",
"65537",
",",
"key_size",
"=",
"bits",
",",
"backend",
"=",
"default_backend",
"(",
")",
")",
"return"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPFile._data_in_prefetch_buffers | 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. | paramiko/sftp_file.py | 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):
"""
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... | [
"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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L132-L147 | [
"def",
"_data_in_prefetch_buffers",
"(",
"self",
",",
"offset",
")",
":",
"k",
"=",
"[",
"i",
"for",
"i",
"in",
"self",
".",
"_prefetch_data",
".",
"keys",
"(",
")",
"if",
"i",
"<=",
"offset",
"]",
"if",
"len",
"(",
"k",
")",
"==",
"0",
":",
"ret... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPFile.seek | Set the file's current position.
See `file.seek` for details. | paramiko/sftp_file.py | 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):
"""
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
... | [
"Set",
"the",
"file",
"s",
"current",
"position",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L258-L272 | [
"def",
"seek",
"(",
"self",
",",
"offset",
",",
"whence",
"=",
"0",
")",
":",
"self",
".",
"flush",
"(",
")",
"if",
"whence",
"==",
"self",
".",
"SEEK_SET",
":",
"self",
".",
"_realpos",
"=",
"self",
".",
"_pos",
"=",
"offset",
"elif",
"whence",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPFile.stat | 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. | paramiko/sftp_file.py | 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):
"""
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",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L274-L286 | [
"def",
"stat",
"(",
"self",
")",
":",
"t",
",",
"msg",
"=",
"self",
".",
"sftp",
".",
"_request",
"(",
"CMD_FSTAT",
",",
"self",
".",
"handle",
")",
"if",
"t",
"!=",
"CMD_ATTRS",
":",
"raise",
"SFTPError",
"(",
"\"Expected attributes\"",
")",
"return",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPFile.truncate | 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 | paramiko/sftp_file.py | 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):
"""
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({... | [
"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",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L343-L356 | [
"def",
"truncate",
"(",
"self",
",",
"size",
")",
":",
"self",
".",
"sftp",
".",
"_log",
"(",
"DEBUG",
",",
"\"truncate({}, {!r})\"",
".",
"format",
"(",
"hexlify",
"(",
"self",
".",
"handle",
")",
",",
"size",
")",
")",
"attr",
"=",
"SFTPAttributes",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPFile.check | 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
... | paramiko/sftp_file.py | 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):
"""
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... | [
"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",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L358-L416 | [
"def",
"check",
"(",
"self",
",",
"hash_algorithm",
",",
"offset",
"=",
"0",
",",
"length",
"=",
"0",
",",
"block_size",
"=",
"0",
")",
":",
"t",
",",
"msg",
"=",
"self",
".",
"sftp",
".",
"_request",
"(",
"CMD_EXTENDED",
",",
"\"check-file\"",
",",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPFile.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 speed by avoiding roundtrip latency.
The file's contents are incrementally buffered in a background thread.
The prefetch... | paramiko/sftp_file.py | 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):
"""
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... | [
"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",... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L438-L476 | [
"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",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPFile.readv | 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... | paramiko/sftp_file.py | 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):
"""
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 ... | [
"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... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L478-L515 | [
"def",
"readv",
"(",
"self",
",",
"chunks",
")",
":",
"self",
".",
"sftp",
".",
"_log",
"(",
"DEBUG",
",",
"\"readv({}, {!r})\"",
".",
"format",
"(",
"hexlify",
"(",
"self",
".",
"handle",
")",
",",
"chunks",
")",
")",
"read_chunks",
"=",
"[",
"]",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPFile._check_exception | if there's a saved exception, raise & clear it | paramiko/sftp_file.py | 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 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 | [
"if",
"there",
"s",
"a",
"saved",
"exception",
"raise",
"&",
"clear",
"it"
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_file.py#L565-L570 | [
"def",
"_check_exception",
"(",
"self",
")",
":",
"if",
"self",
".",
"_saved_exception",
"is",
"not",
"None",
":",
"x",
"=",
"self",
".",
"_saved_exception",
"self",
".",
"_saved_exception",
"=",
"None",
"raise",
"x"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | open_only | Decorator for `.Channel` methods which performs an openness check.
:raises:
`.SSHException` -- If the wrapped method is called on an unopened
`.Channel`. | paramiko/channel.py | 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):
"""
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
... | [
"Decorator",
"for",
".",
"Channel",
"methods",
"which",
"performs",
"an",
"openness",
"check",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L54-L74 | [
"def",
"open_only",
"(",
"func",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"_check",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"if",
"(",
"self",
".",
"closed",
"or",
"self",
".",
"eof_received",
"or",
"self",
".",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.exec_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
can't be reused. You must open a new channel if you... | paramiko/channel.py | 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):
"""
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
... | [
"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",
"."... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L233-L257 | [
"def",
"exec_command",
"(",
"self",
",",
"command",
")",
":",
"m",
"=",
"Message",
"(",
")",
"m",
".",
"add_byte",
"(",
"cMSG_CHANNEL_REQUEST",
")",
"m",
".",
"add_int",
"(",
"self",
".",
"remote_chanid",
")",
"m",
".",
"add_string",
"(",
"\"exec\"",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.resize_pty | 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... | paramiko/channel.py | 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):
"""
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... | [
"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",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L286-L309 | [
"def",
"resize_pty",
"(",
"self",
",",
"width",
"=",
"80",
",",
"height",
"=",
"24",
",",
"width_pixels",
"=",
"0",
",",
"height_pixels",
"=",
"0",
")",
":",
"m",
"=",
"Message",
"(",
")",
"m",
".",
"add_byte",
"(",
"cMSG_CHANNEL_REQUEST",
")",
"m",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.update_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 silently reject some environment variables; see the
... | paramiko/channel.py | 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):
"""
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 ... | [
"Updates",
"this",
"channel",
"s",
"remote",
"shell",
"environment",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L312-L335 | [
"def",
"update_environment",
"(",
"self",
",",
"environment",
")",
":",
"for",
"name",
",",
"value",
"in",
"environment",
".",
"items",
"(",
")",
":",
"try",
":",
"self",
".",
"set_environment_variable",
"(",
"name",
",",
"value",
")",
"except",
"SSHExcept... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.set_environment_variable | 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 ... | paramiko/channel.py | 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):
"""
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... | [
"Set",
"the",
"value",
"of",
"an",
"environment",
"variable",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L338-L362 | [
"def",
"set_environment_variable",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"m",
"=",
"Message",
"(",
")",
"m",
".",
"add_byte",
"(",
"cMSG_CHANNEL_REQUEST",
")",
"m",
".",
"add_int",
"(",
"self",
".",
"remote_chanid",
")",
"m",
".",
"add_string... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.recv_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... | paramiko/channel.py | 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):
"""
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... | [
"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... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L379-L404 | [
"def",
"recv_exit_status",
"(",
"self",
")",
":",
"self",
".",
"status_event",
".",
"wait",
"(",
")",
"assert",
"self",
".",
"status_event",
".",
"is_set",
"(",
")",
"return",
"self",
".",
"exit_status"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.request_x11 | 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... | paramiko/channel.py | 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,
):
"""
Request an x11 session on this channel. If the server allows it,
further x11 requests can be made from the server to th... | [
"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... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L428-L492 | [
"def",
"request_x11",
"(",
"self",
",",
"screen_number",
"=",
"0",
",",
"auth_protocol",
"=",
"None",
",",
"auth_cookie",
"=",
"None",
",",
"single_connection",
"=",
"False",
",",
"handler",
"=",
"None",
",",
")",
":",
"if",
"auth_protocol",
"is",
"None",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.request_forward_agent | 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 ... | paramiko/channel.py | 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):
"""
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 ... | [
"Request",
"for",
"a",
"forward",
"SSH",
"Agent",
"on",
"this",
"channel",
".",
"This",
"is",
"only",
"valid",
"for",
"an",
"ssh",
"-",
"agent",
"from",
"OpenSSH",
"!!!"
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L495-L516 | [
"def",
"request_forward_agent",
"(",
"self",
",",
"handler",
")",
":",
"m",
"=",
"Message",
"(",
")",
"m",
".",
"add_byte",
"(",
"cMSG_CHANNEL_REQUEST",
")",
"m",
".",
"add_int",
"(",
"self",
".",
"remote_chanid",
")",
"m",
".",
"add_string",
"(",
"\"aut... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.set_combine_stderr | 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... | paramiko/channel.py | 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):
"""
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``
... | [
"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",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L551-L584 | [
"def",
"set_combine_stderr",
"(",
"self",
",",
"combine",
")",
":",
"data",
"=",
"bytes",
"(",
")",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"try",
":",
"old",
"=",
"self",
".",
"combine_stderr",
"self",
".",
"combine_stderr",
"=",
"combine",
"if... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.close | 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. | paramiko/channel.py | 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):
"""
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",
")",
".",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L647-L671 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.send_ready | 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... | paramiko/channel.py | 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):
"""
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 ... | [
"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... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L762-L781 | [
"def",
"send_ready",
"(",
"self",
")",
":",
"self",
".",
"lock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"self",
".",
"closed",
"or",
"self",
".",
"eof_sent",
":",
"return",
"True",
"return",
"self",
".",
"out_window_size",
">",
"0",
"finally",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.send | 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.
:... | paramiko/channel.py | 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):
"""
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... | [
"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",... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L783-L801 | [
"def",
"send",
"(",
"self",
",",
"s",
")",
":",
"m",
"=",
"Message",
"(",
")",
"m",
".",
"add_byte",
"(",
"cMSG_CHANNEL_DATA",
")",
"m",
".",
"add_int",
"(",
"self",
".",
"remote_chanid",
")",
"return",
"self",
".",
"_send",
"(",
"s",
",",
"m",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.send_stderr | 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... | paramiko/channel.py | 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):
"""
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... | [
"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... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L803-L825 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.sendall | 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 ... | paramiko/channel.py | 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):
"""
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... | [
"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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L827-L848 | [
"def",
"sendall",
"(",
"self",
",",
"s",
")",
":",
"while",
"s",
":",
"sent",
"=",
"self",
".",
"send",
"(",
"s",
")",
"s",
"=",
"s",
"[",
"sent",
":",
"]",
"return",
"None"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.sendall_stderr | 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... | paramiko/channel.py | 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):
"""
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... | [
"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",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L850-L869 | [
"def",
"sendall_stderr",
"(",
"self",
",",
"s",
")",
":",
"while",
"s",
":",
"sent",
"=",
"self",
".",
"send_stderr",
"(",
"s",
")",
"s",
"=",
"s",
"[",
"sent",
":",
"]",
"return",
"None"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.fileno | 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... | paramiko/channel.py | 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):
"""
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... | [
"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... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L898-L926 | [
"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 ... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel.shutdown | 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:
... | paramiko/channel.py | 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):
"""
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... | [
"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... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L928-L949 | [
"def",
"shutdown",
"(",
"self",
",",
"how",
")",
":",
"if",
"(",
"how",
"==",
"0",
")",
"or",
"(",
"how",
"==",
"2",
")",
":",
"# feign \"read\" shutdown",
"self",
".",
"eof_received",
"=",
"1",
"if",
"(",
"how",
"==",
"1",
")",
"or",
"(",
"how",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | Channel._wait_for_send_window | (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). | paramiko/channel.py | 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.)
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 ... | [
"(",
"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... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/channel.py#L1278-L1315 | [
"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?",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPServer.convert_errno | 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... | paramiko/sftp_server.py | 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):
"""
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... | [
"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... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_server.py#L180-L196 | [
"def",
"convert_errno",
"(",
"e",
")",
":",
"if",
"e",
"==",
"errno",
".",
"EACCES",
":",
"# permission denied",
"return",
"SFTP_PERMISSION_DENIED",
"elif",
"(",
"e",
"==",
"errno",
".",
"ENOENT",
")",
"or",
"(",
"e",
"==",
"errno",
".",
"ENOTDIR",
")",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SFTPServer._convert_pflags | convert SFTP-style open() flags to Python's os.open() flags | paramiko/sftp_server.py | 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):
"""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... | [
"convert",
"SFTP",
"-",
"style",
"open",
"()",
"flags",
"to",
"Python",
"s",
"os",
".",
"open",
"()",
"flags"
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/sftp_server.py#L360-L376 | [
"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... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | BufferedPipe.set_event | Set an event on this buffer. When data is ready to be read (or the
buffer has been closed), the event will be set. When no data is
ready, the event will be cleared.
:param threading.Event event: the event to set/clear | paramiko/buffered_pipe.py | def set_event(self, event):
"""
Set an event on this buffer. When data is ready to be read (or the
buffer has been closed), the event will be set. When no data is
ready, the event will be cleared.
:param threading.Event event: the event to set/clear
"""
self._l... | def set_event(self, event):
"""
Set an event on this buffer. When data is ready to be read (or the
buffer has been closed), the event will be set. When no data is
ready, the event will be cleared.
:param threading.Event event: the event to set/clear
"""
self._l... | [
"Set",
"an",
"event",
"on",
"this",
"buffer",
".",
"When",
"data",
"is",
"ready",
"to",
"be",
"read",
"(",
"or",
"the",
"buffer",
"has",
"been",
"closed",
")",
"the",
"event",
"will",
"be",
"set",
".",
"When",
"no",
"data",
"is",
"ready",
"the",
"e... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/buffered_pipe.py#L69-L90 | [
"def",
"set_event",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_event",
"=",
"event",
"# Make sure the event starts in `set` state if we appear to already",
"# be closed; otherwise, if we start in `clea... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | BufferedPipe.feed | Feed new data into this pipe. This method is assumed to be called
from a separate thread, so synchronization is done.
:param data: the data to add, as a ``str`` or ``bytes`` | paramiko/buffered_pipe.py | def feed(self, data):
"""
Feed new data into this pipe. This method is assumed to be called
from a separate thread, so synchronization is done.
:param data: the data to add, as a ``str`` or ``bytes``
"""
self._lock.acquire()
try:
if self._event is no... | def feed(self, data):
"""
Feed new data into this pipe. This method is assumed to be called
from a separate thread, so synchronization is done.
:param data: the data to add, as a ``str`` or ``bytes``
"""
self._lock.acquire()
try:
if self._event is no... | [
"Feed",
"new",
"data",
"into",
"this",
"pipe",
".",
"This",
"method",
"is",
"assumed",
"to",
"be",
"called",
"from",
"a",
"separate",
"thread",
"so",
"synchronization",
"is",
"done",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/buffered_pipe.py#L92-L106 | [
"def",
"feed",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"self",
".",
"_event",
"is",
"not",
"None",
":",
"self",
".",
"_event",
".",
"set",
"(",
")",
"self",
".",
"_buffer_frombytes",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | BufferedPipe.read_ready | Returns true if data is buffered and ready to be read from this
feeder. A ``False`` result does not mean that the feeder has closed;
it means you may need to wait before more data arrives.
:return:
``True`` if a `read` call would immediately return at least one
byte; ``... | paramiko/buffered_pipe.py | def read_ready(self):
"""
Returns true if data is buffered and ready to be read from this
feeder. A ``False`` result does not mean that the feeder has closed;
it means you may need to wait before more data arrives.
:return:
``True`` if a `read` call would immediatel... | def read_ready(self):
"""
Returns true if data is buffered and ready to be read from this
feeder. A ``False`` result does not mean that the feeder has closed;
it means you may need to wait before more data arrives.
:return:
``True`` if a `read` call would immediatel... | [
"Returns",
"true",
"if",
"data",
"is",
"buffered",
"and",
"ready",
"to",
"be",
"read",
"from",
"this",
"feeder",
".",
"A",
"False",
"result",
"does",
"not",
"mean",
"that",
"the",
"feeder",
"has",
"closed",
";",
"it",
"means",
"you",
"may",
"need",
"to... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/buffered_pipe.py#L108-L124 | [
"def",
"read_ready",
"(",
"self",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"len",
"(",
"self",
".",
"_buffer",
")",
"==",
"0",
":",
"return",
"False",
"return",
"True",
"finally",
":",
"self",
".",
"_lock",
".",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | BufferedPipe.read | Read data from the pipe. The return value is a string representing
the data received. The maximum amount of data to be received at once
is specified by ``nbytes``. If a string of length zero is returned,
the pipe has been closed.
The optional ``timeout`` argument can be a nonnegative... | paramiko/buffered_pipe.py | def read(self, nbytes, timeout=None):
"""
Read data from the pipe. The return value is a string representing
the data received. The maximum amount of data to be received at once
is specified by ``nbytes``. If a string of length zero is returned,
the pipe has been closed.
... | def read(self, nbytes, timeout=None):
"""
Read data from the pipe. The return value is a string representing
the data received. The maximum amount of data to be received at once
is specified by ``nbytes``. If a string of length zero is returned,
the pipe has been closed.
... | [
"Read",
"data",
"from",
"the",
"pipe",
".",
"The",
"return",
"value",
"is",
"a",
"string",
"representing",
"the",
"data",
"received",
".",
"The",
"maximum",
"amount",
"of",
"data",
"to",
"be",
"received",
"at",
"once",
"is",
"specified",
"by",
"nbytes",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/buffered_pipe.py#L126-L178 | [
"def",
"read",
"(",
"self",
",",
"nbytes",
",",
"timeout",
"=",
"None",
")",
":",
"out",
"=",
"bytes",
"(",
")",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"len",
"(",
"self",
".",
"_buffer",
")",
"==",
"0",
":",
"if",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | BufferedPipe.empty | Clear out the buffer and return all data that was in it.
:return:
any data that was in the buffer prior to clearing it out, as a
`str` | paramiko/buffered_pipe.py | def empty(self):
"""
Clear out the buffer and return all data that was in it.
:return:
any data that was in the buffer prior to clearing it out, as a
`str`
"""
self._lock.acquire()
try:
out = self._buffer_tobytes()
del self... | def empty(self):
"""
Clear out the buffer and return all data that was in it.
:return:
any data that was in the buffer prior to clearing it out, as a
`str`
"""
self._lock.acquire()
try:
out = self._buffer_tobytes()
del self... | [
"Clear",
"out",
"the",
"buffer",
"and",
"return",
"all",
"data",
"that",
"was",
"in",
"it",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/buffered_pipe.py#L180-L196 | [
"def",
"empty",
"(",
"self",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"out",
"=",
"self",
".",
"_buffer_tobytes",
"(",
")",
"del",
"self",
".",
"_buffer",
"[",
":",
"]",
"if",
"(",
"self",
".",
"_event",
"is",
"not",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | BufferedPipe.close | Close this pipe object. Future calls to `read` after the buffer
has been emptied will return immediately with an empty string. | paramiko/buffered_pipe.py | def close(self):
"""
Close this pipe object. Future calls to `read` after the buffer
has been emptied will return immediately with an empty string.
"""
self._lock.acquire()
try:
self._closed = True
self._cv.notifyAll()
if self._event i... | def close(self):
"""
Close this pipe object. Future calls to `read` after the buffer
has been emptied will return immediately with an empty string.
"""
self._lock.acquire()
try:
self._closed = True
self._cv.notifyAll()
if self._event i... | [
"Close",
"this",
"pipe",
"object",
".",
"Future",
"calls",
"to",
"read",
"after",
"the",
"buffer",
"has",
"been",
"emptied",
"will",
"return",
"immediately",
"with",
"an",
"empty",
"string",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/buffered_pipe.py#L198-L210 | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_closed",
"=",
"True",
"self",
".",
"_cv",
".",
"notifyAll",
"(",
")",
"if",
"self",
".",
"_event",
"is",
"not",
"None",
":",
"self",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHConfig.parse | Read an OpenSSH config from the given file object.
:param file_obj: a file-like object to read the config file from | paramiko/config.py | def parse(self, file_obj):
"""
Read an OpenSSH config from the given file object.
:param file_obj: a file-like object to read the config file from
"""
host = {"host": ["*"], "config": {}}
for line in file_obj:
# Strip any leading or trailing whitespace from t... | def parse(self, file_obj):
"""
Read an OpenSSH config from the given file object.
:param file_obj: a file-like object to read the config file from
"""
host = {"host": ["*"], "config": {}}
for line in file_obj:
# Strip any leading or trailing whitespace from t... | [
"Read",
"an",
"OpenSSH",
"config",
"from",
"the",
"given",
"file",
"object",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/config.py#L52-L94 | [
"def",
"parse",
"(",
"self",
",",
"file_obj",
")",
":",
"host",
"=",
"{",
"\"host\"",
":",
"[",
"\"*\"",
"]",
",",
"\"config\"",
":",
"{",
"}",
"}",
"for",
"line",
"in",
"file_obj",
":",
"# Strip any leading or trailing whitespace from the line.",
"# Refer to ... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHConfig.lookup | Return a dict (`SSHConfigDict`) of config options for a given hostname.
The host-matching rules of OpenSSH's ``ssh_config`` man page are used:
For each parameter, the first obtained value will be used. The
configuration files contain sections separated by ``Host``
specifications, and t... | paramiko/config.py | def lookup(self, hostname):
"""
Return a dict (`SSHConfigDict`) of config options for a given hostname.
The host-matching rules of OpenSSH's ``ssh_config`` man page are used:
For each parameter, the first obtained value will be used. The
configuration files contain sections sep... | def lookup(self, hostname):
"""
Return a dict (`SSHConfigDict`) of config options for a given hostname.
The host-matching rules of OpenSSH's ``ssh_config`` man page are used:
For each parameter, the first obtained value will be used. The
configuration files contain sections sep... | [
"Return",
"a",
"dict",
"(",
"SSHConfigDict",
")",
"of",
"config",
"options",
"for",
"a",
"given",
"hostname",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/config.py#L96-L147 | [
"def",
"lookup",
"(",
"self",
",",
"hostname",
")",
":",
"matches",
"=",
"[",
"config",
"for",
"config",
"in",
"self",
".",
"_config",
"if",
"self",
".",
"_allowed",
"(",
"config",
"[",
"\"host\"",
"]",
",",
"hostname",
")",
"]",
"ret",
"=",
"SSHConf... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHConfig.get_hostnames | Return the set of literal hostnames defined in the SSH config (both
explicit hostnames and wildcard entries). | paramiko/config.py | def get_hostnames(self):
"""
Return the set of literal hostnames defined in the SSH config (both
explicit hostnames and wildcard entries).
"""
hosts = set()
for entry in self._config:
hosts.update(entry["host"])
return hosts | def get_hostnames(self):
"""
Return the set of literal hostnames defined in the SSH config (both
explicit hostnames and wildcard entries).
"""
hosts = set()
for entry in self._config:
hosts.update(entry["host"])
return hosts | [
"Return",
"the",
"set",
"of",
"literal",
"hostnames",
"defined",
"in",
"the",
"SSH",
"config",
"(",
"both",
"explicit",
"hostnames",
"and",
"wildcard",
"entries",
")",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/config.py#L149-L157 | [
"def",
"get_hostnames",
"(",
"self",
")",
":",
"hosts",
"=",
"set",
"(",
")",
"for",
"entry",
"in",
"self",
".",
"_config",
":",
"hosts",
".",
"update",
"(",
"entry",
"[",
"\"host\"",
"]",
")",
"return",
"hosts"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHConfig._expand_variables | Return a dict of config options with expanded substitutions
for a given hostname.
Please refer to man ``ssh_config`` for the parameters that
are replaced.
:param dict config: the config for the hostname
:param str hostname: the hostname that the config belongs to | paramiko/config.py | def _expand_variables(self, config, hostname):
"""
Return a dict of config options with expanded substitutions
for a given hostname.
Please refer to man ``ssh_config`` for the parameters that
are replaced.
:param dict config: the config for the hostname
:param s... | def _expand_variables(self, config, hostname):
"""
Return a dict of config options with expanded substitutions
for a given hostname.
Please refer to man ``ssh_config`` for the parameters that
are replaced.
:param dict config: the config for the hostname
:param s... | [
"Return",
"a",
"dict",
"of",
"config",
"options",
"with",
"expanded",
"substitutions",
"for",
"a",
"given",
"hostname",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/config.py#L168-L239 | [
"def",
"_expand_variables",
"(",
"self",
",",
"config",
",",
"hostname",
")",
":",
"if",
"\"hostname\"",
"in",
"config",
":",
"config",
"[",
"\"hostname\"",
"]",
"=",
"config",
"[",
"\"hostname\"",
"]",
".",
"replace",
"(",
"\"%h\"",
",",
"hostname",
")",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHConfig._get_hosts | Return a list of host_names from host value. | paramiko/config.py | def _get_hosts(self, host):
"""
Return a list of host_names from host value.
"""
try:
return shlex.split(host)
except ValueError:
raise Exception("Unparsable host {}".format(host)) | def _get_hosts(self, host):
"""
Return a list of host_names from host value.
"""
try:
return shlex.split(host)
except ValueError:
raise Exception("Unparsable host {}".format(host)) | [
"Return",
"a",
"list",
"of",
"host_names",
"from",
"host",
"value",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/config.py#L241-L248 | [
"def",
"_get_hosts",
"(",
"self",
",",
"host",
")",
":",
"try",
":",
"return",
"shlex",
".",
"split",
"(",
"host",
")",
"except",
"ValueError",
":",
"raise",
"Exception",
"(",
"\"Unparsable host {}\"",
".",
"format",
"(",
"host",
")",
")"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | SSHConfigDict.as_bool | Express given key's value as a boolean type.
Typically, this is used for ``ssh_config``'s pseudo-boolean values
which are either ``"yes"`` or ``"no"``. In such cases, ``"yes"`` yields
``True`` and any other value becomes ``False``.
.. note::
If (for whatever reason) the sto... | paramiko/config.py | def as_bool(self, key):
"""
Express given key's value as a boolean type.
Typically, this is used for ``ssh_config``'s pseudo-boolean values
which are either ``"yes"`` or ``"no"``. In such cases, ``"yes"`` yields
``True`` and any other value becomes ``False``.
.. note::
... | def as_bool(self, key):
"""
Express given key's value as a boolean type.
Typically, this is used for ``ssh_config``'s pseudo-boolean values
which are either ``"yes"`` or ``"no"``. In such cases, ``"yes"`` yields
``True`` and any other value becomes ``False``.
.. note::
... | [
"Express",
"given",
"key",
"s",
"value",
"as",
"a",
"boolean",
"type",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/config.py#L344-L361 | [
"def",
"as_bool",
"(",
"self",
",",
"key",
")",
":",
"val",
"=",
"self",
"[",
"key",
"]",
"if",
"isinstance",
"(",
"val",
",",
"bool",
")",
":",
"return",
"val",
"return",
"val",
".",
"lower",
"(",
")",
"==",
"\"yes\""
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | ServerInterface.check_auth_gssapi_with_mic | Authenticate the given user to the server if he is a valid krb5
principal.
:param str username: The username of the authenticating client
:param int gss_authenticated: The result of the krb5 authentication
:param str cc_filename: The krb5 client credentials cache filename
:retur... | paramiko/server.py | def check_auth_gssapi_with_mic(
self, username, gss_authenticated=AUTH_FAILED, cc_file=None
):
"""
Authenticate the given user to the server if he is a valid krb5
principal.
:param str username: The username of the authenticating client
:param int gss_authenticated: ... | def check_auth_gssapi_with_mic(
self, username, gss_authenticated=AUTH_FAILED, cc_file=None
):
"""
Authenticate the given user to the server if he is a valid krb5
principal.
:param str username: The username of the authenticating client
:param int gss_authenticated: ... | [
"Authenticate",
"the",
"given",
"user",
"to",
"the",
"server",
"if",
"he",
"is",
"a",
"valid",
"krb5",
"principal",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/server.py#L239-L267 | [
"def",
"check_auth_gssapi_with_mic",
"(",
"self",
",",
"username",
",",
"gss_authenticated",
"=",
"AUTH_FAILED",
",",
"cc_file",
"=",
"None",
")",
":",
"if",
"gss_authenticated",
"==",
"AUTH_SUCCESSFUL",
":",
"return",
"AUTH_SUCCESSFUL",
"return",
"AUTH_FAILED"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | ServerInterface.check_auth_gssapi_keyex | Authenticate the given user to the server if he is a valid krb5
principal and GSS-API Key Exchange was performed.
If GSS-API Key Exchange was not performed, this authentication method
won't be available.
:param str username: The username of the authenticating client
:param int g... | paramiko/server.py | def check_auth_gssapi_keyex(
self, username, gss_authenticated=AUTH_FAILED, cc_file=None
):
"""
Authenticate the given user to the server if he is a valid krb5
principal and GSS-API Key Exchange was performed.
If GSS-API Key Exchange was not performed, this authentication met... | def check_auth_gssapi_keyex(
self, username, gss_authenticated=AUTH_FAILED, cc_file=None
):
"""
Authenticate the given user to the server if he is a valid krb5
principal and GSS-API Key Exchange was performed.
If GSS-API Key Exchange was not performed, this authentication met... | [
"Authenticate",
"the",
"given",
"user",
"to",
"the",
"server",
"if",
"he",
"is",
"a",
"valid",
"krb5",
"principal",
"and",
"GSS",
"-",
"API",
"Key",
"Exchange",
"was",
"performed",
".",
"If",
"GSS",
"-",
"API",
"Key",
"Exchange",
"was",
"not",
"performed... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/server.py#L269-L299 | [
"def",
"check_auth_gssapi_keyex",
"(",
"self",
",",
"username",
",",
"gss_authenticated",
"=",
"AUTH_FAILED",
",",
"cc_file",
"=",
"None",
")",
":",
"if",
"gss_authenticated",
"==",
"AUTH_SUCCESSFUL",
":",
"return",
"AUTH_SUCCESSFUL",
"return",
"AUTH_FAILED"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | ServerInterface.check_channel_subsystem_request | Determine if a requested subsystem will be provided to the client on
the given channel. If this method returns ``True``, all future I/O
through this channel will be assumed to be connected to the requested
subsystem. An example of a subsystem is ``sftp``.
The default implementation ch... | paramiko/server.py | def check_channel_subsystem_request(self, channel, name):
"""
Determine if a requested subsystem will be provided to the client on
the given channel. If this method returns ``True``, all future I/O
through this channel will be assumed to be connected to the requested
subsystem. ... | def check_channel_subsystem_request(self, channel, name):
"""
Determine if a requested subsystem will be provided to the client on
the given channel. If this method returns ``True``, all future I/O
through this channel will be assumed to be connected to the requested
subsystem. ... | [
"Determine",
"if",
"a",
"requested",
"subsystem",
"will",
"be",
"provided",
"to",
"the",
"client",
"on",
"the",
"given",
"channel",
".",
"If",
"this",
"method",
"returns",
"True",
"all",
"future",
"I",
"/",
"O",
"through",
"this",
"channel",
"will",
"be",
... | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/server.py#L435-L463 | [
"def",
"check_channel_subsystem_request",
"(",
"self",
",",
"channel",
",",
"name",
")",
":",
"transport",
"=",
"channel",
".",
"get_transport",
"(",
")",
"handler_class",
",",
"larg",
",",
"kwarg",
"=",
"transport",
".",
"_get_subsystem_handler",
"(",
"name",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | InteractiveQuery.add_prompt | Add a prompt to this query. The prompt should be a (reasonably short)
string. Multiple prompts can be added to the same query.
:param str prompt: the user prompt
:param bool echo:
``True`` (default) if the user's response should be echoed;
``False`` if not (for a passw... | paramiko/server.py | def add_prompt(self, prompt, echo=True):
"""
Add a prompt to this query. The prompt should be a (reasonably short)
string. Multiple prompts can be added to the same query.
:param str prompt: the user prompt
:param bool echo:
``True`` (default) if the user's respons... | def add_prompt(self, prompt, echo=True):
"""
Add a prompt to this query. The prompt should be a (reasonably short)
string. Multiple prompts can be added to the same query.
:param str prompt: the user prompt
:param bool echo:
``True`` (default) if the user's respons... | [
"Add",
"a",
"prompt",
"to",
"this",
"query",
".",
"The",
"prompt",
"should",
"be",
"a",
"(",
"reasonably",
"short",
")",
"string",
".",
"Multiple",
"prompts",
"can",
"be",
"added",
"to",
"the",
"same",
"query",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/server.py#L623-L633 | [
"def",
"add_prompt",
"(",
"self",
",",
"prompt",
",",
"echo",
"=",
"True",
")",
":",
"self",
".",
"prompts",
".",
"append",
"(",
"(",
"prompt",
",",
"echo",
")",
")"
] | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | GSSAuth | Provide SSH2 GSS-API / SSPI authentication.
:param str auth_method: The name of the SSH authentication mechanism
(gssapi-with-mic or gss-keyex)
:param bool gss_deleg_creds: Delegate client credentials or not.
We delegate credentials by default.
:... | paramiko/ssh_gss.py | def GSSAuth(auth_method, gss_deleg_creds=True):
"""
Provide SSH2 GSS-API / SSPI authentication.
:param str auth_method: The name of the SSH authentication mechanism
(gssapi-with-mic or gss-keyex)
:param bool gss_deleg_creds: Delegate client credentials or not.
... | def GSSAuth(auth_method, gss_deleg_creds=True):
"""
Provide SSH2 GSS-API / SSPI authentication.
:param str auth_method: The name of the SSH authentication mechanism
(gssapi-with-mic or gss-keyex)
:param bool gss_deleg_creds: Delegate client credentials or not.
... | [
"Provide",
"SSH2",
"GSS",
"-",
"API",
"/",
"SSPI",
"authentication",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L68-L94 | [
"def",
"GSSAuth",
"(",
"auth_method",
",",
"gss_deleg_creds",
"=",
"True",
")",
":",
"if",
"_API",
"==",
"\"MIT\"",
":",
"return",
"_SSH_GSSAPI",
"(",
"auth_method",
",",
"gss_deleg_creds",
")",
"elif",
"_API",
"==",
"\"SSPI\"",
"and",
"os",
".",
"name",
"... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | _SSH_GSSAuth.ssh_gss_oids | This method returns a single OID, because we only support the
Kerberos V5 mechanism.
:param str mode: Client for client mode and server for server mode
:return: A byte sequence containing the number of supported
OIDs, the length of the OID and the actual OID encoded with
... | paramiko/ssh_gss.py | def ssh_gss_oids(self, mode="client"):
"""
This method returns a single OID, because we only support the
Kerberos V5 mechanism.
:param str mode: Client for client mode and server for server mode
:return: A byte sequence containing the number of supported
OIDs, t... | def ssh_gss_oids(self, mode="client"):
"""
This method returns a single OID, because we only support the
Kerberos V5 mechanism.
:param str mode: Client for client mode and server for server mode
:return: A byte sequence containing the number of supported
OIDs, t... | [
"This",
"method",
"returns",
"a",
"single",
"OID",
"because",
"we",
"only",
"support",
"the",
"Kerberos",
"V5",
"mechanism",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L150-L170 | [
"def",
"ssh_gss_oids",
"(",
"self",
",",
"mode",
"=",
"\"client\"",
")",
":",
"from",
"pyasn1",
".",
"type",
".",
"univ",
"import",
"ObjectIdentifier",
"from",
"pyasn1",
".",
"codec",
".",
"der",
"import",
"encoder",
"OIDs",
"=",
"self",
".",
"_make_uint32... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | _SSH_GSSAuth.ssh_check_mech | Check if the given OID is the Kerberos V5 OID (server mode).
:param str desired_mech: The desired GSS-API mechanism of the client
:return: ``True`` if the given OID is supported, otherwise C{False} | paramiko/ssh_gss.py | def ssh_check_mech(self, desired_mech):
"""
Check if the given OID is the Kerberos V5 OID (server mode).
:param str desired_mech: The desired GSS-API mechanism of the client
:return: ``True`` if the given OID is supported, otherwise C{False}
"""
from pyasn1.codec.der imp... | def ssh_check_mech(self, desired_mech):
"""
Check if the given OID is the Kerberos V5 OID (server mode).
:param str desired_mech: The desired GSS-API mechanism of the client
:return: ``True`` if the given OID is supported, otherwise C{False}
"""
from pyasn1.codec.der imp... | [
"Check",
"if",
"the",
"given",
"OID",
"is",
"the",
"Kerberos",
"V5",
"OID",
"(",
"server",
"mode",
")",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L172-L184 | [
"def",
"ssh_check_mech",
"(",
"self",
",",
"desired_mech",
")",
":",
"from",
"pyasn1",
".",
"codec",
".",
"der",
"import",
"decoder",
"mech",
",",
"__",
"=",
"decoder",
".",
"decode",
"(",
"desired_mech",
")",
"if",
"mech",
".",
"__str__",
"(",
")",
"!... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | _SSH_GSSAuth._ssh_build_mic | Create the SSH2 MIC filed for gssapi-with-mic.
:param str session_id: The SSH session ID
:param str username: The name of the user who attempts to login
:param str service: The requested SSH service
:param str auth_method: The requested SSH authentication mechanism
:return: The ... | paramiko/ssh_gss.py | def _ssh_build_mic(self, session_id, username, service, auth_method):
"""
Create the SSH2 MIC filed for gssapi-with-mic.
:param str session_id: The SSH session ID
:param str username: The name of the user who attempts to login
:param str service: The requested SSH service
... | def _ssh_build_mic(self, session_id, username, service, auth_method):
"""
Create the SSH2 MIC filed for gssapi-with-mic.
:param str session_id: The SSH session ID
:param str username: The name of the user who attempts to login
:param str service: The requested SSH service
... | [
"Create",
"the",
"SSH2",
"MIC",
"filed",
"for",
"gssapi",
"-",
"with",
"-",
"mic",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L197-L223 | [
"def",
"_ssh_build_mic",
"(",
"self",
",",
"session_id",
",",
"username",
",",
"service",
",",
"auth_method",
")",
":",
"mic",
"=",
"self",
".",
"_make_uint32",
"(",
"len",
"(",
"session_id",
")",
")",
"mic",
"+=",
"session_id",
"mic",
"+=",
"struct",
".... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | _SSH_GSSAPI.ssh_init_sec_context | Initialize a GSS-API context.
:param str username: The name of the user who attempts to login
:param str target: The hostname of the target to connect to
:param str desired_mech: The negotiated GSS-API mechanism
("pseudo negotiated" mechanism, because we
... | paramiko/ssh_gss.py | def ssh_init_sec_context(
self, target, desired_mech=None, username=None, recv_token=None
):
"""
Initialize a GSS-API context.
:param str username: The name of the user who attempts to login
:param str target: The hostname of the target to connect to
:param str desir... | def ssh_init_sec_context(
self, target, desired_mech=None, username=None, recv_token=None
):
"""
Initialize a GSS-API context.
:param str username: The name of the user who attempts to login
:param str target: The hostname of the target to connect to
:param str desir... | [
"Initialize",
"a",
"GSS",
"-",
"API",
"context",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L255-L305 | [
"def",
"ssh_init_sec_context",
"(",
"self",
",",
"target",
",",
"desired_mech",
"=",
"None",
",",
"username",
"=",
"None",
",",
"recv_token",
"=",
"None",
")",
":",
"from",
"pyasn1",
".",
"codec",
".",
"der",
"import",
"decoder",
"self",
".",
"_username",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | _SSH_GSSAPI.ssh_accept_sec_context | Accept a GSS-API context (server mode).
:param str hostname: The servers hostname
:param str username: The name of the user who attempts to login
:param str recv_token: The GSS-API Token received from the server,
if it's not the initial call.
:return: A ``... | paramiko/ssh_gss.py | def ssh_accept_sec_context(self, hostname, recv_token, username=None):
"""
Accept a GSS-API context (server mode).
:param str hostname: The servers hostname
:param str username: The name of the user who attempts to login
:param str recv_token: The GSS-API Token received from the... | def ssh_accept_sec_context(self, hostname, recv_token, username=None):
"""
Accept a GSS-API context (server mode).
:param str hostname: The servers hostname
:param str username: The name of the user who attempts to login
:param str recv_token: The GSS-API Token received from the... | [
"Accept",
"a",
"GSS",
"-",
"API",
"context",
"(",
"server",
"mode",
")",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L334-L352 | [
"def",
"ssh_accept_sec_context",
"(",
"self",
",",
"hostname",
",",
"recv_token",
",",
"username",
"=",
"None",
")",
":",
"# hostname and username are not required for GSSAPI, but for SSPI",
"self",
".",
"_gss_host",
"=",
"hostname",
"self",
".",
"_username",
"=",
"us... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | _SSH_SSPI.ssh_init_sec_context | Initialize a SSPI context.
:param str username: The name of the user who attempts to login
:param str target: The FQDN of the target to connect to
:param str desired_mech: The negotiated SSPI mechanism
("pseudo negotiated" mechanism, because we
... | paramiko/ssh_gss.py | def ssh_init_sec_context(
self, target, desired_mech=None, username=None, recv_token=None
):
"""
Initialize a SSPI context.
:param str username: The name of the user who attempts to login
:param str target: The FQDN of the target to connect to
:param str desired_mech... | def ssh_init_sec_context(
self, target, desired_mech=None, username=None, recv_token=None
):
"""
Initialize a SSPI context.
:param str username: The name of the user who attempts to login
:param str target: The FQDN of the target to connect to
:param str desired_mech... | [
"Initialize",
"a",
"SSPI",
"context",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L431-L481 | [
"def",
"ssh_init_sec_context",
"(",
"self",
",",
"target",
",",
"desired_mech",
"=",
"None",
",",
"username",
"=",
"None",
",",
"recv_token",
"=",
"None",
")",
":",
"from",
"pyasn1",
".",
"codec",
".",
"der",
"import",
"decoder",
"self",
".",
"_username",
... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
train | _SSH_SSPI.ssh_get_mic | Create the MIC token for a SSH2 message.
:param str session_id: The SSH session ID
:param bool gss_kex: Generate the MIC for Key Exchange with SSPI or not
:return: gssapi-with-mic:
Returns the MIC token from SSPI for the message we created
with ``_ssh_build_mic... | paramiko/ssh_gss.py | def ssh_get_mic(self, session_id, gss_kex=False):
"""
Create the MIC token for a SSH2 message.
:param str session_id: The SSH session ID
:param bool gss_kex: Generate the MIC for Key Exchange with SSPI or not
:return: gssapi-with-mic:
Returns the MIC token from ... | def ssh_get_mic(self, session_id, gss_kex=False):
"""
Create the MIC token for a SSH2 message.
:param str session_id: The SSH session ID
:param bool gss_kex: Generate the MIC for Key Exchange with SSPI or not
:return: gssapi-with-mic:
Returns the MIC token from ... | [
"Create",
"the",
"MIC",
"token",
"for",
"a",
"SSH2",
"message",
"."
] | paramiko/paramiko | python | https://github.com/paramiko/paramiko/blob/cf7d49d66f3b1fbc8b0853518a54050182b3b5eb/paramiko/ssh_gss.py#L483-L508 | [
"def",
"ssh_get_mic",
"(",
"self",
",",
"session_id",
",",
"gss_kex",
"=",
"False",
")",
":",
"self",
".",
"_session_id",
"=",
"session_id",
"if",
"not",
"gss_kex",
":",
"mic_field",
"=",
"self",
".",
"_ssh_build_mic",
"(",
"self",
".",
"_session_id",
",",... | cf7d49d66f3b1fbc8b0853518a54050182b3b5eb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.