Skip to content

Commit

Permalink
Add top-level docstrings to a bunch of salt.utils modules which are m…
Browse files Browse the repository at this point in the history
…issing them
  • Loading branch information
terminalmage committed Oct 16, 2017
1 parent 413de95 commit 473fbb1
Show file tree
Hide file tree
Showing 29 changed files with 100 additions and 21 deletions.
13 changes: 9 additions & 4 deletions salt/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# DEPRECATED FUNCTIONS
#
# These are not referenced anywhere in the codebase and are slated for removal.
#
def option(value, default='', opts=None, pillar=None):
'''
Pass in a generic option and receive the value that will be assigned
Expand Down Expand Up @@ -110,15 +111,18 @@ def required_modules_error(name, docstring):
#
# MOVED FUNCTIONS
#
# These are deprecated and will be removed in Neon.
# These functions have been moved to new locations. The functions below are
# convenience functions which will allow the old function locations to continue
# to work. The convenience functions will be removed in the Neon release.
#
def get_accumulator_dir(cachedir):
# Late import to avoid circular import.
import salt.utils.versions
import salt.state
salt.utils.versions.warn_until(
'Neon',
'Use of \'salt.utils.get_accumulator_dir\' detected. This function '
'has been moved to \'salt.state.accumulator_dir\' as of '
'has been moved to \'salt.state.get_accumulator_dir\' as of '
'Salt Oxygen. This warning will be removed in Salt Neon.'
)
return salt.state.get_accumulator_dir(cachedir)
Expand Down Expand Up @@ -1648,8 +1652,9 @@ def get_values_of_matching_keys(pattern_dict, user_name):
salt.utils.versions.warn_until(
'Neon',
'Use of \'salt.utils.get_values_of_matching_keys\' detected. '
'This function has been moved to \'salt.utils.master.get_master_key\' '
'as of Salt Oxygen. This warning will be removed in Salt Neon.'
'This function has been moved to '
'\'salt.utils.master.get_values_of_matching_keys\' as of Salt Oxygen. '
'This warning will be removed in Salt Neon.'
)
return salt.utils.master.get_values_of_matching_keys(pattern_dict, user_name)

Expand Down
3 changes: 3 additions & 0 deletions salt/utils/cache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
In-memory caching used by Salt
'''
# Import Python libs
from __future__ import absolute_import, print_function
import os
Expand Down
4 changes: 2 additions & 2 deletions salt/utils/configcomparer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
"""
'''
Utilities for comparing and updating configurations while keeping track of
changes in a way that can be easily reported in a state.
"""
'''

# Import Python libs
from __future__ import absolute_import
Expand Down
3 changes: 3 additions & 0 deletions salt/utils/configparser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
Custom configparser classes
'''
# Import Python libs
from __future__ import absolute_import
import re
Expand Down
3 changes: 3 additions & 0 deletions salt/utils/crypt.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
Functions dealing with encryption
'''

from __future__ import absolute_import

Expand Down
4 changes: 4 additions & 0 deletions salt/utils/data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-
'''
Functions for manipulating, inspecting, or otherwise working with data types
and data structures.
'''

from __future__ import absolute_import

Expand Down
3 changes: 3 additions & 0 deletions salt/utils/dateutils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
Convenience functions for dealing with datetime classes
'''

from __future__ import absolute_import, division

Expand Down
5 changes: 4 additions & 1 deletion salt/utils/decorators/signature.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-

'''
A decorator which returns a function with the same signature of the function
which is being wrapped.
'''
# Import Python libs
from __future__ import absolute_import
import inspect
Expand Down
4 changes: 4 additions & 0 deletions salt/utils/doc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-
'''
Functions for analyzing/parsing docstrings
'''

from __future__ import absolute_import
import re
from salt.ext import six
Expand Down
3 changes: 3 additions & 0 deletions salt/utils/files.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
Functions for working with files
'''

from __future__ import absolute_import

Expand Down
6 changes: 3 additions & 3 deletions salt/utils/fsutils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 SUSE LLC

'''
Run-time utilities
'''
#
# Copyright (C) 2014 SUSE LLC


# Import Python libs
from __future__ import absolute_import
Expand Down
3 changes: 3 additions & 0 deletions salt/utils/functools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
Utility functions to modify other functions
'''

from __future__ import absolute_import

Expand Down
3 changes: 3 additions & 0 deletions salt/utils/gitfs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
Classes which provide the shared base for GitFS, git_pillar, and winrepo
'''

# Import python libs
from __future__ import absolute_import
Expand Down
4 changes: 4 additions & 0 deletions salt/utils/jid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-
'''
Functions for creating and working with job IDs
'''

from __future__ import absolute_import
from __future__ import print_function

Expand Down
3 changes: 3 additions & 0 deletions salt/utils/job.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
Functions for interacting with the job cache
'''

# Import Python libs
from __future__ import absolute_import
Expand Down
3 changes: 3 additions & 0 deletions salt/utils/json.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
Functions to work with JSON
'''

from __future__ import absolute_import

Expand Down
3 changes: 3 additions & 0 deletions salt/utils/lazy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
Lazily-evaluated data structures, primarily used by Salt's loader
'''

# Import Python Libs
from __future__ import absolute_import
Expand Down
3 changes: 3 additions & 0 deletions salt/utils/mako.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
Functions for working with Mako templates
'''
from __future__ import absolute_import

# Import python libs
Expand Down
4 changes: 2 additions & 2 deletions salt/utils/oset.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
"""
'''
Available at repository https://github.com/LuminosoInsight/ordered-set
Expand All @@ -20,7 +20,7 @@
- index() just returns the index of an item
- added a __getstate__ and __setstate__ so it can be pickled
- added __getitem__
"""
'''
from __future__ import absolute_import
import collections

Expand Down
3 changes: 3 additions & 0 deletions salt/utils/process.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
Functions for daemonizing and otherwise modifying running processes
'''

# Import python libs
from __future__ import absolute_import, with_statement
Expand Down
3 changes: 3 additions & 0 deletions salt/utils/profile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
Decorator and functions to profile Salt using cProfile
'''

from __future__ import absolute_import

Expand Down
4 changes: 4 additions & 0 deletions salt/utils/reactor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-
'''
Functions which implement running reactor jobs
'''


# Import python libs
from __future__ import absolute_import
Expand Down
3 changes: 3 additions & 0 deletions salt/utils/stringutils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
Functions for manipulating or otherwise processing strings
'''

# Import Python libs
from __future__ import absolute_import, print_function
Expand Down
4 changes: 3 additions & 1 deletion salt/utils/timed_subprocess.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
'''For running command line executables with a timeout'''
'''
For running command line executables with a timeout
'''
from __future__ import absolute_import

import shlex
Expand Down
12 changes: 5 additions & 7 deletions salt/utils/timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@

log = logging.getLogger(__name__)

# To give us some leeway when making time-calculations
BLUR_FACTOR = 0.95
"""
To give us some leeway when making time-calculations
"""


def wait_for(func, timeout=10, step=1, default=None, func_args=(), func_kwargs=None):
"""
Call `func` at regular intervals and Waits until the given function returns a truthy value
within the given timeout and returns that value.
'''
Call `func` at regular intervals and Waits until the given function returns
a truthy value within the given timeout and returns that value.
@param func:
@type func: function
Expand All @@ -29,7 +27,7 @@ def wait_for(func, timeout=10, step=1, default=None, func_args=(), func_kwargs=N
@param func_kwargs: **kwargs for `func`
@type func_kwargs: dict
@return: `default` or result of `func`
"""
'''
if func_kwargs is None:
func_kwargs = dict()
max_time = time.time() + timeout
Expand Down
4 changes: 4 additions & 0 deletions salt/utils/user.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-
'''
Functions for querying and modifying a user account and the groups to which it
belongs.
'''

from __future__ import absolute_import

Expand Down
3 changes: 3 additions & 0 deletions salt/utils/yamlencoding.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# -*- coding: utf-8 -*-
'''
Functions for adding yaml encoding to the jinja context
'''

# Import Python libs
from __future__ import absolute_import
Expand Down
4 changes: 4 additions & 0 deletions salt/utils/yamlloader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# -*- coding: utf-8 -*-
'''
Custom YAML loading in Salt
'''

# Import python libs
from __future__ import absolute_import
import warnings
Expand Down
4 changes: 3 additions & 1 deletion salt/utils/zeromq.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-

'''
ZMQ-specific functions
'''
# Import Python libs
from __future__ import absolute_import

Expand Down

0 comments on commit 473fbb1

Please sign in to comment.