Fix numerous flake8 warnings

This commit is contained in:
Jaisen Mathai 2016-06-24 00:31:58 -04:00
parent 1ad3d16da6
commit cb38bf5176
5 changed files with 18 additions and 33 deletions

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash
flake8 elodie --exclude=tests && nosetests -w elodie/tests
flake8 elodie --exclude=tests,external && nosetests -w elodie/tests

View File

@ -15,10 +15,6 @@ from elodie.dependencies import get_exiftool
from elodie.external.pyexiftool import ExifTool
from elodie.media.base import Base
import os
import re
import subprocess
class Media(Base):
@ -92,12 +88,16 @@ class Media(Base):
for key in self.latitude_keys + self.longitude_keys:
# TODO: verify that we need to check ref key
# when self.set_gps_ref != True
if type == 'latitude' and key in self.latitude_keys and key in exif:
if self.latitude_ref_key in exif and exif[self.latitude_ref_key] == 'S': #noqa
if type == 'latitude' and key in self.latitude_keys and \
key in exif:
if self.latitude_ref_key in exif and \
exif[self.latitude_ref_key] == 'S':
direction_multiplier = -1
return exif[key] * direction_multiplier
elif type == 'longitude' and key in self.longitude_keys and key in exif: #noqa
if self.longitude_ref_key in exif and exif[self.longitude_ref_key] == 'W': #noqa
elif type == 'longitude' and key in self.longitude_keys and \
key in exif:
if self.longitude_ref_key in exif and \
exif[self.longitude_ref_key] == 'W':
direction_multiplier = -1
return exif[key] * direction_multiplier
@ -170,8 +170,6 @@ class Media(Base):
if(time is None):
return False
source = self.source
tags = {}
formatted_time = time.strftime('%Y:%m:%d %H:%M:%S')
for key in self.exif_map['date_taken']:
@ -185,8 +183,6 @@ class Media(Base):
if(not self.is_valid()):
return None
source = self.source
# The lat/lon _keys array has an order of precedence.
# The first key is writable and we will give the writable
# key precence when reading.
@ -222,8 +218,6 @@ class Media(Base):
if(title is None):
return None
source = self.source
tags = {self.title_key: title}
status = self.__set_tags(tags)
self.reset_cache()

View File

@ -15,8 +15,6 @@ from re import compile
from elodie import constants
from elodie import geolocation
from elodie.external.pyexiftool import ExifTool
from media import Media
@ -80,7 +78,7 @@ class Photo(Media):
# We need to parse a string from EXIF into a timestamp.
# EXIF DateTimeOriginal and EXIF DateTime are both stored
# in %Y:%m:%d %H:%M:%S format
# we use split on a space and then r':|-' -> convert to int -> .timetuple()
# we split on a space and then r':|-' -> convert to int -> .timetuple()
# the conversion in the local timezone
# EXIF DateTime is already stored as a timestamp
# Sourced from https://github.com/photo/frontend/blob/master/src/libraries/models/Photo.php#L500 # noqa

View File

@ -7,19 +7,12 @@ objects (AVI, MOV, etc.).
# load modules
from distutils.spawn import find_executable
import tempfile
from datetime import datetime
import os
import re
import shutil
import subprocess
import time
from elodie import constants
from elodie import plist_parser
from elodie.dependencies import get_exiftool
from media import Base
from media import Media