Skip to content

Update uses of map() to use list/set comprehensions instead #142

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2018
Merged

Update uses of map() to use list/set comprehensions instead #142

merged 1 commit into from
Jan 5, 2018

Conversation

jdufresne
Copy link
Member

Updates style to modern Python idioms.

@codecov
Copy link

codecov bot commented Dec 19, 2017

Codecov Report

Merging #142 into master will decrease coverage by <.01%.
The diff coverage is 75%.

@@            Coverage Diff             @@
##           master     #142      +/-   ##
==========================================
- Coverage   69.35%   69.34%   -0.01%     
==========================================
  Files          49       49              
  Lines        4708     4707       -1     
  Branches      800      808       +8     
==========================================
- Hits         3265     3264       -1     
  Misses       1088     1088              
  Partials      355      355
Impacted Files Coverage Δ
Lib/ldap/controls/deref.py 57.14% <ø> (ø) ⬆️
Lib/ldap/filter.py 65.62% <0%> (ø) ⬆️
Lib/ldapurl.py 78.1% <0%> (ø) ⬆️
Lib/ldap/functions.py 75.55% <100%> (-0.54%) ⬇️
Lib/ldap/modlist.py 84.61% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 98c535b...3ae51ed. Read the comment docs.

@@ -108,7 +108,7 @@ def decodeControlValue(self,encodedControlValue):
for deref_res in decodedValue:
deref_attr,deref_val,deref_vals = deref_res[0],deref_res[1],deref_res[2]
partial_attrs_dict = {
str(tv[0]): map(str,tv[1])
str(tv[0]): [str(v) for v in tv[1]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Python 2, list comprehensions leak the internal variable. Therefore I prefer list() for list comprehensions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's OK to use comprehensions with one-letter variable names.
No need to change this.

Copy link
Member

@encukou encukou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Let's put this in 3.1.

@encukou encukou added this to the 3.1 milestone Dec 20, 2017
@encukou
Copy link
Member

encukou commented Jan 5, 2018

3.0 will need another change, so let's include this one in 3.0 as well.

Updates style to modern Python idioms.
@encukou encukou merged commit 3ae51ed into python-ldap:master Jan 5, 2018
@jdufresne jdufresne deleted the map-to-comprehension branch March 30, 2018 12:51
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.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy