mirror of
https://gitlab.com/bashrc2/epicyon
synced 2026-11-01 02:15:12 +00:00
Enforce convention of underscore before local function names
This commit is contained in:
1 parent
0cf0841402
commit
5cd9aa8d66
42 files changed
+1805
-1786
No files matched your search
@@ -56,12 +56,12 @@ def removeMetaData(imageFilename: str, outputFilename: str) -> None:
|
||||
os.system('/usr/bin/mogrify -strip ' + outputFilename) # nosec
|
||||
|
||||
|
||||
def getImageHash(imageFilename: str) -> str:
|
||||
def _getImageHash(imageFilename: str) -> str:
|
||||
value = numpy.array(Image.open(imageFilename).convert("RGB"))
|
||||
return blurhash_encode(value)
|
||||
|
||||
|
||||
def isMedia(imageFilename: str) -> bool:
|
||||
def _isMedia(imageFilename: str) -> bool:
|
||||
permittedMedia = getMediaExtensions()
|
||||
for m in permittedMedia:
|
||||
if imageFilename.endswith('.' + m):
|
||||
@@ -103,7 +103,7 @@ def getAttachmentMediaType(filename: str) -> str:
|
||||
return mediaType
|
||||
|
||||
|
||||
def updateEtag(mediaFilename: str) -> None:
|
||||
def _updateEtag(mediaFilename: str) -> None:
|
||||
""" calculate the etag, which is a sha1 of the data
|
||||
"""
|
||||
# only create etags for media
|
||||
@@ -143,7 +143,7 @@ def attachMedia(baseDir: str, httpPrefix: str, domain: str, port: int,
|
||||
Blurhash is optional, since low power systems may take a long
|
||||
time to calculate it
|
||||
"""
|
||||
if not isMedia(imageFilename):
|
||||
if not _isMedia(imageFilename):
|
||||
return postJson
|
||||
|
||||
fileExtension = None
|
||||
@@ -182,7 +182,7 @@ def attachMedia(baseDir: str, httpPrefix: str, domain: str, port: int,
|
||||
if mediaType.startswith('image/'):
|
||||
attachmentJson['focialPoint'] = [0.0, 0.0]
|
||||
if useBlurhash:
|
||||
attachmentJson['blurhash'] = getImageHash(imageFilename)
|
||||
attachmentJson['blurhash'] = _getImageHash(imageFilename)
|
||||
postJson['attachment'] = [attachmentJson]
|
||||
|
||||
if baseDir:
|
||||
@@ -190,7 +190,7 @@ def attachMedia(baseDir: str, httpPrefix: str, domain: str, port: int,
|
||||
removeMetaData(imageFilename, mediaFilename)
|
||||
else:
|
||||
copyfile(imageFilename, mediaFilename)
|
||||
updateEtag(mediaFilename)
|
||||
_updateEtag(mediaFilename)
|
||||
|
||||
return postJson
|
||||
|
||||
|
||||
Reference in new issue
Block a user