Skip to content

Avoid deprecation warning from portage.dep.strip_empty() - #23834

Merged
jfindlay merged 2 commits into
saltstack:developfrom
Arabus:develop
May 18, 2015
Merged

jfindlay merged 2 commits into
saltstack:developfrom
Arabus:develop

Conversation

@Arabus

@Arabus Arabus commented May 17, 2015

Copy link
Copy Markdown
Contributor

Switch portage.dep.strip_empty(...) to list comprehension to avoid deprecation warning and do essentially the same according to docs:

def strip_empty(myarr):
        """
        Strip all empty elements from an array

        @param myarr: The list of elements
        @type myarr: List
        @rtype: Array
        @return: The array with empty elements removed
        """
        warnings.warn(_("%s is deprecated and will be removed without replacement.") % \
                ('portage.dep.strip_empty',), DeprecationWarning, stacklevel=2)
        return [x for x in myarr if x]

Unfortunately I do not have the time at hand to write a test for this.

Regards,

jfindlay added a commit that referenced this pull request May 18, 2015
Avoid deprecation warning from  portage.dep.strip_empty()
@jfindlay
jfindlay merged commit 41f315b into saltstack:develop May 18, 2015
@jfindlay

Copy link
Copy Markdown
Contributor

@Arabus, thanks for the fix. In the future, please feel free to submit fixes directly to the oldest supported release branch as they are regularly merged forward, see https://docs.saltstack.com/en/latest/topics/development/contributing.html#which-salt-branch.

@Arabus

Arabus commented May 18, 2015

Copy link
Copy Markdown
Contributor Author

Hey, no problem, I'll keep that in mind for future requests :-)

thatch45 added a commit that referenced this pull request May 19, 2015
backport #23834, change portage.dep.strip_empty to list comprehension
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants