Fix numerous flake8 warnings
This commit is contained in:
parent
1ad3d16da6
commit
cb38bf5176
|
@ -1,3 +1,3 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
flake8 elodie --exclude=tests && nosetests -w elodie/tests
|
flake8 elodie --exclude=tests,external && nosetests -w elodie/tests
|
||||||
|
|
|
@ -15,10 +15,6 @@ from elodie.dependencies import get_exiftool
|
||||||
from elodie.external.pyexiftool import ExifTool
|
from elodie.external.pyexiftool import ExifTool
|
||||||
from elodie.media.base import Base
|
from elodie.media.base import Base
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
|
|
||||||
class Media(Base):
|
class Media(Base):
|
||||||
|
|
||||||
|
@ -92,12 +88,16 @@ class Media(Base):
|
||||||
for key in self.latitude_keys + self.longitude_keys:
|
for key in self.latitude_keys + self.longitude_keys:
|
||||||
# TODO: verify that we need to check ref key
|
# TODO: verify that we need to check ref key
|
||||||
# when self.set_gps_ref != True
|
# when self.set_gps_ref != True
|
||||||
if type == 'latitude' and key in self.latitude_keys and key in exif:
|
if type == 'latitude' and key in self.latitude_keys and \
|
||||||
if self.latitude_ref_key in exif and exif[self.latitude_ref_key] == 'S': #noqa
|
key in exif:
|
||||||
|
if self.latitude_ref_key in exif and \
|
||||||
|
exif[self.latitude_ref_key] == 'S':
|
||||||
direction_multiplier = -1
|
direction_multiplier = -1
|
||||||
return exif[key] * direction_multiplier
|
return exif[key] * direction_multiplier
|
||||||
elif type == 'longitude' and key in self.longitude_keys and key in exif: #noqa
|
elif type == 'longitude' and key in self.longitude_keys and \
|
||||||
if self.longitude_ref_key in exif and exif[self.longitude_ref_key] == 'W': #noqa
|
key in exif:
|
||||||
|
if self.longitude_ref_key in exif and \
|
||||||
|
exif[self.longitude_ref_key] == 'W':
|
||||||
direction_multiplier = -1
|
direction_multiplier = -1
|
||||||
return exif[key] * direction_multiplier
|
return exif[key] * direction_multiplier
|
||||||
|
|
||||||
|
@ -170,8 +170,6 @@ class Media(Base):
|
||||||
if(time is None):
|
if(time is None):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
source = self.source
|
|
||||||
|
|
||||||
tags = {}
|
tags = {}
|
||||||
formatted_time = time.strftime('%Y:%m:%d %H:%M:%S')
|
formatted_time = time.strftime('%Y:%m:%d %H:%M:%S')
|
||||||
for key in self.exif_map['date_taken']:
|
for key in self.exif_map['date_taken']:
|
||||||
|
@ -185,8 +183,6 @@ class Media(Base):
|
||||||
if(not self.is_valid()):
|
if(not self.is_valid()):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
source = self.source
|
|
||||||
|
|
||||||
# The lat/lon _keys array has an order of precedence.
|
# The lat/lon _keys array has an order of precedence.
|
||||||
# The first key is writable and we will give the writable
|
# The first key is writable and we will give the writable
|
||||||
# key precence when reading.
|
# key precence when reading.
|
||||||
|
@ -222,8 +218,6 @@ class Media(Base):
|
||||||
if(title is None):
|
if(title is None):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
source = self.source
|
|
||||||
|
|
||||||
tags = {self.title_key: title}
|
tags = {self.title_key: title}
|
||||||
status = self.__set_tags(tags)
|
status = self.__set_tags(tags)
|
||||||
self.reset_cache()
|
self.reset_cache()
|
||||||
|
|
|
@ -15,8 +15,6 @@ from re import compile
|
||||||
|
|
||||||
|
|
||||||
from elodie import constants
|
from elodie import constants
|
||||||
from elodie import geolocation
|
|
||||||
from elodie.external.pyexiftool import ExifTool
|
|
||||||
from media import Media
|
from media import Media
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +78,7 @@ class Photo(Media):
|
||||||
# We need to parse a string from EXIF into a timestamp.
|
# We need to parse a string from EXIF into a timestamp.
|
||||||
# EXIF DateTimeOriginal and EXIF DateTime are both stored
|
# EXIF DateTimeOriginal and EXIF DateTime are both stored
|
||||||
# in %Y:%m:%d %H:%M:%S format
|
# 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
|
# the conversion in the local timezone
|
||||||
# EXIF DateTime is already stored as a timestamp
|
# EXIF DateTime is already stored as a timestamp
|
||||||
# Sourced from https://github.com/photo/frontend/blob/master/src/libraries/models/Photo.php#L500 # noqa
|
# Sourced from https://github.com/photo/frontend/blob/master/src/libraries/models/Photo.php#L500 # noqa
|
||||||
|
|
|
@ -7,19 +7,12 @@ objects (AVI, MOV, etc.).
|
||||||
|
|
||||||
# load modules
|
# load modules
|
||||||
from distutils.spawn import find_executable
|
from distutils.spawn import find_executable
|
||||||
import tempfile
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
|
||||||
import subprocess
|
|
||||||
import time
|
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
|
from media import Media
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue