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

Cdat web plot subsetting #1951

Merged
merged 16 commits into from Jun 22, 2016

Conversation

Projects
None yet
3 participants
@doutriaux1
Member

doutriaux1 commented Apr 26, 2016

@danlipsa this is the rest of your PR that you merged before I got a chance to push it. Please review.

slicelist.append(key)
elif key is unspecified or key is None or key == ':':
slicelist.append (slice(0, len(self.getAxis(i))))
elif key is Ellipsis:
raise CDMSError, "Misuse of ellipsis in specification."
elif type(key) is types.TupleType:
elif sinstance(key, tuple):

This comment has been minimized.

@danlipsa

danlipsa Apr 27, 2016

Contributor

isinstance is misspeled here. Would flake8 catch this?

This comment has been minimized.

@doutriaux1

doutriaux1 Apr 27, 2016

Member

yep i need to run flake8 on this.

@@ -549,12 +546,12 @@ def matchone(self, pattern, attname):
"""
if attname is None:
for attval in self.attributes.values():
if type(attval) is types.StringType and pattern.match(attval) is not None:
if isinstance(attval,basestring) and pattern.search(attval) is not None:

This comment has been minimized.

@danlipsa

danlipsa Apr 27, 2016

Contributor

This has a different behavior: match vs search. Not sure what the correct behavior is.

This comment has been minimized.

@doutriaux1

doutriaux1 Apr 27, 2016

Member

oops copy/pasting too much! Nice catch!

return 1
return 0
elif self.attributes.has_key(attname):
attval = self.attributes[attname]
return (type(attval) is types.StringType and pattern.match(attval) is not None)
return isinstance(attval,basestring) and pattern.search(attval) is not None

This comment has been minimized.

@danlipsa

danlipsa Apr 27, 2016

Contributor

Same here.

@@ -205,7 +203,7 @@ def __del__(self):
def normalizedn(self, dn):
explodeddn = ldap.explode_dn(dn)
return string.join(explodeddn,',')
return ','.join(explodeddn)

This comment has been minimized.

@danlipsa

danlipsa Apr 27, 2016

Contributor

This reverses the order of parameters compared with original.

This comment has been minimized.

@doutriaux1

doutriaux1 Apr 27, 2016

Member

i dont think so:

>>> string.join(["A","B"],"-")
'A-B'
>>> "-".join(["A","B"])
'A-B'
@@ -239,7 +237,7 @@ def getObjFromDataset(self, dn):
# Get the parent dataset
explodeddn = ldap.explode_dn(dn)
dsetdn = string.join(explodeddn[1:],',') # Dataset node is parent of variable
dsetdn = ','.join(explodeddn[1:]) # Dataset node is parent of variable

This comment has been minimized.

@danlipsa

danlipsa Apr 27, 2016

Contributor

Same here.

This comment has been minimized.

@doutriaux1

doutriaux1 Apr 27, 2016

Member

same here 😉

@@ -143,7 +143,7 @@ def showdim(self):
for nd in range(self.rank()):
result.append('** Dimension ' + str(nd+1) + ' **')
result = result + self.getAxis(nd).listall(1)
print string.join(result, '\n')
print '\n'.join(result)

This comment has been minimized.

@danlipsa

danlipsa Apr 27, 2016

Contributor

Reverses order.

This comment has been minimized.

@doutriaux1
@@ -179,7 +179,7 @@ def listall (self, all=None):
def info(self, flag=None, device=None):
"Write info about slab; include dimension values and weights if flag"
if device is None: device = sys.stdout
device.write(string.join(self.listall(all=flag), "\n"))
device.write('\n'.join(self.listall(all=flag)))

This comment has been minimized.

@danlipsa

danlipsa Apr 27, 2016

Contributor

reverses order

This comment has been minimized.

@doutriaux1

doutriaux1 Apr 27, 2016

Member

still nope

@@ -426,7 +424,7 @@ def disambig(name, dict, num, comparator, value):
uniqname = '%s_%d'%(name,num)
if dict.has_key(uniqname) and comparator(value, dict[uniqname]):
trial_name = uniqname
for letter in string.lowercase:
for letter in 'abcdefghijklmnopqrstuvwxyz':

This comment has been minimized.

@danlipsa

danlipsa Apr 27, 2016

Contributor

There is a string.ascii_lowercase

This comment has been minimized.

@doutriaux1

doutriaux1 Apr 27, 2016

Member

yes but I do not want to use the string module

@@ -1523,8 +1514,8 @@ def orderparse (order):
elif r == '...':
r = Ellipsis
elif len(r) == 1:
if r in string.digits:
r = string.atoi(r)
if r in '0123456789':

This comment has been minimized.

@danlipsa

danlipsa Apr 27, 2016

Contributor

Use r.isdigit()

@danlipsa

This comment has been minimized.

Contributor

danlipsa commented Apr 27, 2016

@doutriaux1 Nice cleanup! See my comments. @aashish24 Please review.

@danlipsa

This comment has been minimized.

Contributor

danlipsa commented Apr 27, 2016

@doutriaux1 What about the comments where I said it reverses the order. I don't think that happens actually, but rather it uses the default separator: ' ' rather than \n or ,

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Apr 27, 2016

@danlipsa I commented on this, it doesn't reverse the order, look at my sample code in my comments.

In [1]: import string

In [2]: string.join(["A","B"],"-")
Out[2]: 'A-B'

In [3]: "-".join(["A","B"])
Out[3]: 'A-B'
@danlipsa

This comment has been minimized.

Contributor

danlipsa commented Apr 28, 2016

@doutriaux1 I see. Confusing syntax for the join in statement 3! You would expect a member function of an object to be applied to the object, so the result would be - A B. Another possible interpretation is that we use "-" just to select between unicode and ascii so the result in that case is A B with the default separator. I like the syntax in 2 a lot better.

@danlipsa

This comment has been minimized.

Contributor

danlipsa commented May 2, 2016

@doutriaux1 LGTM. 👍

@aashish24

This comment has been minimized.

Contributor

aashish24 commented May 19, 2016

@doutriaux1 looks like we need to update the branch to resolve the conflict.

@aashish24

This comment has been minimized.

Contributor

aashish24 commented May 26, 2016

@doutriaux1 @danlipsa should we update this branch and merge it?

@aashish24

This comment has been minimized.

Contributor

aashish24 commented Jun 22, 2016

@doutriaux1 @danlipsa same here. I believe we all did LGTM. Any hold on this branch?

@doutriaux1 doutriaux1 merged commit d5537f6 into master Jun 22, 2016

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details

@doutriaux1 doutriaux1 deleted the cdat-web-plot-subsetting branch Jun 22, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment