Skip to content

Commit c7dcd06

Browse files
committed
fix lint warnings
1 parent 693ff3f commit c7dcd06

File tree

11 files changed

+52
-39
lines changed

11 files changed

+52
-39
lines changed

doc_src/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@
184184
# Grouping the document tree into LaTeX files. List of tuples
185185
# (source start file, target name, title, author, documentclass [howto/manual]).
186186
latex_documents = [
187-
('index', 'app.tex', u'geocamLensWeb Documentation',
188-
u'Trey Smith', 'manual'),
187+
('index', 'app.tex', u'geocamLensWeb Documentation',
188+
u'Trey Smith', 'manual'),
189189
]
190190

191191
# The name of an image file (relative to this directory) to place at the top of

example/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
TEMPLATE_LOADERS = (
7878
'django.template.loaders.filesystem.load_template_source',
7979
'django.template.loaders.app_directories.load_template_source',
80-
# 'django.template.loaders.eggs.load_template_source',
80+
# 'django.template.loaders.eggs.load_template_source',
8181
)
8282

8383
MIDDLEWARE_CLASSES = (

example/urls.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
from django.contrib import admin
1212
admin.autodiscover()
1313

14-
urlpatterns = patterns('',
14+
urlpatterns = patterns(
15+
'',
16+
1517
# Example:
1618
# (r'^example/', include('example.foo.urls')),
1719

@@ -24,9 +26,11 @@
2426

2527
)
2628

27-
urlpatterns = urlpatterns + patterns('',
29+
urlpatterns = urlpatterns + patterns(
30+
'',
31+
2832
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
2933
{'document_root': settings.MEDIA_ROOT}),
30-
# (r'^data/(?P<path>.*)$', 'django.views.static.serve',
31-
# {'document_root': settings.DATA_ROOT}),
32-
)
34+
# (r'^data/(?P<path>.*)$', 'django.views.static.serve',
35+
# {'document_root': settings.DATA_ROOT}),
36+
)

geocamLens/SearchAbstract.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class BadQuery(Exception):
1515
pass
1616

1717

18-
class SearchAbstract:
18+
class SearchAbstract(object):
1919
# override these settings in derived classes
2020
getAllFeatures = None
2121
fields = ()
@@ -51,14 +51,14 @@ def filterFieldAfter(self, query, clause, field, term, negated):
5151
return Q(**{self.timeField + '__gte': utcDT})
5252

5353
def filterFieldDefault(self, query, clause, field, term, negated):
54-
if field == None:
54+
if field is None:
5555
fields = self.flookup.keys()
5656
elif field not in self.flookup:
5757
raise BadQuery("Oops, can't understand field name '%s' of search '%s'. Legal field names are: %s."
5858
% (field, query, ', '.join(self.flookup.keys())))
5959
else:
6060
fields = [field]
61-
if not re.search('^[\.\-\_a-zA-Z0-9]*$', term):
61+
if not re.search(r'^[\.\-\_a-zA-Z0-9]*$', term):
6262
raise BadQuery("Oops, can't understand term '%s' in search '%s'. Terms must contain only letters, numbers, periods, hyphens, and underscores."
6363
% (term, query))
6464
if term == '':
@@ -103,7 +103,7 @@ def queryTreeToString(self, queryTree):
103103
for term in queryTree]))
104104

105105
def parseQuery(self, query):
106-
if not re.search('^[\-\.\:\_a-zA-Z0-9 ]*$', query):
106+
if not re.search(r'^[\-\.\:\_a-zA-Z0-9 ]*$', query):
107107
raise BadQuery("Oops, can't understand search '%s'. Searches must contain only letters, numbers, minus signs, colons, periods, underscores, and spaces."
108108
% query)
109109
queryClauses = query.split()

geocamLens/UploadClient.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
from geocamUtil import MimeMultipartFormData
1616

17+
# pylint: disable=C1001
18+
1719

1820
class UploadClient:
1921
def __init__(self, url, userName='root', password=''):
@@ -80,7 +82,7 @@ def uploadImage(self, imageName, attributes, downsampleFactor=1):
8082
def uploadTrack(self, url, trackName, attributes=None):
8183
trackData = file(trackName, 'r').read()
8284

83-
if attributes == None:
85+
if attributes is None:
8486
attributes = dict(trackUploadProtocolVersion='1.0')
8587

8688
#cookieProcessor = urllib2.HTTPCookieProcessor()

geocamLens/ViewKml.py

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
from geocamLens.models import GoogleEarthSession
1616
from geocamLens import settings
1717

18+
# pylint: disable=C1001
19+
1820
CACHED_CSS = None
1921

2022

geocamLens/ViewLensAbstract.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def getFeaturesGeoJson(self, request):
6666
numFeatures = int(numFeaturesParam)
6767
else:
6868
numFeatures = settings.GEOCAM_LENS_DEFAULT_NUM_FEATURES
69-
if numFeatures != None:
69+
if numFeatures is not None:
7070
matches = matches[:numFeatures]
7171

7272
if errorMessage:

geocamLens/bin/simpleImport.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def doit(opts, importDirs):
168168
if opts.secure:
169169
opts.upload = True
170170
assert opts.url
171-
if opts.password == None:
171+
if opts.password is None:
172172
opts.password = getpass.getpass('password for %s at %s: ' % (opts.user, opts.url))
173173
if opts.upload:
174174
opts.url = opts.url.rstrip('/')

geocamLens/forms.py

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
from geocamLens.models import Photo
1414

15+
# pylint: disable=R0924,E1101,C1001
16+
1517

1618
# the field names in this form are currently retained for backward compatibility with old versions
1719
# of GeoCam Mobile

geocamLens/models.py

+26-23
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737

3838
from geocamLens import settings
3939

40+
# pylint: disable=C1001,E1101
41+
4042
TIME_ZONES = None
4143
TOP_TIME_ZONES = ['US/Pacific', 'US/Eastern', 'US/Central', 'US/Mountain']
4244
TIME_ZONES = TOP_TIME_ZONES + [tz for tz in pytz.common_timezones
@@ -84,7 +86,7 @@
8486
(STATUS_ACTIVE, 'active'),
8587
# deleted but not purged yet
8688
(STATUS_DELETED, 'deleted'),
87-
)
89+
)
8890

8991
WF_NEEDS_EDITS = 0
9092
WF_SUBMITTED_FOR_VALIDATION = 1
@@ -95,7 +97,7 @@
9597
(WF_SUBMITTED_FOR_VALIDATION, 'Submitted for validation'),
9698
(WF_VALID, 'Valid'),
9799
(WF_REJECTED, 'Rejected'),
98-
)
100+
)
99101
DEFAULT_WORKFLOW_STATUS = WF_SUBMITTED_FOR_VALIDATION
100102

101103
CARDINAL_DIRECTIONS = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE',
@@ -176,7 +178,7 @@ def getThumbnailPath(self, width):
176178

177179
def calcThumbSize(self, fullWidth, fullHeight, maxOutWidth,
178180
maxOutHeight=None):
179-
if maxOutHeight == None:
181+
if maxOutHeight is None:
180182
maxOutHeight = (maxOutWidth * 3) // 4
181183
if float(maxOutWidth) / fullWidth < float(maxOutHeight) / fullHeight:
182184
thumbWidth = maxOutWidth
@@ -233,7 +235,7 @@ def galleryThumb(self):
233235
% (w0, h0, self.getThumbnailUrl(w0), w, h))
234236

235237
def getRotatedIconDict(self):
236-
if self.yaw == None:
238+
if self.yaw is None:
237239
return self.getStyledIconDict()
238240
rot = self.yaw
239241
rotRounded = 10 * int(0.1 * rot + 0.5)
@@ -275,10 +277,11 @@ def getBalloonHtml(self, request):
275277
border="0"
276278
/>
277279
</a>
278-
""" % dict(viewerUrl=viewerUrl,
279-
thumbnailUrl=thumbnailUrl,
280-
dw=dw,
281-
dh=dh))
280+
""" %
281+
dict(viewerUrl=viewerUrl,
282+
thumbnailUrl=thumbnailUrl,
283+
dw=dw,
284+
dh=dh))
282285
else:
283286
result.append("""
284287
<div><a href="%(viewerUrl)s">Show detail view</a></div>
@@ -304,16 +307,16 @@ def getUploadImageFormVals(self, formData):
304307
folderMatches = Folder.objects.filter(name=folderName)
305308
if folderMatches:
306309
folder = folderMatches[0]
307-
if folder == None:
310+
if folder is None:
308311
folder = Folder.objects.get(id=1)
309312

310313
tzone = pytz.timezone(settings.TIME_ZONE)
311314
timestampStr = Xmp.checkMissing(formData.get('cameraTime', None))
312-
if timestampStr == None:
315+
if timestampStr is None:
313316
timestampUtc = None
314317
else:
315318
timestampLocal = parseUploadTime(timestampStr)
316-
if timestampLocal.tzinfo == None:
319+
if timestampLocal.tzinfo is None:
317320
timestampLocal = tzone.localize(timestampLocal)
318321
timestampUtc = (timestampLocal
319322
.astimezone(pytz.utc)
@@ -340,7 +343,7 @@ def getUploadImageFormVals(self, formData):
340343
yaw=yaw,
341344
yawRef=yawRef)
342345
formVals = dict([(k, v) for k, v in formVals0.iteritems()
343-
if Xmp.checkMissing(v) != None])
346+
if Xmp.checkMissing(v) is not None])
344347
return formVals
345348

346349
@staticmethod
@@ -371,7 +374,7 @@ def processVals(self, vals):
371374

372375
# find any '#foo' hashtags in notes and add them to the tags field
373376
if 'notes' in vals:
374-
for hashtag in re.finditer('\#([\w0-9_]+)', vals['notes']):
377+
for hashtag in re.finditer(r'\#([\w0-9_]+)', vals['notes']):
375378
tagsList.append(hashtag.group(1))
376379
vals['tags'] = self.makeTagsString(tagsList)
377380

@@ -384,15 +387,15 @@ def processVals(self, vals):
384387
def getImportVals(self, storePath=None, uploadImageFormData=None):
385388
vals = {'icon': settings.GEOCAM_LENS_DEFAULT_ICON}
386389

387-
if storePath != None:
390+
if storePath is not None:
388391
xmpVals = self.getXmpVals(storePath)
389392
print >> sys.stderr, 'getImportVals: exif/xmp data:', xmpVals
390393
vals.update(xmpVals)
391394

392-
if uploadImageFormData != None:
395+
if uploadImageFormData is not None:
393396
formVals = self.getUploadImageFormVals(uploadImageFormData)
394397
print >> sys.stderr, 'getImportVals: UploadImageForm data:', \
395-
formVals
398+
formVals
396399
vals.update(formVals)
397400

398401
self.processVals(vals)
@@ -455,7 +458,7 @@ def getCaptionTimeZone(self):
455458
return pytz.timezone(settings.DEFAULT_TIME_ZONE['code'])
456459

457460
def getCaptionTimeStamp(self):
458-
if self.timestamp == None:
461+
if self.timestamp is None:
459462
return '(unknown)'
460463
else:
461464
tzone = self.getCaptionTimeZone()
@@ -467,20 +470,20 @@ def getCaptionTimeStamp(self):
467470
return '%s %s' % (str(localizedDt), tzName)
468471

469472
def getCaptionFieldLatLon(self):
470-
if self.latitude == None:
473+
if self.latitude is None:
471474
val = '(unknown)'
472475
else:
473476
val = '%.5f, %.5f' % (self.latitude, self.longitude)
474477
return ['lat, lon', val]
475478

476479
def getCaptionFieldHeading(self):
477-
if self.yaw == None:
480+
if self.yaw is None:
478481
val = '(unknown)'
479482
else:
480483
dirIndex = int(round(self.yaw / 22.5)) % 16
481484
cardinal = CARDINAL_DIRECTIONS[dirIndex]
482485

483-
if self.yawRef == None:
486+
if self.yawRef is None:
484487
yawStr = 'unknown'
485488
else:
486489
yawStr = YAW_REF_LOOKUP[self.yawRef]
@@ -490,7 +493,7 @@ def getCaptionFieldHeading(self):
490493
return ['heading', val]
491494

492495
def getCaptionFieldTime(self):
493-
if self.timestamp == None:
496+
if self.timestamp is None:
494497
val = '(unknown)'
495498
else:
496499
val = self.getCaptionTimeStamp()
@@ -504,13 +507,13 @@ def getCaptionFields(self):
504507
return ['latLon', 'heading', 'time']
505508

506509
def getCaptionHeader(self):
507-
if self.timestamp == None:
510+
if self.timestamp is None:
508511
tsVal = '(unknown)'
509512
else:
510513
tsVal = (TimeUtil
511514
.getTimeShort(self.timestamp,
512515
tz=self.getCaptionTimeZone()))
513-
if self.name == None:
516+
if self.name is None:
514517
nameVal = '(untitled)'
515518
else:
516519
nameVal = self.name

geocamLens/urls.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@
4747
# Mobile *if* user authentication is off (not recommended!).
4848
(r'^upload/(?P<userName>[^/]+)/$', views.uploadImage),
4949

50-
)
50+
)

0 commit comments

Comments
 (0)