partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
present
Ensure the data pipeline exists with matching definition. name Name of the service to ensure a data pipeline exists for. pipeline_objects Pipeline objects to use. Will override objects read from pillars. pipeline_objects_from_pillars The pillar key to use for lookup. paramete...
salt/states/boto_datapipeline.py
def present(name, pipeline_objects=None, pipeline_objects_from_pillars='boto_datapipeline_pipeline_objects', parameter_objects=None, parameter_objects_from_pillars='boto_datapipeline_parameter_objects', parameter_values=None, parameter_values_from_pillars='bot...
def present(name, pipeline_objects=None, pipeline_objects_from_pillars='boto_datapipeline_pipeline_objects', parameter_objects=None, parameter_objects_from_pillars='boto_datapipeline_parameter_objects', parameter_values=None, parameter_values_from_pillars='bot...
[ "Ensure", "the", "data", "pipeline", "exists", "with", "matching", "definition", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L72-L251
[ "def", "present", "(", "name", ",", "pipeline_objects", "=", "None", ",", "pipeline_objects_from_pillars", "=", "'boto_datapipeline_pipeline_objects'", ",", "parameter_objects", "=", "None", ",", "parameter_objects_from_pillars", "=", "'boto_datapipeline_parameter_objects'", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_pipeline_present_with_definition
Return true if the pipeline exists and the definition matches. name The name of the pipeline. expected_pipeline_objects Pipeline objects that must match the definition. expected_parameter_objects Parameter objects that must match the definition. expected_parameter_values ...
salt/states/boto_datapipeline.py
def _pipeline_present_with_definition(name, expected_pipeline_objects, expected_parameter_objects, expected_parameter_values, region, key, keyid, profile): ''' Return true if the pipeline exists and...
def _pipeline_present_with_definition(name, expected_pipeline_objects, expected_parameter_objects, expected_parameter_values, region, key, keyid, profile): ''' Return true if the pipeline exists and...
[ "Return", "true", "if", "the", "pipeline", "exists", "and", "the", "definition", "matches", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L268-L331
[ "def", "_pipeline_present_with_definition", "(", "name", ",", "expected_pipeline_objects", ",", "expected_parameter_objects", ",", "expected_parameter_values", ",", "region", ",", "key", ",", "keyid", ",", "profile", ")", ":", "result_pipeline_id", "=", "__salt__", "[",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_cleaned
Return standardized pipeline objects to be used for comparing Remove year, month, and day components of the startDateTime so that data pipelines with the same time of day but different days are considered equal.
salt/states/boto_datapipeline.py
def _cleaned(_pipeline_objects): """Return standardized pipeline objects to be used for comparing Remove year, month, and day components of the startDateTime so that data pipelines with the same time of day but different days are considered equal. """ pipeline_objects = copy.deepcopy(_pipeline_...
def _cleaned(_pipeline_objects): """Return standardized pipeline objects to be used for comparing Remove year, month, and day components of the startDateTime so that data pipelines with the same time of day but different days are considered equal. """ pipeline_objects = copy.deepcopy(_pipeline_...
[ "Return", "standardized", "pipeline", "objects", "to", "be", "used", "for", "comparing" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L334-L350
[ "def", "_cleaned", "(", "_pipeline_objects", ")", ":", "pipeline_objects", "=", "copy", ".", "deepcopy", "(", "_pipeline_objects", ")", "for", "pipeline_object", "in", "pipeline_objects", ":", "if", "pipeline_object", "[", "'id'", "]", "==", "'DefaultSchedule'", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_recursive_compare
Return v1 == v2. Compares list, dict, recursively.
salt/states/boto_datapipeline.py
def _recursive_compare(v1, v2): ''' Return v1 == v2. Compares list, dict, recursively. ''' if isinstance(v1, list): if v2 is None: v2 = [] if len(v1) != len(v2): return False v1.sort(key=_id_or_key) v2.sort(key=_id_or_key) for x, y in zip(v...
def _recursive_compare(v1, v2): ''' Return v1 == v2. Compares list, dict, recursively. ''' if isinstance(v1, list): if v2 is None: v2 = [] if len(v1) != len(v2): return False v1.sort(key=_id_or_key) v2.sort(key=_id_or_key) for x, y in zip(v...
[ "Return", "v1", "==", "v2", ".", "Compares", "list", "dict", "recursively", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L353-L380
[ "def", "_recursive_compare", "(", "v1", ",", "v2", ")", ":", "if", "isinstance", "(", "v1", ",", "list", ")", ":", "if", "v2", "is", "None", ":", "v2", "=", "[", "]", "if", "len", "(", "v1", ")", "!=", "len", "(", "v2", ")", ":", "return", "F...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_id_or_key
Return the value at key 'id' or 'key'.
salt/states/boto_datapipeline.py
def _id_or_key(list_item): ''' Return the value at key 'id' or 'key'. ''' if isinstance(list_item, dict): if 'id' in list_item: return list_item['id'] if 'key' in list_item: return list_item['key'] return list_item
def _id_or_key(list_item): ''' Return the value at key 'id' or 'key'. ''' if isinstance(list_item, dict): if 'id' in list_item: return list_item['id'] if 'key' in list_item: return list_item['key'] return list_item
[ "Return", "the", "value", "at", "key", "id", "or", "key", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L383-L392
[ "def", "_id_or_key", "(", "list_item", ")", ":", "if", "isinstance", "(", "list_item", ",", "dict", ")", ":", "if", "'id'", "in", "list_item", ":", "return", "list_item", "[", "'id'", "]", "if", "'key'", "in", "list_item", ":", "return", "list_item", "["...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_diff
Return string diff of pipeline definitions.
salt/states/boto_datapipeline.py
def _diff(old_pipeline_definition, new_pipeline_definition): ''' Return string diff of pipeline definitions. ''' old_pipeline_definition.pop('ResponseMetadata', None) new_pipeline_definition.pop('ResponseMetadata', None) diff = salt.utils.data.decode(difflib.unified_diff( salt.utils.jso...
def _diff(old_pipeline_definition, new_pipeline_definition): ''' Return string diff of pipeline definitions. ''' old_pipeline_definition.pop('ResponseMetadata', None) new_pipeline_definition.pop('ResponseMetadata', None) diff = salt.utils.data.decode(difflib.unified_diff( salt.utils.jso...
[ "Return", "string", "diff", "of", "pipeline", "definitions", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L395-L406
[ "def", "_diff", "(", "old_pipeline_definition", ",", "new_pipeline_definition", ")", ":", "old_pipeline_definition", ".", "pop", "(", "'ResponseMetadata'", ",", "None", ")", "new_pipeline_definition", ".", "pop", "(", "'ResponseMetadata'", ",", "None", ")", "diff", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_standardize
Return standardized format for lists/dictionaries. Lists of dictionaries are sorted by the value of the dictionary at its primary key ('id' or 'key'). OrderedDict's are converted to basic dictionaries.
salt/states/boto_datapipeline.py
def _standardize(structure): ''' Return standardized format for lists/dictionaries. Lists of dictionaries are sorted by the value of the dictionary at its primary key ('id' or 'key'). OrderedDict's are converted to basic dictionaries. ''' def mutating_helper(structure): if isinstanc...
def _standardize(structure): ''' Return standardized format for lists/dictionaries. Lists of dictionaries are sorted by the value of the dictionary at its primary key ('id' or 'key'). OrderedDict's are converted to basic dictionaries. ''' def mutating_helper(structure): if isinstanc...
[ "Return", "standardized", "format", "for", "lists", "/", "dictionaries", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L409-L430
[ "def", "_standardize", "(", "structure", ")", ":", "def", "mutating_helper", "(", "structure", ")", ":", "if", "isinstance", "(", "structure", ",", "list", ")", ":", "structure", ".", "sort", "(", "key", "=", "_id_or_key", ")", "for", "each", "in", "stru...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_pipeline_objects
Return a list of pipeline objects that compose the pipeline pipeline_objects_from_pillars The pillar key to use for lookup pipeline_object_overrides Pipeline objects to use. Will override objects read from pillars.
salt/states/boto_datapipeline.py
def _pipeline_objects(pipeline_objects_from_pillars, pipeline_object_overrides): ''' Return a list of pipeline objects that compose the pipeline pipeline_objects_from_pillars The pillar key to use for lookup pipeline_object_overrides Pipeline objects to use. Will override objects read ...
def _pipeline_objects(pipeline_objects_from_pillars, pipeline_object_overrides): ''' Return a list of pipeline objects that compose the pipeline pipeline_objects_from_pillars The pillar key to use for lookup pipeline_object_overrides Pipeline objects to use. Will override objects read ...
[ "Return", "a", "list", "of", "pipeline", "objects", "that", "compose", "the", "pipeline" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L433-L448
[ "def", "_pipeline_objects", "(", "pipeline_objects_from_pillars", ",", "pipeline_object_overrides", ")", ":", "from_pillars", "=", "copy", ".", "deepcopy", "(", "__salt__", "[", "'pillar.get'", "]", "(", "pipeline_objects_from_pillars", ")", ")", "from_pillars", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_parameter_objects
Return a list of parameter objects that configure the pipeline parameter_objects_from_pillars The pillar key to use for lookup parameter_object_overrides Parameter objects to use. Will override objects read from pillars.
salt/states/boto_datapipeline.py
def _parameter_objects(parameter_objects_from_pillars, parameter_object_overrides): ''' Return a list of parameter objects that configure the pipeline parameter_objects_from_pillars The pillar key to use for lookup parameter_object_overrides Parameter objects to use. Will override obje...
def _parameter_objects(parameter_objects_from_pillars, parameter_object_overrides): ''' Return a list of parameter objects that configure the pipeline parameter_objects_from_pillars The pillar key to use for lookup parameter_object_overrides Parameter objects to use. Will override obje...
[ "Return", "a", "list", "of", "parameter", "objects", "that", "configure", "the", "pipeline" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L451-L466
[ "def", "_parameter_objects", "(", "parameter_objects_from_pillars", ",", "parameter_object_overrides", ")", ":", "from_pillars", "=", "copy", ".", "deepcopy", "(", "__salt__", "[", "'pillar.get'", "]", "(", "parameter_objects_from_pillars", ")", ")", "from_pillars", "."...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_parameter_values
Return a dictionary of parameter values that configure the pipeline parameter_values_from_pillars The pillar key to use for lookup parameter_value_overrides Parameter values to use. Will override values read from pillars.
salt/states/boto_datapipeline.py
def _parameter_values(parameter_values_from_pillars, parameter_value_overrides): ''' Return a dictionary of parameter values that configure the pipeline parameter_values_from_pillars The pillar key to use for lookup parameter_value_overrides Parameter values to use. Will override value...
def _parameter_values(parameter_values_from_pillars, parameter_value_overrides): ''' Return a dictionary of parameter values that configure the pipeline parameter_values_from_pillars The pillar key to use for lookup parameter_value_overrides Parameter values to use. Will override value...
[ "Return", "a", "dictionary", "of", "parameter", "values", "that", "configure", "the", "pipeline" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L469-L482
[ "def", "_parameter_values", "(", "parameter_values_from_pillars", ",", "parameter_value_overrides", ")", ":", "from_pillars", "=", "copy", ".", "deepcopy", "(", "__salt__", "[", "'pillar.get'", "]", "(", "parameter_values_from_pillars", ")", ")", "from_pillars", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_dict_to_list_ids
Convert a dictionary to a list of dictionaries, where each element has a key value pair {'id': key}. This makes it easy to override pillar values while still satisfying the boto api.
salt/states/boto_datapipeline.py
def _dict_to_list_ids(objects): ''' Convert a dictionary to a list of dictionaries, where each element has a key value pair {'id': key}. This makes it easy to override pillar values while still satisfying the boto api. ''' list_with_ids = [] for key, value in six.iteritems(objects): ...
def _dict_to_list_ids(objects): ''' Convert a dictionary to a list of dictionaries, where each element has a key value pair {'id': key}. This makes it easy to override pillar values while still satisfying the boto api. ''' list_with_ids = [] for key, value in six.iteritems(objects): ...
[ "Convert", "a", "dictionary", "to", "a", "list", "of", "dictionaries", "where", "each", "element", "has", "a", "key", "value", "pair", "{", "id", ":", "key", "}", ".", "This", "makes", "it", "easy", "to", "override", "pillar", "values", "while", "still",...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L485-L496
[ "def", "_dict_to_list_ids", "(", "objects", ")", ":", "list_with_ids", "=", "[", "]", "for", "key", ",", "value", "in", "six", ".", "iteritems", "(", "objects", ")", ":", "element", "=", "{", "'id'", ":", "key", "}", "element", ".", "update", "(", "v...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_properties_from_dict
Transforms dictionary into pipeline object properties. The output format conforms to boto's specification. Example input: { 'a': '1', 'b': { 'ref': '2' }, } Example output: [ { 'key': 'a', ...
salt/states/boto_datapipeline.py
def _properties_from_dict(d, key_name='key'): ''' Transforms dictionary into pipeline object properties. The output format conforms to boto's specification. Example input: { 'a': '1', 'b': { 'ref': '2' }, } Example output: ...
def _properties_from_dict(d, key_name='key'): ''' Transforms dictionary into pipeline object properties. The output format conforms to boto's specification. Example input: { 'a': '1', 'b': { 'ref': '2' }, } Example output: ...
[ "Transforms", "dictionary", "into", "pipeline", "object", "properties", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L499-L537
[ "def", "_properties_from_dict", "(", "d", ",", "key_name", "=", "'key'", ")", ":", "fields", "=", "[", "]", "for", "key", ",", "value", "in", "six", ".", "iteritems", "(", "d", ")", ":", "if", "isinstance", "(", "value", ",", "dict", ")", ":", "fie...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
absent
Ensure a pipeline with the service_name does not exist name Name of the service to ensure a data pipeline does not exist for. region Region to connect to. key Secret key to be used. keyid Access key to be used. profile A dict with region, key and keyid, o...
salt/states/boto_datapipeline.py
def absent(name, region=None, key=None, keyid=None, profile=None): ''' Ensure a pipeline with the service_name does not exist name Name of the service to ensure a data pipeline does not exist for. region Region to connect to. key Secret key to be used. keyid A...
def absent(name, region=None, key=None, keyid=None, profile=None): ''' Ensure a pipeline with the service_name does not exist name Name of the service to ensure a data pipeline does not exist for. region Region to connect to. key Secret key to be used. keyid A...
[ "Ensure", "a", "pipeline", "with", "the", "service_name", "does", "not", "exist" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/boto_datapipeline.py#L540-L588
[ "def", "absent", "(", "name", ",", "region", "=", "None", ",", "key", "=", "None", ",", "keyid", "=", "None", ",", "profile", "=", "None", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'result'", ":", "True", ",", "'comment'", ":", "''"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
deserialize
Deserialize any string or stream like object into a Python data structure. :param stream_or_string: stream or string to deserialize. :param options: options given to lower json/simplejson module.
salt/serializers/json.py
def deserialize(stream_or_string, **options): ''' Deserialize any string or stream like object into a Python data structure. :param stream_or_string: stream or string to deserialize. :param options: options given to lower json/simplejson module. ''' try: if not isinstance(stream_or_str...
def deserialize(stream_or_string, **options): ''' Deserialize any string or stream like object into a Python data structure. :param stream_or_string: stream or string to deserialize. :param options: options given to lower json/simplejson module. ''' try: if not isinstance(stream_or_str...
[ "Deserialize", "any", "string", "or", "stream", "like", "object", "into", "a", "Python", "data", "structure", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/json.py#L30-L48
[ "def", "deserialize", "(", "stream_or_string", ",", "*", "*", "options", ")", ":", "try", ":", "if", "not", "isinstance", "(", "stream_or_string", ",", "(", "bytes", ",", "six", ".", "string_types", ")", ")", ":", "return", "salt", ".", "utils", ".", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
serialize
Serialize Python data to JSON. :param obj: the data structure to serialize :param options: options given to lower json/simplejson module.
salt/serializers/json.py
def serialize(obj, **options): ''' Serialize Python data to JSON. :param obj: the data structure to serialize :param options: options given to lower json/simplejson module. ''' try: if 'fp' in options: return salt.utils.json.dump(obj, _json_module=_json, **options) ...
def serialize(obj, **options): ''' Serialize Python data to JSON. :param obj: the data structure to serialize :param options: options given to lower json/simplejson module. ''' try: if 'fp' in options: return salt.utils.json.dump(obj, _json_module=_json, **options) ...
[ "Serialize", "Python", "data", "to", "JSON", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/serializers/json.py#L51-L65
[ "def", "serialize", "(", "obj", ",", "*", "*", "options", ")", ":", "try", ":", "if", "'fp'", "in", "options", ":", "return", "salt", ".", "utils", ".", "json", ".", "dump", "(", "obj", ",", "_json_module", "=", "_json", ",", "*", "*", "options", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
present
Ensure that the named database is present with the specified properties name The name of the database to manage
salt/states/mysql_database.py
def present(name, character_set=None, collate=None, **connection_args): ''' Ensure that the named database is present with the specified properties name The name of the database to manage ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': 'Da...
def present(name, character_set=None, collate=None, **connection_args): ''' Ensure that the named database is present with the specified properties name The name of the database to manage ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': 'Da...
[ "Ensure", "that", "the", "named", "database", "is", "present", "with", "the", "specified", "properties" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mysql_database.py#L43-L105
[ "def", "present", "(", "name", ",", "character_set", "=", "None", ",", "collate", "=", "None", ",", "*", "*", "connection_args", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
absent
Ensure that the named database is absent name The name of the database to remove
salt/states/mysql_database.py
def absent(name, **connection_args): ''' Ensure that the named database is absent name The name of the database to remove ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} #check if db exists and remove it if __salt__['mysql.db_...
def absent(name, **connection_args): ''' Ensure that the named database is absent name The name of the database to remove ''' ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''} #check if db exists and remove it if __salt__['mysql.db_...
[ "Ensure", "that", "the", "named", "database", "is", "absent" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/mysql_database.py#L108-L148
[ "def", "absent", "(", "name", ",", "*", "*", "connection_args", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "''", "}", "#check if db exists and remove it", "if", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_net_runner_opts
Return the net.find runner options.
salt/runners/net.py
def _get_net_runner_opts(): ''' Return the net.find runner options. ''' runner_opts = __opts__.get('runners', {}).get('net.find', {}) return { 'target': runner_opts.get('target', _DEFAULT_TARGET), 'expr_form': runner_opts.get('expr_form', _DEFAULT_EXPR_FORM), 'ignore_interfac...
def _get_net_runner_opts(): ''' Return the net.find runner options. ''' runner_opts = __opts__.get('runners', {}).get('net.find', {}) return { 'target': runner_opts.get('target', _DEFAULT_TARGET), 'expr_form': runner_opts.get('expr_form', _DEFAULT_EXPR_FORM), 'ignore_interfac...
[ "Return", "the", "net", ".", "find", "runner", "options", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L121-L132
[ "def", "_get_net_runner_opts", "(", ")", ":", "runner_opts", "=", "__opts__", ".", "get", "(", "'runners'", ",", "{", "}", ")", ".", "get", "(", "'net.find'", ",", "{", "}", ")", "return", "{", "'target'", ":", "runner_opts", ".", "get", "(", "'target'...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_get_mine
Return the mine function from all the targeted minions. Just a small helper to avoid redundant pieces of code.
salt/runners/net.py
def _get_mine(fun): ''' Return the mine function from all the targeted minions. Just a small helper to avoid redundant pieces of code. ''' if fun in _CACHE and _CACHE[fun]: return _CACHE[fun] net_runner_opts = _get_net_runner_opts() _CACHE[fun] = __salt__['mine.get'](net_runner_opts....
def _get_mine(fun): ''' Return the mine function from all the targeted minions. Just a small helper to avoid redundant pieces of code. ''' if fun in _CACHE and _CACHE[fun]: return _CACHE[fun] net_runner_opts = _get_net_runner_opts() _CACHE[fun] = __salt__['mine.get'](net_runner_opts....
[ "Return", "the", "mine", "function", "from", "all", "the", "targeted", "minions", ".", "Just", "a", "small", "helper", "to", "avoid", "redundant", "pieces", "of", "code", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L135-L146
[ "def", "_get_mine", "(", "fun", ")", ":", "if", "fun", "in", "_CACHE", "and", "_CACHE", "[", "fun", "]", ":", "return", "_CACHE", "[", "fun", "]", "net_runner_opts", "=", "_get_net_runner_opts", "(", ")", "_CACHE", "[", "fun", "]", "=", "__salt__", "["...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_display_runner
Display or return the rows.
salt/runners/net.py
def _display_runner(rows, labels, title, display=_DEFAULT_DISPLAY): ''' Display or return the rows. ''' if display: net_runner_opts = _get_net_runner_opts() if net_runner_opts.get('outputter') == 'table': ret = salt.output.out_format({'rows': rows, 'labels': labels}, ...
def _display_runner(rows, labels, title, display=_DEFAULT_DISPLAY): ''' Display or return the rows. ''' if display: net_runner_opts = _get_net_runner_opts() if net_runner_opts.get('outputter') == 'table': ret = salt.output.out_format({'rows': rows, 'labels': labels}, ...
[ "Display", "or", "return", "the", "rows", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L149-L168
[ "def", "_display_runner", "(", "rows", ",", "labels", ",", "title", ",", "display", "=", "_DEFAULT_DISPLAY", ")", ":", "if", "display", ":", "net_runner_opts", "=", "_get_net_runner_opts", "(", ")", "if", "net_runner_opts", ".", "get", "(", "'outputter'", ")",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_find_interfaces_ip
Helper to search the interfaces IPs using the MAC address.
salt/runners/net.py
def _find_interfaces_ip(mac): ''' Helper to search the interfaces IPs using the MAC address. ''' try: mac = napalm_helpers.convert(napalm_helpers.mac, mac) except AddrFormatError: return ('', '', []) all_interfaces = _get_mine('net.interfaces') all_ipaddrs = _get_mine('net.i...
def _find_interfaces_ip(mac): ''' Helper to search the interfaces IPs using the MAC address. ''' try: mac = napalm_helpers.convert(napalm_helpers.mac, mac) except AddrFormatError: return ('', '', []) all_interfaces = _get_mine('net.interfaces') all_ipaddrs = _get_mine('net.i...
[ "Helper", "to", "search", "the", "interfaces", "IPs", "using", "the", "MAC", "address", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L183-L213
[ "def", "_find_interfaces_ip", "(", "mac", ")", ":", "try", ":", "mac", "=", "napalm_helpers", ".", "convert", "(", "napalm_helpers", ".", "mac", ",", "mac", ")", "except", "AddrFormatError", ":", "return", "(", "''", ",", "''", ",", "[", "]", ")", "all...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_find_interfaces_mac
Helper to get the interfaces hardware address using the IP Address.
salt/runners/net.py
def _find_interfaces_mac(ip): # pylint: disable=invalid-name ''' Helper to get the interfaces hardware address using the IP Address. ''' all_interfaces = _get_mine('net.interfaces') all_ipaddrs = _get_mine('net.ipaddrs') for device, device_ipaddrs in six.iteritems(all_ipaddrs): if not ...
def _find_interfaces_mac(ip): # pylint: disable=invalid-name ''' Helper to get the interfaces hardware address using the IP Address. ''' all_interfaces = _get_mine('net.interfaces') all_ipaddrs = _get_mine('net.ipaddrs') for device, device_ipaddrs in six.iteritems(all_ipaddrs): if not ...
[ "Helper", "to", "get", "the", "interfaces", "hardware", "address", "using", "the", "IP", "Address", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L216-L235
[ "def", "_find_interfaces_mac", "(", "ip", ")", ":", "# pylint: disable=invalid-name", "all_interfaces", "=", "_get_mine", "(", "'net.interfaces'", ")", "all_ipaddrs", "=", "_get_mine", "(", "'net.ipaddrs'", ")", "for", "device", ",", "device_ipaddrs", "in", "six", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
interfaces
Search for interfaces details in the following mine functions: - net.interfaces - net.ipaddrs Optional arguments: device Return interface data from a certain device only. interface Return data selecting by interface name. pattern Return interfaces that contain a cert...
salt/runners/net.py
def interfaces(device=None, interface=None, title=None, pattern=None, ipnet=None, best=True, display=_DEFAULT_DISPLAY): ''' Search for interfaces details in the following mine functions: - net.interfaces - net.ipa...
def interfaces(device=None, interface=None, title=None, pattern=None, ipnet=None, best=True, display=_DEFAULT_DISPLAY): ''' Search for interfaces details in the following mine functions: - net.interfaces - net.ipa...
[ "Search", "for", "interfaces", "details", "in", "the", "following", "mine", "functions", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L243-L431
[ "def", "interfaces", "(", "device", "=", "None", ",", "interface", "=", "None", ",", "title", "=", "None", ",", "pattern", "=", "None", ",", "ipnet", "=", "None", ",", "best", "=", "True", ",", "display", "=", "_DEFAULT_DISPLAY", ")", ":", "def", "_i...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
findarp
Search for entries in the ARP tables using the following mine functions: - net.arp Optional arguments: device Return interface data from a certain device only. interface Return data selecting by interface name. mac Search using a specific MAC Address. ip Sea...
salt/runners/net.py
def findarp(device=None, interface=None, mac=None, ip=None, display=_DEFAULT_DISPLAY): # pylint: disable=invalid-name ''' Search for entries in the ARP tables using the following mine functions: - net.arp Optional arguments: device Return i...
def findarp(device=None, interface=None, mac=None, ip=None, display=_DEFAULT_DISPLAY): # pylint: disable=invalid-name ''' Search for entries in the ARP tables using the following mine functions: - net.arp Optional arguments: device Return i...
[ "Search", "for", "entries", "in", "the", "ARP", "tables", "using", "the", "following", "mine", "functions", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L434-L521
[ "def", "findarp", "(", "device", "=", "None", ",", "interface", "=", "None", ",", "mac", "=", "None", ",", "ip", "=", "None", ",", "display", "=", "_DEFAULT_DISPLAY", ")", ":", "# pylint: disable=invalid-name", "labels", "=", "{", "'device'", ":", "'Device...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
findmac
Search in the MAC Address tables, using the following mine functions: - net.mac Optional arguments: device Return interface data from a certain device only. interface Return data selecting by interface name. mac Search using a specific MAC Address. vlan Sear...
salt/runners/net.py
def findmac(device=None, mac=None, interface=None, vlan=None, display=_DEFAULT_DISPLAY): ''' Search in the MAC Address tables, using the following mine functions: - net.mac Optional arguments: device Return interface data from a certain device only. interface Return data sele...
def findmac(device=None, mac=None, interface=None, vlan=None, display=_DEFAULT_DISPLAY): ''' Search in the MAC Address tables, using the following mine functions: - net.mac Optional arguments: device Return interface data from a certain device only. interface Return data sele...
[ "Search", "in", "the", "MAC", "Address", "tables", "using", "the", "following", "mine", "functions", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L524-L612
[ "def", "findmac", "(", "device", "=", "None", ",", "mac", "=", "None", ",", "interface", "=", "None", ",", "vlan", "=", "None", ",", "display", "=", "_DEFAULT_DISPLAY", ")", ":", "labels", "=", "{", "'device'", ":", "'Device'", ",", "'interface'", ":",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
lldp
Search in the LLDP neighbors, using the following mine functions: - net.lldp Optional arguments: device Return interface data from a certain device only. interface Return data selecting by interface name. pattern Return LLDP neighbors that have contain this pattern in on...
salt/runners/net.py
def lldp(device=None, interface=None, title=None, pattern=None, chassis=None, display=_DEFAULT_DISPLAY): ''' Search in the LLDP neighbors, using the following mine functions: - net.lldp Optional arguments: device Return interface data from a ce...
def lldp(device=None, interface=None, title=None, pattern=None, chassis=None, display=_DEFAULT_DISPLAY): ''' Search in the LLDP neighbors, using the following mine functions: - net.lldp Optional arguments: device Return interface data from a ce...
[ "Search", "in", "the", "LLDP", "neighbors", "using", "the", "following", "mine", "functions", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L615-L752
[ "def", "lldp", "(", "device", "=", "None", ",", "interface", "=", "None", ",", "title", "=", "None", ",", "pattern", "=", "None", ",", "chassis", "=", "None", ",", "display", "=", "_DEFAULT_DISPLAY", ")", ":", "all_lldp", "=", "_get_mine", "(", "'net.l...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
find
Search in all possible entities (Interfaces, MAC tables, ARP tables, LLDP neighbors), using the following mine functions: - net.mac - net.arp - net.lldp - net.ipaddrs - net.interfaces This function has the advantage that it knows where to look, but the output might become quite long as...
salt/runners/net.py
def find(addr, best=True, display=_DEFAULT_DISPLAY): ''' Search in all possible entities (Interfaces, MAC tables, ARP tables, LLDP neighbors), using the following mine functions: - net.mac - net.arp - net.lldp - net.ipaddrs - net.interfaces This function has the advantage that it k...
def find(addr, best=True, display=_DEFAULT_DISPLAY): ''' Search in all possible entities (Interfaces, MAC tables, ARP tables, LLDP neighbors), using the following mine functions: - net.mac - net.arp - net.lldp - net.ipaddrs - net.interfaces This function has the advantage that it k...
[ "Search", "in", "all", "possible", "entities", "(", "Interfaces", "MAC", "tables", "ARP", "tables", "LLDP", "neighbors", ")", "using", "the", "following", "mine", "functions", ":" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L755-L907
[ "def", "find", "(", "addr", ",", "best", "=", "True", ",", "display", "=", "_DEFAULT_DISPLAY", ")", ":", "if", "not", "addr", ":", "if", "display", ":", "print", "(", "'Please type a valid MAC/IP Address / Device / Interface / VLAN'", ")", "return", "{", "}", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
multi_find
Execute multiple search tasks. This function is based on the `find` function. Depending on the search items, some information might overlap. Optional arguments: best: ``True`` Return only the best match with the interfaces IP networks when the saerching pattern is a valid IP Address or...
salt/runners/net.py
def multi_find(*patterns, **kwargs): ''' Execute multiple search tasks. This function is based on the `find` function. Depending on the search items, some information might overlap. Optional arguments: best: ``True`` Return only the best match with the interfaces IP networks wh...
def multi_find(*patterns, **kwargs): ''' Execute multiple search tasks. This function is based on the `find` function. Depending on the search items, some information might overlap. Optional arguments: best: ``True`` Return only the best match with the interfaces IP networks wh...
[ "Execute", "multiple", "search", "tasks", ".", "This", "function", "is", "based", "on", "the", "find", "function", ".", "Depending", "on", "the", "search", "items", "some", "information", "might", "overlap", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/runners/net.py#L910-L967
[ "def", "multi_find", "(", "*", "patterns", ",", "*", "*", "kwargs", ")", ":", "out", "=", "{", "}", "for", "pattern", "in", "set", "(", "patterns", ")", ":", "search_result", "=", "find", "(", "pattern", ",", "best", "=", "kwargs", ".", "get", "(",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_recurmatch
Recursive generator providing the infrastructure for augtools print behavior. This function is based on test_augeas.py from Harald Hoyer <harald@redhat.com> in the python-augeas repository
salt/modules/augeas_cfg.py
def _recurmatch(path, aug): ''' Recursive generator providing the infrastructure for augtools print behavior. This function is based on test_augeas.py from Harald Hoyer <harald@redhat.com> in the python-augeas repository ''' if path: clean_path = path.rstrip('/*') yield...
def _recurmatch(path, aug): ''' Recursive generator providing the infrastructure for augtools print behavior. This function is based on test_augeas.py from Harald Hoyer <harald@redhat.com> in the python-augeas repository ''' if path: clean_path = path.rstrip('/*') yield...
[ "Recursive", "generator", "providing", "the", "infrastructure", "for", "augtools", "print", "behavior", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L75-L91
[ "def", "_recurmatch", "(", "path", ",", "aug", ")", ":", "if", "path", ":", "clean_path", "=", "path", ".", "rstrip", "(", "'/*'", ")", "yield", "(", "clean_path", ",", "aug", ".", "get", "(", "path", ")", ")", "for", "i", "in", "aug", ".", "matc...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_lstrip_word
Return a copy of the string after the specified prefix was removed from the beginning of the string
salt/modules/augeas_cfg.py
def _lstrip_word(word, prefix): ''' Return a copy of the string after the specified prefix was removed from the beginning of the string ''' if six.text_type(word).startswith(prefix): return six.text_type(word)[len(prefix):] return word
def _lstrip_word(word, prefix): ''' Return a copy of the string after the specified prefix was removed from the beginning of the string ''' if six.text_type(word).startswith(prefix): return six.text_type(word)[len(prefix):] return word
[ "Return", "a", "copy", "of", "the", "string", "after", "the", "specified", "prefix", "was", "removed", "from", "the", "beginning", "of", "the", "string" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L94-L102
[ "def", "_lstrip_word", "(", "word", ",", "prefix", ")", ":", "if", "six", ".", "text_type", "(", "word", ")", ".", "startswith", "(", "prefix", ")", ":", "return", "six", ".", "text_type", "(", "word", ")", "[", "len", "(", "prefix", ")", ":", "]",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_check_load_paths
Checks the validity of the load_path, returns a sanitized version with invalid paths removed.
salt/modules/augeas_cfg.py
def _check_load_paths(load_path): ''' Checks the validity of the load_path, returns a sanitized version with invalid paths removed. ''' if load_path is None or not isinstance(load_path, six.string_types): return None _paths = [] for _path in load_path.split(':'): if os.path...
def _check_load_paths(load_path): ''' Checks the validity of the load_path, returns a sanitized version with invalid paths removed. ''' if load_path is None or not isinstance(load_path, six.string_types): return None _paths = [] for _path in load_path.split(':'): if os.path...
[ "Checks", "the", "validity", "of", "the", "load_path", "returns", "a", "sanitized", "version", "with", "invalid", "paths", "removed", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L105-L124
[ "def", "_check_load_paths", "(", "load_path", ")", ":", "if", "load_path", "is", "None", "or", "not", "isinstance", "(", "load_path", ",", "six", ".", "string_types", ")", ":", "return", "None", "_paths", "=", "[", "]", "for", "_path", "in", "load_path", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
execute
Execute Augeas commands .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' augeas.execute /files/etc/redis/redis.conf \\ commands='["set bind 0.0.0.0", "set maxmemory 1G"]' context The Augeas context lens The Augeas lens to use commands ...
salt/modules/augeas_cfg.py
def execute(context=None, lens=None, commands=(), load_path=None): ''' Execute Augeas commands .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' augeas.execute /files/etc/redis/redis.conf \\ commands='["set bind 0.0.0.0", "set maxmemory 1G"]' context ...
def execute(context=None, lens=None, commands=(), load_path=None): ''' Execute Augeas commands .. versionadded:: 2014.7.0 CLI Example: .. code-block:: bash salt '*' augeas.execute /files/etc/redis/redis.conf \\ commands='["set bind 0.0.0.0", "set maxmemory 1G"]' context ...
[ "Execute", "Augeas", "commands" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L127-L261
[ "def", "execute", "(", "context", "=", "None", ",", "lens", "=", "None", ",", "commands", "=", "(", ")", ",", "load_path", "=", "None", ")", ":", "ret", "=", "{", "'retval'", ":", "False", "}", "arg_map", "=", "{", "'set'", ":", "(", "1", ",", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
get
Get a value for a specific augeas path CLI Example: .. code-block:: bash salt '*' augeas.get /files/etc/hosts/1/ ipaddr path The path to get the value of value The optional value to get .. versionadded:: 2016.3.0 load_path A colon-spearated list of director...
salt/modules/augeas_cfg.py
def get(path, value='', load_path=None): ''' Get a value for a specific augeas path CLI Example: .. code-block:: bash salt '*' augeas.get /files/etc/hosts/1/ ipaddr path The path to get the value of value The optional value to get .. versionadded:: 2016.3.0 ...
def get(path, value='', load_path=None): ''' Get a value for a specific augeas path CLI Example: .. code-block:: bash salt '*' augeas.get /files/etc/hosts/1/ ipaddr path The path to get the value of value The optional value to get .. versionadded:: 2016.3.0 ...
[ "Get", "a", "value", "for", "a", "specific", "augeas", "path" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L264-L306
[ "def", "get", "(", "path", ",", "value", "=", "''", ",", "load_path", "=", "None", ")", ":", "load_path", "=", "_check_load_paths", "(", "load_path", ")", "aug", "=", "_Augeas", "(", "loadpath", "=", "load_path", ")", "ret", "=", "{", "}", "path", "=...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
setvalue
Set a value for a specific augeas path CLI Example: .. code-block:: bash salt '*' augeas.setvalue /files/etc/hosts/1/canonical localhost This will set the first entry in /etc/hosts to localhost CLI Example: .. code-block:: bash salt '*' augeas.setvalue /files/etc/hosts/01/ipad...
salt/modules/augeas_cfg.py
def setvalue(*args): ''' Set a value for a specific augeas path CLI Example: .. code-block:: bash salt '*' augeas.setvalue /files/etc/hosts/1/canonical localhost This will set the first entry in /etc/hosts to localhost CLI Example: .. code-block:: bash salt '*' augeas....
def setvalue(*args): ''' Set a value for a specific augeas path CLI Example: .. code-block:: bash salt '*' augeas.setvalue /files/etc/hosts/1/canonical localhost This will set the first entry in /etc/hosts to localhost CLI Example: .. code-block:: bash salt '*' augeas....
[ "Set", "a", "value", "for", "a", "specific", "augeas", "path" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L309-L391
[ "def", "setvalue", "(", "*", "args", ")", ":", "load_path", "=", "None", "load_paths", "=", "[", "x", "for", "x", "in", "args", "if", "six", ".", "text_type", "(", "x", ")", ".", "startswith", "(", "'load_path='", ")", "]", "if", "load_paths", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
match
Get matches for path expression CLI Example: .. code-block:: bash salt '*' augeas.match /files/etc/services/service-name ssh path The path to match value The value to match on .. versionadded:: 2016.3.0 load_path A colon-spearated list of directories that m...
salt/modules/augeas_cfg.py
def match(path, value='', load_path=None): ''' Get matches for path expression CLI Example: .. code-block:: bash salt '*' augeas.match /files/etc/services/service-name ssh path The path to match value The value to match on .. versionadded:: 2016.3.0 load_pa...
def match(path, value='', load_path=None): ''' Get matches for path expression CLI Example: .. code-block:: bash salt '*' augeas.match /files/etc/services/service-name ssh path The path to match value The value to match on .. versionadded:: 2016.3.0 load_pa...
[ "Get", "matches", "for", "path", "expression" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L394-L432
[ "def", "match", "(", "path", ",", "value", "=", "''", ",", "load_path", "=", "None", ")", ":", "load_path", "=", "_check_load_paths", "(", "load_path", ")", "aug", "=", "_Augeas", "(", "loadpath", "=", "load_path", ")", "ret", "=", "{", "}", "try", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
remove
Get matches for path expression CLI Example: .. code-block:: bash salt '*' augeas.remove \\ /files/etc/sysctl.conf/net.ipv4.conf.all.log_martians path The path to remove .. versionadded:: 2016.3.0 load_path A colon-spearated list of directories that modules shou...
salt/modules/augeas_cfg.py
def remove(path, load_path=None): ''' Get matches for path expression CLI Example: .. code-block:: bash salt '*' augeas.remove \\ /files/etc/sysctl.conf/net.ipv4.conf.all.log_martians path The path to remove .. versionadded:: 2016.3.0 load_path A colon-s...
def remove(path, load_path=None): ''' Get matches for path expression CLI Example: .. code-block:: bash salt '*' augeas.remove \\ /files/etc/sysctl.conf/net.ipv4.conf.all.log_martians path The path to remove .. versionadded:: 2016.3.0 load_path A colon-s...
[ "Get", "matches", "for", "path", "expression" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L435-L472
[ "def", "remove", "(", "path", ",", "load_path", "=", "None", ")", ":", "load_path", "=", "_check_load_paths", "(", "load_path", ")", "aug", "=", "_Augeas", "(", "loadpath", "=", "load_path", ")", "ret", "=", "{", "'retval'", ":", "False", "}", "try", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
ls
List the direct children of a node CLI Example: .. code-block:: bash salt '*' augeas.ls /files/etc/passwd path The path to list .. versionadded:: 2016.3.0 load_path A colon-spearated list of directories that modules should be searched in. This is in addition to ...
salt/modules/augeas_cfg.py
def ls(path, load_path=None): # pylint: disable=C0103 ''' List the direct children of a node CLI Example: .. code-block:: bash salt '*' augeas.ls /files/etc/passwd path The path to list .. versionadded:: 2016.3.0 load_path A colon-spearated list of directories ...
def ls(path, load_path=None): # pylint: disable=C0103 ''' List the direct children of a node CLI Example: .. code-block:: bash salt '*' augeas.ls /files/etc/passwd path The path to list .. versionadded:: 2016.3.0 load_path A colon-spearated list of directories ...
[ "List", "the", "direct", "children", "of", "a", "node" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L475-L523
[ "def", "ls", "(", "path", ",", "load_path", "=", "None", ")", ":", "# pylint: disable=C0103", "def", "_match", "(", "path", ")", ":", "''' Internal match function '''", "try", ":", "matches", "=", "aug", ".", "match", "(", "salt", ".", "utils", ".", "strin...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
tree
Returns recursively the complete tree of a node CLI Example: .. code-block:: bash salt '*' augeas.tree /files/etc/ path The base of the recursive listing .. versionadded:: 2016.3.0 load_path A colon-spearated list of directories that modules should be searched i...
salt/modules/augeas_cfg.py
def tree(path, load_path=None): ''' Returns recursively the complete tree of a node CLI Example: .. code-block:: bash salt '*' augeas.tree /files/etc/ path The base of the recursive listing .. versionadded:: 2016.3.0 load_path A colon-spearated list of directori...
def tree(path, load_path=None): ''' Returns recursively the complete tree of a node CLI Example: .. code-block:: bash salt '*' augeas.tree /files/etc/ path The base of the recursive listing .. versionadded:: 2016.3.0 load_path A colon-spearated list of directori...
[ "Returns", "recursively", "the", "complete", "tree", "of", "a", "node" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/augeas_cfg.py#L526-L552
[ "def", "tree", "(", "path", ",", "load_path", "=", "None", ")", ":", "load_path", "=", "_check_load_paths", "(", "load_path", ")", "aug", "=", "_Augeas", "(", "loadpath", "=", "load_path", ")", "path", "=", "path", ".", "rstrip", "(", "'/'", ")", "+", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
list_installed
Return a list of all installed kernels. CLI Example: .. code-block:: bash salt '*' kernelpkg.list_installed
salt/modules/kernelpkg_linux_apt.py
def list_installed(): ''' Return a list of all installed kernels. CLI Example: .. code-block:: bash salt '*' kernelpkg.list_installed ''' pkg_re = re.compile(r'^{0}-[\d.-]+-{1}$'.format( _package_prefix(), _kernel_type())) pkgs = __salt__['pkg.list_pkgs'](versions_as_list=...
def list_installed(): ''' Return a list of all installed kernels. CLI Example: .. code-block:: bash salt '*' kernelpkg.list_installed ''' pkg_re = re.compile(r'^{0}-[\d.-]+-{1}$'.format( _package_prefix(), _kernel_type())) pkgs = __salt__['pkg.list_pkgs'](versions_as_list=...
[ "Return", "a", "list", "of", "all", "installed", "kernels", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_apt.py#L58-L83
[ "def", "list_installed", "(", ")", ":", "pkg_re", "=", "re", ".", "compile", "(", "r'^{0}-[\\d.-]+-{1}$'", ".", "format", "(", "_package_prefix", "(", ")", ",", "_kernel_type", "(", ")", ")", ")", "pkgs", "=", "__salt__", "[", "'pkg.list_pkgs'", "]", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
upgrade
Upgrade the kernel and optionally reboot the system. reboot : False Request a reboot if a new kernel is available. at_time : immediate Schedule the reboot at some point in the future. This argument is ignored if ``reboot=False``. See :py:func:`~salt.modules.system.reboot` for m...
salt/modules/kernelpkg_linux_apt.py
def upgrade(reboot=False, at_time=None): ''' Upgrade the kernel and optionally reboot the system. reboot : False Request a reboot if a new kernel is available. at_time : immediate Schedule the reboot at some point in the future. This argument is ignored if ``reboot=False``. See...
def upgrade(reboot=False, at_time=None): ''' Upgrade the kernel and optionally reboot the system. reboot : False Request a reboot if a new kernel is available. at_time : immediate Schedule the reboot at some point in the future. This argument is ignored if ``reboot=False``. See...
[ "Upgrade", "the", "kernel", "and", "optionally", "reboot", "the", "system", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_apt.py#L144-L185
[ "def", "upgrade", "(", "reboot", "=", "False", ",", "at_time", "=", "None", ")", ":", "result", "=", "__salt__", "[", "'pkg.install'", "]", "(", "name", "=", "'{0}-{1}'", ".", "format", "(", "_package_prefix", "(", ")", ",", "latest_available", "(", ")",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
remove
Remove a specific version of the kernel. release The release number of an installed kernel. This must be the entire release number as returned by :py:func:`~salt.modules.kernelpkg_linux_apt.list_installed`, not the package name. CLI Example: .. code-block:: bash salt '*' ...
salt/modules/kernelpkg_linux_apt.py
def remove(release): ''' Remove a specific version of the kernel. release The release number of an installed kernel. This must be the entire release number as returned by :py:func:`~salt.modules.kernelpkg_linux_apt.list_installed`, not the package name. CLI Example: .. cod...
def remove(release): ''' Remove a specific version of the kernel. release The release number of an installed kernel. This must be the entire release number as returned by :py:func:`~salt.modules.kernelpkg_linux_apt.list_installed`, not the package name. CLI Example: .. cod...
[ "Remove", "a", "specific", "version", "of", "the", "kernel", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_apt.py#L202-L228
[ "def", "remove", "(", "release", ")", ":", "if", "release", "not", "in", "list_installed", "(", ")", ":", "raise", "CommandExecutionError", "(", "'Kernel release \\'{0}\\' is not installed'", ".", "format", "(", "release", ")", ")", "if", "release", "==", "activ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
cleanup
Remove all unused kernel packages from the system. keep_latest : True In the event that the active kernel is not the latest one installed, setting this to True will retain the latest kernel package, in addition to the active one. If False, all kernel packages other than the active one will ...
salt/modules/kernelpkg_linux_apt.py
def cleanup(keep_latest=True): ''' Remove all unused kernel packages from the system. keep_latest : True In the event that the active kernel is not the latest one installed, setting this to True will retain the latest kernel package, in addition to the active one. If False, all kernel ...
def cleanup(keep_latest=True): ''' Remove all unused kernel packages from the system. keep_latest : True In the event that the active kernel is not the latest one installed, setting this to True will retain the latest kernel package, in addition to the active one. If False, all kernel ...
[ "Remove", "all", "unused", "kernel", "packages", "from", "the", "system", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_apt.py#L231-L262
[ "def", "cleanup", "(", "keep_latest", "=", "True", ")", ":", "removed", "=", "[", "]", "# Loop over all installed kernel packages", "for", "kernel", "in", "list_installed", "(", ")", ":", "# Keep the active kernel package", "if", "kernel", "==", "active", "(", ")"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
_cmp_version
Compare function for package version sorting
salt/modules/kernelpkg_linux_apt.py
def _cmp_version(item1, item2): ''' Compare function for package version sorting ''' vers1 = _LooseVersion(item1) vers2 = _LooseVersion(item2) if vers1 < vers2: return -1 if vers1 > vers2: return 1 return 0
def _cmp_version(item1, item2): ''' Compare function for package version sorting ''' vers1 = _LooseVersion(item1) vers2 = _LooseVersion(item2) if vers1 < vers2: return -1 if vers1 > vers2: return 1 return 0
[ "Compare", "function", "for", "package", "version", "sorting" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/modules/kernelpkg_linux_apt.py#L279-L290
[ "def", "_cmp_version", "(", "item1", ",", "item2", ")", ":", "vers1", "=", "_LooseVersion", "(", "item1", ")", "vers2", "=", "_LooseVersion", "(", "item2", ")", "if", "vers1", "<", "vers2", ":", "return", "-", "1", "if", "vers1", ">", "vers2", ":", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
string
Ensure that the key exists in redis with the value specified name Redis key to manage value Data to persist in key expire Sets time to live for key in seconds expireat Sets expiration time for key via UNIX timestamp, overrides `expire`
salt/states/redismod.py
def string(name, value, expire=None, expireat=None, **connection_args): ''' Ensure that the key exists in redis with the value specified name Redis key to manage value Data to persist in key expire Sets time to live for key in seconds expireat Sets expiration ...
def string(name, value, expire=None, expireat=None, **connection_args): ''' Ensure that the key exists in redis with the value specified name Redis key to manage value Data to persist in key expire Sets time to live for key in seconds expireat Sets expiration ...
[ "Ensure", "that", "the", "key", "exists", "in", "redis", "with", "the", "value", "specified" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/redismod.py#L46-L81
[ "def", "string", "(", "name", ",", "value", ",", "expire", "=", "None", ",", "expireat", "=", "None", ",", "*", "*", "connection_args", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
absent
Ensure key absent from redis name Key to ensure absent from redis keys list of keys to ensure absent, name will be ignored if this is used
salt/states/redismod.py
def absent(name, keys=None, **connection_args): ''' Ensure key absent from redis name Key to ensure absent from redis keys list of keys to ensure absent, name will be ignored if this is used ''' ret = {'name': name, 'changes': {}, 'result': True, ...
def absent(name, keys=None, **connection_args): ''' Ensure key absent from redis name Key to ensure absent from redis keys list of keys to ensure absent, name will be ignored if this is used ''' ret = {'name': name, 'changes': {}, 'result': True, ...
[ "Ensure", "key", "absent", "from", "redis" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/redismod.py#L84-L117
[ "def", "absent", "(", "name", ",", "keys", "=", "None", ",", "*", "*", "connection_args", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", "}", ",", "'result'", ":", "True", ",", "'comment'", ":", "'Key(s) specified already...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
slaveof
Set this redis instance as a slave. .. versionadded: 2016.3.0 name Master to make this a slave of sentinel_host Ip of the sentinel to check for the master sentinel_port Port of the sentinel to check for the master
salt/states/redismod.py
def slaveof(name, sentinel_host=None, sentinel_port=None, sentinel_password=None, **connection_args): ''' Set this redis instance as a slave. .. versionadded: 2016.3.0 name Master to make this a slave of sentinel_host Ip of the sentinel to check for the master sentinel_port ...
def slaveof(name, sentinel_host=None, sentinel_port=None, sentinel_password=None, **connection_args): ''' Set this redis instance as a slave. .. versionadded: 2016.3.0 name Master to make this a slave of sentinel_host Ip of the sentinel to check for the master sentinel_port ...
[ "Set", "this", "redis", "instance", "as", "a", "slave", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/states/redismod.py#L120-L173
[ "def", "slaveof", "(", "name", ",", "sentinel_host", "=", "None", ",", "sentinel_port", "=", "None", ",", "sentinel_password", "=", "None", ",", "*", "*", "connection_args", ")", ":", "ret", "=", "{", "'name'", ":", "name", ",", "'changes'", ":", "{", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
__main
This module can also be run directly for testing Args: detail|list : Provide ``detail`` or version ``list``. system|system+user: System installed and System and User installs.
salt/utils/pkg/win.py
def __main(): '''This module can also be run directly for testing Args: detail|list : Provide ``detail`` or version ``list``. system|system+user: System installed and System and User installs. ''' if len(sys.argv) < 3: sys.stderr.write('usage: {0} <detail|list> <syste...
def __main(): '''This module can also be run directly for testing Args: detail|list : Provide ``detail`` or version ``list``. system|system+user: System installed and System and User installs. ''' if len(sys.argv) < 3: sys.stderr.write('usage: {0} <detail|list> <syste...
[ "This", "module", "can", "also", "be", "run", "directly", "for", "testing", "Args", ":", "detail|list", ":", "Provide", "detail", "or", "version", "list", ".", "system|system", "+", "user", ":", "System", "installed", "and", "System", "and", "User", "install...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L1295-L1321
[ "def", "__main", "(", ")", ":", "if", "len", "(", "sys", ".", "argv", ")", "<", "3", ":", "sys", ".", "stderr", ".", "write", "(", "'usage: {0} <detail|list> <system|system+user>\\n'", ".", "format", "(", "sys", ".", "argv", "[", "0", "]", ")", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
RegSoftwareInfo.__squid_to_guid
Squished GUID (SQUID) to GUID. A SQUID is a Squished/Compressed version of a GUID to use up less space in the registry. Args: squid (str): Squished GUID. Returns: str: the GUID if a valid SQUID provided.
salt/utils/pkg/win.py
def __squid_to_guid(self, squid): ''' Squished GUID (SQUID) to GUID. A SQUID is a Squished/Compressed version of a GUID to use up less space in the registry. Args: squid (str): Squished GUID. Returns: str: the GUID if a valid SQUID provided. ...
def __squid_to_guid(self, squid): ''' Squished GUID (SQUID) to GUID. A SQUID is a Squished/Compressed version of a GUID to use up less space in the registry. Args: squid (str): Squished GUID. Returns: str: the GUID if a valid SQUID provided. ...
[ "Squished", "GUID", "(", "SQUID", ")", "to", "GUID", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L235-L261
[ "def", "__squid_to_guid", "(", "self", ",", "squid", ")", ":", "if", "not", "squid", ":", "return", "''", "squid_match", "=", "self", ".", "__squid_pattern", ".", "match", "(", "squid", ")", "guid", "=", "''", "if", "squid_match", "is", "not", "None", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
RegSoftwareInfo.__one_equals_true
Test for ``1`` as a number or a string and return ``True`` if it is. Args: value: string or number or None. Returns: bool: ``True`` if 1 otherwise ``False``.
salt/utils/pkg/win.py
def __one_equals_true(value): ''' Test for ``1`` as a number or a string and return ``True`` if it is. Args: value: string or number or None. Returns: bool: ``True`` if 1 otherwise ``False``. ''' if isinstance(value, six.integer_types) and value ...
def __one_equals_true(value): ''' Test for ``1`` as a number or a string and return ``True`` if it is. Args: value: string or number or None. Returns: bool: ``True`` if 1 otherwise ``False``. ''' if isinstance(value, six.integer_types) and value ...
[ "Test", "for", "1", "as", "a", "number", "or", "a", "string", "and", "return", "True", "if", "it", "is", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L264-L280
[ "def", "__one_equals_true", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "six", ".", "integer_types", ")", "and", "value", "==", "1", ":", "return", "True", "elif", "(", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
RegSoftwareInfo.__reg_query_value
Calls RegQueryValueEx If PY2 ensure unicode string and expand REG_EXPAND_SZ before returning Remember to catch not found exceptions when calling. Args: handle (object): open registry handle. value_name (str): Name of the value you wished returned Returns: ...
salt/utils/pkg/win.py
def __reg_query_value(handle, value_name): ''' Calls RegQueryValueEx If PY2 ensure unicode string and expand REG_EXPAND_SZ before returning Remember to catch not found exceptions when calling. Args: handle (object): open registry handle. value_name (str)...
def __reg_query_value(handle, value_name): ''' Calls RegQueryValueEx If PY2 ensure unicode string and expand REG_EXPAND_SZ before returning Remember to catch not found exceptions when calling. Args: handle (object): open registry handle. value_name (str)...
[ "Calls", "RegQueryValueEx" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L283-L308
[ "def", "__reg_query_value", "(", "handle", ",", "value_name", ")", ":", "# item_value, item_type = win32api.RegQueryValueEx(self.__reg_uninstall_handle, value_name)", "item_value", ",", "item_type", "=", "win32api", ".", "RegQueryValueEx", "(", "handle", ",", "value_name", ")...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
RegSoftwareInfo.install_time
Return the install time, or provide an estimate of install time. Installers or even self upgrading software must/should update the date held within InstallDate field when they change versions. Some installers do not set ``InstallDate`` at all so we use the last modified time on the regi...
salt/utils/pkg/win.py
def install_time(self): ''' Return the install time, or provide an estimate of install time. Installers or even self upgrading software must/should update the date held within InstallDate field when they change versions. Some installers do not set ``InstallDate`` at all so we us...
def install_time(self): ''' Return the install time, or provide an estimate of install time. Installers or even self upgrading software must/should update the date held within InstallDate field when they change versions. Some installers do not set ``InstallDate`` at all so we us...
[ "Return", "the", "install", "time", "or", "provide", "an", "estimate", "of", "install", "time", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L311-L341
[ "def", "install_time", "(", "self", ")", ":", "time1970", "=", "self", ".", "__mod_time1970", "# time of last resort", "try", ":", "# pylint: disable=no-member", "date_string", ",", "item_type", "=", "win32api", ".", "RegQueryValueEx", "(", "self", ".", "__reg_unins...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
RegSoftwareInfo.get_install_value
For the uninstall section of the registry return the name value. Args: value_name (str): Registry value name. wanted_type (str): The type of value wanted if the type does not match None is return. wanted_type support values are ``str`` ``i...
salt/utils/pkg/win.py
def get_install_value(self, value_name, wanted_type=None): ''' For the uninstall section of the registry return the name value. Args: value_name (str): Registry value name. wanted_type (str): The type of value wanted if the type does not match ...
def get_install_value(self, value_name, wanted_type=None): ''' For the uninstall section of the registry return the name value. Args: value_name (str): Registry value name. wanted_type (str): The type of value wanted if the type does not match ...
[ "For", "the", "uninstall", "section", "of", "the", "registry", "return", "the", "name", "value", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L343-L368
[ "def", "get_install_value", "(", "self", ",", "value_name", ",", "wanted_type", "=", "None", ")", ":", "try", ":", "item_value", ",", "item_type", "=", "self", ".", "__reg_query_value", "(", "self", ".", "__reg_uninstall_handle", ",", "value_name", ")", "excep...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
RegSoftwareInfo.get_product_value
For the product section of the registry return the name value. Args: value_name (str): Registry value name. wanted_type (str): The type of value wanted if the type does not match None is return. wanted_type support values are ``str`` ``int...
salt/utils/pkg/win.py
def get_product_value(self, value_name, wanted_type=None): ''' For the product section of the registry return the name value. Args: value_name (str): Registry value name. wanted_type (str): The type of value wanted if the type does not match ...
def get_product_value(self, value_name, wanted_type=None): ''' For the product section of the registry return the name value. Args: value_name (str): Registry value name. wanted_type (str): The type of value wanted if the type does not match ...
[ "For", "the", "product", "section", "of", "the", "registry", "return", "the", "name", "value", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L382-L420
[ "def", "get_product_value", "(", "self", ",", "value_name", ",", "wanted_type", "=", "None", ")", ":", "if", "not", "self", ".", "__reg_products_handle", ":", "return", "None", "subkey", ",", "search_value_name", "=", "os", ".", "path", ".", "split", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
RegSoftwareInfo.upgrade_code
For installers which follow the Microsoft Installer standard, returns the ``Upgrade code``. Returns: value (str): ``Upgrade code`` GUID for installed software.
salt/utils/pkg/win.py
def upgrade_code(self): ''' For installers which follow the Microsoft Installer standard, returns the ``Upgrade code``. Returns: value (str): ``Upgrade code`` GUID for installed software. ''' if not self.__squid: # Must have a valid squid for an u...
def upgrade_code(self): ''' For installers which follow the Microsoft Installer standard, returns the ``Upgrade code``. Returns: value (str): ``Upgrade code`` GUID for installed software. ''' if not self.__squid: # Must have a valid squid for an u...
[ "For", "installers", "which", "follow", "the", "Microsoft", "Installer", "standard", "returns", "the", "Upgrade", "code", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L423-L484
[ "def", "upgrade_code", "(", "self", ")", ":", "if", "not", "self", ".", "__squid", ":", "# Must have a valid squid for an upgrade code to exist", "return", "''", "# GUID/SQUID are unique, so it does not matter if they are 32bit or", "# 64bit or user install so all items are cached in...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
RegSoftwareInfo.list_patches
For installers which follow the Microsoft Installer standard, returns a list of patches applied. Returns: value (list): Long name of the patch.
salt/utils/pkg/win.py
def list_patches(self): ''' For installers which follow the Microsoft Installer standard, returns a list of patches applied. Returns: value (list): Long name of the patch. ''' if not self.__squid: # Must have a valid squid for an upgrade code to e...
def list_patches(self): ''' For installers which follow the Microsoft Installer standard, returns a list of patches applied. Returns: value (list): Long name of the patch. ''' if not self.__squid: # Must have a valid squid for an upgrade code to e...
[ "For", "installers", "which", "follow", "the", "Microsoft", "Installer", "standard", "returns", "a", "list", "of", "patches", "applied", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L487-L548
[ "def", "list_patches", "(", "self", ")", ":", "if", "not", "self", ".", "__squid", ":", "# Must have a valid squid for an upgrade code to exist", "return", "[", "]", "if", "self", ".", "__patch_list", "is", "None", ":", "# Read in the upgrade codes in this section of th...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
RegSoftwareInfo.version_binary
Return version number which is stored in binary format. Returns: str: <major 0-255>.<minior 0-255>.<build 0-65535> or None if not found
salt/utils/pkg/win.py
def version_binary(self): ''' Return version number which is stored in binary format. Returns: str: <major 0-255>.<minior 0-255>.<build 0-65535> or None if not found ''' # Under MSI 'Version' is a 'REG_DWORD' which then sets other registry # values like Displ...
def version_binary(self): ''' Return version number which is stored in binary format. Returns: str: <major 0-255>.<minior 0-255>.<build 0-65535> or None if not found ''' # Under MSI 'Version' is a 'REG_DWORD' which then sets other registry # values like Displ...
[ "Return", "version", "number", "which", "is", "stored", "in", "binary", "format", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L601-L643
[ "def", "version_binary", "(", "self", ")", ":", "# Under MSI 'Version' is a 'REG_DWORD' which then sets other registry", "# values like DisplayVersion to x.x.x to the same value.", "# However not everyone plays by the rules, so we need to check first.", "# version_binary_data will be None if the r...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
WinSoftware.pkg_version_list
Returns information on a package. Args: pkg_id (str): Package Id of the software/component. Returns: list: List of version numbers installed.
salt/utils/pkg/win.py
def pkg_version_list(self, pkg_id): ''' Returns information on a package. Args: pkg_id (str): Package Id of the software/component. Returns: list: List of version numbers installed. ''' pkg_data = self.__reg_software.get(pkg_id, None) if ...
def pkg_version_list(self, pkg_id): ''' Returns information on a package. Args: pkg_id (str): Package Id of the software/component. Returns: list: List of version numbers installed. ''' pkg_data = self.__reg_software.get(pkg_id, None) if ...
[ "Returns", "information", "on", "a", "package", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L803-L823
[ "def", "pkg_version_list", "(", "self", ",", "pkg_id", ")", ":", "pkg_data", "=", "self", ".", "__reg_software", ".", "get", "(", "pkg_id", ",", "None", ")", "if", "not", "pkg_data", ":", "return", "[", "]", "if", "isinstance", "(", "pkg_data", ",", "l...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
WinSoftware.__sid_to_username
Provided with a valid Windows Security Identifier (SID) and returns a Username Args: sid (str): Security Identifier (SID). Returns: str: Username in the format of username@realm or username@computer.
salt/utils/pkg/win.py
def __sid_to_username(sid): ''' Provided with a valid Windows Security Identifier (SID) and returns a Username Args: sid (str): Security Identifier (SID). Returns: str: Username in the format of username@realm or username@computer. ''' if sid is ...
def __sid_to_username(sid): ''' Provided with a valid Windows Security Identifier (SID) and returns a Username Args: sid (str): Security Identifier (SID). Returns: str: Username in the format of username@realm or username@computer. ''' if sid is ...
[ "Provided", "with", "a", "valid", "Windows", "Security", "Identifier", "(", "SID", ")", "and", "returns", "a", "Username" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L852-L902
[ "def", "__sid_to_username", "(", "sid", ")", ":", "if", "sid", "is", "None", "or", "sid", "==", "''", ":", "return", "''", "try", ":", "sid_bin", "=", "win32security", ".", "GetBinarySid", "(", "sid", ")", "# pylint: disable=no-member", "except", "pywintypes...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
WinSoftware.__software_to_pkg_id
Determine the Package ID of a software/component using the software/component ``publisher``, ``name``, whether its a software or a component, and if its 32bit or 64bit archiecture. Args: publisher (str): Publisher of the software/component. name (str): Name of the softwa...
salt/utils/pkg/win.py
def __software_to_pkg_id(self, publisher, name, is_component, is_32bit): ''' Determine the Package ID of a software/component using the software/component ``publisher``, ``name``, whether its a software or a component, and if its 32bit or 64bit archiecture. Args: pub...
def __software_to_pkg_id(self, publisher, name, is_component, is_32bit): ''' Determine the Package ID of a software/component using the software/component ``publisher``, ``name``, whether its a software or a component, and if its 32bit or 64bit archiecture. Args: pub...
[ "Determine", "the", "Package", "ID", "of", "a", "software", "/", "component", "using", "the", "software", "/", "component", "publisher", "name", "whether", "its", "a", "software", "or", "a", "component", "and", "if", "its", "32bit", "or", "64bit", "archiectu...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L904-L950
[ "def", "__software_to_pkg_id", "(", "self", ",", "publisher", ",", "name", ",", "is_component", ",", "is_32bit", ")", ":", "if", "publisher", ":", "# remove , and lowercase as , are used as list separators", "pub_lc", "=", "publisher", ".", "replace", "(", "','", ",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
WinSoftware.__version_capture_slp
This returns the version and where the version string came from, based on instructions under ``version_capture``, if ``version_capture`` is missing, it defaults to value of display-version. Args: pkg_id (str): Publisher of the software/component. version_binary (str): Na...
salt/utils/pkg/win.py
def __version_capture_slp(self, pkg_id, version_binary, version_display, display_name): ''' This returns the version and where the version string came from, based on instructions under ``version_capture``, if ``version_capture`` is missing, it defaults to value of display-version. ...
def __version_capture_slp(self, pkg_id, version_binary, version_display, display_name): ''' This returns the version and where the version string came from, based on instructions under ``version_capture``, if ``version_capture`` is missing, it defaults to value of display-version. ...
[ "This", "returns", "the", "version", "and", "where", "the", "version", "string", "came", "from", "based", "on", "instructions", "under", "version_capture", "if", "version_capture", "is", "missing", "it", "defaults", "to", "value", "of", "display", "-", "version"...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L952-L993
[ "def", "__version_capture_slp", "(", "self", ",", "pkg_id", ",", "version_binary", ",", "version_display", ",", "display_name", ")", ":", "if", "self", ".", "__pkg_obj", "and", "hasattr", "(", "self", ".", "__pkg_obj", ",", "'version_capture'", ")", ":", "vers...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
WinSoftware.__collect_software_info
Update data with the next software found
salt/utils/pkg/win.py
def __collect_software_info(self, sid, key_software, use_32bit): ''' Update data with the next software found ''' reg_soft_info = RegSoftwareInfo(key_software, sid, use_32bit) # Check if the registry entry is a valid. # a) Cannot manage software without at least a displ...
def __collect_software_info(self, sid, key_software, use_32bit): ''' Update data with the next software found ''' reg_soft_info = RegSoftwareInfo(key_software, sid, use_32bit) # Check if the registry entry is a valid. # a) Cannot manage software without at least a displ...
[ "Update", "data", "with", "the", "next", "software", "found" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L995-L1209
[ "def", "__collect_software_info", "(", "self", ",", "sid", ",", "key_software", ",", "use_32bit", ")", ":", "reg_soft_info", "=", "RegSoftwareInfo", "(", "key_software", ",", "sid", ",", "use_32bit", ")", "# Check if the registry entry is a valid.", "# a) Cannot manage ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
WinSoftware.__get_software_details
This searches the uninstall keys in the registry to find a match in the sub keys, it will return a dict with the display name as the key and the version as the value .. sectionauthor:: Damon Atkins <https://github.com/damon-atkins> .. versionadded:: Carbon
salt/utils/pkg/win.py
def __get_software_details(self, user_pkgs): ''' This searches the uninstall keys in the registry to find a match in the sub keys, it will return a dict with the display name as the key and the version as the value .. sectionauthor:: Damon Atkins <https://github.com/damon-atkins>...
def __get_software_details(self, user_pkgs): ''' This searches the uninstall keys in the registry to find a match in the sub keys, it will return a dict with the display name as the key and the version as the value .. sectionauthor:: Damon Atkins <https://github.com/damon-atkins>...
[ "This", "searches", "the", "uninstall", "keys", "in", "the", "registry", "to", "find", "a", "match", "in", "the", "sub", "keys", "it", "will", "return", "a", "dict", "with", "the", "display", "name", "as", "the", "key", "and", "the", "version", "as", "...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/pkg/win.py#L1211-L1292
[ "def", "__get_software_details", "(", "self", ",", "user_pkgs", ")", ":", "# FUNCTION MAIN CODE #", "# Search 64bit, on 64bit platform, on 32bit its ignored.", "if", "platform", ".", "architecture", "(", ")", "[", "0", "]", "==", "'32bit'", ":", "# Handle Python 32bit on ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
enforce_types
Force params to be strings unless they should remain a different type
salt/utils/gitfs.py
def enforce_types(key, val): ''' Force params to be strings unless they should remain a different type ''' non_string_params = { 'ssl_verify': bool, 'insecure_auth': bool, 'disable_saltenv_mapping': bool, 'env_whitelist': 'stringlist', 'env_blacklist': 'stringlist...
def enforce_types(key, val): ''' Force params to be strings unless they should remain a different type ''' non_string_params = { 'ssl_verify': bool, 'insecure_auth': bool, 'disable_saltenv_mapping': bool, 'env_whitelist': 'stringlist', 'env_blacklist': 'stringlist...
[ "Force", "params", "to", "be", "strings", "unless", "they", "should", "remain", "a", "different", "type" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L153-L204
[ "def", "enforce_types", "(", "key", ",", "val", ")", ":", "non_string_params", "=", "{", "'ssl_verify'", ":", "bool", ",", "'insecure_auth'", ":", "bool", ",", "'disable_saltenv_mapping'", ":", "bool", ",", "'env_whitelist'", ":", "'stringlist'", ",", "'env_blac...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider._get_envs_from_ref_paths
Return the names of remote refs (stripped of the remote name) and tags which are map to the branches and tags.
salt/utils/gitfs.py
def _get_envs_from_ref_paths(self, refs): ''' Return the names of remote refs (stripped of the remote name) and tags which are map to the branches and tags. ''' def _check_ref(env_set, rname): ''' Add the appropriate saltenv(s) to the set ''' ...
def _get_envs_from_ref_paths(self, refs): ''' Return the names of remote refs (stripped of the remote name) and tags which are map to the branches and tags. ''' def _check_ref(env_set, rname): ''' Add the appropriate saltenv(s) to the set ''' ...
[ "Return", "the", "names", "of", "remote", "refs", "(", "stripped", "of", "the", "remote", "name", ")", "and", "tags", "which", "are", "map", "to", "the", "branches", "and", "tags", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L467-L503
[ "def", "_get_envs_from_ref_paths", "(", "self", ",", "refs", ")", ":", "def", "_check_ref", "(", "env_set", ",", "rname", ")", ":", "'''\n Add the appropriate saltenv(s) to the set\n '''", "if", "rname", "in", "self", ".", "saltenv_revmap", ":", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider.add_conf_overlay
Programmatically determine config value based on the desired saltenv
salt/utils/gitfs.py
def add_conf_overlay(cls, name): ''' Programmatically determine config value based on the desired saltenv ''' def _getconf(self, tgt_env='base'): strip_sep = lambda x: x.rstrip(os.sep) \ if name in ('root', 'mountpoint') \ else x if...
def add_conf_overlay(cls, name): ''' Programmatically determine config value based on the desired saltenv ''' def _getconf(self, tgt_env='base'): strip_sep = lambda x: x.rstrip(os.sep) \ if name in ('root', 'mountpoint') \ else x if...
[ "Programmatically", "determine", "config", "value", "based", "on", "the", "desired", "saltenv" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L509-L570
[ "def", "add_conf_overlay", "(", "cls", ",", "name", ")", ":", "def", "_getconf", "(", "self", ",", "tgt_env", "=", "'base'", ")", ":", "strip_sep", "=", "lambda", "x", ":", "x", ".", "rstrip", "(", "os", ".", "sep", ")", "if", "name", "in", "(", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider.check_root
Check if the relative root path exists in the checked-out copy of the remote. Return the full path to that relative root if it does exist, otherwise return None.
salt/utils/gitfs.py
def check_root(self): ''' Check if the relative root path exists in the checked-out copy of the remote. Return the full path to that relative root if it does exist, otherwise return None. ''' # No need to pass an environment to self.root() here since per-saltenv #...
def check_root(self): ''' Check if the relative root path exists in the checked-out copy of the remote. Return the full path to that relative root if it does exist, otherwise return None. ''' # No need to pass an environment to self.root() here since per-saltenv #...
[ "Check", "if", "the", "relative", "root", "path", "exists", "in", "the", "checked", "-", "out", "copy", "of", "the", "remote", ".", "Return", "the", "full", "path", "to", "that", "relative", "root", "if", "it", "does", "exist", "otherwise", "return", "No...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L572-L588
[ "def", "check_root", "(", "self", ")", ":", "# No need to pass an environment to self.root() here since per-saltenv", "# configuration is a gitfs-only feature and check_root() is not used", "# for gitfs.", "root_dir", "=", "salt", ".", "utils", ".", "path", ".", "join", "(", "s...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider.clean_stale_refs
Remove stale refs so that they are no longer seen as fileserver envs
salt/utils/gitfs.py
def clean_stale_refs(self): ''' Remove stale refs so that they are no longer seen as fileserver envs ''' cleaned = [] cmd_str = 'git remote prune origin' # Attempt to force all output to plain ascii english, which is what some parsing code # may expect. #...
def clean_stale_refs(self): ''' Remove stale refs so that they are no longer seen as fileserver envs ''' cleaned = [] cmd_str = 'git remote prune origin' # Attempt to force all output to plain ascii english, which is what some parsing code # may expect. #...
[ "Remove", "stale", "refs", "so", "that", "they", "are", "no", "longer", "seen", "as", "fileserver", "envs" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L590-L631
[ "def", "clean_stale_refs", "(", "self", ")", ":", "cleaned", "=", "[", "]", "cmd_str", "=", "'git remote prune origin'", "# Attempt to force all output to plain ascii english, which is what some parsing code", "# may expect.", "# According to stackoverflow (http://goo.gl/l74GC8), we ar...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider.clear_lock
Clear update.lk
salt/utils/gitfs.py
def clear_lock(self, lock_type='update'): ''' Clear update.lk ''' lock_file = self._get_lock_file(lock_type=lock_type) def _add_error(errlist, exc): msg = ('Unable to remove update lock for {0} ({1}): {2} ' .format(self.url, lock_file, exc)) ...
def clear_lock(self, lock_type='update'): ''' Clear update.lk ''' lock_file = self._get_lock_file(lock_type=lock_type) def _add_error(errlist, exc): msg = ('Unable to remove update lock for {0} ({1}): {2} ' .format(self.url, lock_file, exc)) ...
[ "Clear", "update", ".", "lk" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L633-L672
[ "def", "clear_lock", "(", "self", ",", "lock_type", "=", "'update'", ")", ":", "lock_file", "=", "self", ".", "_get_lock_file", "(", "lock_type", "=", "lock_type", ")", "def", "_add_error", "(", "errlist", ",", "exc", ")", ":", "msg", "=", "(", "'Unable ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider.enforce_git_config
For the config options which need to be maintained in the git config, ensure that the git config file is configured as desired.
salt/utils/gitfs.py
def enforce_git_config(self): ''' For the config options which need to be maintained in the git config, ensure that the git config file is configured as desired. ''' git_config = os.path.join(self.gitdir, 'config') conf = salt.utils.configparser.GitConfigParser() ...
def enforce_git_config(self): ''' For the config options which need to be maintained in the git config, ensure that the git config file is configured as desired. ''' git_config = os.path.join(self.gitdir, 'config') conf = salt.utils.configparser.GitConfigParser() ...
[ "For", "the", "config", "options", "which", "need", "to", "be", "maintained", "in", "the", "git", "config", "ensure", "that", "the", "git", "config", "file", "is", "configured", "as", "desired", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L674-L762
[ "def", "enforce_git_config", "(", "self", ")", ":", "git_config", "=", "os", ".", "path", ".", "join", "(", "self", ".", "gitdir", ",", "'config'", ")", "conf", "=", "salt", ".", "utils", ".", "configparser", ".", "GitConfigParser", "(", ")", "if", "no...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider.fetch
Fetch the repo. If the local copy was updated, return True. If the local copy was already up-to-date, return False. This function requires that a _fetch() function be implemented in a sub-class.
salt/utils/gitfs.py
def fetch(self): ''' Fetch the repo. If the local copy was updated, return True. If the local copy was already up-to-date, return False. This function requires that a _fetch() function be implemented in a sub-class. ''' try: with self.gen_lock(lock_ty...
def fetch(self): ''' Fetch the repo. If the local copy was updated, return True. If the local copy was already up-to-date, return False. This function requires that a _fetch() function be implemented in a sub-class. ''' try: with self.gen_lock(lock_ty...
[ "Fetch", "the", "repo", ".", "If", "the", "local", "copy", "was", "updated", "return", "True", ".", "If", "the", "local", "copy", "was", "already", "up", "-", "to", "-", "date", "return", "False", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L764-L791
[ "def", "fetch", "(", "self", ")", ":", "try", ":", "with", "self", ".", "gen_lock", "(", "lock_type", "=", "'update'", ")", ":", "log", ".", "debug", "(", "'Fetching %s remote \\'%s\\''", ",", "self", ".", "role", ",", "self", ".", "id", ")", "# Run pr...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider._lock
Place a lock file if (and only if) it does not already exist.
salt/utils/gitfs.py
def _lock(self, lock_type='update', failhard=False): ''' Place a lock file if (and only if) it does not already exist. ''' try: fh_ = os.open(self._get_lock_file(lock_type), os.O_CREAT | os.O_EXCL | os.O_WRONLY) with os.fdopen(fh_, 'wb'):...
def _lock(self, lock_type='update', failhard=False): ''' Place a lock file if (and only if) it does not already exist. ''' try: fh_ = os.open(self._get_lock_file(lock_type), os.O_CREAT | os.O_EXCL | os.O_WRONLY) with os.fdopen(fh_, 'wb'):...
[ "Place", "a", "lock", "file", "if", "(", "and", "only", "if", ")", "it", "does", "not", "already", "exist", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L793-L872
[ "def", "_lock", "(", "self", ",", "lock_type", "=", "'update'", ",", "failhard", "=", "False", ")", ":", "try", ":", "fh_", "=", "os", ".", "open", "(", "self", ".", "_get_lock_file", "(", "lock_type", ")", ",", "os", ".", "O_CREAT", "|", "os", "."...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider.lock
Place an lock file and report on the success/failure. This is an interface to be used by the fileserver runner, so it is hard-coded to perform an update lock. We aren't using the gen_lock() contextmanager here because the lock is meant to stay and not be automatically removed.
salt/utils/gitfs.py
def lock(self): ''' Place an lock file and report on the success/failure. This is an interface to be used by the fileserver runner, so it is hard-coded to perform an update lock. We aren't using the gen_lock() contextmanager here because the lock is meant to stay and not be ...
def lock(self): ''' Place an lock file and report on the success/failure. This is an interface to be used by the fileserver runner, so it is hard-coded to perform an update lock. We aren't using the gen_lock() contextmanager here because the lock is meant to stay and not be ...
[ "Place", "an", "lock", "file", "and", "report", "on", "the", "success", "/", "failure", ".", "This", "is", "an", "interface", "to", "be", "used", "by", "the", "fileserver", "runner", "so", "it", "is", "hard", "-", "coded", "to", "perform", "an", "updat...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L874-L891
[ "def", "lock", "(", "self", ")", ":", "success", "=", "[", "]", "failed", "=", "[", "]", "try", ":", "result", "=", "self", ".", "_lock", "(", "lock_type", "=", "'update'", ")", "except", "GitLockError", "as", "exc", ":", "failed", ".", "append", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider.gen_lock
Set and automatically clear a lock
salt/utils/gitfs.py
def gen_lock(self, lock_type='update', timeout=0, poll_interval=0.5): ''' Set and automatically clear a lock ''' if not isinstance(lock_type, six.string_types): raise GitLockError( errno.EINVAL, 'Invalid lock_type \'{0}\''.format(lock_type) ...
def gen_lock(self, lock_type='update', timeout=0, poll_interval=0.5): ''' Set and automatically clear a lock ''' if not isinstance(lock_type, six.string_types): raise GitLockError( errno.EINVAL, 'Invalid lock_type \'{0}\''.format(lock_type) ...
[ "Set", "and", "automatically", "clear", "a", "lock" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L894-L945
[ "def", "gen_lock", "(", "self", ",", "lock_type", "=", "'update'", ",", "timeout", "=", "0", ",", "poll_interval", "=", "0.5", ")", ":", "if", "not", "isinstance", "(", "lock_type", ",", "six", ".", "string_types", ")", ":", "raise", "GitLockError", "(",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider.env_is_exposed
Check if an environment is exposed by comparing it against a whitelist and blacklist.
salt/utils/gitfs.py
def env_is_exposed(self, tgt_env): ''' Check if an environment is exposed by comparing it against a whitelist and blacklist. ''' return salt.utils.stringutils.check_whitelist_blacklist( tgt_env, whitelist=self.saltenv_whitelist, blacklist=self....
def env_is_exposed(self, tgt_env): ''' Check if an environment is exposed by comparing it against a whitelist and blacklist. ''' return salt.utils.stringutils.check_whitelist_blacklist( tgt_env, whitelist=self.saltenv_whitelist, blacklist=self....
[ "Check", "if", "an", "environment", "is", "exposed", "by", "comparing", "it", "against", "a", "whitelist", "and", "blacklist", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L965-L974
[ "def", "env_is_exposed", "(", "self", ",", "tgt_env", ")", ":", "return", "salt", ".", "utils", ".", "stringutils", ".", "check_whitelist_blacklist", "(", "tgt_env", ",", "whitelist", "=", "self", ".", "saltenv_whitelist", ",", "blacklist", "=", "self", ".", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider.get_checkout_target
Resolve dynamically-set branch
salt/utils/gitfs.py
def get_checkout_target(self): ''' Resolve dynamically-set branch ''' if self.role == 'git_pillar' and self.branch == '__env__': try: return self.all_saltenvs except AttributeError: # all_saltenvs not configured for this remote ...
def get_checkout_target(self): ''' Resolve dynamically-set branch ''' if self.role == 'git_pillar' and self.branch == '__env__': try: return self.all_saltenvs except AttributeError: # all_saltenvs not configured for this remote ...
[ "Resolve", "dynamically", "-", "set", "branch" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1001-L1017
[ "def", "get_checkout_target", "(", "self", ")", ":", "if", "self", ".", "role", "==", "'git_pillar'", "and", "self", ".", "branch", "==", "'__env__'", ":", "try", ":", "return", "self", ".", "all_saltenvs", "except", "AttributeError", ":", "# all_saltenvs not ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider.get_tree
Return a tree object for the specified environment
salt/utils/gitfs.py
def get_tree(self, tgt_env): ''' Return a tree object for the specified environment ''' if not self.env_is_exposed(tgt_env): return None tgt_ref = self.ref(tgt_env) if tgt_ref is None: return None for ref_type in self.ref_types: ...
def get_tree(self, tgt_env): ''' Return a tree object for the specified environment ''' if not self.env_is_exposed(tgt_env): return None tgt_ref = self.ref(tgt_env) if tgt_ref is None: return None for ref_type in self.ref_types: ...
[ "Return", "a", "tree", "object", "for", "the", "specified", "environment" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1019-L1045
[ "def", "get_tree", "(", "self", ",", "tgt_env", ")", ":", "if", "not", "self", ".", "env_is_exposed", "(", "tgt_env", ")", ":", "return", "None", "tgt_ref", "=", "self", ".", "ref", "(", "tgt_env", ")", "if", "tgt_ref", "is", "None", ":", "return", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider.get_url
Examine self.id and assign self.url (and self.branch, for git_pillar)
salt/utils/gitfs.py
def get_url(self): ''' Examine self.id and assign self.url (and self.branch, for git_pillar) ''' if self.role in ('git_pillar', 'winrepo'): # With winrepo and git_pillar, the remote is specified in the # format '<branch> <url>', so that we can get a unique identif...
def get_url(self): ''' Examine self.id and assign self.url (and self.branch, for git_pillar) ''' if self.role in ('git_pillar', 'winrepo'): # With winrepo and git_pillar, the remote is specified in the # format '<branch> <url>', so that we can get a unique identif...
[ "Examine", "self", ".", "id", "and", "assign", "self", ".", "url", "(", "and", "self", ".", "branch", "for", "git_pillar", ")" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1047-L1061
[ "def", "get_url", "(", "self", ")", ":", "if", "self", ".", "role", "in", "(", "'git_pillar'", ",", "'winrepo'", ")", ":", "# With winrepo and git_pillar, the remote is specified in the", "# format '<branch> <url>', so that we can get a unique identifier", "# to hash for each r...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitProvider.linkdir_walk
Return the expected result of an os.walk on the linkdir, based on the mountpoint value.
salt/utils/gitfs.py
def linkdir_walk(self): ''' Return the expected result of an os.walk on the linkdir, based on the mountpoint value. ''' try: # Use cached linkdir_walk if we've already run this return self._linkdir_walk except AttributeError: self._link...
def linkdir_walk(self): ''' Return the expected result of an os.walk on the linkdir, based on the mountpoint value. ''' try: # Use cached linkdir_walk if we've already run this return self._linkdir_walk except AttributeError: self._link...
[ "Return", "the", "expected", "result", "of", "an", "os", ".", "walk", "on", "the", "linkdir", "based", "on", "the", "mountpoint", "value", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1064-L1097
[ "def", "linkdir_walk", "(", "self", ")", ":", "try", ":", "# Use cached linkdir_walk if we've already run this", "return", "self", ".", "_linkdir_walk", "except", "AttributeError", ":", "self", ".", "_linkdir_walk", "=", "[", "]", "try", ":", "parts", "=", "self",...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitPython.checkout
Checkout the configured branch/tag. We catch an "Exception" class here instead of a specific exception class because the exceptions raised by GitPython when running these functions vary in different versions of GitPython.
salt/utils/gitfs.py
def checkout(self): ''' Checkout the configured branch/tag. We catch an "Exception" class here instead of a specific exception class because the exceptions raised by GitPython when running these functions vary in different versions of GitPython. ''' tgt_ref = self...
def checkout(self): ''' Checkout the configured branch/tag. We catch an "Exception" class here instead of a specific exception class because the exceptions raised by GitPython when running these functions vary in different versions of GitPython. ''' tgt_ref = self...
[ "Checkout", "the", "configured", "branch", "/", "tag", ".", "We", "catch", "an", "Exception", "class", "here", "instead", "of", "a", "specific", "exception", "class", "because", "the", "exceptions", "raised", "by", "GitPython", "when", "running", "these", "fun...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1131-L1196
[ "def", "checkout", "(", "self", ")", ":", "tgt_ref", "=", "self", ".", "get_checkout_target", "(", ")", "try", ":", "head_sha", "=", "self", ".", "repo", ".", "rev_parse", "(", "'HEAD'", ")", ".", "hexsha", "except", "Exception", ":", "# Should only happen...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitPython.init_remote
Initialize/attach to a remote using GitPython. Return a boolean which will let the calling function know whether or not a new repo was initialized by this function.
salt/utils/gitfs.py
def init_remote(self): ''' Initialize/attach to a remote using GitPython. Return a boolean which will let the calling function know whether or not a new repo was initialized by this function. ''' new = False if not os.listdir(self.cachedir): # Repo cac...
def init_remote(self): ''' Initialize/attach to a remote using GitPython. Return a boolean which will let the calling function know whether or not a new repo was initialized by this function. ''' new = False if not os.listdir(self.cachedir): # Repo cac...
[ "Initialize", "/", "attach", "to", "a", "remote", "using", "GitPython", ".", "Return", "a", "boolean", "which", "will", "let", "the", "calling", "function", "know", "whether", "or", "not", "a", "new", "repo", "was", "initialized", "by", "this", "function", ...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1198-L1220
[ "def", "init_remote", "(", "self", ")", ":", "new", "=", "False", "if", "not", "os", ".", "listdir", "(", "self", ".", "cachedir", ")", ":", "# Repo cachedir is empty, initialize a new repo there", "self", ".", "repo", "=", "git", ".", "Repo", ".", "init", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitPython.dir_list
Get list of directories for the target environment using GitPython
salt/utils/gitfs.py
def dir_list(self, tgt_env): ''' Get list of directories for the target environment using GitPython ''' ret = set() tree = self.get_tree(tgt_env) if not tree: return ret if self.root(tgt_env): try: tree = tree / self.root(tg...
def dir_list(self, tgt_env): ''' Get list of directories for the target environment using GitPython ''' ret = set() tree = self.get_tree(tgt_env) if not tree: return ret if self.root(tgt_env): try: tree = tree / self.root(tg...
[ "Get", "list", "of", "directories", "for", "the", "target", "environment", "using", "GitPython" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1222-L1245
[ "def", "dir_list", "(", "self", ",", "tgt_env", ")", ":", "ret", "=", "set", "(", ")", "tree", "=", "self", ".", "get_tree", "(", "tgt_env", ")", "if", "not", "tree", ":", "return", "ret", "if", "self", ".", "root", "(", "tgt_env", ")", ":", "try...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitPython.envs
Check the refs and return a list of the ones which can be used as salt environments.
salt/utils/gitfs.py
def envs(self): ''' Check the refs and return a list of the ones which can be used as salt environments. ''' ref_paths = [x.path for x in self.repo.refs] return self._get_envs_from_ref_paths(ref_paths)
def envs(self): ''' Check the refs and return a list of the ones which can be used as salt environments. ''' ref_paths = [x.path for x in self.repo.refs] return self._get_envs_from_ref_paths(ref_paths)
[ "Check", "the", "refs", "and", "return", "a", "list", "of", "the", "ones", "which", "can", "be", "used", "as", "salt", "environments", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1247-L1253
[ "def", "envs", "(", "self", ")", ":", "ref_paths", "=", "[", "x", ".", "path", "for", "x", "in", "self", ".", "repo", ".", "refs", "]", "return", "self", ".", "_get_envs_from_ref_paths", "(", "ref_paths", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitPython._fetch
Fetch the repo. If the local copy was updated, return True. If the local copy was already up-to-date, return False.
salt/utils/gitfs.py
def _fetch(self): ''' Fetch the repo. If the local copy was updated, return True. If the local copy was already up-to-date, return False. ''' origin = self.repo.remotes[0] try: fetch_results = origin.fetch() except AssertionError: fetch_res...
def _fetch(self): ''' Fetch the repo. If the local copy was updated, return True. If the local copy was already up-to-date, return False. ''' origin = self.repo.remotes[0] try: fetch_results = origin.fetch() except AssertionError: fetch_res...
[ "Fetch", "the", "repo", ".", "If", "the", "local", "copy", "was", "updated", "return", "True", ".", "If", "the", "local", "copy", "was", "already", "up", "-", "to", "-", "date", "return", "False", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1255-L1291
[ "def", "_fetch", "(", "self", ")", ":", "origin", "=", "self", ".", "repo", ".", "remotes", "[", "0", "]", "try", ":", "fetch_results", "=", "origin", ".", "fetch", "(", ")", "except", "AssertionError", ":", "fetch_results", "=", "origin", ".", "fetch"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitPython.file_list
Get file list for the target environment using GitPython
salt/utils/gitfs.py
def file_list(self, tgt_env): ''' Get file list for the target environment using GitPython ''' files = set() symlinks = {} tree = self.get_tree(tgt_env) if not tree: # Not found, return empty objects return files, symlinks if self.r...
def file_list(self, tgt_env): ''' Get file list for the target environment using GitPython ''' files = set() symlinks = {} tree = self.get_tree(tgt_env) if not tree: # Not found, return empty objects return files, symlinks if self.r...
[ "Get", "file", "list", "for", "the", "target", "environment", "using", "GitPython" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1293-L1325
[ "def", "file_list", "(", "self", ",", "tgt_env", ")", ":", "files", "=", "set", "(", ")", "symlinks", "=", "{", "}", "tree", "=", "self", ".", "get_tree", "(", "tgt_env", ")", "if", "not", "tree", ":", "# Not found, return empty objects", "return", "file...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitPython.find_file
Find the specified file in the specified environment
salt/utils/gitfs.py
def find_file(self, path, tgt_env): ''' Find the specified file in the specified environment ''' tree = self.get_tree(tgt_env) if not tree: # Branch/tag/SHA not found in repo return None, None, None blob = None depth = 0 while True:...
def find_file(self, path, tgt_env): ''' Find the specified file in the specified environment ''' tree = self.get_tree(tgt_env) if not tree: # Branch/tag/SHA not found in repo return None, None, None blob = None depth = 0 while True:...
[ "Find", "the", "specified", "file", "in", "the", "specified", "environment" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1327-L1368
[ "def", "find_file", "(", "self", ",", "path", ",", "tgt_env", ")", ":", "tree", "=", "self", ".", "get_tree", "(", "tgt_env", ")", "if", "not", "tree", ":", "# Branch/tag/SHA not found in repo", "return", "None", ",", "None", ",", "None", "blob", "=", "N...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitPython.get_tree_from_branch
Return a git.Tree object matching a head ref fetched into refs/remotes/origin/
salt/utils/gitfs.py
def get_tree_from_branch(self, ref): ''' Return a git.Tree object matching a head ref fetched into refs/remotes/origin/ ''' try: return git.RemoteReference( self.repo, 'refs/remotes/origin/{0}'.format(ref)).commit.tree except Va...
def get_tree_from_branch(self, ref): ''' Return a git.Tree object matching a head ref fetched into refs/remotes/origin/ ''' try: return git.RemoteReference( self.repo, 'refs/remotes/origin/{0}'.format(ref)).commit.tree except Va...
[ "Return", "a", "git", ".", "Tree", "object", "matching", "a", "head", "ref", "fetched", "into", "refs", "/", "remotes", "/", "origin", "/" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1370-L1380
[ "def", "get_tree_from_branch", "(", "self", ",", "ref", ")", ":", "try", ":", "return", "git", ".", "RemoteReference", "(", "self", ".", "repo", ",", "'refs/remotes/origin/{0}'", ".", "format", "(", "ref", ")", ")", ".", "commit", ".", "tree", "except", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitPython.get_tree_from_tag
Return a git.Tree object matching a tag ref fetched into refs/tags/
salt/utils/gitfs.py
def get_tree_from_tag(self, ref): ''' Return a git.Tree object matching a tag ref fetched into refs/tags/ ''' try: return git.TagReference( self.repo, 'refs/tags/{0}'.format(ref)).commit.tree except ValueError: return None
def get_tree_from_tag(self, ref): ''' Return a git.Tree object matching a tag ref fetched into refs/tags/ ''' try: return git.TagReference( self.repo, 'refs/tags/{0}'.format(ref)).commit.tree except ValueError: return None
[ "Return", "a", "git", ".", "Tree", "object", "matching", "a", "tag", "ref", "fetched", "into", "refs", "/", "tags", "/" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1382-L1391
[ "def", "get_tree_from_tag", "(", "self", ",", "ref", ")", ":", "try", ":", "return", "git", ".", "TagReference", "(", "self", ".", "repo", ",", "'refs/tags/{0}'", ".", "format", "(", "ref", ")", ")", ".", "commit", ".", "tree", "except", "ValueError", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitPython.get_tree_from_sha
Return a git.Tree object matching a SHA
salt/utils/gitfs.py
def get_tree_from_sha(self, ref): ''' Return a git.Tree object matching a SHA ''' try: return self.repo.rev_parse(ref).tree except (gitdb.exc.ODBError, AttributeError): return None
def get_tree_from_sha(self, ref): ''' Return a git.Tree object matching a SHA ''' try: return self.repo.rev_parse(ref).tree except (gitdb.exc.ODBError, AttributeError): return None
[ "Return", "a", "git", ".", "Tree", "object", "matching", "a", "SHA" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1393-L1400
[ "def", "get_tree_from_sha", "(", "self", ",", "ref", ")", ":", "try", ":", "return", "self", ".", "repo", ".", "rev_parse", "(", "ref", ")", ".", "tree", "except", "(", "gitdb", ".", "exc", ".", "ODBError", ",", "AttributeError", ")", ":", "return", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
GitPython.write_file
Using the blob object, write the file to the destination path
salt/utils/gitfs.py
def write_file(self, blob, dest): ''' Using the blob object, write the file to the destination path ''' with salt.utils.files.fopen(dest, 'wb+') as fp_: blob.stream_data(fp_)
def write_file(self, blob, dest): ''' Using the blob object, write the file to the destination path ''' with salt.utils.files.fopen(dest, 'wb+') as fp_: blob.stream_data(fp_)
[ "Using", "the", "blob", "object", "write", "the", "file", "to", "the", "destination", "path" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1402-L1407
[ "def", "write_file", "(", "self", ",", "blob", ",", "dest", ")", ":", "with", "salt", ".", "utils", ".", "files", ".", "fopen", "(", "dest", ",", "'wb+'", ")", "as", "fp_", ":", "blob", ".", "stream_data", "(", "fp_", ")" ]
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Pygit2.checkout
Checkout the configured branch/tag
salt/utils/gitfs.py
def checkout(self): ''' Checkout the configured branch/tag ''' tgt_ref = self.get_checkout_target() local_ref = 'refs/heads/' + tgt_ref remote_ref = 'refs/remotes/origin/' + tgt_ref tag_ref = 'refs/tags/' + tgt_ref try: local_head = self.repo....
def checkout(self): ''' Checkout the configured branch/tag ''' tgt_ref = self.get_checkout_target() local_ref = 'refs/heads/' + tgt_ref remote_ref = 'refs/remotes/origin/' + tgt_ref tag_ref = 'refs/tags/' + tgt_ref try: local_head = self.repo....
[ "Checkout", "the", "configured", "branch", "/", "tag" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1435-L1617
[ "def", "checkout", "(", "self", ")", ":", "tgt_ref", "=", "self", ".", "get_checkout_target", "(", ")", "local_ref", "=", "'refs/heads/'", "+", "tgt_ref", "remote_ref", "=", "'refs/remotes/origin/'", "+", "tgt_ref", "tag_ref", "=", "'refs/tags/'", "+", "tgt_ref"...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Pygit2.clean_stale_refs
Clean stale local refs so they don't appear as fileserver environments
salt/utils/gitfs.py
def clean_stale_refs(self, local_refs=None): # pylint: disable=arguments-differ ''' Clean stale local refs so they don't appear as fileserver environments ''' try: if pygit2.GIT_FETCH_PRUNE: # Don't need to clean anything, pygit2 can do it by itself ...
def clean_stale_refs(self, local_refs=None): # pylint: disable=arguments-differ ''' Clean stale local refs so they don't appear as fileserver environments ''' try: if pygit2.GIT_FETCH_PRUNE: # Don't need to clean anything, pygit2 can do it by itself ...
[ "Clean", "stale", "local", "refs", "so", "they", "don", "t", "appear", "as", "fileserver", "environments" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1619-L1638
[ "def", "clean_stale_refs", "(", "self", ",", "local_refs", "=", "None", ")", ":", "# pylint: disable=arguments-differ", "try", ":", "if", "pygit2", ".", "GIT_FETCH_PRUNE", ":", "# Don't need to clean anything, pygit2 can do it by itself", "return", "[", "]", "except", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Pygit2.init_remote
Initialize/attach to a remote using pygit2. Return a boolean which will let the calling function know whether or not a new repo was initialized by this function.
salt/utils/gitfs.py
def init_remote(self): ''' Initialize/attach to a remote using pygit2. Return a boolean which will let the calling function know whether or not a new repo was initialized by this function. ''' # https://github.com/libgit2/pygit2/issues/339 # https://github.com/lib...
def init_remote(self): ''' Initialize/attach to a remote using pygit2. Return a boolean which will let the calling function know whether or not a new repo was initialized by this function. ''' # https://github.com/libgit2/pygit2/issues/339 # https://github.com/lib...
[ "Initialize", "/", "attach", "to", "a", "remote", "using", "pygit2", ".", "Return", "a", "boolean", "which", "will", "let", "the", "calling", "function", "know", "whether", "or", "not", "a", "new", "repo", "was", "initialized", "by", "this", "function", "....
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1640-L1666
[ "def", "init_remote", "(", "self", ")", ":", "# https://github.com/libgit2/pygit2/issues/339", "# https://github.com/libgit2/libgit2/issues/2122", "home", "=", "os", ".", "path", ".", "expanduser", "(", "'~'", ")", "pygit2", ".", "settings", ".", "search_path", "[", "...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Pygit2.dir_list
Get a list of directories for the target environment using pygit2
salt/utils/gitfs.py
def dir_list(self, tgt_env): ''' Get a list of directories for the target environment using pygit2 ''' def _traverse(tree, blobs, prefix): ''' Traverse through a pygit2 Tree object recursively, accumulating all the empty directories within it in the "b...
def dir_list(self, tgt_env): ''' Get a list of directories for the target environment using pygit2 ''' def _traverse(tree, blobs, prefix): ''' Traverse through a pygit2 Tree object recursively, accumulating all the empty directories within it in the "b...
[ "Get", "a", "list", "of", "directories", "for", "the", "target", "environment", "using", "pygit2" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1668-L1717
[ "def", "dir_list", "(", "self", ",", "tgt_env", ")", ":", "def", "_traverse", "(", "tree", ",", "blobs", ",", "prefix", ")", ":", "'''\n Traverse through a pygit2 Tree object recursively, accumulating all\n the empty directories within it in the \"blobs\" li...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Pygit2._fetch
Fetch the repo. If the local copy was updated, return True. If the local copy was already up-to-date, return False.
salt/utils/gitfs.py
def _fetch(self): ''' Fetch the repo. If the local copy was updated, return True. If the local copy was already up-to-date, return False. ''' origin = self.repo.remotes[0] refs_pre = self.repo.listall_references() fetch_kwargs = {} # pygit2 radically chang...
def _fetch(self): ''' Fetch the repo. If the local copy was updated, return True. If the local copy was already up-to-date, return False. ''' origin = self.repo.remotes[0] refs_pre = self.repo.listall_references() fetch_kwargs = {} # pygit2 radically chang...
[ "Fetch", "the", "repo", ".", "If", "the", "local", "copy", "was", "updated", "return", "True", ".", "If", "the", "local", "copy", "was", "already", "up", "-", "to", "-", "date", "return", "False", "." ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1727-L1790
[ "def", "_fetch", "(", "self", ")", ":", "origin", "=", "self", ".", "repo", ".", "remotes", "[", "0", "]", "refs_pre", "=", "self", ".", "repo", ".", "listall_references", "(", ")", "fetch_kwargs", "=", "{", "}", "# pygit2 radically changed fetchiing in 0.23...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Pygit2.file_list
Get file list for the target environment using pygit2
salt/utils/gitfs.py
def file_list(self, tgt_env): ''' Get file list for the target environment using pygit2 ''' def _traverse(tree, blobs, prefix): ''' Traverse through a pygit2 Tree object recursively, accumulating all the file paths and symlink info in the "blobs" dict ...
def file_list(self, tgt_env): ''' Get file list for the target environment using pygit2 ''' def _traverse(tree, blobs, prefix): ''' Traverse through a pygit2 Tree object recursively, accumulating all the file paths and symlink info in the "blobs" dict ...
[ "Get", "file", "list", "for", "the", "target", "environment", "using", "pygit2" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1792-L1847
[ "def", "file_list", "(", "self", ",", "tgt_env", ")", ":", "def", "_traverse", "(", "tree", ",", "blobs", ",", "prefix", ")", ":", "'''\n Traverse through a pygit2 Tree object recursively, accumulating all\n the file paths and symlink info in the \"blobs\" d...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Pygit2.find_file
Find the specified file in the specified environment
salt/utils/gitfs.py
def find_file(self, path, tgt_env): ''' Find the specified file in the specified environment ''' tree = self.get_tree(tgt_env) if not tree: # Branch/tag/SHA not found in repo return None, None, None blob = None mode = None depth = 0...
def find_file(self, path, tgt_env): ''' Find the specified file in the specified environment ''' tree = self.get_tree(tgt_env) if not tree: # Branch/tag/SHA not found in repo return None, None, None blob = None mode = None depth = 0...
[ "Find", "the", "specified", "file", "in", "the", "specified", "environment" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1849-L1887
[ "def", "find_file", "(", "self", ",", "path", ",", "tgt_env", ")", ":", "tree", "=", "self", ".", "get_tree", "(", "tgt_env", ")", "if", "not", "tree", ":", "# Branch/tag/SHA not found in repo", "return", "None", ",", "None", ",", "None", "blob", "=", "N...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Pygit2.get_tree_from_branch
Return a pygit2.Tree object matching a head ref fetched into refs/remotes/origin/
salt/utils/gitfs.py
def get_tree_from_branch(self, ref): ''' Return a pygit2.Tree object matching a head ref fetched into refs/remotes/origin/ ''' try: return self.peel(self.repo.lookup_reference( 'refs/remotes/origin/{0}'.format(ref))).tree except KeyError: ...
def get_tree_from_branch(self, ref): ''' Return a pygit2.Tree object matching a head ref fetched into refs/remotes/origin/ ''' try: return self.peel(self.repo.lookup_reference( 'refs/remotes/origin/{0}'.format(ref))).tree except KeyError: ...
[ "Return", "a", "pygit2", ".", "Tree", "object", "matching", "a", "head", "ref", "fetched", "into", "refs", "/", "remotes", "/", "origin", "/" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1889-L1898
[ "def", "get_tree_from_branch", "(", "self", ",", "ref", ")", ":", "try", ":", "return", "self", ".", "peel", "(", "self", ".", "repo", ".", "lookup_reference", "(", "'refs/remotes/origin/{0}'", ".", "format", "(", "ref", ")", ")", ")", ".", "tree", "exce...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Pygit2.get_tree_from_sha
Return a pygit2.Tree object matching a SHA
salt/utils/gitfs.py
def get_tree_from_sha(self, ref): ''' Return a pygit2.Tree object matching a SHA ''' try: return self.repo.revparse_single(ref).tree except (KeyError, TypeError, ValueError, AttributeError): return None
def get_tree_from_sha(self, ref): ''' Return a pygit2.Tree object matching a SHA ''' try: return self.repo.revparse_single(ref).tree except (KeyError, TypeError, ValueError, AttributeError): return None
[ "Return", "a", "pygit2", ".", "Tree", "object", "matching", "a", "SHA" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1910-L1917
[ "def", "get_tree_from_sha", "(", "self", ",", "ref", ")", ":", "try", ":", "return", "self", ".", "repo", ".", "revparse_single", "(", "ref", ")", ".", "tree", "except", "(", "KeyError", ",", "TypeError", ",", "ValueError", ",", "AttributeError", ")", ":...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Pygit2.setup_callbacks
Assign attributes for pygit2 callbacks
salt/utils/gitfs.py
def setup_callbacks(self): ''' Assign attributes for pygit2 callbacks ''' if PYGIT2_VERSION >= _LooseVersion('0.23.2'): self.remotecallbacks = pygit2.RemoteCallbacks( credentials=self.credentials) if not self.ssl_verify: # Override ...
def setup_callbacks(self): ''' Assign attributes for pygit2 callbacks ''' if PYGIT2_VERSION >= _LooseVersion('0.23.2'): self.remotecallbacks = pygit2.RemoteCallbacks( credentials=self.credentials) if not self.ssl_verify: # Override ...
[ "Assign", "attributes", "for", "pygit2", "callbacks" ]
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1919-L1940
[ "def", "setup_callbacks", "(", "self", ")", ":", "if", "PYGIT2_VERSION", ">=", "_LooseVersion", "(", "'0.23.2'", ")", ":", "self", ".", "remotecallbacks", "=", "pygit2", ".", "RemoteCallbacks", "(", "credentials", "=", "self", ".", "credentials", ")", "if", ...
e8541fd6e744ab0df786c0f76102e41631f45d46
train
Pygit2.verify_auth
Check the username and password/keypair info for validity. If valid, set a 'credentials' attribute consisting of the appropriate Pygit2 credentials object. Return False if a required auth param is not present. Return True if the required auth parameters are present (or auth is not config...
salt/utils/gitfs.py
def verify_auth(self): ''' Check the username and password/keypair info for validity. If valid, set a 'credentials' attribute consisting of the appropriate Pygit2 credentials object. Return False if a required auth param is not present. Return True if the required auth parameters...
def verify_auth(self): ''' Check the username and password/keypair info for validity. If valid, set a 'credentials' attribute consisting of the appropriate Pygit2 credentials object. Return False if a required auth param is not present. Return True if the required auth parameters...
[ "Check", "the", "username", "and", "password", "/", "keypair", "info", "for", "validity", ".", "If", "valid", "set", "a", "credentials", "attribute", "consisting", "of", "the", "appropriate", "Pygit2", "credentials", "object", ".", "Return", "False", "if", "a"...
saltstack/salt
python
https://github.com/saltstack/salt/blob/e8541fd6e744ab0df786c0f76102e41631f45d46/salt/utils/gitfs.py#L1942-L2063
[ "def", "verify_auth", "(", "self", ")", ":", "self", ".", "credentials", "=", "None", "if", "os", ".", "path", ".", "isabs", "(", "self", ".", "url", ")", ":", "# If the URL is an absolute file path, there is no authentication.", "return", "True", "elif", "not",...
e8541fd6e744ab0df786c0f76102e41631f45d46