Skip to content
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

Blackened all code #95

Merged
merged 14 commits into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/lucasmbrown/mirrors-autoflake
rev: v1.3
hooks:
- id: autoflake
args: ['--in-place', '--remove-all-unused-imports', '--ignore-init-module-imports', '--remove-unused-variable']
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
additional_dependencies:
- toml
- repo: https://github.com/ambv/black
rev: master
hooks:
- id: black
language_version: python3.6
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-xml
- id: fix-encoding-pragma
- id: flake8
additional_dependencies:
- toml
- flake8-assertive
- flake8-blind-except
- flake8-builtins
- flake8-coding
- flake8-comprehensions
- flake8-isort
- flake8-logging-format
- flake8-mutable
- flake8-print
- pep8-naming
14 changes: 8 additions & 6 deletions imgee/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

import os.path

from flask import Flask, redirect, url_for
from flask_migrate import Migrate
from werkzeug.utils import secure_filename

from flask import Flask, redirect, url_for
from flask_lastuser import Lastuser
from flask_lastuser.sqlalchemy import UserManager
from baseframe import baseframe, assets, Version
from flask_migrate import Migrate

from baseframe import Version, assets, baseframe
import coaster.app

from ._version import __version__

version = Version(__version__)
Expand All @@ -20,9 +22,9 @@

assets['imgee.css'][version] = 'css/app.css'

from . import models, views
from .models import db
from .tasks import TaskRegistry
from . import models, views # NOQA # isort:skip
from .models import db # NOQA # isort:skip
from .tasks import TaskRegistry # NOQA # isort:skip

registry = TaskRegistry()

Expand Down
11 changes: 6 additions & 5 deletions imgee/forms.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-

from coaster.utils import make_name
from baseframe.forms import Form
from wtforms.validators import Required, ValidationError, Length
from wtforms import FileField, TextField, HiddenField, SelectField
from wtforms import FileField, HiddenField, SelectField, TextField
from wtforms.validators import Length, Required, ValidationError

from baseframe.forms import Form
from coaster.utils import make_name
from imgee import app

from .models import Label
from .utils import is_file_allowed

Expand All @@ -18,7 +19,7 @@ def valid_file(form, field):


class UploadImageForm(Form):
file = FileField("File", validators=[Required(), valid_file])
file_obj = FileField("File", validators=[Required(), valid_file])
iambibhas marked this conversation as resolved.
Show resolved Hide resolved


class DeleteImageForm(Form):
Expand Down
9 changes: 5 additions & 4 deletions imgee/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-

from flask_sqlalchemy import SQLAlchemy

from imgee import app

db = SQLAlchemy(app)

from imgee.models.user import *
from imgee.models.stored_file import *
from imgee.models.thumbnail import *
from imgee.models.profile import *
from imgee.models.user import * # NOQA # isort:skip
from imgee.models.stored_file import * # NOQA # isort:skip
from imgee.models.thumbnail import * # NOQA # isort:skip
from imgee.models.profile import * # NOQA # isort:skip
5 changes: 4 additions & 1 deletion imgee/models/profile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from coaster.sqlalchemy import BaseNameMixin
# -*- coding: utf-8 -*-
from flask_lastuser.sqlalchemy import ProfileMixin

from coaster.sqlalchemy import BaseNameMixin

from . import db


Expand Down
20 changes: 10 additions & 10 deletions imgee/models/stored_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from flask import url_for

from coaster.sqlalchemy import BaseNameMixin, BaseScopedNameMixin

from .. import app
from ..utils import guess_extension, newid
from . import db
from ..utils import newid, guess_extension


image_labels = db.Table(
'image_labels',
Expand Down Expand Up @@ -75,16 +75,16 @@ def filename(self):
return self.name + self.extn

def dict_data(self):
return dict(
title=self.title,
uploaded=self.created_at.isoformat() + 'Z',
filesize=app.jinja_env.filters['filesizeformat'](self.size),
imgsize=u'%s×%s px' % (self.width, self.height),
url=url_for('view_image', profile=self.profile.name, image=self.name),
thumb_url=url_for(
return {
'title': self.title,
'uploaded': self.created_at.isoformat() + 'Z',
'filesize': app.jinja_env.filters['filesizeformat'](self.size),
'imgsize': u'%s×%s px' % (self.width, self.height),
'url': url_for('view_image', profile=self.profile.name, image=self.name),
'thumb_url': url_for(
'get_image', image=self.name, size=app.config.get('THUMBNAIL_SIZE')
),
)
}

def add_labels(self, labels):
status = {'+': [], '-': [], '': []}
Expand Down
3 changes: 2 additions & 1 deletion imgee/models/thumbnail.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-

from coaster.sqlalchemy import BaseMixin
from . import db

from ..utils import newid
from . import db


class Thumbnail(BaseMixin, db.Model):
Expand Down
4 changes: 3 additions & 1 deletion imgee/models/user.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-

from flask import url_for
from flask_lastuser.sqlalchemy import UserBase
from werkzeug.utils import cached_property

from flask_lastuser.sqlalchemy import UserBase

from . import db
from .profile import Profile

Expand Down
2 changes: 1 addition & 1 deletion imgee/static/img/imgee.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions imgee/static/js/dropzone-amd-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,19 @@ Emitter.prototype.hasListeners = function(event){
/*
#
# More info at [www.dropzonejs.com](http://www.dropzonejs.com)
#
# Copyright (c) 2012, Matias Meno
#
#
# Copyright (c) 2012, Matias Meno
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -202,9 +202,9 @@ Emitter.prototype.hasListeners = function(event){

/*
This is a list of all available events you can register on a dropzone object.
You can register an event handler like this:
dropzone.on("dragEnter", function() { });
*/

Expand Down Expand Up @@ -1184,4 +1184,4 @@ Emitter.prototype.hasListeners = function(event){
}).call(this);

return module.exports;
}));
}));
1 change: 0 additions & 1 deletion imgee/static/js/edit_in_place.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,3 @@ $(".editable_label").each(function (){
}
});
});

4 changes: 2 additions & 2 deletions imgee/static/js/jquery.ba-postmessage.min.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* jQuery postMessage - v0.5 - 9/11/2009
* http://benalman.com/projects/jquery-postmessage-plugin/
*
*
* Copyright (c) 2009 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){var g,d,j=1,a,b=this,f=!1,h="postMessage",e="addEventListener",c,i=b[h]&&!$.browser.opera;$[h]=function(k,l,m){if(!l){return}k=typeof k==="string"?k:$.param(k);m=m||parent;if(i){m[h](k,l.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))}else{if(l){m.location=l.replace(/#.*$/,"")+"#"+(+new Date)+(j++)+"&"+k}}};$.receiveMessage=c=function(l,m,k){if(i){if(l){a&&c();a=function(n){if((typeof m==="string"&&n.origin!==m)||($.isFunction(m)&&m(n.origin)===f)){return f}l(n)}}if(b[e]){b[l?e:"removeEventListener"]("message",a,f)}else{b[l?"attachEvent":"detachEvent"]("onmessage",a)}}else{g&&clearInterval(g);g=null;if(l){k=typeof m==="number"?m:typeof k==="number"?k:100;g=setInterval(function(){var o=document.location.hash,n=/^#?\d+&/;if(o!==d&&n.test(o)){d=o;l({data:o.replace(n,"")})}},k)}}}})(jQuery);
(function($){var g,d,j=1,a,b=this,f=!1,h="postMessage",e="addEventListener",c,i=b[h]&&!$.browser.opera;$[h]=function(k,l,m){if(!l){return}k=typeof k==="string"?k:$.param(k);m=m||parent;if(i){m[h](k,l.replace(/([^:]+:\/\/[^\/]+).*/,"$1"))}else{if(l){m.location=l.replace(/#.*$/,"")+"#"+(+new Date)+(j++)+"&"+k}}};$.receiveMessage=c=function(l,m,k){if(i){if(l){a&&c();a=function(n){if((typeof m==="string"&&n.origin!==m)||($.isFunction(m)&&m(n.origin)===f)){return f}l(n)}}if(b[e]){b[l?e:"removeEventListener"]("message",a,f)}else{b[l?"attachEvent":"detachEvent"]("onmessage",a)}}else{g&&clearInterval(g);g=null;if(l){k=typeof m==="number"?m:typeof k==="number"?k:100;g=setInterval(function(){var o=document.location.hash,n=/^#?\d+&/;if(o!==d&&n.test(o)){d=o;l({data:o.replace(n,"")})}},k)}}}})(jQuery);
2 changes: 1 addition & 1 deletion imgee/static/js/jquery.history.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion imgee/static/js/jquery.jeditable.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions imgee/static/js/list-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $(document).ready(function(){
//if currently active option do nothing
return false;
} else {

if(selectedOptionId == 'listview') {
$(this).addClass('active');
$('#gridview').removeClass('active');
Expand All @@ -24,13 +24,13 @@ $(document).ready(function(){
else if(selectedOptionId == 'gridview') {
$(this).addClass('active');
$('#listview').removeClass('active');

showcase.removeClass('list');
showcase.addClass('grid');
$('.left').removeClass('span1');
$('#row-ctrl').removeClass('row');
}

}
}
});
});
});
Loading