repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
graphql-python/graphene-django
graphene_django/filter/filterset.py
custom_filterset_factory
def custom_filterset_factory(model, filterset_base_class=FilterSet, **meta): """ Create a filterset for the given model using the provided meta data """ meta.update({"model": model}) meta_class = type(str("Meta"), (object,), meta) filterset = type( str("%sFilterSet" % model._meta.object_name...
python
def custom_filterset_factory(model, filterset_base_class=FilterSet, **meta): """ Create a filterset for the given model using the provided meta data """ meta.update({"model": model}) meta_class = type(str("Meta"), (object,), meta) filterset = type( str("%sFilterSet" % model._meta.object_name...
[ "def", "custom_filterset_factory", "(", "model", ",", "filterset_base_class", "=", "FilterSet", ",", "*", "*", "meta", ")", ":", "meta", ".", "update", "(", "{", "\"model\"", ":", "model", "}", ")", "meta_class", "=", "type", "(", "str", "(", "\"Meta\"", ...
Create a filterset for the given model using the provided meta data
[ "Create", "a", "filterset", "for", "the", "given", "model", "using", "the", "provided", "meta", "data" ]
20160113948b4167b61dbdaa477bb301227aac2e
https://github.com/graphql-python/graphene-django/blob/20160113948b4167b61dbdaa477bb301227aac2e/graphene_django/filter/filterset.py#L95-L105
train
Create a custom filterset for the given model.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
graphql-python/graphene-django
graphene_django/filter/filterset.py
GlobalIDFilter.filter
def filter(self, qs, value): """ Convert the filter value to a primary key before filtering """ _id = None if value is not None: _, _id = from_global_id(value) return super(GlobalIDFilter, self).filter(qs, _id)
python
def filter(self, qs, value): """ Convert the filter value to a primary key before filtering """ _id = None if value is not None: _, _id = from_global_id(value) return super(GlobalIDFilter, self).filter(qs, _id)
[ "def", "filter", "(", "self", ",", "qs", ",", "value", ")", ":", "_id", "=", "None", "if", "value", "is", "not", "None", ":", "_", ",", "_id", "=", "from_global_id", "(", "value", ")", "return", "super", "(", "GlobalIDFilter", ",", "self", ")", "."...
Convert the filter value to a primary key before filtering
[ "Convert", "the", "filter", "value", "to", "a", "primary", "key", "before", "filtering" ]
20160113948b4167b61dbdaa477bb301227aac2e
https://github.com/graphql-python/graphene-django/blob/20160113948b4167b61dbdaa477bb301227aac2e/graphene_django/filter/filterset.py#L16-L21
train
Convert the filter value to a primary key before filtering
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
graphql-python/graphene-django
graphene_django/filter/utils.py
get_filtering_args_from_filterset
def get_filtering_args_from_filterset(filterset_class, type): """ Inspect a FilterSet and produce the arguments to pass to a Graphene Field. These arguments will be available to filter against in the GraphQL """ from ..forms.converter import convert_form_field args = {} for name, fi...
python
def get_filtering_args_from_filterset(filterset_class, type): """ Inspect a FilterSet and produce the arguments to pass to a Graphene Field. These arguments will be available to filter against in the GraphQL """ from ..forms.converter import convert_form_field args = {} for name, fi...
[ "def", "get_filtering_args_from_filterset", "(", "filterset_class", ",", "type", ")", ":", "from", ".", ".", "forms", ".", "converter", "import", "convert_form_field", "args", "=", "{", "}", "for", "name", ",", "filter_field", "in", "six", ".", "iteritems", "(...
Inspect a FilterSet and produce the arguments to pass to a Graphene Field. These arguments will be available to filter against in the GraphQL
[ "Inspect", "a", "FilterSet", "and", "produce", "the", "arguments", "to", "pass", "to", "a", "Graphene", "Field", ".", "These", "arguments", "will", "be", "available", "to", "filter", "against", "in", "the", "GraphQL" ]
20160113948b4167b61dbdaa477bb301227aac2e
https://github.com/graphql-python/graphene-django/blob/20160113948b4167b61dbdaa477bb301227aac2e/graphene_django/filter/utils.py#L6-L19
train
Inspects a FilterSet and returns the arguments to pass to a Graphene Field
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/admin/__init__.py
AdminClient._make_topics_result
def _make_topics_result(f, futmap): """ Map per-topic results to per-topic futures in futmap. The result value of each (successful) future is None. """ try: result = f.result() for topic, error in result.items(): fut = futmap.get(topic, Non...
python
def _make_topics_result(f, futmap): """ Map per-topic results to per-topic futures in futmap. The result value of each (successful) future is None. """ try: result = f.result() for topic, error in result.items(): fut = futmap.get(topic, Non...
[ "def", "_make_topics_result", "(", "f", ",", "futmap", ")", ":", "try", ":", "result", "=", "f", ".", "result", "(", ")", "for", "topic", ",", "error", "in", "result", ".", "items", "(", ")", ":", "fut", "=", "futmap", ".", "get", "(", "topic", "...
Map per-topic results to per-topic futures in futmap. The result value of each (successful) future is None.
[ "Map", "per", "-", "topic", "results", "to", "per", "-", "topic", "futures", "in", "futmap", ".", "The", "result", "value", "of", "each", "(", "successful", ")", "future", "is", "None", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/admin/__init__.py#L219-L240
train
Make result values for all topics in the given futures.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/admin/__init__.py
AdminClient._make_resource_result
def _make_resource_result(f, futmap): """ Map per-resource results to per-resource futures in futmap. The result value of each (successful) future is a ConfigResource. """ try: result = f.result() for resource, configs in result.items(): fu...
python
def _make_resource_result(f, futmap): """ Map per-resource results to per-resource futures in futmap. The result value of each (successful) future is a ConfigResource. """ try: result = f.result() for resource, configs in result.items(): fu...
[ "def", "_make_resource_result", "(", "f", ",", "futmap", ")", ":", "try", ":", "result", "=", "f", ".", "result", "(", ")", "for", "resource", ",", "configs", "in", "result", ".", "items", "(", ")", ":", "fut", "=", "futmap", ".", "get", "(", "reso...
Map per-resource results to per-resource futures in futmap. The result value of each (successful) future is a ConfigResource.
[ "Map", "per", "-", "resource", "results", "to", "per", "-", "resource", "futures", "in", "futmap", ".", "The", "result", "value", "of", "each", "(", "successful", ")", "future", "is", "a", "ConfigResource", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/admin/__init__.py#L243-L265
train
Make a result for each resource in the given futures.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/admin/__init__.py
AdminClient._make_futures
def _make_futures(futmap_keys, class_check, make_result_fn): """ Create futures and a futuremap for the keys in futmap_keys, and create a request-level future to be bassed to the C API. """ futmap = {} for key in futmap_keys: if class_check is not None and not...
python
def _make_futures(futmap_keys, class_check, make_result_fn): """ Create futures and a futuremap for the keys in futmap_keys, and create a request-level future to be bassed to the C API. """ futmap = {} for key in futmap_keys: if class_check is not None and not...
[ "def", "_make_futures", "(", "futmap_keys", ",", "class_check", ",", "make_result_fn", ")", ":", "futmap", "=", "{", "}", "for", "key", "in", "futmap_keys", ":", "if", "class_check", "is", "not", "None", "and", "not", "isinstance", "(", "key", ",", "class_...
Create futures and a futuremap for the keys in futmap_keys, and create a request-level future to be bassed to the C API.
[ "Create", "futures", "and", "a", "futuremap", "for", "the", "keys", "in", "futmap_keys", "and", "create", "a", "request", "-", "level", "future", "to", "be", "bassed", "to", "the", "C", "API", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/admin/__init__.py#L268-L290
train
Create futures and a futuremap for the keys in futmap_keys and create a request - level futuremap for the keys in futmap_keys and set the result of make_result_fn.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/admin/__init__.py
AdminClient.create_topics
def create_topics(self, new_topics, **kwargs): """ Create new topics in cluster. The future result() value is None. :param list(NewTopic) new_topics: New topics to be created. :param float operation_timeout: Set broker's operation timeout in seconds, controlli...
python
def create_topics(self, new_topics, **kwargs): """ Create new topics in cluster. The future result() value is None. :param list(NewTopic) new_topics: New topics to be created. :param float operation_timeout: Set broker's operation timeout in seconds, controlli...
[ "def", "create_topics", "(", "self", ",", "new_topics", ",", "*", "*", "kwargs", ")", ":", "f", ",", "futmap", "=", "AdminClient", ".", "_make_futures", "(", "[", "x", ".", "topic", "for", "x", "in", "new_topics", "]", ",", "None", ",", "AdminClient", ...
Create new topics in cluster. The future result() value is None. :param list(NewTopic) new_topics: New topics to be created. :param float operation_timeout: Set broker's operation timeout in seconds, controlling how long the CreateTopics request will block o...
[ "Create", "new", "topics", "in", "cluster", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/admin/__init__.py#L292-L323
train
Create new topics in cluster.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/admin/__init__.py
AdminClient.delete_topics
def delete_topics(self, topics, **kwargs): """ Delete topics. The future result() value is None. :param list(str) topics: Topics to mark for deletion. :param float operation_timeout: Set broker's operation timeout in seconds, controlling how long the DeleteTop...
python
def delete_topics(self, topics, **kwargs): """ Delete topics. The future result() value is None. :param list(str) topics: Topics to mark for deletion. :param float operation_timeout: Set broker's operation timeout in seconds, controlling how long the DeleteTop...
[ "def", "delete_topics", "(", "self", ",", "topics", ",", "*", "*", "kwargs", ")", ":", "f", ",", "futmap", "=", "AdminClient", ".", "_make_futures", "(", "topics", ",", "None", ",", "AdminClient", ".", "_make_topics_result", ")", "super", "(", "AdminClient...
Delete topics. The future result() value is None. :param list(str) topics: Topics to mark for deletion. :param float operation_timeout: Set broker's operation timeout in seconds, controlling how long the DeleteTopics request will block on the broker waiting ...
[ "Delete", "topics", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/admin/__init__.py#L325-L353
train
Delete topics.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/admin/__init__.py
AdminClient.create_partitions
def create_partitions(self, new_partitions, **kwargs): """ Create additional partitions for the given topics. The future result() value is None. :param list(NewPartitions) new_partitions: New partitions to be created. :param float operation_timeout: Set broker's operation timeo...
python
def create_partitions(self, new_partitions, **kwargs): """ Create additional partitions for the given topics. The future result() value is None. :param list(NewPartitions) new_partitions: New partitions to be created. :param float operation_timeout: Set broker's operation timeo...
[ "def", "create_partitions", "(", "self", ",", "new_partitions", ",", "*", "*", "kwargs", ")", ":", "f", ",", "futmap", "=", "AdminClient", ".", "_make_futures", "(", "[", "x", ".", "topic", "for", "x", "in", "new_partitions", "]", ",", "None", ",", "Ad...
Create additional partitions for the given topics. The future result() value is None. :param list(NewPartitions) new_partitions: New partitions to be created. :param float operation_timeout: Set broker's operation timeout in seconds, controlling how long the CreatePartitions ...
[ "Create", "additional", "partitions", "for", "the", "given", "topics", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/admin/__init__.py#L355-L386
train
Create additional partitions for the given topics.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/admin/__init__.py
AdminClient.describe_configs
def describe_configs(self, resources, **kwargs): """ Get configuration for the specified resources. The future result() value is a dict(<configname, ConfigEntry>). :warning: Multiple resources and resource types may be requested, but at most one resource of type RESOU...
python
def describe_configs(self, resources, **kwargs): """ Get configuration for the specified resources. The future result() value is a dict(<configname, ConfigEntry>). :warning: Multiple resources and resource types may be requested, but at most one resource of type RESOU...
[ "def", "describe_configs", "(", "self", ",", "resources", ",", "*", "*", "kwargs", ")", ":", "f", ",", "futmap", "=", "AdminClient", ".", "_make_futures", "(", "resources", ",", "ConfigResource", ",", "AdminClient", ".", "_make_resource_result", ")", "super", ...
Get configuration for the specified resources. The future result() value is a dict(<configname, ConfigEntry>). :warning: Multiple resources and resource types may be requested, but at most one resource of type RESOURCE_BROKER is allowed per call since these resource...
[ "Get", "configuration", "for", "the", "specified", "resources", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/admin/__init__.py#L388-L419
train
Get the configuration for the specified resources.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/avro/load.py
loads
def loads(schema_str): """ Parse a schema given a schema string """ try: if sys.version_info[0] < 3: return schema.parse(schema_str) else: return schema.Parse(schema_str) except schema.SchemaParseException as e: raise ClientError("Schema parse failed: %s" % (s...
python
def loads(schema_str): """ Parse a schema given a schema string """ try: if sys.version_info[0] < 3: return schema.parse(schema_str) else: return schema.Parse(schema_str) except schema.SchemaParseException as e: raise ClientError("Schema parse failed: %s" % (s...
[ "def", "loads", "(", "schema_str", ")", ":", "try", ":", "if", "sys", ".", "version_info", "[", "0", "]", "<", "3", ":", "return", "schema", ".", "parse", "(", "schema_str", ")", "else", ":", "return", "schema", ".", "Parse", "(", "schema_str", ")", ...
Parse a schema given a schema string
[ "Parse", "a", "schema", "given", "a", "schema", "string" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/avro/load.py#L23-L31
train
Parse a schema given a schema string
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/avro/__init__.py
AvroProducer.produce
def produce(self, **kwargs): """ Asynchronously sends message to Kafka by encoding with specified or default avro schema. :param str topic: topic name :param object value: An object to serialize :param str value_schema: Avro schema for value :param ob...
python
def produce(self, **kwargs): """ Asynchronously sends message to Kafka by encoding with specified or default avro schema. :param str topic: topic name :param object value: An object to serialize :param str value_schema: Avro schema for value :param ob...
[ "def", "produce", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# get schemas from kwargs if defined", "key_schema", "=", "kwargs", ".", "pop", "(", "'key_schema'", ",", "self", ".", "_key_schema", ")", "value_schema", "=", "kwargs", ".", "pop", "(", "'v...
Asynchronously sends message to Kafka by encoding with specified or default avro schema. :param str topic: topic name :param object value: An object to serialize :param str value_schema: Avro schema for value :param object key: An object to serialize :param s...
[ "Asynchronously", "sends", "message", "to", "Kafka", "by", "encoding", "with", "specified", "or", "default", "avro", "schema", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/avro/__init__.py#L53-L90
train
Asynchronously sends message to Kafka by encoding with specified avro schema.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/avro/__init__.py
AvroConsumer.poll
def poll(self, timeout=None): """ This is an overriden method from confluent_kafka.Consumer class. This handles message deserialization using avro schema :param float timeout: Poll timeout in seconds (default: indefinite) :returns: message object with deserialized key and value ...
python
def poll(self, timeout=None): """ This is an overriden method from confluent_kafka.Consumer class. This handles message deserialization using avro schema :param float timeout: Poll timeout in seconds (default: indefinite) :returns: message object with deserialized key and value ...
[ "def", "poll", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "timeout", "is", "None", ":", "timeout", "=", "-", "1", "message", "=", "super", "(", "AvroConsumer", ",", "self", ")", ".", "poll", "(", "timeout", ")", "if", "message", "is"...
This is an overriden method from confluent_kafka.Consumer class. This handles message deserialization using avro schema :param float timeout: Poll timeout in seconds (default: indefinite) :returns: message object with deserialized key and value as dict objects :rtype: Message
[ "This", "is", "an", "overriden", "method", "from", "confluent_kafka", ".", "Consumer", "class", ".", "This", "handles", "message", "deserialization", "using", "avro", "schema" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/avro/__init__.py#L128-L157
train
This method is used to poll a message from Kafka.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/avro/serializer/message_serializer.py
MessageSerializer.encode_record_with_schema
def encode_record_with_schema(self, topic, schema, record, is_key=False): """ Given a parsed avro schema, encode a record for the given topic. The record is expected to be a dictionary. The schema is registered with the subject of 'topic-value' :param str topic: Topic name ...
python
def encode_record_with_schema(self, topic, schema, record, is_key=False): """ Given a parsed avro schema, encode a record for the given topic. The record is expected to be a dictionary. The schema is registered with the subject of 'topic-value' :param str topic: Topic name ...
[ "def", "encode_record_with_schema", "(", "self", ",", "topic", ",", "schema", ",", "record", ",", "is_key", "=", "False", ")", ":", "serialize_err", "=", "KeySerializerError", "if", "is_key", "else", "ValueSerializerError", "subject_suffix", "=", "(", "'-key'", ...
Given a parsed avro schema, encode a record for the given topic. The record is expected to be a dictionary. The schema is registered with the subject of 'topic-value' :param str topic: Topic name :param schema schema: Avro Schema :param dict record: An object to serialize ...
[ "Given", "a", "parsed", "avro", "schema", "encode", "a", "record", "for", "the", "given", "topic", ".", "The", "record", "is", "expected", "to", "be", "a", "dictionary", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/avro/serializer/message_serializer.py#L86-L113
train
Given a parsed avro schema encode a record for the given topic.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/avro/serializer/message_serializer.py
MessageSerializer.encode_record_with_schema_id
def encode_record_with_schema_id(self, schema_id, record, is_key=False): """ Encode a record with a given schema id. The record must be a python dictionary. :param int schema_id: integer ID :param dict record: An object to serialize :param bool is_key: If the record is a...
python
def encode_record_with_schema_id(self, schema_id, record, is_key=False): """ Encode a record with a given schema id. The record must be a python dictionary. :param int schema_id: integer ID :param dict record: An object to serialize :param bool is_key: If the record is a...
[ "def", "encode_record_with_schema_id", "(", "self", ",", "schema_id", ",", "record", ",", "is_key", "=", "False", ")", ":", "serialize_err", "=", "KeySerializerError", "if", "is_key", "else", "ValueSerializerError", "# use slow avro", "if", "schema_id", "not", "in",...
Encode a record with a given schema id. The record must be a python dictionary. :param int schema_id: integer ID :param dict record: An object to serialize :param bool is_key: If the record is a key :returns: decoder function :rtype: func
[ "Encode", "a", "record", "with", "a", "given", "schema", "id", ".", "The", "record", "must", "be", "a", "python", "dictionary", ".", ":", "param", "int", "schema_id", ":", "integer", "ID", ":", "param", "dict", "record", ":", "An", "object", "to", "ser...
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/avro/serializer/message_serializer.py#L115-L149
train
Encode a record with a given schema ID.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/avro/serializer/message_serializer.py
MessageSerializer.decode_message
def decode_message(self, message, is_key=False): """ Decode a message from kafka that has been encoded for use with the schema registry. :param str|bytes or None message: message key or value to be decoded :returns: Decoded message contents. :rtype dict: """ ...
python
def decode_message(self, message, is_key=False): """ Decode a message from kafka that has been encoded for use with the schema registry. :param str|bytes or None message: message key or value to be decoded :returns: Decoded message contents. :rtype dict: """ ...
[ "def", "decode_message", "(", "self", ",", "message", ",", "is_key", "=", "False", ")", ":", "if", "message", "is", "None", ":", "return", "None", "if", "len", "(", "message", ")", "<=", "5", ":", "raise", "SerializerError", "(", "\"message is too small to...
Decode a message from kafka that has been encoded for use with the schema registry. :param str|bytes or None message: message key or value to be decoded :returns: Decoded message contents. :rtype dict:
[ "Decode", "a", "message", "from", "kafka", "that", "has", "been", "encoded", "for", "use", "with", "the", "schema", "registry", ".", ":", "param", "str|bytes", "or", "None", "message", ":", "message", "key", "or", "value", "to", "be", "decoded", ":", "re...
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/avro/serializer/message_serializer.py#L207-L227
train
Decodes a message from kafka that has been encoded for use with the schema registry.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
examples/confluent_cloud.py
acked
def acked(err, msg): """Delivery report callback called (from flush()) on successful or failed delivery of the message.""" if err is not None: print("failed to deliver message: {}".format(err.str())) else: print("produced to: {} [{}] @ {}".format(msg.topic(), msg.partition(), msg.offset()))
python
def acked(err, msg): """Delivery report callback called (from flush()) on successful or failed delivery of the message.""" if err is not None: print("failed to deliver message: {}".format(err.str())) else: print("produced to: {} [{}] @ {}".format(msg.topic(), msg.partition(), msg.offset()))
[ "def", "acked", "(", "err", ",", "msg", ")", ":", "if", "err", "is", "not", "None", ":", "print", "(", "\"failed to deliver message: {}\"", ".", "format", "(", "err", ".", "str", "(", ")", ")", ")", "else", ":", "print", "(", "\"produced to: {} [{}] @ {}...
Delivery report callback called (from flush()) on successful or failed delivery of the message.
[ "Delivery", "report", "callback", "called", "(", "from", "flush", "()", ")", "on", "successful", "or", "failed", "delivery", "of", "the", "message", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/examples/confluent_cloud.py#L65-L70
train
Callback called when a message is acked.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
examples/adminapi.py
example_create_topics
def example_create_topics(a, topics): """ Create topics """ new_topics = [NewTopic(topic, num_partitions=3, replication_factor=1) for topic in topics] # Call create_topics to asynchronously create topics, a dict # of <topic,future> is returned. fs = a.create_topics(new_topics) # Wait for opera...
python
def example_create_topics(a, topics): """ Create topics """ new_topics = [NewTopic(topic, num_partitions=3, replication_factor=1) for topic in topics] # Call create_topics to asynchronously create topics, a dict # of <topic,future> is returned. fs = a.create_topics(new_topics) # Wait for opera...
[ "def", "example_create_topics", "(", "a", ",", "topics", ")", ":", "new_topics", "=", "[", "NewTopic", "(", "topic", ",", "num_partitions", "=", "3", ",", "replication_factor", "=", "1", ")", "for", "topic", "in", "topics", "]", "# Call create_topics to asynch...
Create topics
[ "Create", "topics" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/examples/adminapi.py#L31-L48
train
Create topics.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
examples/adminapi.py
example_delete_topics
def example_delete_topics(a, topics): """ delete topics """ # Call delete_topics to asynchronously delete topics, a future is returned. # By default this operation on the broker returns immediately while # topics are deleted in the background. But here we give it some time (30s) # to propagate in t...
python
def example_delete_topics(a, topics): """ delete topics """ # Call delete_topics to asynchronously delete topics, a future is returned. # By default this operation on the broker returns immediately while # topics are deleted in the background. But here we give it some time (30s) # to propagate in t...
[ "def", "example_delete_topics", "(", "a", ",", "topics", ")", ":", "# Call delete_topics to asynchronously delete topics, a future is returned.", "# By default this operation on the broker returns immediately while", "# topics are deleted in the background. But here we give it some time (30s)", ...
delete topics
[ "delete", "topics" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/examples/adminapi.py#L51-L68
train
Delete topics from the broker.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
examples/adminapi.py
example_create_partitions
def example_create_partitions(a, topics): """ create partitions """ new_parts = [NewPartitions(topic, int(new_total_count)) for topic, new_total_count in zip(topics[0::2], topics[1::2])] # Try switching validate_only to True to only validate the operation # on the broker but not actua...
python
def example_create_partitions(a, topics): """ create partitions """ new_parts = [NewPartitions(topic, int(new_total_count)) for topic, new_total_count in zip(topics[0::2], topics[1::2])] # Try switching validate_only to True to only validate the operation # on the broker but not actua...
[ "def", "example_create_partitions", "(", "a", ",", "topics", ")", ":", "new_parts", "=", "[", "NewPartitions", "(", "topic", ",", "int", "(", "new_total_count", ")", ")", "for", "topic", ",", "new_total_count", "in", "zip", "(", "topics", "[", "0", ":", ...
create partitions
[ "create", "partitions" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/examples/adminapi.py#L71-L87
train
Create partitions for all topics.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
examples/adminapi.py
example_describe_configs
def example_describe_configs(a, args): """ describe configs """ resources = [ConfigResource(restype, resname) for restype, resname in zip(args[0::2], args[1::2])] fs = a.describe_configs(resources) # Wait for operation to finish. for res, f in fs.items(): try: ...
python
def example_describe_configs(a, args): """ describe configs """ resources = [ConfigResource(restype, resname) for restype, resname in zip(args[0::2], args[1::2])] fs = a.describe_configs(resources) # Wait for operation to finish. for res, f in fs.items(): try: ...
[ "def", "example_describe_configs", "(", "a", ",", "args", ")", ":", "resources", "=", "[", "ConfigResource", "(", "restype", ",", "resname", ")", "for", "restype", ",", "resname", "in", "zip", "(", "args", "[", "0", ":", ":", "2", "]", ",", "args", "...
describe configs
[ "describe", "configs" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/examples/adminapi.py#L99-L117
train
describe configs for all resources in the cluster
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
examples/adminapi.py
example_alter_configs
def example_alter_configs(a, args): """ Alter configs atomically, replacing non-specified configuration properties with their default values. """ resources = [] for restype, resname, configs in zip(args[0::3], args[1::3], args[2::3]): resource = ConfigResource(restype, resname) reso...
python
def example_alter_configs(a, args): """ Alter configs atomically, replacing non-specified configuration properties with their default values. """ resources = [] for restype, resname, configs in zip(args[0::3], args[1::3], args[2::3]): resource = ConfigResource(restype, resname) reso...
[ "def", "example_alter_configs", "(", "a", ",", "args", ")", ":", "resources", "=", "[", "]", "for", "restype", ",", "resname", ",", "configs", "in", "zip", "(", "args", "[", "0", ":", ":", "3", "]", ",", "args", "[", "1", ":", ":", "3", "]", ",...
Alter configs atomically, replacing non-specified configuration properties with their default values.
[ "Alter", "configs", "atomically", "replacing", "non", "-", "specified", "configuration", "properties", "with", "their", "default", "values", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/examples/adminapi.py#L120-L140
train
Alter configs atomically replacing non - specified configuration properties with their default values.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
examples/adminapi.py
example_delta_alter_configs
def example_delta_alter_configs(a, args): """ The AlterConfigs Kafka API requires all configuration to be passed, any left out configuration properties will revert to their default settings. This example shows how to just modify the supplied configuration entries by first reading the configuration ...
python
def example_delta_alter_configs(a, args): """ The AlterConfigs Kafka API requires all configuration to be passed, any left out configuration properties will revert to their default settings. This example shows how to just modify the supplied configuration entries by first reading the configuration ...
[ "def", "example_delta_alter_configs", "(", "a", ",", "args", ")", ":", "# Convert supplied config to resources.", "# We can reuse the same resources both for describe_configs and", "# alter_configs.", "resources", "=", "[", "]", "for", "restype", ",", "resname", ",", "configs...
The AlterConfigs Kafka API requires all configuration to be passed, any left out configuration properties will revert to their default settings. This example shows how to just modify the supplied configuration entries by first reading the configuration from the broker, updating the supplied configurati...
[ "The", "AlterConfigs", "Kafka", "API", "requires", "all", "configuration", "to", "be", "passed", "any", "left", "out", "configuration", "properties", "will", "revert", "to", "their", "default", "settings", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/examples/adminapi.py#L143-L232
train
This example shows how to modify the supplied configuration entries in Kafka.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
examples/adminapi.py
example_list
def example_list(a, args): """ list topics and cluster metadata """ if len(args) == 0: what = "all" else: what = args[0] md = a.list_topics(timeout=10) print("Cluster {} metadata (response from broker {}):".format(md.cluster_id, md.orig_broker_name)) if what in ("all", "broke...
python
def example_list(a, args): """ list topics and cluster metadata """ if len(args) == 0: what = "all" else: what = args[0] md = a.list_topics(timeout=10) print("Cluster {} metadata (response from broker {}):".format(md.cluster_id, md.orig_broker_name)) if what in ("all", "broke...
[ "def", "example_list", "(", "a", ",", "args", ")", ":", "if", "len", "(", "args", ")", "==", "0", ":", "what", "=", "\"all\"", "else", ":", "what", "=", "args", "[", "0", "]", "md", "=", "a", ".", "list_topics", "(", "timeout", "=", "10", ")", ...
list topics and cluster metadata
[ "list", "topics", "and", "cluster", "metadata" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/examples/adminapi.py#L235-L274
train
list topics and cluster metadata
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/__init__.py
_resolve_plugins
def _resolve_plugins(plugins): """ Resolve embedded plugins from the wheel's library directory. For internal module use only. :param str plugins: The plugin.library.paths value """ import os from sys import platform # Location of __init__.py and the embedded library directory ...
python
def _resolve_plugins(plugins): """ Resolve embedded plugins from the wheel's library directory. For internal module use only. :param str plugins: The plugin.library.paths value """ import os from sys import platform # Location of __init__.py and the embedded library directory ...
[ "def", "_resolve_plugins", "(", "plugins", ")", ":", "import", "os", "from", "sys", "import", "platform", "# Location of __init__.py and the embedded library directory", "basedir", "=", "os", ".", "path", ".", "dirname", "(", "__file__", ")", "if", "platform", "in",...
Resolve embedded plugins from the wheel's library directory. For internal module use only. :param str plugins: The plugin.library.paths value
[ "Resolve", "embedded", "plugins", "from", "the", "wheel", "s", "library", "directory", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/__init__.py#L47-L102
train
Resolve embedded plugins from the wheel s library directory.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
examples/avro-cli.py
on_delivery
def on_delivery(err, msg, obj): """ Handle delivery reports served from producer.poll. This callback takes an extra argument, obj. This allows the original contents to be included for debugging purposes. """ if err is not None: print('Message {} delivery failed for user {} wi...
python
def on_delivery(err, msg, obj): """ Handle delivery reports served from producer.poll. This callback takes an extra argument, obj. This allows the original contents to be included for debugging purposes. """ if err is not None: print('Message {} delivery failed for user {} wi...
[ "def", "on_delivery", "(", "err", ",", "msg", ",", "obj", ")", ":", "if", "err", "is", "not", "None", ":", "print", "(", "'Message {} delivery failed for user {} with error {}'", ".", "format", "(", "obj", ".", "id", ",", "obj", ".", "name", ",", "err", ...
Handle delivery reports served from producer.poll. This callback takes an extra argument, obj. This allows the original contents to be included for debugging purposes.
[ "Handle", "delivery", "reports", "served", "from", "producer", ".", "poll", ".", "This", "callback", "takes", "an", "extra", "argument", "obj", ".", "This", "allows", "the", "original", "contents", "to", "be", "included", "for", "debugging", "purposes", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/examples/avro-cli.py#L68-L79
train
Handle delivery reports served from producer. poll.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
examples/avro-cli.py
produce
def produce(topic, conf): """ Produce User records """ from confluent_kafka.avro import AvroProducer producer = AvroProducer(conf, default_value_schema=record_schema) print("Producing user records to topic {}. ^c to exit.".format(topic)) while True: # Instantiate new User, pop...
python
def produce(topic, conf): """ Produce User records """ from confluent_kafka.avro import AvroProducer producer = AvroProducer(conf, default_value_schema=record_schema) print("Producing user records to topic {}. ^c to exit.".format(topic)) while True: # Instantiate new User, pop...
[ "def", "produce", "(", "topic", ",", "conf", ")", ":", "from", "confluent_kafka", ".", "avro", "import", "AvroProducer", "producer", "=", "AvroProducer", "(", "conf", ",", "default_value_schema", "=", "record_schema", ")", "print", "(", "\"Producing user records t...
Produce User records
[ "Produce", "User", "records" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/examples/avro-cli.py#L82-L113
train
Produce user records to a topic.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
examples/avro-cli.py
consume
def consume(topic, conf): """ Consume User records """ from confluent_kafka.avro import AvroConsumer from confluent_kafka.avro.serializer import SerializerError print("Consuming user records from topic {} with group {}. ^c to exit.".format(topic, conf["group.id"])) c = AvroConsumer(con...
python
def consume(topic, conf): """ Consume User records """ from confluent_kafka.avro import AvroConsumer from confluent_kafka.avro.serializer import SerializerError print("Consuming user records from topic {} with group {}. ^c to exit.".format(topic, conf["group.id"])) c = AvroConsumer(con...
[ "def", "consume", "(", "topic", ",", "conf", ")", ":", "from", "confluent_kafka", ".", "avro", "import", "AvroConsumer", "from", "confluent_kafka", ".", "avro", ".", "serializer", "import", "SerializerError", "print", "(", "\"Consuming user records from topic {} with ...
Consume User records
[ "Consume", "User", "records" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/examples/avro-cli.py#L116-L151
train
Consume user records from kafka topic with group.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/avro/cached_schema_registry_client.py
CachedSchemaRegistryClient.register
def register(self, subject, avro_schema): """ POST /subjects/(string: subject)/versions Register a schema with the registry under the given subject and receive a schema id. avro_schema must be a parsed schema from the python avro library Multiple instances of the same s...
python
def register(self, subject, avro_schema): """ POST /subjects/(string: subject)/versions Register a schema with the registry under the given subject and receive a schema id. avro_schema must be a parsed schema from the python avro library Multiple instances of the same s...
[ "def", "register", "(", "self", ",", "subject", ",", "avro_schema", ")", ":", "schemas_to_id", "=", "self", ".", "subject_to_schema_ids", "[", "subject", "]", "schema_id", "=", "schemas_to_id", ".", "get", "(", "avro_schema", ",", "None", ")", "if", "schema_...
POST /subjects/(string: subject)/versions Register a schema with the registry under the given subject and receive a schema id. avro_schema must be a parsed schema from the python avro library Multiple instances of the same schema will result in cache misses. :param str subject...
[ "POST", "/", "subjects", "/", "(", "string", ":", "subject", ")", "/", "versions", "Register", "a", "schema", "with", "the", "registry", "under", "the", "given", "subject", "and", "receive", "a", "schema", "id", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/avro/cached_schema_registry_client.py#L192-L230
train
Register a schema with the registry under the given subject.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/avro/cached_schema_registry_client.py
CachedSchemaRegistryClient.delete_subject
def delete_subject(self, subject): """ DELETE /subjects/(string: subject) Deletes the specified subject and its associated compatibility level if registered. It is recommended to use this API only when a topic needs to be recycled or in development environments. :param subject: s...
python
def delete_subject(self, subject): """ DELETE /subjects/(string: subject) Deletes the specified subject and its associated compatibility level if registered. It is recommended to use this API only when a topic needs to be recycled or in development environments. :param subject: s...
[ "def", "delete_subject", "(", "self", ",", "subject", ")", ":", "url", "=", "'/'", ".", "join", "(", "[", "self", ".", "url", ",", "'subjects'", ",", "subject", "]", ")", "result", ",", "code", "=", "self", ".", "_send_request", "(", "url", ",", "m...
DELETE /subjects/(string: subject) Deletes the specified subject and its associated compatibility level if registered. It is recommended to use this API only when a topic needs to be recycled or in development environments. :param subject: subject name :returns: version of the schema del...
[ "DELETE", "/", "subjects", "/", "(", "string", ":", "subject", ")", "Deletes", "the", "specified", "subject", "and", "its", "associated", "compatibility", "level", "if", "registered", ".", "It", "is", "recommended", "to", "use", "this", "API", "only", "when"...
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/avro/cached_schema_registry_client.py#L232-L247
train
Delete the specified subject and its associated compatibility level if registered.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/avro/cached_schema_registry_client.py
CachedSchemaRegistryClient.get_by_id
def get_by_id(self, schema_id): """ GET /schemas/ids/{int: id} Retrieve a parsed avro schema by id or None if not found :param int schema_id: int value :returns: Avro schema :rtype: schema """ if schema_id in self.id_to_schema: return self.id_t...
python
def get_by_id(self, schema_id): """ GET /schemas/ids/{int: id} Retrieve a parsed avro schema by id or None if not found :param int schema_id: int value :returns: Avro schema :rtype: schema """ if schema_id in self.id_to_schema: return self.id_t...
[ "def", "get_by_id", "(", "self", ",", "schema_id", ")", ":", "if", "schema_id", "in", "self", ".", "id_to_schema", ":", "return", "self", ".", "id_to_schema", "[", "schema_id", "]", "# fetch from the registry", "url", "=", "'/'", ".", "join", "(", "[", "se...
GET /schemas/ids/{int: id} Retrieve a parsed avro schema by id or None if not found :param int schema_id: int value :returns: Avro schema :rtype: schema
[ "GET", "/", "schemas", "/", "ids", "/", "{", "int", ":", "id", "}", "Retrieve", "a", "parsed", "avro", "schema", "by", "id", "or", "None", "if", "not", "found", ":", "param", "int", "schema_id", ":", "int", "value", ":", "returns", ":", "Avro", "sc...
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/avro/cached_schema_registry_client.py#L249-L279
train
Get an Avro schema by its ID.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/avro/cached_schema_registry_client.py
CachedSchemaRegistryClient.get_version
def get_version(self, subject, avro_schema): """ POST /subjects/(string: subject) Get the version of a schema for a given subject. Returns None if not found. :param str subject: subject name :param: schema avro_schema: Avro schema :returns: version :rtyp...
python
def get_version(self, subject, avro_schema): """ POST /subjects/(string: subject) Get the version of a schema for a given subject. Returns None if not found. :param str subject: subject name :param: schema avro_schema: Avro schema :returns: version :rtyp...
[ "def", "get_version", "(", "self", ",", "subject", ",", "avro_schema", ")", ":", "schemas_to_version", "=", "self", ".", "subject_to_schema_versions", "[", "subject", "]", "version", "=", "schemas_to_version", ".", "get", "(", "avro_schema", ",", "None", ")", ...
POST /subjects/(string: subject) Get the version of a schema for a given subject. Returns None if not found. :param str subject: subject name :param: schema avro_schema: Avro schema :returns: version :rtype: int
[ "POST", "/", "subjects", "/", "(", "string", ":", "subject", ")" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/avro/cached_schema_registry_client.py#L321-L351
train
Get the version of a schema for a given subject.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/avro/cached_schema_registry_client.py
CachedSchemaRegistryClient.update_compatibility
def update_compatibility(self, level, subject=None): """ PUT /config/(string: subject) Update the compatibility level for a subject. Level must be one of: :param str level: ex: 'NONE','FULL','FORWARD', or 'BACKWARD' """ if level not in VALID_LEVELS: raise C...
python
def update_compatibility(self, level, subject=None): """ PUT /config/(string: subject) Update the compatibility level for a subject. Level must be one of: :param str level: ex: 'NONE','FULL','FORWARD', or 'BACKWARD' """ if level not in VALID_LEVELS: raise C...
[ "def", "update_compatibility", "(", "self", ",", "level", ",", "subject", "=", "None", ")", ":", "if", "level", "not", "in", "VALID_LEVELS", ":", "raise", "ClientError", "(", "\"Invalid level specified: %s\"", "%", "(", "str", "(", "level", ")", ")", ")", ...
PUT /config/(string: subject) Update the compatibility level for a subject. Level must be one of: :param str level: ex: 'NONE','FULL','FORWARD', or 'BACKWARD'
[ "PUT", "/", "config", "/", "(", "string", ":", "subject", ")" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/avro/cached_schema_registry_client.py#L385-L405
train
Update the compatibility level for a subject.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
confluent_kafka/avro/cached_schema_registry_client.py
CachedSchemaRegistryClient.get_compatibility
def get_compatibility(self, subject=None): """ GET /config Get the current compatibility level for a subject. Result will be one of: :param str subject: subject name :raises ClientError: if the request was unsuccessful or an invalid compatibility level was returned :ret...
python
def get_compatibility(self, subject=None): """ GET /config Get the current compatibility level for a subject. Result will be one of: :param str subject: subject name :raises ClientError: if the request was unsuccessful or an invalid compatibility level was returned :ret...
[ "def", "get_compatibility", "(", "self", ",", "subject", "=", "None", ")", ":", "url", "=", "'/'", ".", "join", "(", "[", "self", ".", "url", ",", "'config'", "]", ")", "if", "subject", ":", "url", "=", "'/'", ".", "join", "(", "[", "url", ",", ...
GET /config Get the current compatibility level for a subject. Result will be one of: :param str subject: subject name :raises ClientError: if the request was unsuccessful or an invalid compatibility level was returned :returns: one of 'NONE','FULL','FORWARD', or 'BACKWARD' :rt...
[ "GET", "/", "config", "Get", "the", "current", "compatibility", "level", "for", "a", "subject", ".", "Result", "will", "be", "one", "of", ":" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/confluent_kafka/avro/cached_schema_registry_client.py#L407-L434
train
GET / config
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
tools/download-s3.py
Artifact.download
def download(self, dirpath): """ Download artifact from S3 and store in dirpath directory. If the artifact is already downloaded nothing is done. """ if os.path.isfile(self.lpath) and os.path.getsize(self.lpath) > 0: return print('Downloading %s -> %s' % (self.path, self....
python
def download(self, dirpath): """ Download artifact from S3 and store in dirpath directory. If the artifact is already downloaded nothing is done. """ if os.path.isfile(self.lpath) and os.path.getsize(self.lpath) > 0: return print('Downloading %s -> %s' % (self.path, self....
[ "def", "download", "(", "self", ",", "dirpath", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "self", ".", "lpath", ")", "and", "os", ".", "path", ".", "getsize", "(", "self", ".", "lpath", ")", ">", "0", ":", "return", "print", "(", "...
Download artifact from S3 and store in dirpath directory. If the artifact is already downloaded nothing is done.
[ "Download", "artifact", "from", "S3", "and", "store", "in", "dirpath", "directory", ".", "If", "the", "artifact", "is", "already", "downloaded", "nothing", "is", "done", "." ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/tools/download-s3.py#L46-L54
train
Download the artifact from S3 and store in dirpath.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
tools/download-s3.py
Artifacts.collect_single_s3
def collect_single_s3(self, path): """ Collect single S3 artifact :param: path string: S3 path """ # The S3 folder contains the tokens needed to perform # matching of project, gitref, etc. folder = os.path.dirname(path) rinfo = re.findall(r'(?P<tag>[^-]+)-(?P<v...
python
def collect_single_s3(self, path): """ Collect single S3 artifact :param: path string: S3 path """ # The S3 folder contains the tokens needed to perform # matching of project, gitref, etc. folder = os.path.dirname(path) rinfo = re.findall(r'(?P<tag>[^-]+)-(?P<v...
[ "def", "collect_single_s3", "(", "self", ",", "path", ")", ":", "# The S3 folder contains the tokens needed to perform", "# matching of project, gitref, etc.", "folder", "=", "os", ".", "path", ".", "dirname", "(", "path", ")", "rinfo", "=", "re", ".", "findall", "(...
Collect single S3 artifact :param: path string: S3 path
[ "Collect", "single", "S3", "artifact", ":", "param", ":", "path", "string", ":", "S3", "path" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/tools/download-s3.py#L68-L102
train
Collect a single artifact from an S3 path.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
tools/download-s3.py
Artifacts.collect_s3
def collect_s3(self): """ Collect and download build-artifacts from S3 based on git reference """ print('Collecting artifacts matching tag/sha %s from S3 bucket %s' % (self.gitref, s3_bucket)) self.s3 = boto3.resource('s3') self.s3_bucket = self.s3.Bucket(s3_bucket) self.s3.meta....
python
def collect_s3(self): """ Collect and download build-artifacts from S3 based on git reference """ print('Collecting artifacts matching tag/sha %s from S3 bucket %s' % (self.gitref, s3_bucket)) self.s3 = boto3.resource('s3') self.s3_bucket = self.s3.Bucket(s3_bucket) self.s3.meta....
[ "def", "collect_s3", "(", "self", ")", ":", "print", "(", "'Collecting artifacts matching tag/sha %s from S3 bucket %s'", "%", "(", "self", ".", "gitref", ",", "s3_bucket", ")", ")", "self", ".", "s3", "=", "boto3", ".", "resource", "(", "'s3'", ")", "self", ...
Collect and download build-artifacts from S3 based on git reference
[ "Collect", "and", "download", "build", "-", "artifacts", "from", "S3", "based", "on", "git", "reference" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/tools/download-s3.py#L104-L114
train
Collect and download build - artifacts from S3 based on git reference
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
confluentinc/confluent-kafka-python
tools/download-s3.py
Artifacts.collect_local
def collect_local(self, path): """ Collect artifacts from a local directory possibly previously collected from s3 """ for f in os.listdir(path): lpath = os.path.join(path, f) if not os.path.isfile(lpath): continue Artifact(self, lpath)
python
def collect_local(self, path): """ Collect artifacts from a local directory possibly previously collected from s3 """ for f in os.listdir(path): lpath = os.path.join(path, f) if not os.path.isfile(lpath): continue Artifact(self, lpath)
[ "def", "collect_local", "(", "self", ",", "path", ")", ":", "for", "f", "in", "os", ".", "listdir", "(", "path", ")", ":", "lpath", "=", "os", ".", "path", ".", "join", "(", "path", ",", "f", ")", "if", "not", "os", ".", "path", ".", "isfile", ...
Collect artifacts from a local directory possibly previously collected from s3
[ "Collect", "artifacts", "from", "a", "local", "directory", "possibly", "previously", "collected", "from", "s3" ]
5a8aeb741609e61eaccafff2a67fa494dd549e8b
https://github.com/confluentinc/confluent-kafka-python/blob/5a8aeb741609e61eaccafff2a67fa494dd549e8b/tools/download-s3.py#L116-L123
train
Collect artifacts from a local directory possibly previously collected from s3
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/ddns.py
_config
def _config(name, key=None, **kwargs): ''' Return a value for 'name' from command line args then config file options. Specify 'key' if the config file option is not the same as 'name'. ''' if key is None: key = name if name in kwargs: value = kwargs[name] else: value ...
python
def _config(name, key=None, **kwargs): ''' Return a value for 'name' from command line args then config file options. Specify 'key' if the config file option is not the same as 'name'. ''' if key is None: key = name if name in kwargs: value = kwargs[name] else: value ...
[ "def", "_config", "(", "name", ",", "key", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "key", "is", "None", ":", "key", "=", "name", "if", "name", "in", "kwargs", ":", "value", "=", "kwargs", "[", "name", "]", "else", ":", "value", "=...
Return a value for 'name' from command line args then config file options. Specify 'key' if the config file option is not the same as 'name'.
[ "Return", "a", "value", "for", "name", "from", "command", "line", "args", "then", "config", "file", "options", ".", "Specify", "key", "if", "the", "config", "file", "option", "is", "not", "the", "same", "as", "name", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ddns.py#L55-L68
train
Return a value for name from command line args then config file options.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/ddns.py
add_host
def add_host(zone, name, ttl, ip, nameserver='127.0.0.1', replace=True, timeout=5, port=53, **kwargs): ''' Add, replace, or update the A and PTR (reverse) records for a host. CLI Example: .. code-block:: bash salt ns1 ddns.add_host example.com host1 60 10.1.1.1 ''' res = ...
python
def add_host(zone, name, ttl, ip, nameserver='127.0.0.1', replace=True, timeout=5, port=53, **kwargs): ''' Add, replace, or update the A and PTR (reverse) records for a host. CLI Example: .. code-block:: bash salt ns1 ddns.add_host example.com host1 60 10.1.1.1 ''' res = ...
[ "def", "add_host", "(", "zone", ",", "name", ",", "ttl", ",", "ip", ",", "nameserver", "=", "'127.0.0.1'", ",", "replace", "=", "True", ",", "timeout", "=", "5", ",", "port", "=", "53", ",", "*", "*", "kwargs", ")", ":", "res", "=", "update", "("...
Add, replace, or update the A and PTR (reverse) records for a host. CLI Example: .. code-block:: bash salt ns1 ddns.add_host example.com host1 60 10.1.1.1
[ "Add", "replace", "or", "update", "the", "A", "and", "PTR", "(", "reverse", ")", "records", "for", "a", "host", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ddns.py#L79-L109
train
Add or update the A and PTR records for a host.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/ddns.py
delete_host
def delete_host(zone, name, nameserver='127.0.0.1', timeout=5, port=53, **kwargs): ''' Delete the forward and reverse records for a host. Returns true if any records are deleted. CLI Example: .. code-block:: bash salt ns1 ddns.delete_host example.com host1 ''' fqd...
python
def delete_host(zone, name, nameserver='127.0.0.1', timeout=5, port=53, **kwargs): ''' Delete the forward and reverse records for a host. Returns true if any records are deleted. CLI Example: .. code-block:: bash salt ns1 ddns.delete_host example.com host1 ''' fqd...
[ "def", "delete_host", "(", "zone", ",", "name", ",", "nameserver", "=", "'127.0.0.1'", ",", "timeout", "=", "5", ",", "port", "=", "53", ",", "*", "*", "kwargs", ")", ":", "fqdn", "=", "'{0}.{1}'", ".", "format", "(", "name", ",", "zone", ")", "req...
Delete the forward and reverse records for a host. Returns true if any records are deleted. CLI Example: .. code-block:: bash salt ns1 ddns.delete_host example.com host1
[ "Delete", "the", "forward", "and", "reverse", "records", "for", "a", "host", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ddns.py#L112-L151
train
Delete the forward and reverse records for a host.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/ddns.py
update
def update(zone, name, ttl, rdtype, data, nameserver='127.0.0.1', timeout=5, replace=False, port=53, **kwargs): ''' Add, replace, or update a DNS record. nameserver must be an IP address and the minion running this module must have update privileges on that server. If replace is true, fir...
python
def update(zone, name, ttl, rdtype, data, nameserver='127.0.0.1', timeout=5, replace=False, port=53, **kwargs): ''' Add, replace, or update a DNS record. nameserver must be an IP address and the minion running this module must have update privileges on that server. If replace is true, fir...
[ "def", "update", "(", "zone", ",", "name", ",", "ttl", ",", "rdtype", ",", "data", ",", "nameserver", "=", "'127.0.0.1'", ",", "timeout", "=", "5", ",", "replace", "=", "False", ",", "port", "=", "53", ",", "*", "*", "kwargs", ")", ":", "name", "...
Add, replace, or update a DNS record. nameserver must be an IP address and the minion running this module must have update privileges on that server. If replace is true, first deletes all records for this name and type. CLI Example: .. code-block:: bash salt ns1 ddns.update example.com ho...
[ "Add", "replace", "or", "update", "a", "DNS", "record", ".", "nameserver", "must", "be", "an", "IP", "address", "and", "the", "minion", "running", "this", "module", "must", "have", "update", "privileges", "on", "that", "server", ".", "If", "replace", "is",...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ddns.py#L154-L205
train
Update a DNS record in a named zone.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/ansiblegate.py
_set_callables
def _set_callables(modules): ''' Set all Ansible modules callables :return: ''' def _set_function(cmd_name, doc): ''' Create a Salt function for the Ansible module. ''' def _cmd(*args, **kw): ''' Call an Ansible module as a function from the Sa...
python
def _set_callables(modules): ''' Set all Ansible modules callables :return: ''' def _set_function(cmd_name, doc): ''' Create a Salt function for the Ansible module. ''' def _cmd(*args, **kw): ''' Call an Ansible module as a function from the Sa...
[ "def", "_set_callables", "(", "modules", ")", ":", "def", "_set_function", "(", "cmd_name", ",", "doc", ")", ":", "'''\n Create a Salt function for the Ansible module.\n '''", "def", "_cmd", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "'''\n ...
Set all Ansible modules callables :return:
[ "Set", "all", "Ansible", "modules", "callables", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ansiblegate.py#L190-L215
train
Set all Ansible modules callables
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/ansiblegate.py
help
def help(module=None, *args): ''' Display help on Ansible standard module. :param module: :return: ''' if not module: raise CommandExecutionError('Please tell me what module you want to have helped with. ' 'Or call "ansible.list" to know what is avail...
python
def help(module=None, *args): ''' Display help on Ansible standard module. :param module: :return: ''' if not module: raise CommandExecutionError('Please tell me what module you want to have helped with. ' 'Or call "ansible.list" to know what is avail...
[ "def", "help", "(", "module", "=", "None", ",", "*", "args", ")", ":", "if", "not", "module", ":", "raise", "CommandExecutionError", "(", "'Please tell me what module you want to have helped with. '", "'Or call \"ansible.list\" to know what is available.'", ")", "try", ":...
Display help on Ansible standard module. :param module: :return:
[ "Display", "help", "on", "Ansible", "standard", "module", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ansiblegate.py#L237-L273
train
Display help on Ansible standard module.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/ansiblegate.py
playbooks
def playbooks(playbook, rundir=None, check=False, diff=False, extra_vars=None, flush_cache=False, forks=5, inventory=None, limit=None, list_hosts=False, list_tags=False, list_tasks=False, module_path=None, skip_tags=None, start_at_task=None, syntax_check=False, ta...
python
def playbooks(playbook, rundir=None, check=False, diff=False, extra_vars=None, flush_cache=False, forks=5, inventory=None, limit=None, list_hosts=False, list_tags=False, list_tasks=False, module_path=None, skip_tags=None, start_at_task=None, syntax_check=False, ta...
[ "def", "playbooks", "(", "playbook", ",", "rundir", "=", "None", ",", "check", "=", "False", ",", "diff", "=", "False", ",", "extra_vars", "=", "None", ",", "flush_cache", "=", "False", ",", "forks", "=", "5", ",", "inventory", "=", "None", ",", "lim...
Run Ansible Playbooks :param playbook: Which playbook to run. :param rundir: Directory to run `ansible-playbook` in. (Default: None) :param check: don't make any changes; instead, try to predict some of the changes that may occur (Default: False) :param diff: when changing (small) fil...
[ "Run", "Ansible", "Playbooks" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ansiblegate.py#L286-L381
train
Ansible Playbooks for the given playbook.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/ansiblegate.py
AnsibleModuleResolver._get_modules_map
def _get_modules_map(self, path=None): ''' Get installed Ansible modules :return: ''' paths = {} root = ansible.modules.__path__[0] if not path: path = root for p_el in os.listdir(path): p_el_path = os.path.join(path, p_el) ...
python
def _get_modules_map(self, path=None): ''' Get installed Ansible modules :return: ''' paths = {} root = ansible.modules.__path__[0] if not path: path = root for p_el in os.listdir(path): p_el_path = os.path.join(path, p_el) ...
[ "def", "_get_modules_map", "(", "self", ",", "path", "=", "None", ")", ":", "paths", "=", "{", "}", "root", "=", "ansible", ".", "modules", ".", "__path__", "[", "0", "]", "if", "not", "path", ":", "path", "=", "root", "for", "p_el", "in", "os", ...
Get installed Ansible modules :return:
[ "Get", "installed", "Ansible", "modules", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ansiblegate.py#L68-L92
train
Get installed Ansible modules and return a dict of the names of the modules that are installed.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/ansiblegate.py
AnsibleModuleResolver.load_module
def load_module(self, module): ''' Introspect Ansible module. :param module: :return: ''' m_ref = self._modules_map.get(module) if m_ref is None: raise LoaderError('Module "{0}" was not found'.format(module)) mod = importlib.import_module('ans...
python
def load_module(self, module): ''' Introspect Ansible module. :param module: :return: ''' m_ref = self._modules_map.get(module) if m_ref is None: raise LoaderError('Module "{0}" was not found'.format(module)) mod = importlib.import_module('ans...
[ "def", "load_module", "(", "self", ",", "module", ")", ":", "m_ref", "=", "self", ".", "_modules_map", ".", "get", "(", "module", ")", "if", "m_ref", "is", "None", ":", "raise", "LoaderError", "(", "'Module \"{0}\" was not found'", ".", "format", "(", "mod...
Introspect Ansible module. :param module: :return:
[ "Introspect", "Ansible", "module", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ansiblegate.py#L94-L107
train
Load an ansible module.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/ansiblegate.py
AnsibleModuleResolver.get_modules_list
def get_modules_list(self, pattern=None): ''' Return module map references. :return: ''' if pattern and '*' not in pattern: pattern = '*{0}*'.format(pattern) modules = [] for m_name, m_path in self._modules_map.items(): m_path = m_path.spli...
python
def get_modules_list(self, pattern=None): ''' Return module map references. :return: ''' if pattern and '*' not in pattern: pattern = '*{0}*'.format(pattern) modules = [] for m_name, m_path in self._modules_map.items(): m_path = m_path.spli...
[ "def", "get_modules_list", "(", "self", ",", "pattern", "=", "None", ")", ":", "if", "pattern", "and", "'*'", "not", "in", "pattern", ":", "pattern", "=", "'*{0}*'", ".", "format", "(", "pattern", ")", "modules", "=", "[", "]", "for", "m_name", ",", ...
Return module map references. :return:
[ "Return", "module", "map", "references", ".", ":", "return", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ansiblegate.py#L109-L122
train
Return a list of all modules that match the pattern.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/ansiblegate.py
AnsibleModuleCaller.call
def call(self, module, *args, **kwargs): ''' Call an Ansible module by invoking it. :param module: the name of the module. :param args: Arguments to the module :param kwargs: keywords to the module :return: ''' module = self._resolver.load_module(module) ...
python
def call(self, module, *args, **kwargs): ''' Call an Ansible module by invoking it. :param module: the name of the module. :param args: Arguments to the module :param kwargs: keywords to the module :return: ''' module = self._resolver.load_module(module) ...
[ "def", "call", "(", "self", ",", "module", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "module", "=", "self", ".", "_resolver", ".", "load_module", "(", "module", ")", "if", "not", "hasattr", "(", "module", ",", "'main'", ")", ":", "raise"...
Call an Ansible module by invoking it. :param module: the name of the module. :param args: Arguments to the module :param kwargs: keywords to the module :return:
[ "Call", "an", "Ansible", "module", "by", "invoking", "it", ".", ":", "param", "module", ":", "the", "name", "of", "the", "module", ".", ":", "param", "args", ":", "Arguments", "to", "the", "module", ":", "param", "kwargs", ":", "keywords", "to", "the",...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/ansiblegate.py#L142-L183
train
Call an Ansible module by invoking it.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
__clean_tmp
def __clean_tmp(sfn): ''' Clean out a template temp file ''' if sfn.startswith(os.path.join(tempfile.gettempdir(), salt.utils.files.TEMPFILE_PREFIX)): # Don't remove if it exists in file_roots (any saltenv) all_roots = itertools.chain.from_iterable( ...
python
def __clean_tmp(sfn): ''' Clean out a template temp file ''' if sfn.startswith(os.path.join(tempfile.gettempdir(), salt.utils.files.TEMPFILE_PREFIX)): # Don't remove if it exists in file_roots (any saltenv) all_roots = itertools.chain.from_iterable( ...
[ "def", "__clean_tmp", "(", "sfn", ")", ":", "if", "sfn", ".", "startswith", "(", "os", ".", "path", ".", "join", "(", "tempfile", ".", "gettempdir", "(", ")", ",", "salt", ".", "utils", ".", "files", ".", "TEMPFILE_PREFIX", ")", ")", ":", "# Don't re...
Clean out a template temp file
[ "Clean", "out", "a", "template", "temp", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L88-L100
train
Clean out a template temp file
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
_binary_replace
def _binary_replace(old, new): ''' This function does NOT do any diffing, it just checks the old and new files to see if either is binary, and provides an appropriate string noting the difference between the two files. If neither file is binary, an empty string is returned. This function should...
python
def _binary_replace(old, new): ''' This function does NOT do any diffing, it just checks the old and new files to see if either is binary, and provides an appropriate string noting the difference between the two files. If neither file is binary, an empty string is returned. This function should...
[ "def", "_binary_replace", "(", "old", ",", "new", ")", ":", "old_isbin", "=", "not", "__utils__", "[", "'files.is_text'", "]", "(", "old", ")", "new_isbin", "=", "not", "__utils__", "[", "'files.is_text'", "]", "(", "new", ")", "if", "any", "(", "(", "...
This function does NOT do any diffing, it just checks the old and new files to see if either is binary, and provides an appropriate string noting the difference between the two files. If neither file is binary, an empty string is returned. This function should only be run AFTER it has been determined t...
[ "This", "function", "does", "NOT", "do", "any", "diffing", "it", "just", "checks", "the", "old", "and", "new", "files", "to", "see", "if", "either", "is", "binary", "and", "provides", "an", "appropriate", "string", "noting", "the", "difference", "between", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L112-L131
train
This function replaces binary files with text files.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
_splitlines_preserving_trailing_newline
def _splitlines_preserving_trailing_newline(str): ''' Returns a list of the lines in the string, breaking at line boundaries and preserving a trailing newline (if present). Essentially, this works like ``str.striplines(False)`` but preserves an empty line at the end. This is equivalent to the follo...
python
def _splitlines_preserving_trailing_newline(str): ''' Returns a list of the lines in the string, breaking at line boundaries and preserving a trailing newline (if present). Essentially, this works like ``str.striplines(False)`` but preserves an empty line at the end. This is equivalent to the follo...
[ "def", "_splitlines_preserving_trailing_newline", "(", "str", ")", ":", "lines", "=", "str", ".", "splitlines", "(", ")", "if", "str", ".", "endswith", "(", "'\\n'", ")", "or", "str", ".", "endswith", "(", "'\\r'", ")", ":", "lines", ".", "append", "(", ...
Returns a list of the lines in the string, breaking at line boundaries and preserving a trailing newline (if present). Essentially, this works like ``str.striplines(False)`` but preserves an empty line at the end. This is equivalent to the following code: .. code-block:: python lines = str.sp...
[ "Returns", "a", "list", "of", "the", "lines", "in", "the", "string", "breaking", "at", "line", "boundaries", "and", "preserving", "a", "trailing", "newline", "(", "if", "present", ")", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L142-L159
train
Returns a list of the lines in the string preserving a trailing newline.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
get_gid
def get_gid(path, follow_symlinks=True): ''' Return the id of the group that owns a given file path file or directory of which to get the gid follow_symlinks indicated if symlinks should be followed CLI Example: .. code-block:: bash salt '*' file.get_gid /etc/passwd...
python
def get_gid(path, follow_symlinks=True): ''' Return the id of the group that owns a given file path file or directory of which to get the gid follow_symlinks indicated if symlinks should be followed CLI Example: .. code-block:: bash salt '*' file.get_gid /etc/passwd...
[ "def", "get_gid", "(", "path", ",", "follow_symlinks", "=", "True", ")", ":", "return", "stats", "(", "os", ".", "path", ".", "expanduser", "(", "path", ")", ",", "follow_symlinks", "=", "follow_symlinks", ")", ".", "get", "(", "'gid'", ",", "-", "1", ...
Return the id of the group that owns a given file path file or directory of which to get the gid follow_symlinks indicated if symlinks should be followed CLI Example: .. code-block:: bash salt '*' file.get_gid /etc/passwd .. versionchanged:: 0.16.4 ``follow_sym...
[ "Return", "the", "id", "of", "the", "group", "that", "owns", "a", "given", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L215-L235
train
Get the gid of a given file or directory
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
get_group
def get_group(path, follow_symlinks=True): ''' Return the group that owns a given file path file or directory of which to get the group follow_symlinks indicated if symlinks should be followed CLI Example: .. code-block:: bash salt '*' file.get_group /etc/passwd ...
python
def get_group(path, follow_symlinks=True): ''' Return the group that owns a given file path file or directory of which to get the group follow_symlinks indicated if symlinks should be followed CLI Example: .. code-block:: bash salt '*' file.get_group /etc/passwd ...
[ "def", "get_group", "(", "path", ",", "follow_symlinks", "=", "True", ")", ":", "return", "stats", "(", "os", ".", "path", ".", "expanduser", "(", "path", ")", ",", "follow_symlinks", "=", "follow_symlinks", ")", ".", "get", "(", "'group'", ",", "False",...
Return the group that owns a given file path file or directory of which to get the group follow_symlinks indicated if symlinks should be followed CLI Example: .. code-block:: bash salt '*' file.get_group /etc/passwd .. versionchanged:: 0.16.4 ``follow_symlinks``...
[ "Return", "the", "group", "that", "owns", "a", "given", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L238-L257
train
Get the group that owns a given file or directory
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
user_to_uid
def user_to_uid(user): ''' Convert user name to a uid user user name to convert to its uid CLI Example: .. code-block:: bash salt '*' file.user_to_uid root ''' if user is None: user = salt.utils.user.get_user() try: if isinstance(user, int): ...
python
def user_to_uid(user): ''' Convert user name to a uid user user name to convert to its uid CLI Example: .. code-block:: bash salt '*' file.user_to_uid root ''' if user is None: user = salt.utils.user.get_user() try: if isinstance(user, int): ...
[ "def", "user_to_uid", "(", "user", ")", ":", "if", "user", "is", "None", ":", "user", "=", "salt", ".", "utils", ".", "user", ".", "get_user", "(", ")", "try", ":", "if", "isinstance", "(", "user", ",", "int", ")", ":", "return", "user", "return", ...
Convert user name to a uid user user name to convert to its uid CLI Example: .. code-block:: bash salt '*' file.user_to_uid root
[ "Convert", "user", "name", "to", "a", "uid" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L280-L300
train
Convert user name to a uid
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
get_uid
def get_uid(path, follow_symlinks=True): ''' Return the id of the user that owns a given file path file or directory of which to get the uid follow_symlinks indicated if symlinks should be followed CLI Example: .. code-block:: bash salt '*' file.get_uid /etc/passwd ...
python
def get_uid(path, follow_symlinks=True): ''' Return the id of the user that owns a given file path file or directory of which to get the uid follow_symlinks indicated if symlinks should be followed CLI Example: .. code-block:: bash salt '*' file.get_uid /etc/passwd ...
[ "def", "get_uid", "(", "path", ",", "follow_symlinks", "=", "True", ")", ":", "return", "stats", "(", "os", ".", "path", ".", "expanduser", "(", "path", ")", ",", "follow_symlinks", "=", "follow_symlinks", ")", ".", "get", "(", "'uid'", ",", "-", "1", ...
Return the id of the user that owns a given file path file or directory of which to get the uid follow_symlinks indicated if symlinks should be followed CLI Example: .. code-block:: bash salt '*' file.get_uid /etc/passwd .. versionchanged:: 0.16.4 ``follow_symli...
[ "Return", "the", "id", "of", "the", "user", "that", "owns", "a", "given", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L303-L322
train
Get the uid of a given file or directory
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
get_mode
def get_mode(path, follow_symlinks=True): ''' Return the mode of a file path file or directory of which to get the mode follow_symlinks indicated if symlinks should be followed CLI Example: .. code-block:: bash salt '*' file.get_mode /etc/passwd .. versionchange...
python
def get_mode(path, follow_symlinks=True): ''' Return the mode of a file path file or directory of which to get the mode follow_symlinks indicated if symlinks should be followed CLI Example: .. code-block:: bash salt '*' file.get_mode /etc/passwd .. versionchange...
[ "def", "get_mode", "(", "path", ",", "follow_symlinks", "=", "True", ")", ":", "return", "stats", "(", "os", ".", "path", ".", "expanduser", "(", "path", ")", ",", "follow_symlinks", "=", "follow_symlinks", ")", ".", "get", "(", "'mode'", ",", "''", ")...
Return the mode of a file path file or directory of which to get the mode follow_symlinks indicated if symlinks should be followed CLI Example: .. code-block:: bash salt '*' file.get_mode /etc/passwd .. versionchanged:: 2014.1.0 ``follow_symlinks`` option added
[ "Return", "the", "mode", "of", "a", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L347-L366
train
Get the mode of a file or directory
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
set_mode
def set_mode(path, mode): ''' Set the mode of a file path file or directory of which to set the mode mode mode to set the path to CLI Example: .. code-block:: bash salt '*' file.set_mode /etc/passwd 0644 ''' path = os.path.expanduser(path) mode = six.tex...
python
def set_mode(path, mode): ''' Set the mode of a file path file or directory of which to set the mode mode mode to set the path to CLI Example: .. code-block:: bash salt '*' file.set_mode /etc/passwd 0644 ''' path = os.path.expanduser(path) mode = six.tex...
[ "def", "set_mode", "(", "path", ",", "mode", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "mode", "=", "six", ".", "text_type", "(", "mode", ")", ".", "lstrip", "(", "'0Oo'", ")", "if", "not", "mode", ":", "mode"...
Set the mode of a file path file or directory of which to set the mode mode mode to set the path to CLI Example: .. code-block:: bash salt '*' file.set_mode /etc/passwd 0644
[ "Set", "the", "mode", "of", "a", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L369-L396
train
Set the mode of a file or directory of which to set the mode
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
lchown
def lchown(path, user, group): ''' Chown a file, pass the file the desired user and group without following symlinks. path path to the file or directory user user owner group group owner CLI Example: .. code-block:: bash salt '*' file.chown /etc/pass...
python
def lchown(path, user, group): ''' Chown a file, pass the file the desired user and group without following symlinks. path path to the file or directory user user owner group group owner CLI Example: .. code-block:: bash salt '*' file.chown /etc/pass...
[ "def", "lchown", "(", "path", ",", "user", ",", "group", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "uid", "=", "user_to_uid", "(", "user", ")", "gid", "=", "group_to_gid", "(", "group", ")", "err", "=", "''", ...
Chown a file, pass the file the desired user and group without following symlinks. path path to the file or directory user user owner group group owner CLI Example: .. code-block:: bash salt '*' file.chown /etc/passwd root root
[ "Chown", "a", "file", "pass", "the", "file", "the", "desired", "user", "and", "group", "without", "following", "symlinks", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L399-L435
train
Chown a file pass the file the desired user and group without following symlinks.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
chown
def chown(path, user, group): ''' Chown a file, pass the file the desired user and group path path to the file or directory user user owner group group owner CLI Example: .. code-block:: bash salt '*' file.chown /etc/passwd root root ''' path = o...
python
def chown(path, user, group): ''' Chown a file, pass the file the desired user and group path path to the file or directory user user owner group group owner CLI Example: .. code-block:: bash salt '*' file.chown /etc/passwd root root ''' path = o...
[ "def", "chown", "(", "path", ",", "user", ",", "group", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "uid", "=", "user_to_uid", "(", "user", ")", "gid", "=", "group_to_gid", "(", "group", ")", "err", "=", "''", "...
Chown a file, pass the file the desired user and group path path to the file or directory user user owner group group owner CLI Example: .. code-block:: bash salt '*' file.chown /etc/passwd root root
[ "Chown", "a", "file", "pass", "the", "file", "the", "desired", "user", "and", "group" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L438-L481
train
Chown a file pass the file the desired user and group and return the result
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
chgrp
def chgrp(path, group): ''' Change the group of a file path path to the file or directory group group owner CLI Example: .. code-block:: bash salt '*' file.chgrp /etc/passwd root ''' path = os.path.expanduser(path) user = get_user(path) return chown(...
python
def chgrp(path, group): ''' Change the group of a file path path to the file or directory group group owner CLI Example: .. code-block:: bash salt '*' file.chgrp /etc/passwd root ''' path = os.path.expanduser(path) user = get_user(path) return chown(...
[ "def", "chgrp", "(", "path", ",", "group", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "user", "=", "get_user", "(", "path", ")", "return", "chown", "(", "path", ",", "user", ",", "group", ")" ]
Change the group of a file path path to the file or directory group group owner CLI Example: .. code-block:: bash salt '*' file.chgrp /etc/passwd root
[ "Change", "the", "group", "of", "a", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L484-L503
train
Change the group of a file or directory
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
_cmp_attrs
def _cmp_attrs(path, attrs): ''' .. versionadded:: 2018.3.0 Compare attributes of a given file to given attributes. Returns a pair (list) where first item are attributes to add and second item are to be removed. Please take into account when using this function that some minions will not h...
python
def _cmp_attrs(path, attrs): ''' .. versionadded:: 2018.3.0 Compare attributes of a given file to given attributes. Returns a pair (list) where first item are attributes to add and second item are to be removed. Please take into account when using this function that some minions will not h...
[ "def", "_cmp_attrs", "(", "path", ",", "attrs", ")", ":", "diff", "=", "[", "None", ",", "None", "]", "# lsattr for AIX is not the same thing as lsattr for linux.", "if", "salt", ".", "utils", ".", "platform", ".", "is_aix", "(", ")", ":", "return", "None", ...
.. versionadded:: 2018.3.0 Compare attributes of a given file to given attributes. Returns a pair (list) where first item are attributes to add and second item are to be removed. Please take into account when using this function that some minions will not have lsattr installed. path p...
[ "..", "versionadded", "::", "2018", ".", "3", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L506-L543
train
Compare attributes of a given file with a given list of attributes.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
lsattr
def lsattr(path): ''' .. versionadded:: 2018.3.0 .. versionchanged:: 2018.3.1 If ``lsattr`` is not installed on the system, ``None`` is returned. .. versionchanged:: 2018.3.4 If on ``AIX``, ``None`` is returned even if in filesystem as lsattr on ``AIX`` is not the same thing as t...
python
def lsattr(path): ''' .. versionadded:: 2018.3.0 .. versionchanged:: 2018.3.1 If ``lsattr`` is not installed on the system, ``None`` is returned. .. versionchanged:: 2018.3.4 If on ``AIX``, ``None`` is returned even if in filesystem as lsattr on ``AIX`` is not the same thing as t...
[ "def", "lsattr", "(", "path", ")", ":", "if", "not", "salt", ".", "utils", ".", "path", ".", "which", "(", "'lsattr'", ")", "or", "salt", ".", "utils", ".", "platform", ".", "is_aix", "(", ")", ":", "return", "None", "if", "not", "os", ".", "path...
.. versionadded:: 2018.3.0 .. versionchanged:: 2018.3.1 If ``lsattr`` is not installed on the system, ``None`` is returned. .. versionchanged:: 2018.3.4 If on ``AIX``, ``None`` is returned even if in filesystem as lsattr on ``AIX`` is not the same thing as the linux version. Obtain ...
[ "..", "versionadded", "::", "2018", ".", "3", ".", "0", "..", "versionchanged", "::", "2018", ".", "3", ".", "1", "If", "lsattr", "is", "not", "installed", "on", "the", "system", "None", "is", "returned", ".", "..", "versionchanged", "::", "2018", ".",...
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L546-L582
train
Return the modifiable attributes of a file or directory.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
chattr
def chattr(*files, **kwargs): ''' .. versionadded:: 2018.3.0 Change the attributes of files. This function accepts one or more files and the following options: operator Can be wither ``add`` or ``remove``. Determines whether attributes should be added or removed from files att...
python
def chattr(*files, **kwargs): ''' .. versionadded:: 2018.3.0 Change the attributes of files. This function accepts one or more files and the following options: operator Can be wither ``add`` or ``remove``. Determines whether attributes should be added or removed from files att...
[ "def", "chattr", "(", "*", "files", ",", "*", "*", "kwargs", ")", ":", "operator", "=", "kwargs", ".", "pop", "(", "'operator'", ",", "None", ")", "attributes", "=", "kwargs", ".", "pop", "(", "'attributes'", ",", "None", ")", "flags", "=", "kwargs",...
.. versionadded:: 2018.3.0 Change the attributes of files. This function accepts one or more files and the following options: operator Can be wither ``add`` or ``remove``. Determines whether attributes should be added or removed from files attributes One or more of the followi...
[ "..", "versionadded", "::", "2018", ".", "3", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L585-L648
train
Change the attributes of a file or directory.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
get_sum
def get_sum(path, form='sha256'): ''' Return the checksum for the given file. The following checksum algorithms are supported: * md5 * sha1 * sha224 * sha256 **(default)** * sha384 * sha512 path path to the file or directory form desired sum format CLI...
python
def get_sum(path, form='sha256'): ''' Return the checksum for the given file. The following checksum algorithms are supported: * md5 * sha1 * sha224 * sha256 **(default)** * sha384 * sha512 path path to the file or directory form desired sum format CLI...
[ "def", "get_sum", "(", "path", ",", "form", "=", "'sha256'", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "return", "'File not found'", "return", ...
Return the checksum for the given file. The following checksum algorithms are supported: * md5 * sha1 * sha224 * sha256 **(default)** * sha384 * sha512 path path to the file or directory form desired sum format CLI Example: .. code-block:: bash s...
[ "Return", "the", "checksum", "for", "the", "given", "file", ".", "The", "following", "checksum", "algorithms", "are", "supported", ":" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L651-L679
train
Return the checksum for the given file
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
get_hash
def get_hash(path, form='sha256', chunk_size=65536): ''' Get the hash sum of a file This is better than ``get_sum`` for the following reasons: - It does not read the entire file into memory. - It does not return a string on error. The returned value of ``get_sum`` cannot really ...
python
def get_hash(path, form='sha256', chunk_size=65536): ''' Get the hash sum of a file This is better than ``get_sum`` for the following reasons: - It does not read the entire file into memory. - It does not return a string on error. The returned value of ``get_sum`` cannot really ...
[ "def", "get_hash", "(", "path", ",", "form", "=", "'sha256'", ",", "chunk_size", "=", "65536", ")", ":", "return", "salt", ".", "utils", ".", "hashutils", ".", "get_hash", "(", "os", ".", "path", ".", "expanduser", "(", "path", ")", ",", "form", ",",...
Get the hash sum of a file This is better than ``get_sum`` for the following reasons: - It does not read the entire file into memory. - It does not return a string on error. The returned value of ``get_sum`` cannot really be trusted since it is vulnerable to collisions: ``ge...
[ "Get", "the", "hash", "sum", "of", "a", "file" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L682-L707
train
Get the hash sum of a file
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
get_source_sum
def get_source_sum(file_name='', source='', source_hash=None, source_hash_name=None, saltenv='base'): ''' .. versionadded:: 2016.11.0 Used by :py:func:`file.get_managed <salt.modules.file.get_managed>` to obtain the hash and ha...
python
def get_source_sum(file_name='', source='', source_hash=None, source_hash_name=None, saltenv='base'): ''' .. versionadded:: 2016.11.0 Used by :py:func:`file.get_managed <salt.modules.file.get_managed>` to obtain the hash and ha...
[ "def", "get_source_sum", "(", "file_name", "=", "''", ",", "source", "=", "''", ",", "source_hash", "=", "None", ",", "source_hash_name", "=", "None", ",", "saltenv", "=", "'base'", ")", ":", "def", "_invalid_source_hash_format", "(", ")", ":", "'''\n ...
.. versionadded:: 2016.11.0 Used by :py:func:`file.get_managed <salt.modules.file.get_managed>` to obtain the hash and hash type from the parameters specified below. file_name Optional file name being managed, for matching with :py:func:`file.extract_hash <salt.modules.file.extract_hash>`....
[ "..", "versionadded", "::", "2016", ".", "11", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L710-L848
train
Return the source_sum for the file_name source_hash and source_hash_name
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
check_hash
def check_hash(path, file_hash): ''' Check if a file matches the given hash string Returns ``True`` if the hash matches, otherwise ``False``. path Path to a file local to the minion. hash The hash to check against the file specified in the ``path`` argument. .. versioncha...
python
def check_hash(path, file_hash): ''' Check if a file matches the given hash string Returns ``True`` if the hash matches, otherwise ``False``. path Path to a file local to the minion. hash The hash to check against the file specified in the ``path`` argument. .. versioncha...
[ "def", "check_hash", "(", "path", ",", "file_hash", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "not", "isinstance", "(", "file_hash", ",", "six", ".", "string_types", ")", ":", "raise", "SaltInvocationError", "("...
Check if a file matches the given hash string Returns ``True`` if the hash matches, otherwise ``False``. path Path to a file local to the minion. hash The hash to check against the file specified in the ``path`` argument. .. versionchanged:: 2016.11.4 For this and newer ...
[ "Check", "if", "a", "file", "matches", "the", "given", "hash", "string" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L851-L905
train
Check if a file matches the given hash string.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
find
def find(path, *args, **kwargs): ''' Approximate the Unix ``find(1)`` command and return a list of paths that meet the specified criteria. The options include match criteria: .. code-block:: text name = path-glob # case sensitive iname = path-glob ...
python
def find(path, *args, **kwargs): ''' Approximate the Unix ``find(1)`` command and return a list of paths that meet the specified criteria. The options include match criteria: .. code-block:: text name = path-glob # case sensitive iname = path-glob ...
[ "def", "find", "(", "path", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'delete'", "in", "args", ":", "kwargs", "[", "'delete'", "]", "=", "'f'", "elif", "'print'", "in", "args", ":", "kwargs", "[", "'print'", "]", "=", "'path'", ...
Approximate the Unix ``find(1)`` command and return a list of paths that meet the specified criteria. The options include match criteria: .. code-block:: text name = path-glob # case sensitive iname = path-glob # case insensitive regex = path...
[ "Approximate", "the", "Unix", "find", "(", "1", ")", "command", "and", "return", "a", "list", "of", "paths", "that", "meet", "the", "specified", "criteria", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L908-L1034
train
This function returns a list of paths that meet the specified criteria.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
_sed_esc
def _sed_esc(string, escape_all=False): ''' Escape single quotes and forward slashes ''' special_chars = "^.[$()|*+?{" string = string.replace("'", "'\"'\"'").replace("/", "\\/") if escape_all is True: for char in special_chars: string = string.replace(char, "\\" + char) ...
python
def _sed_esc(string, escape_all=False): ''' Escape single quotes and forward slashes ''' special_chars = "^.[$()|*+?{" string = string.replace("'", "'\"'\"'").replace("/", "\\/") if escape_all is True: for char in special_chars: string = string.replace(char, "\\" + char) ...
[ "def", "_sed_esc", "(", "string", ",", "escape_all", "=", "False", ")", ":", "special_chars", "=", "\"^.[$()|*+?{\"", "string", "=", "string", ".", "replace", "(", "\"'\"", ",", "\"'\\\"'\\\"'\"", ")", ".", "replace", "(", "\"/\"", ",", "\"\\\\/\"", ")", "...
Escape single quotes and forward slashes
[ "Escape", "single", "quotes", "and", "forward", "slashes" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1037-L1046
train
Escape single quotes forward slashes and slashes and escape all special characters in a string.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
sed
def sed(path, before, after, limit='', backup='.bak', options='-r -e', flags='g', escape_all=False, negate_match=False): ''' .. deprecated:: 0.17.0 Use :py:func:`~salt.modules.file.replace` instead. Make a simple edit to a file Equ...
python
def sed(path, before, after, limit='', backup='.bak', options='-r -e', flags='g', escape_all=False, negate_match=False): ''' .. deprecated:: 0.17.0 Use :py:func:`~salt.modules.file.replace` instead. Make a simple edit to a file Equ...
[ "def", "sed", "(", "path", ",", "before", ",", "after", ",", "limit", "=", "''", ",", "backup", "=", "'.bak'", ",", "options", "=", "'-r -e'", ",", "flags", "=", "'g'", ",", "escape_all", "=", "False", ",", "negate_match", "=", "False", ")", ":", "...
.. deprecated:: 0.17.0 Use :py:func:`~salt.modules.file.replace` instead. Make a simple edit to a file Equivalent to: .. code-block:: bash sed <backup> <options> "/<limit>/ s/<before>/<after>/<flags> <file>" path The full path to the file to be edited before A pat...
[ "..", "deprecated", "::", "0", ".", "17", ".", "0", "Use", ":", "py", ":", "func", ":", "~salt", ".", "modules", ".", "file", ".", "replace", "instead", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1049-L1132
train
A simple sed command that returns a file with the given path and the given patterns.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
sed_contains
def sed_contains(path, text, limit='', flags='g'): ''' .. deprecated:: 0.17.0 Use :func:`search` instead. Return True if the file at ``path`` contains ``text``. Utilizes sed to perform the search (line-wise search). Note: the ``p`` flag wil...
python
def sed_contains(path, text, limit='', flags='g'): ''' .. deprecated:: 0.17.0 Use :func:`search` instead. Return True if the file at ``path`` contains ``text``. Utilizes sed to perform the search (line-wise search). Note: the ``p`` flag wil...
[ "def", "sed_contains", "(", "path", ",", "text", ",", "limit", "=", "''", ",", "flags", "=", "'g'", ")", ":", "# Largely inspired by Fabric's contrib.files.contains()", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "not", "os", ...
.. deprecated:: 0.17.0 Use :func:`search` instead. Return True if the file at ``path`` contains ``text``. Utilizes sed to perform the search (line-wise search). Note: the ``p`` flag will be added to any flags you pass in. CLI Example: .. code-block:: bash salt '*' file.contains /...
[ "..", "deprecated", "::", "0", ".", "17", ".", "0", "Use", ":", "func", ":", "search", "instead", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1135-L1179
train
Return True if the file at path contains text.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
psed
def psed(path, before, after, limit='', backup='.bak', flags='gMS', escape_all=False, multi=False): ''' .. deprecated:: 0.17.0 Use :py:func:`~salt.modules.file.replace` instead. Make a simple edit to a file (pure Python version) Equ...
python
def psed(path, before, after, limit='', backup='.bak', flags='gMS', escape_all=False, multi=False): ''' .. deprecated:: 0.17.0 Use :py:func:`~salt.modules.file.replace` instead. Make a simple edit to a file (pure Python version) Equ...
[ "def", "psed", "(", "path", ",", "before", ",", "after", ",", "limit", "=", "''", ",", "backup", "=", "'.bak'", ",", "flags", "=", "'gMS'", ",", "escape_all", "=", "False", ",", "multi", "=", "False", ")", ":", "# Largely inspired by Fabric's contrib.files...
.. deprecated:: 0.17.0 Use :py:func:`~salt.modules.file.replace` instead. Make a simple edit to a file (pure Python version) Equivalent to: .. code-block:: bash sed <backup> <options> "/<limit>/ s/<before>/<after>/<flags> <file>" path The full path to the file to be edited ...
[ "..", "deprecated", "::", "0", ".", "17", ".", "0", "Use", ":", "py", ":", "func", ":", "~salt", ".", "modules", ".", "file", ".", "replace", "instead", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1182-L1280
train
Return a copy of the file with the given pattern.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
_psed
def _psed(text, before, after, limit, flags): ''' Does the actual work for file.psed, so that single lines can be passed in ''' atext = text if limit: limit = re.compile(limit) comps = text.split(limit) atext = ''.join(comps[1:]) c...
python
def _psed(text, before, after, limit, flags): ''' Does the actual work for file.psed, so that single lines can be passed in ''' atext = text if limit: limit = re.compile(limit) comps = text.split(limit) atext = ''.join(comps[1:]) c...
[ "def", "_psed", "(", "text", ",", "before", ",", "after", ",", "limit", ",", "flags", ")", ":", "atext", "=", "text", "if", "limit", ":", "limit", "=", "re", ".", "compile", "(", "limit", ")", "comps", "=", "text", ".", "split", "(", "limit", ")"...
Does the actual work for file.psed, so that single lines can be passed in
[ "Does", "the", "actual", "work", "for", "file", ".", "psed", "so", "that", "single", "lines", "can", "be", "passed", "in" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1291-L1317
train
Does the actual work for file. psed
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
uncomment
def uncomment(path, regex, char='#', backup='.bak'): ''' .. deprecated:: 0.17.0 Use :py:func:`~salt.modules.file.replace` instead. Uncomment specified commented lines in a file path The full path to the file to be edited regex A regu...
python
def uncomment(path, regex, char='#', backup='.bak'): ''' .. deprecated:: 0.17.0 Use :py:func:`~salt.modules.file.replace` instead. Uncomment specified commented lines in a file path The full path to the file to be edited regex A regu...
[ "def", "uncomment", "(", "path", ",", "regex", ",", "char", "=", "'#'", ",", "backup", "=", "'.bak'", ")", ":", "return", "comment_line", "(", "path", "=", "path", ",", "regex", "=", "regex", ",", "char", "=", "char", ",", "cmnt", "=", "False", ","...
.. deprecated:: 0.17.0 Use :py:func:`~salt.modules.file.replace` instead. Uncomment specified commented lines in a file path The full path to the file to be edited regex A regular expression used to find the lines that are to be uncommented. This regex should not include the...
[ "..", "deprecated", "::", "0", ".", "17", ".", "0", "Use", ":", "py", ":", "func", ":", "~salt", ".", "modules", ".", "file", ".", "replace", "instead", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1320-L1354
train
This function will uncomment the lines in a file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
comment
def comment(path, regex, char='#', backup='.bak'): ''' .. deprecated:: 0.17.0 Use :py:func:`~salt.modules.file.replace` instead. Comment out specified lines in a file path The full path to the file to be edited regex A regular expression u...
python
def comment(path, regex, char='#', backup='.bak'): ''' .. deprecated:: 0.17.0 Use :py:func:`~salt.modules.file.replace` instead. Comment out specified lines in a file path The full path to the file to be edited regex A regular expression u...
[ "def", "comment", "(", "path", ",", "regex", ",", "char", "=", "'#'", ",", "backup", "=", "'.bak'", ")", ":", "return", "comment_line", "(", "path", "=", "path", ",", "regex", "=", "regex", ",", "char", "=", "char", ",", "cmnt", "=", "True", ",", ...
.. deprecated:: 0.17.0 Use :py:func:`~salt.modules.file.replace` instead. Comment out specified lines in a file path The full path to the file to be edited regex A regular expression used to find the lines that are to be commented; this pattern will be wrapped in parenthesis...
[ "..", "deprecated", "::", "0", ".", "17", ".", "0", "Use", ":", "py", ":", "func", ":", "~salt", ".", "modules", ".", "file", ".", "replace", "instead", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1357-L1396
train
Return a copy of the file with the specified lines commented out.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
comment_line
def comment_line(path, regex, char='#', cmnt=True, backup='.bak'): r''' Comment or Uncomment a line in a text file. :param path: string The full path to the text file. :param regex: string A regex expression that begin...
python
def comment_line(path, regex, char='#', cmnt=True, backup='.bak'): r''' Comment or Uncomment a line in a text file. :param path: string The full path to the text file. :param regex: string A regex expression that begin...
[ "def", "comment_line", "(", "path", ",", "regex", ",", "char", "=", "'#'", ",", "cmnt", "=", "True", ",", "backup", "=", "'.bak'", ")", ":", "# Get the regex for comment or uncomment", "if", "cmnt", ":", "regex", "=", "'{0}({1}){2}'", ".", "format", "(", "...
r''' Comment or Uncomment a line in a text file. :param path: string The full path to the text file. :param regex: string A regex expression that begins with ``^`` that will find the line you wish to comment. Can be as simple as ``^color =`` :param char: string The cha...
[ "r", "Comment", "or", "Uncomment", "a", "line", "in", "a", "text", "file", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1399-L1578
train
r Comments a line in a text file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
_get_flags
def _get_flags(flags): ''' Return an integer appropriate for use as a flag for the re module from a list of human-readable strings .. code-block:: python >>> _get_flags(['MULTILINE', 'IGNORECASE']) 10 >>> _get_flags('MULTILINE') 8 >>> _get_flags(2) 2 ...
python
def _get_flags(flags): ''' Return an integer appropriate for use as a flag for the re module from a list of human-readable strings .. code-block:: python >>> _get_flags(['MULTILINE', 'IGNORECASE']) 10 >>> _get_flags('MULTILINE') 8 >>> _get_flags(2) 2 ...
[ "def", "_get_flags", "(", "flags", ")", ":", "if", "isinstance", "(", "flags", ",", "six", ".", "string_types", ")", ":", "flags", "=", "[", "flags", "]", "if", "isinstance", "(", "flags", ",", "Iterable", ")", "and", "not", "isinstance", "(", "flags",...
Return an integer appropriate for use as a flag for the re module from a list of human-readable strings .. code-block:: python >>> _get_flags(['MULTILINE', 'IGNORECASE']) 10 >>> _get_flags('MULTILINE') 8 >>> _get_flags(2) 2
[ "Return", "an", "integer", "appropriate", "for", "use", "as", "a", "flag", "for", "the", "re", "module", "from", "a", "list", "of", "human", "-", "readable", "strings" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1581-L1617
train
Return an integer appropriate for use as a flag for the re module from a list of human - readable strings
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
_add_flags
def _add_flags(flags, new_flags): ''' Combine ``flags`` and ``new_flags`` ''' flags = _get_flags(flags) new_flags = _get_flags(new_flags) return flags | new_flags
python
def _add_flags(flags, new_flags): ''' Combine ``flags`` and ``new_flags`` ''' flags = _get_flags(flags) new_flags = _get_flags(new_flags) return flags | new_flags
[ "def", "_add_flags", "(", "flags", ",", "new_flags", ")", ":", "flags", "=", "_get_flags", "(", "flags", ")", "new_flags", "=", "_get_flags", "(", "new_flags", ")", "return", "flags", "|", "new_flags" ]
Combine ``flags`` and ``new_flags``
[ "Combine", "flags", "and", "new_flags" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1620-L1626
train
Combine flags and new_flags and return the result.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
_mkstemp_copy
def _mkstemp_copy(path, preserve_inode=True): ''' Create a temp file and move/copy the contents of ``path`` to the temp file. Return the path to the temp file. path The full path to the file whose contents will be moved/copied to a temp file. Whether it's moved or copi...
python
def _mkstemp_copy(path, preserve_inode=True): ''' Create a temp file and move/copy the contents of ``path`` to the temp file. Return the path to the temp file. path The full path to the file whose contents will be moved/copied to a temp file. Whether it's moved or copi...
[ "def", "_mkstemp_copy", "(", "path", ",", "preserve_inode", "=", "True", ")", ":", "temp_file", "=", "None", "# Create the temp file", "try", ":", "temp_file", "=", "salt", ".", "utils", ".", "files", ".", "mkstemp", "(", "prefix", "=", "salt", ".", "utils...
Create a temp file and move/copy the contents of ``path`` to the temp file. Return the path to the temp file. path The full path to the file whose contents will be moved/copied to a temp file. Whether it's moved or copied depends on the value of ``preserve_inode``. preserve_inode Pr...
[ "Create", "a", "temp", "file", "and", "move", "/", "copy", "the", "contents", "of", "path", "to", "the", "temp", "file", ".", "Return", "the", "path", "to", "the", "temp", "file", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1629-L1680
train
Create a temp file and move it to the temp file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
_starts_till
def _starts_till(src, probe, strip_comments=True): ''' Returns True if src and probe at least matches at the beginning till some point. ''' def _strip_comments(txt): ''' Strip possible comments. Usually comments are one or two symbols at the beginning of the line, separated with ...
python
def _starts_till(src, probe, strip_comments=True): ''' Returns True if src and probe at least matches at the beginning till some point. ''' def _strip_comments(txt): ''' Strip possible comments. Usually comments are one or two symbols at the beginning of the line, separated with ...
[ "def", "_starts_till", "(", "src", ",", "probe", ",", "strip_comments", "=", "True", ")", ":", "def", "_strip_comments", "(", "txt", ")", ":", "'''\n Strip possible comments.\n Usually comments are one or two symbols at the beginning of the line, separated with spac...
Returns True if src and probe at least matches at the beginning till some point.
[ "Returns", "True", "if", "src", "and", "probe", "at", "least", "matches", "at", "the", "beginning", "till", "some", "point", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1683-L1721
train
Returns True if src and probe at least matches at the beginning till some point.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
_regex_to_static
def _regex_to_static(src, regex): ''' Expand regular expression to static match. ''' if not src or not regex: return None try: compiled = re.compile(regex, re.DOTALL) src = [line for line in src if compiled.search(line) or line.count(regex)] except Exception as ex: ...
python
def _regex_to_static(src, regex): ''' Expand regular expression to static match. ''' if not src or not regex: return None try: compiled = re.compile(regex, re.DOTALL) src = [line for line in src if compiled.search(line) or line.count(regex)] except Exception as ex: ...
[ "def", "_regex_to_static", "(", "src", ",", "regex", ")", ":", "if", "not", "src", "or", "not", "regex", ":", "return", "None", "try", ":", "compiled", "=", "re", ".", "compile", "(", "regex", ",", "re", ".", "DOTALL", ")", "src", "=", "[", "line",...
Expand regular expression to static match.
[ "Expand", "regular", "expression", "to", "static", "match", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1724-L1737
train
Expand regular expression to static match.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
_assert_occurrence
def _assert_occurrence(probe, target, amount=1): ''' Raise an exception, if there are different amount of specified occurrences in src. ''' occ = len(probe) if occ > amount: msg = 'more than' elif occ < amount: msg = 'less than' elif not occ: msg = 'no' else: ...
python
def _assert_occurrence(probe, target, amount=1): ''' Raise an exception, if there are different amount of specified occurrences in src. ''' occ = len(probe) if occ > amount: msg = 'more than' elif occ < amount: msg = 'less than' elif not occ: msg = 'no' else: ...
[ "def", "_assert_occurrence", "(", "probe", ",", "target", ",", "amount", "=", "1", ")", ":", "occ", "=", "len", "(", "probe", ")", "if", "occ", ">", "amount", ":", "msg", "=", "'more than'", "elif", "occ", "<", "amount", ":", "msg", "=", "'less than'...
Raise an exception, if there are different amount of specified occurrences in src.
[ "Raise", "an", "exception", "if", "there", "are", "different", "amount", "of", "specified", "occurrences", "in", "src", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1740-L1757
train
Raise an exception if there are different amount of specified occurrences in src.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
_set_line_indent
def _set_line_indent(src, line, indent): ''' Indent the line with the source line. ''' if not indent: return line idt = [] for c in src: if c not in ['\t', ' ']: break idt.append(c) return ''.join(idt) + line.lstrip()
python
def _set_line_indent(src, line, indent): ''' Indent the line with the source line. ''' if not indent: return line idt = [] for c in src: if c not in ['\t', ' ']: break idt.append(c) return ''.join(idt) + line.lstrip()
[ "def", "_set_line_indent", "(", "src", ",", "line", ",", "indent", ")", ":", "if", "not", "indent", ":", "return", "line", "idt", "=", "[", "]", "for", "c", "in", "src", ":", "if", "c", "not", "in", "[", "'\\t'", ",", "' '", "]", ":", "break", ...
Indent the line with the source line.
[ "Indent", "the", "line", "with", "the", "source", "line", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1760-L1773
train
Indent the line with the source line.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
_set_line_eol
def _set_line_eol(src, line): ''' Add line ending ''' line_ending = _get_eol(src) or os.linesep return line.rstrip() + line_ending
python
def _set_line_eol(src, line): ''' Add line ending ''' line_ending = _get_eol(src) or os.linesep return line.rstrip() + line_ending
[ "def", "_set_line_eol", "(", "src", ",", "line", ")", ":", "line_ending", "=", "_get_eol", "(", "src", ")", "or", "os", ".", "linesep", "return", "line", ".", "rstrip", "(", ")", "+", "line_ending" ]
Add line ending
[ "Add", "line", "ending" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1781-L1786
train
Set the line ending of the line.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
line
def line(path, content=None, match=None, mode=None, location=None, before=None, after=None, show_changes=True, backup=False, quiet=False, indent=True): ''' .. versionadded:: 2015.8.0 Edit a line in the configuration file. The ``path`` and ``content`` arguments are required, as well as...
python
def line(path, content=None, match=None, mode=None, location=None, before=None, after=None, show_changes=True, backup=False, quiet=False, indent=True): ''' .. versionadded:: 2015.8.0 Edit a line in the configuration file. The ``path`` and ``content`` arguments are required, as well as...
[ "def", "line", "(", "path", ",", "content", "=", "None", ",", "match", "=", "None", ",", "mode", "=", "None", ",", "location", "=", "None", ",", "before", "=", "None", ",", "after", "=", "None", ",", "show_changes", "=", "True", ",", "backup", "=",...
.. versionadded:: 2015.8.0 Edit a line in the configuration file. The ``path`` and ``content`` arguments are required, as well as passing in one of the ``mode`` options. path Filesystem path to the file to be edited. content Content of the line. Allowed to be empty if mode=delete....
[ "..", "versionadded", "::", "2015", ".", "8", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L1805-L2068
train
Edit a line in the configuration file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
replace
def replace(path, pattern, repl, count=0, flags=8, bufsize=1, append_if_not_found=False, prepend_if_not_found=False, not_found_content=None, backup='.bak', dry_run=False, search_only=False...
python
def replace(path, pattern, repl, count=0, flags=8, bufsize=1, append_if_not_found=False, prepend_if_not_found=False, not_found_content=None, backup='.bak', dry_run=False, search_only=False...
[ "def", "replace", "(", "path", ",", "pattern", ",", "repl", ",", "count", "=", "0", ",", "flags", "=", "8", ",", "bufsize", "=", "1", ",", "append_if_not_found", "=", "False", ",", "prepend_if_not_found", "=", "False", ",", "not_found_content", "=", "Non...
.. versionadded:: 0.17.0 Replace occurrences of a pattern in a file. If ``show_changes`` is ``True``, then a diff of what changed will be returned, otherwise a ``True`` will be returned when changes are made, and ``False`` when no changes are made. This is a pure Python implementation that wraps P...
[ "..", "versionadded", "::", "0", ".", "17", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L2071-L2450
train
Replace occurrences of a pattern in a file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
blockreplace
def blockreplace(path, marker_start='#-- start managed zone --', marker_end='#-- end managed zone --', content='', append_if_not_found=False, prepend_if_not_found=False, backup='.bak', dry_run=False, show_changes=True, append_newline=False, ...
python
def blockreplace(path, marker_start='#-- start managed zone --', marker_end='#-- end managed zone --', content='', append_if_not_found=False, prepend_if_not_found=False, backup='.bak', dry_run=False, show_changes=True, append_newline=False, ...
[ "def", "blockreplace", "(", "path", ",", "marker_start", "=", "'#-- start managed zone --'", ",", "marker_end", "=", "'#-- end managed zone --'", ",", "content", "=", "''", ",", "append_if_not_found", "=", "False", ",", "prepend_if_not_found", "=", "False", ",", "ba...
.. versionadded:: 2014.1.0 Replace content of a text block in a file, delimited by line markers A block of content delimited by comments can help you manage several lines entries without worrying about old entries removal. .. note:: This function will store two copies of the file in-memory (...
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L2453-L2776
train
This function replaces the content of a text block in a file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
search
def search(path, pattern, flags=8, bufsize=1, ignore_if_missing=False, multiline=False ): ''' .. versionadded:: 0.17.0 Search for occurrences of a pattern in a file Except for multiline, params are identical to :py:func:`~salt.modules.file.replace`. ...
python
def search(path, pattern, flags=8, bufsize=1, ignore_if_missing=False, multiline=False ): ''' .. versionadded:: 0.17.0 Search for occurrences of a pattern in a file Except for multiline, params are identical to :py:func:`~salt.modules.file.replace`. ...
[ "def", "search", "(", "path", ",", "pattern", ",", "flags", "=", "8", ",", "bufsize", "=", "1", ",", "ignore_if_missing", "=", "False", ",", "multiline", "=", "False", ")", ":", "if", "multiline", ":", "flags", "=", "_add_flags", "(", "flags", ",", "...
.. versionadded:: 0.17.0 Search for occurrences of a pattern in a file Except for multiline, params are identical to :py:func:`~salt.modules.file.replace`. multiline If true, inserts 'MULTILINE' into ``flags`` and sets ``bufsize`` to 'file'. .. versionadded:: 2015.8.0 CL...
[ "..", "versionadded", "::", "0", ".", "17", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L2779-L2821
train
Search for occurrences of a pattern in a file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
patch
def patch(originalfile, patchfile, options='', dry_run=False): ''' .. versionadded:: 0.10.4 Apply a patch to a file or directory. Equivalent to: .. code-block:: bash patch <options> -i <patchfile> <originalfile> Or, when a directory is patched: .. code-block:: bash pat...
python
def patch(originalfile, patchfile, options='', dry_run=False): ''' .. versionadded:: 0.10.4 Apply a patch to a file or directory. Equivalent to: .. code-block:: bash patch <options> -i <patchfile> <originalfile> Or, when a directory is patched: .. code-block:: bash pat...
[ "def", "patch", "(", "originalfile", ",", "patchfile", ",", "options", "=", "''", ",", "dry_run", "=", "False", ")", ":", "patchpath", "=", "salt", ".", "utils", ".", "path", ".", "which", "(", "'patch'", ")", "if", "not", "patchpath", ":", "raise", ...
.. versionadded:: 0.10.4 Apply a patch to a file or directory. Equivalent to: .. code-block:: bash patch <options> -i <patchfile> <originalfile> Or, when a directory is patched: .. code-block:: bash patch <options> -i <patchfile> -d <originalfile> -p0 originalfile ...
[ "..", "versionadded", "::", "0", ".", "10", ".", "4" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L2824-L2903
train
Apply a patch to a file or directory.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
contains
def contains(path, text): ''' .. deprecated:: 0.17.0 Use :func:`search` instead. Return ``True`` if the file at ``path`` contains ``text`` CLI Example: .. code-block:: bash salt '*' file.contains /etc/crontab 'mymaintenance.sh' ''' path = os.path.expanduser(path) if n...
python
def contains(path, text): ''' .. deprecated:: 0.17.0 Use :func:`search` instead. Return ``True`` if the file at ``path`` contains ``text`` CLI Example: .. code-block:: bash salt '*' file.contains /etc/crontab 'mymaintenance.sh' ''' path = os.path.expanduser(path) if n...
[ "def", "contains", "(", "path", ",", "text", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "return", "False", "stripped_text", "=", "six", ".", ...
.. deprecated:: 0.17.0 Use :func:`search` instead. Return ``True`` if the file at ``path`` contains ``text`` CLI Example: .. code-block:: bash salt '*' file.contains /etc/crontab 'mymaintenance.sh'
[ "..", "deprecated", "::", "0", ".", "17", ".", "0", "Use", ":", "func", ":", "search", "instead", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L2906-L2932
train
Return True if the file at path contains text.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
contains_regex
def contains_regex(path, regex, lchar=''): ''' .. deprecated:: 0.17.0 Use :func:`search` instead. Return True if the given regular expression matches on any line in the text of a given file. If the lchar argument (leading char) is specified, it will strip `lchar` from the left side of e...
python
def contains_regex(path, regex, lchar=''): ''' .. deprecated:: 0.17.0 Use :func:`search` instead. Return True if the given regular expression matches on any line in the text of a given file. If the lchar argument (leading char) is specified, it will strip `lchar` from the left side of e...
[ "def", "contains_regex", "(", "path", ",", "regex", ",", "lchar", "=", "''", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "return", "False", "...
.. deprecated:: 0.17.0 Use :func:`search` instead. Return True if the given regular expression matches on any line in the text of a given file. If the lchar argument (leading char) is specified, it will strip `lchar` from the left side of each line before trying to match CLI Example: ...
[ "..", "deprecated", "::", "0", ".", "17", ".", "0", "Use", ":", "func", ":", "search", "instead", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L2935-L2967
train
Return True if the given regular expression matches on any line in the text aurus of a given file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
contains_glob
def contains_glob(path, glob_expr): ''' .. deprecated:: 0.17.0 Use :func:`search` instead. Return ``True`` if the given glob matches a string in the named file CLI Example: .. code-block:: bash salt '*' file.contains_glob /etc/foobar '*cheese*' ''' path = os.path.expanduse...
python
def contains_glob(path, glob_expr): ''' .. deprecated:: 0.17.0 Use :func:`search` instead. Return ``True`` if the given glob matches a string in the named file CLI Example: .. code-block:: bash salt '*' file.contains_glob /etc/foobar '*cheese*' ''' path = os.path.expanduse...
[ "def", "contains_glob", "(", "path", ",", "glob_expr", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "return", "False", "try", ":", "with", "salt...
.. deprecated:: 0.17.0 Use :func:`search` instead. Return ``True`` if the given glob matches a string in the named file CLI Example: .. code-block:: bash salt '*' file.contains_glob /etc/foobar '*cheese*'
[ "..", "deprecated", "::", "0", ".", "17", ".", "0", "Use", ":", "func", ":", "search", "instead", "." ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L2970-L2995
train
Return True if the given glob is contained in the named file Taxonomy
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
append
def append(path, *args, **kwargs): ''' .. versionadded:: 0.9.5 Append text to the end of a file path path to file `*args` strings to append to file CLI Example: .. code-block:: bash salt '*' file.append /etc/motd \\ "With all thine offerings thou...
python
def append(path, *args, **kwargs): ''' .. versionadded:: 0.9.5 Append text to the end of a file path path to file `*args` strings to append to file CLI Example: .. code-block:: bash salt '*' file.append /etc/motd \\ "With all thine offerings thou...
[ "def", "append", "(", "path", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "# Largely inspired by Fabric's contrib.files.append()", "if", "'args'", "in", "kwargs", ":", "if", "isi...
.. versionadded:: 0.9.5 Append text to the end of a file path path to file `*args` strings to append to file CLI Example: .. code-block:: bash salt '*' file.append /etc/motd \\ "With all thine offerings thou shalt offer salt." \\ "Salt is...
[ "..", "versionadded", "::", "0", ".", "9", ".", "5" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L2998-L3067
train
Append text to the end of a file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
prepend
def prepend(path, *args, **kwargs): ''' .. versionadded:: 2014.7.0 Prepend text to the beginning of a file path path to file `*args` strings to prepend to the file CLI Example: .. code-block:: bash salt '*' file.prepend /etc/motd \\ "With all thi...
python
def prepend(path, *args, **kwargs): ''' .. versionadded:: 2014.7.0 Prepend text to the beginning of a file path path to file `*args` strings to prepend to the file CLI Example: .. code-block:: bash salt '*' file.prepend /etc/motd \\ "With all thi...
[ "def", "prepend", "(", "path", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "'args'", "in", "kwargs", ":", "if", "isinstance", "(", "kwargs", "[", "'args'", "]", "...
.. versionadded:: 2014.7.0 Prepend text to the beginning of a file path path to file `*args` strings to prepend to the file CLI Example: .. code-block:: bash salt '*' file.prepend /etc/motd \\ "With all thine offerings thou shalt offer salt." \\ ...
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3070-L3125
train
Prepend text to the beginning of a file
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
write
def write(path, *args, **kwargs): ''' .. versionadded:: 2014.7.0 Write text to a file, overwriting any existing contents. path path to file `*args` strings to write to the file CLI Example: .. code-block:: bash salt '*' file.write /etc/motd \\ "W...
python
def write(path, *args, **kwargs): ''' .. versionadded:: 2014.7.0 Write text to a file, overwriting any existing contents. path path to file `*args` strings to write to the file CLI Example: .. code-block:: bash salt '*' file.write /etc/motd \\ "W...
[ "def", "write", "(", "path", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "if", "'args'", "in", "kwargs", ":", "if", "isinstance", "(", "kwargs", "[", "'args'", "]", ","...
.. versionadded:: 2014.7.0 Write text to a file, overwriting any existing contents. path path to file `*args` strings to write to the file CLI Example: .. code-block:: bash salt '*' file.write /etc/motd \\ "With all thine offerings thou shalt offer salt....
[ "..", "versionadded", "::", "2014", ".", "7", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3128-L3173
train
Writes text to a file
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
touch
def touch(name, atime=None, mtime=None): ''' .. versionadded:: 0.9.5 Just like the ``touch`` command, create a file if it doesn't exist or simply update the atime and mtime if it already does. atime: Access time in Unix epoch time. Set it to 0 to set atime of the file with Unix dat...
python
def touch(name, atime=None, mtime=None): ''' .. versionadded:: 0.9.5 Just like the ``touch`` command, create a file if it doesn't exist or simply update the atime and mtime if it already does. atime: Access time in Unix epoch time. Set it to 0 to set atime of the file with Unix dat...
[ "def", "touch", "(", "name", ",", "atime", "=", "None", ",", "mtime", "=", "None", ")", ":", "name", "=", "os", ".", "path", ".", "expanduser", "(", "name", ")", "if", "atime", "and", "atime", ".", "isdigit", "(", ")", ":", "atime", "=", "int", ...
.. versionadded:: 0.9.5 Just like the ``touch`` command, create a file if it doesn't exist or simply update the atime and mtime if it already does. atime: Access time in Unix epoch time. Set it to 0 to set atime of the file with Unix date of birth. If this parameter isn't set, atime ...
[ "..", "versionadded", "::", "0", ".", "9", ".", "5" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3176-L3224
train
Create a file in the specified directory and update the atime and mtime fields of the specified file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
tail
def tail(path, lines): ''' .. versionadded:: Neon Read the last n lines from a file path path to file lines number of lines to read CLI Example: .. code-block:: bash salt '*' file.tail /path/to/file 10 ''' path = os.path.expanduser(path) lines_found ...
python
def tail(path, lines): ''' .. versionadded:: Neon Read the last n lines from a file path path to file lines number of lines to read CLI Example: .. code-block:: bash salt '*' file.tail /path/to/file 10 ''' path = os.path.expanduser(path) lines_found ...
[ "def", "tail", "(", "path", ",", "lines", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "lines_found", "=", "[", "]", "buffer_size", "=", "4098", "if", "not", "os", ".", "path", ".", "isfile", "(", "path", ")", ":...
.. versionadded:: Neon Read the last n lines from a file path path to file lines number of lines to read CLI Example: .. code-block:: bash salt '*' file.tail /path/to/file 10
[ "..", "versionadded", "::", "Neon" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3227-L3287
train
Read the last n lines from a file and return the list of lines found.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
seek_read
def seek_read(path, size, offset): ''' .. versionadded:: 2014.1.0 Seek to a position on a file and read it path path to file seek amount to read at once offset offset to start into the file CLI Example: .. code-block:: bash salt '*' file.seek_read /...
python
def seek_read(path, size, offset): ''' .. versionadded:: 2014.1.0 Seek to a position on a file and read it path path to file seek amount to read at once offset offset to start into the file CLI Example: .. code-block:: bash salt '*' file.seek_read /...
[ "def", "seek_read", "(", "path", ",", "size", ",", "offset", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "seek_fh", "=", "os", ".", "open", "(", "path", ",", "os", ".", "O_RDONLY", ")", "try", ":", "os", ".", ...
.. versionadded:: 2014.1.0 Seek to a position on a file and read it path path to file seek amount to read at once offset offset to start into the file CLI Example: .. code-block:: bash salt '*' file.seek_read /path/to/file 4096 0
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3290-L3318
train
Reads the contents of the file at the specified offset and returns the contents as a string.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
saltstack/salt
salt/modules/file.py
seek_write
def seek_write(path, data, offset): ''' .. versionadded:: 2014.1.0 Seek to a position on a file and write to it path path to file data data to write to file offset position in file to start writing CLI Example: .. code-block:: bash salt '*' file.see...
python
def seek_write(path, data, offset): ''' .. versionadded:: 2014.1.0 Seek to a position on a file and write to it path path to file data data to write to file offset position in file to start writing CLI Example: .. code-block:: bash salt '*' file.see...
[ "def", "seek_write", "(", "path", ",", "data", ",", "offset", ")", ":", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "seek_fh", "=", "os", ".", "open", "(", "path", ",", "os", ".", "O_WRONLY", ")", "try", ":", "os", ".", ...
.. versionadded:: 2014.1.0 Seek to a position on a file and write to it path path to file data data to write to file offset position in file to start writing CLI Example: .. code-block:: bash salt '*' file.seek_write /path/to/file 'some data' 4096
[ "..", "versionadded", "::", "2014", ".", "1", ".", "0" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/file.py#L3321-L3350
train
Seek to a position on a file and write to it
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...