project
stringlengths 1
98
| commit_sha
stringlengths 40
40
| parent_sha
stringlengths 40
40
| file_path
stringlengths 4
209
| project_url
stringlengths 23
132
| likely_bug
bool 1
class | comodified
bool 1
class | in_function
bool 2
classes | diff
stringlengths 27
9.71k
| before
stringlengths 1
8.91k
| after
stringlengths 1
6k
| sstub_pattern
stringclasses 23
values | edit_script
stringlengths 33
158k
| key
stringlengths 45
154
| commit_message
stringlengths 3
65.5k
⌀ | files
list |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
flask-admin | 473d5f1a5b54338b1dca9c4993da209f098cdff8 | 15335f7c71659ba7e1efb825e6f8a14e390cfc27 | flask_admin/tests/test_model.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -773,7 +773,7 @@ def test_list_row_actions():
# Test custom views
view = MockModelView(Model, endpoint='test3',
- column_list_row_actions=[
+ column_extra_row_actions=[
template.LinkRowAction('glyphicon glyphicon-off', 'http://localhost/?id={row_id}'),
template.EndpointLinkRowAction('glyphicon glyphicon-test', 'test1.index_view')
])
| view = MockModelView ( Model , endpoint = 'test3' , column_list_row_actions = [ template . LinkRowAction ( 'glyphicon glyphicon-off' , 'http://localhost/?id={row_id}' ) , template . EndpointLinkRowAction ( 'glyphicon glyphicon-test' , 'test1.index_view' ) ] ) | view = MockModelView ( Model , endpoint = 'test3' , column_extra_row_actions = [ template . LinkRowAction ( 'glyphicon glyphicon-off' , 'http://localhost/?id={row_id}' ) , template . EndpointLinkRowAction ( 'glyphicon glyphicon-test' , 'test1.index_view' ) ] ) | CHANGE_KEYWORD_ARGUMENT_USED | [["Update", ["identifier:column_list_row_actions", 3, 26, 3, 49], "column_extra_row_actions"]] | zhijuebin/flask-admin@473d5f1a5b54338b1dca9c4993da209f098cdff8 | Fixed test | [
{
"sha": "48d3ba820d8c407f6a0718df289121915d5d9657",
"filename": "flask_admin/tests/test_model.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/473d5f1a5b54338b1dca9c4993da209f098cdff8/flask_admin%2Ftests%2Ftest_model.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/473d5f1a5b54338b1dca9c4993da209f098cdff8/flask_admin%2Ftests%2Ftest_model.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Ftests%2Ftest_model.py?ref=473d5f1a5b54338b1dca9c4993da209f098cdff8",
"patch": "@@ -773,7 +773,7 @@ def test_list_row_actions():\n \n # Test custom views\n view = MockModelView(Model, endpoint='test3',\n- column_list_row_actions=[\n+ column_extra_row_actions=[\n template.LinkRowAction('glyphicon glyphicon-off', 'http://localhost/?id={row_id}'),\n template.EndpointLinkRowAction('glyphicon glyphicon-test', 'test1.index_view')\n ])"
}
] |
ROSE | 10cbbb396c18ac4a7cc9785d2a7b1ede8138700c | ca722265baf5973a150c555124e089fcaa8d5eac | rose/server/game.py | https://github.com/sleviim/ROSE | true | false | true | @@ -94,7 +94,7 @@ class Game(object):
def print_stats(self):
print
print 'Stats'
- for i, p in enumerate(sorted(self.players.values())):
+ for i, p in enumerate(sorted(self.players.values(), reverse=True)):
print '%d %10s row:%d score:%d' % (
i+1, p.name, p.y, p.score
)
| for i , p in enumerate ( sorted ( self . players . values ( ) ) ) : print '%d %10s row:%d score:%d' % ( i + 1 , p . name , p . y , p . score ) | for i , p in enumerate ( sorted ( self . players . values ( ) , reverse = True ) ) : print '%d %10s row:%d score:%d' % ( i + 1 , p . name , p . y , p . score ) | SAME_FUNCTION_MORE_ARGS | [["Insert", ["argument_list", 3, 37, 3, 60], [",:,", "T"], 2], ["Insert", ["argument_list", 3, 37, 3, 60], ["keyword_argument", "N0"], 3], ["Insert", "N0", ["identifier:reverse", "T"], 0], ["Insert", "N0", ["=:=", "T"], 1], ["Insert", "N0", ["true:True", "T"], 2]] | sleviim/ROSE@10cbbb396c18ac4a7cc9785d2a7b1ede8138700c | Fix sorting of server stats (#234)
Fixes #232 | [
{
"sha": "7eeb3c69e89830ebc0a4e641805f8622c55656a6",
"filename": "rose/server/game.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/sleviim/ROSE/blob/10cbbb396c18ac4a7cc9785d2a7b1ede8138700c/rose%2Fserver%2Fgame.py",
"raw_url": "https://github.com/sleviim/ROSE/raw/10cbbb396c18ac4a7cc9785d2a7b1ede8138700c/rose%2Fserver%2Fgame.py",
"contents_url": "https://api.github.com/repos/sleviim/ROSE/contents/rose%2Fserver%2Fgame.py?ref=10cbbb396c18ac4a7cc9785d2a7b1ede8138700c",
"patch": "@@ -94,7 +94,7 @@ def drive_player(self, name, info):\n def print_stats(self):\n print\n print 'Stats'\n- for i, p in enumerate(sorted(self.players.values())):\n+ for i, p in enumerate(sorted(self.players.values(), reverse=True)):\n print '%d %10s row:%d score:%d' % (\n i+1, p.name, p.y, p.score\n )"
}
] |
ROSE | a663a5ca8be6672d627d4fa882b46bcd1abe8a23 | c7438bd55bb0f9f617ee2767590f602d817527c7 | rose/common/message.py | https://github.com/sleviim/ROSE | true | false | false | @@ -1,5 +1,5 @@
import json
-from rose.common import error
+from . import error
def parse(line):
| from rose . common import error | from . import error | SINGLE_STMT | [["Insert", ["import_from_statement", 1, 1, 1, 30], ["relative_import", "N0"], 1], ["Insert", "N0", ["import_prefix", "N1"], 0], ["Move", "N1", [".:.", 1, 10, 1, 11], 0], ["Delete", ["identifier:rose", 1, 6, 1, 10]], ["Delete", ["identifier:common", 1, 11, 1, 17]], ["Delete", ["dotted_name", 1, 6, 1, 17]]] | sleviim/ROSE@a663a5ca8be6672d627d4fa882b46bcd1abe8a23 | Modernize imports in rose.common package
partially fixes #192 | [
{
"sha": "0b021d42b6407ebe4df9d1e08a630126b0a899d1",
"filename": "rose/common/message.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/sleviim/ROSE/blob/a663a5ca8be6672d627d4fa882b46bcd1abe8a23/rose%2Fcommon%2Fmessage.py",
"raw_url": "https://github.com/sleviim/ROSE/raw/a663a5ca8be6672d627d4fa882b46bcd1abe8a23/rose%2Fcommon%2Fmessage.py",
"contents_url": "https://api.github.com/repos/sleviim/ROSE/contents/rose%2Fcommon%2Fmessage.py?ref=a663a5ca8be6672d627d4fa882b46bcd1abe8a23",
"patch": "@@ -1,5 +1,5 @@\n import json\n-from rose.common import error\n+from . import error\n \n \n def parse(line):"
}
] |
ROSE | e35bdac58f00402b0c35e7dd4d991a9519a0efad | ffd4cc04202dd8abdd02680361c11846d6ae98cf | rose/server/score.py | https://github.com/sleviim/ROSE | true | false | true | @@ -46,7 +46,7 @@ def process(players, track):
elif obstacle in (obstacles.TRASH,
obstacles.BIKE,
obstacles.BARRIER):
- if player.action != actions.LEFT and player.action != actions.RIGHT:
+ if player.action not in (actions.LEFT, actions.RIGHT):
track.clear(player.x, player.y)
player.y += 1
player.score += config.score_move_backward * 2
| if player . action != actions . LEFT and player . action != actions . RIGHT : track . clear ( player . x , player . y ) player . y += 1 player . score += config . score_move_backward * 2 | if player . action not in ( actions . LEFT , actions . RIGHT ) : track . clear ( player . x , player . y ) player . y += 1 player . score += config . score_move_backward * 2 | SINGLE_STMT | [["Move", ["if_statement", 3, 13, 6, 63], ["comparison_operator", 3, 16, 3, 45], 1], ["Insert", ["comparison_operator", 3, 16, 3, 45], ["not:not", "T"], 1], ["Insert", ["comparison_operator", 3, 16, 3, 45], ["in:in", "T"], 2], ["Insert", ["comparison_operator", 3, 16, 3, 45], ["tuple", "N0"], 3], ["Insert", "N0", ["(:(", "T"], 0], ["Move", "N0", ["attribute", 3, 33, 3, 45], 1], ["Insert", "N0", [",:,", "T"], 2], ["Move", "N0", ["attribute", 3, 67, 3, 80], 3], ["Insert", "N0", ["):)", "T"], 4], ["Delete", ["!=:!=", 3, 30, 3, 32]], ["Delete", ["and:and", 3, 46, 3, 49]], ["Delete", ["identifier:player", 3, 50, 3, 56]], ["Delete", [".:.", 3, 56, 3, 57]], ["Delete", ["identifier:action", 3, 57, 3, 63]], ["Delete", ["attribute", 3, 50, 3, 63]], ["Delete", ["!=:!=", 3, 64, 3, 66]], ["Delete", ["comparison_operator", 3, 50, 3, 80]], ["Delete", ["boolean_operator", 3, 16, 3, 80]]] | sleviim/ROSE@e35bdac58f00402b0c35e7dd4d991a9519a0efad | score.py: avoid failing on flake8 test (#406)
Line's length is currently 80>79 chars.
This patch tries to fix it, so the travis test won't fail. | [
{
"sha": "0c1e777a5ec55d18495c1d820d64f352aed68035",
"filename": "rose/server/score.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/sleviim/ROSE/blob/e35bdac58f00402b0c35e7dd4d991a9519a0efad/rose%2Fserver%2Fscore.py",
"raw_url": "https://github.com/sleviim/ROSE/raw/e35bdac58f00402b0c35e7dd4d991a9519a0efad/rose%2Fserver%2Fscore.py",
"contents_url": "https://api.github.com/repos/sleviim/ROSE/contents/rose%2Fserver%2Fscore.py?ref=e35bdac58f00402b0c35e7dd4d991a9519a0efad",
"patch": "@@ -46,7 +46,7 @@ def process(players, track):\n elif obstacle in (obstacles.TRASH,\n obstacles.BIKE,\n obstacles.BARRIER):\n- if player.action != actions.LEFT and player.action != actions.RIGHT:\n+ if player.action not in (actions.LEFT, actions.RIGHT):\n track.clear(player.x, player.y)\n player.y += 1\n player.score += config.score_move_backward * 2"
}
] |
my-first-blog | f1d6d9c843532dc44ba5746e3383f8d2a067e71a | a9f7eba5f1aa0188d47e6e2cacfc3a8aed7d7fe3 | mysite/urls.py | https://github.com/SlabePiwko/my-first-blog | true | false | false | @@ -17,5 +17,5 @@ from django.contrib import admin
from django.urls import path
urlpatterns = [
- path('admin/', admin.site.urls),
+ path(r'^admin/', admin.site.urls),
]
| urlpatterns = [ path ( 'admin/' , admin . site . urls ) , ] | urlpatterns = [ path ( r'^admin/' , admin . site . urls ) , ] | CHANGE_STRING_LITERAL | [["Update", ["string:'admin/'", 3, 10, 3, 18], "r'^admin/'"]] | SlabePiwko/my-first-blog@f1d6d9c843532dc44ba5746e3383f8d2a067e71a | urls fix | [
{
"sha": "495fda5ba79440a95de184ac1ab92ad411f4606f",
"filename": "mysite/urls.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/SlabePiwko/my-first-blog/blob/f1d6d9c843532dc44ba5746e3383f8d2a067e71a/mysite%2Furls.py",
"raw_url": "https://github.com/SlabePiwko/my-first-blog/raw/f1d6d9c843532dc44ba5746e3383f8d2a067e71a/mysite%2Furls.py",
"contents_url": "https://api.github.com/repos/SlabePiwko/my-first-blog/contents/mysite%2Furls.py?ref=f1d6d9c843532dc44ba5746e3383f8d2a067e71a",
"patch": "@@ -17,5 +17,5 @@\n from django.urls import path\n \n urlpatterns = [\n- path('admin/', admin.site.urls),\n+ path(r'^admin/', admin.site.urls),\n ]"
}
] |
my-first-blog | 46f3b39652a865cf353c3cc8a3c3ecfc1cf69b98 | f1d6d9c843532dc44ba5746e3383f8d2a067e71a | mysite/settings.py | https://github.com/SlabePiwko/my-first-blog | true | false | false | @@ -25,7 +25,7 @@ SECRET_KEY = '+mfod-o6kplfw&b&plv!#xiprhx7top)a7#(&p2yxov*p7y7)2'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
-ALLOWED_HOSTS = []
+ALLOWED_HOSTS = ['slabepiwko.pythonanywhere.com']
# Application definition
| ALLOWED_HOSTS = [ ] | ALLOWED_HOSTS = [ 'slabepiwko.pythonanywhere.com' ] | ADD_ELEMENTS_TO_ITERABLE | [["Insert", ["list", 3, 17, 3, 19], ["string:'slabepiwko.pythonanywhere.com'", "T"], 1]] | SlabePiwko/my-first-blog@46f3b39652a865cf353c3cc8a3c3ecfc1cf69b98 | settings fix | [
{
"sha": "d9e7723e080e5715e92ee3378cfd8b80b17bd380",
"filename": "mysite/settings.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/SlabePiwko/my-first-blog/blob/46f3b39652a865cf353c3cc8a3c3ecfc1cf69b98/mysite%2Fsettings.py",
"raw_url": "https://github.com/SlabePiwko/my-first-blog/raw/46f3b39652a865cf353c3cc8a3c3ecfc1cf69b98/mysite%2Fsettings.py",
"contents_url": "https://api.github.com/repos/SlabePiwko/my-first-blog/contents/mysite%2Fsettings.py?ref=46f3b39652a865cf353c3cc8a3c3ecfc1cf69b98",
"patch": "@@ -25,7 +25,7 @@\n # SECURITY WARNING: don't run with debug turned on in production!\n DEBUG = True\n \n-ALLOWED_HOSTS = []\n+ALLOWED_HOSTS = ['slabepiwko.pythonanywhere.com']\n \n \n # Application definition"
}
] |
BookCheck-Backend | abd458f69f631d187291b1012fe745547de71972 | be840fe404f042e614eec8e6c4b91dc507faa4aa | Server/server.py | https://github.com/JoMingyu/BookCheck-Backend | true | false | false | @@ -13,6 +13,6 @@ if __name__ == '__main__':
new_library = LibraryModel(id='test', title='멋진 도서관').save()
AdminModel.objects(id='test').delete()
- AdminModel.objects(id='test', pw='test', managing_library=new_library).save()
+ AdminModel(id='test', pw='test', managing_library=new_library).save()
app.run(host=app.config['HOST'], port=app.config['PORT'], debug=app.debug, threaded=True)
| AdminModel . objects ( id = 'test' , pw = 'test' , managing_library = new_library ) . save ( ) | AdminModel ( id = 'test' , pw = 'test' , managing_library = new_library ) . save ( ) | SINGLE_STMT | [["Move", ["call", 3, 5, 3, 75], ["identifier:AdminModel", 3, 5, 3, 15], 0], ["Delete", [".:.", 3, 15, 3, 16]], ["Delete", ["identifier:objects", 3, 16, 3, 23]], ["Delete", ["attribute", 3, 5, 3, 23]]] | JoMingyu/BookCheck-Backend@abd458f69f631d187291b1012fe745547de71972 | [FIX] About AdminModel saving | [
{
"sha": "b0fbddc968a7facf7262d4fb8feda8e639391d94",
"filename": "Server/server.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/JoMingyu/BookCheck-Backend/blob/abd458f69f631d187291b1012fe745547de71972/Server%2Fserver.py",
"raw_url": "https://github.com/JoMingyu/BookCheck-Backend/raw/abd458f69f631d187291b1012fe745547de71972/Server%2Fserver.py",
"contents_url": "https://api.github.com/repos/JoMingyu/BookCheck-Backend/contents/Server%2Fserver.py?ref=abd458f69f631d187291b1012fe745547de71972",
"patch": "@@ -13,6 +13,6 @@ def index():\n new_library = LibraryModel(id='test', title='멋진 도서관').save()\n \n AdminModel.objects(id='test').delete()\n- AdminModel.objects(id='test', pw='test', managing_library=new_library).save()\n+ AdminModel(id='test', pw='test', managing_library=new_library).save()\n \n app.run(host=app.config['HOST'], port=app.config['PORT'], debug=app.debug, threaded=True)"
}
] |
heroku | 0f67637d57e48d04e505ca196227dbd51098b36d | 0415cd3bd25f10d5b6139f380d4f378bbff68c53 | app.py | https://github.com/matejstolfa/heroku | true | false | false | @@ -97,4 +97,4 @@ if __name__ == '__main__':
print "Starting app on port %d" % port
- app.run(debug=False, port=port)
+ app.run(debug=False, port=port, host='0.0.0.0')
| app . run ( debug = False , port = port ) | app . run ( debug = False , port = port , host = '0.0.0.0' ) | SAME_FUNCTION_MORE_ARGS | [["Insert", ["argument_list", 3, 12, 3, 36], [",:,", "T"], 4], ["Insert", ["argument_list", 3, 12, 3, 36], ["keyword_argument", "N0"], 5], ["Insert", "N0", ["identifier:host", "T"], 0], ["Insert", "N0", ["=:=", "T"], 1], ["Insert", "N0", ["string:'0.0.0.0'", "T"], 2]] | matejstolfa/heroku@0f67637d57e48d04e505ca196227dbd51098b36d | Fix host | [
{
"sha": "748d986d9a21803a7467f8bb51d080b90114ff2c",
"filename": "app.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/matejstolfa/heroku/blob/0f67637d57e48d04e505ca196227dbd51098b36d/app.py",
"raw_url": "https://github.com/matejstolfa/heroku/raw/0f67637d57e48d04e505ca196227dbd51098b36d/app.py",
"contents_url": "https://api.github.com/repos/matejstolfa/heroku/contents/app.py?ref=0f67637d57e48d04e505ca196227dbd51098b36d",
"patch": "@@ -97,4 +97,4 @@ def makeWebhookResult(data):\n \n print \"Starting app on port %d\" % port\n \n- app.run(debug=False, port=port)\n+ app.run(debug=False, port=port, host='0.0.0.0')"
}
] |
my-first-blog | 9646533621d44b2d8b4340206877df6dd859ac27 | b460e51c3dc43d32366f7f9c67cfab10892d1666 | mysite/settings.py | https://github.com/Haneb/my-first-blog | true | false | false | @@ -25,7 +25,7 @@ SECRET_KEY = 'odcncm6*bar=@jc&(ne@mm5#p(ary-$k1rorr#qnveaf8g1pmr'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
-ALLOWED_HOSTS = ['127.0.0.1', 'mes.pythoneanywhere.com']
+ALLOWED_HOSTS = ['127.0.0.1', 'mes.pythonanywhere.com']
# Application definition
| ALLOWED_HOSTS = [ '127.0.0.1' , 'mes.pythoneanywhere.com' ] | ALLOWED_HOSTS = [ '127.0.0.1' , 'mes.pythonanywhere.com' ] | CHANGE_STRING_LITERAL | [["Update", ["string:'mes.pythoneanywhere.com'", 3, 31, 3, 56], "'mes.pythonanywhere.com'"]] | Haneb/my-first-blog@9646533621d44b2d8b4340206877df6dd859ac27 | fixed typo | [
{
"sha": "3b2abf28c2039ce6755c98adc14415aa58421492",
"filename": "mysite/settings.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/Haneb/my-first-blog/blob/9646533621d44b2d8b4340206877df6dd859ac27/mysite%2Fsettings.py",
"raw_url": "https://github.com/Haneb/my-first-blog/raw/9646533621d44b2d8b4340206877df6dd859ac27/mysite%2Fsettings.py",
"contents_url": "https://api.github.com/repos/Haneb/my-first-blog/contents/mysite%2Fsettings.py?ref=9646533621d44b2d8b4340206877df6dd859ac27",
"patch": "@@ -25,7 +25,7 @@\n # SECURITY WARNING: don't run with debug turned on in production!\n DEBUG = True\n \n-ALLOWED_HOSTS = ['127.0.0.1', 'mes.pythoneanywhere.com']\n+ALLOWED_HOSTS = ['127.0.0.1', 'mes.pythonanywhere.com']\n \n \n # Application definition"
}
] |
flask-admin | 98868e05fafae3056120e697a6f483ca10f4aa1d | 10a0030ce9a1bb0734c6942d27892bc8e5968385 | flask_admin/contrib/fileadmin.py | https://github.com/zhijuebin/flask-admin | true | false | false | @@ -116,7 +116,7 @@ class FileAdmin(BaseView, ActionsMixin):
allowed_extensions = ('swf', 'jpg', 'gif', 'png')
"""
- editable_extensions = None
+ editable_extensions = tuple()
"""
List of editable extensions, in lower case.
| """
editable_extensions = None
""" | """
editable_extensions = tuple()
""" | CHANGE_STRING_LITERAL | [["Update", ["string:\"\"\"\n \n editable_extensions = None\n \"\"\"", 1, 5, 4, 8], "\"\"\"\n \n editable_extensions = tuple()\n \"\"\""]] | zhijuebin/flask-admin@98868e05fafae3056120e697a6f483ca10f4aa1d | By default, no file is editable | [
{
"sha": "aa22c450849475f880701e95dfb41460bf63042a",
"filename": "flask_admin/contrib/fileadmin.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/98868e05fafae3056120e697a6f483ca10f4aa1d/flask_admin%2Fcontrib%2Ffileadmin.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/98868e05fafae3056120e697a6f483ca10f4aa1d/flask_admin%2Fcontrib%2Ffileadmin.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Ffileadmin.py?ref=98868e05fafae3056120e697a6f483ca10f4aa1d",
"patch": "@@ -116,7 +116,7 @@ class MyAdmin(FileAdmin):\n allowed_extensions = ('swf', 'jpg', 'gif', 'png')\n \"\"\"\n \n- editable_extensions = None\n+ editable_extensions = tuple()\n \"\"\"\n List of editable extensions, in lower case.\n "
}
] |
flask-admin | 6ce54ace9ccd40a4f4af6706f701b4070f721781 | 22853154f40f5d1bac20a1be18756d98deb840e2 | flask_admin/contrib/sqlamodel/form.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -432,7 +432,7 @@ class InlineModelConverter(InlineModelConverterBase):
for prop in target_mapper.iterate_properties:
if hasattr(prop, 'direction') and prop.direction.name == 'MANYTOONE':
- if prop.mapper.class_ == model:
+ if issubclass(model, prop.mapper.class_):
reverse_prop = prop
break
else:
| if prop . mapper . class_ == model : reverse_prop = prop break | if issubclass ( model , prop . mapper . class_ ) : reverse_prop = prop break | SINGLE_STMT | [["Insert", ["if_statement", 3, 17, 5, 26], ["call", "N0"], 1], ["Insert", "N0", ["identifier:issubclass", "T"], 0], ["Insert", "N0", ["argument_list", "N1"], 1], ["Insert", "N1", ["(:(", "T"], 0], ["Insert", "N1", ["identifier:model", "T"], 1], ["Insert", "N1", [",:,", "T"], 2], ["Move", "N1", ["attribute", 3, 20, 3, 38], 3], ["Insert", "N1", ["):)", "T"], 4], ["Delete", ["==:==", 3, 39, 3, 41]], ["Delete", ["identifier:model", 3, 42, 3, 47]], ["Delete", ["comparison_operator", 3, 20, 3, 47]]] | zhijuebin/flask-admin@6ce54ace9ccd40a4f4af6706f701b4070f721781 | Fixed #172 | [
{
"sha": "c15d0ad69c1cdfe0fc3bce6d0d7cfa715024f8bc",
"filename": "flask_admin/contrib/sqlamodel/form.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/6ce54ace9ccd40a4f4af6706f701b4070f721781/flask_admin%2Fcontrib%2Fsqlamodel%2Fform.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/6ce54ace9ccd40a4f4af6706f701b4070f721781/flask_admin%2Fcontrib%2Fsqlamodel%2Fform.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fsqlamodel%2Fform.py?ref=6ce54ace9ccd40a4f4af6706f701b4070f721781",
"patch": "@@ -432,7 +432,7 @@ def contribute(self, converter, model, form_class, inline_model):\n \n for prop in target_mapper.iterate_properties:\n if hasattr(prop, 'direction') and prop.direction.name == 'MANYTOONE':\n- if prop.mapper.class_ == model:\n+ if issubclass(model, prop.mapper.class_):\n reverse_prop = prop\n break\n else:"
}
] |
flask-admin | 6ae0e63f1459412049877d8ceb21ae6d47f7a1e7 | b310562bc07f297e7f5ea195a452c309520e631e | flask_admin/contrib/sqlamodel/form.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -170,7 +170,7 @@ class AdminModelConverter(ModelConverterBase):
if value is not None:
if getattr(default, 'is_callable', False):
- value = value(None)
+ value = lambda: default.arg(None)
else:
if not getattr(default, 'is_scalar', True):
value = None
| value = value ( None ) | value = lambda : default . arg ( None ) | SINGLE_STMT | [["Insert", ["assignment", 3, 29, 3, 48], ["lambda", "N0"], 2], ["Insert", "N0", ["lambda:lambda", "T"], 0], ["Insert", "N0", [":::", "T"], 1], ["Move", "N0", ["call", 3, 37, 3, 48], 2], ["Insert", ["call", 3, 37, 3, 48], ["attribute", "N1"], 0], ["Update", ["identifier:value", 3, 37, 3, 42], "default"], ["Move", "N1", ["identifier:value", 3, 37, 3, 42], 0], ["Insert", "N1", [".:.", "T"], 1], ["Insert", "N1", ["identifier:arg", "T"], 2]] | zhijuebin/flask-admin@6ae0e63f1459412049877d8ceb21ae6d47f7a1e7 | Fixed #183. Properly handle callable defaults | [
{
"sha": "a7ea03fe43441c8506f8d1e9f29a2623264d98b3",
"filename": "flask_admin/contrib/sqlamodel/form.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/6ae0e63f1459412049877d8ceb21ae6d47f7a1e7/flask_admin%2Fcontrib%2Fsqlamodel%2Fform.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/6ae0e63f1459412049877d8ceb21ae6d47f7a1e7/flask_admin%2Fcontrib%2Fsqlamodel%2Fform.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fsqlamodel%2Fform.py?ref=6ae0e63f1459412049877d8ceb21ae6d47f7a1e7",
"patch": "@@ -170,7 +170,7 @@ def convert(self, model, mapper, prop, field_args, hidden_pk):\n \n if value is not None:\n if getattr(default, 'is_callable', False):\n- value = value(None)\n+ value = lambda: default.arg(None)\n else:\n if not getattr(default, 'is_scalar', True):\n value = None"
}
] |
flask-admin | fc06ece11df60ab8e6ddfb4383df9378c683524e | 1843600ff071d2f7df8dc48478a970e8f003a652 | flask_admin/contrib/sqlamodel/form.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -88,7 +88,7 @@ class AdminModelConverter(ModelConverterBase):
# Contribute model-related parameters
if 'allow_blank' not in kwargs:
- kwargs['allow_blank'] = local_column.nullable,
+ kwargs['allow_blank'] = local_column.nullable
if 'query_factory' not in kwargs:
kwargs['query_factory'] = lambda: self.session.query(remote_model)
| kwargs [ 'allow_blank' ] = local_column . nullable , | kwargs [ 'allow_blank' ] = local_column . nullable | SINGLE_STMT | [["Move", ["assignment", 3, 17, 3, 63], ["attribute", 3, 41, 3, 62], 2], ["Delete", [",:,", 3, 62, 3, 63]], ["Delete", ["expression_list", 3, 41, 3, 63]]] | zhijuebin/flask-admin@fc06ece11df60ab8e6ddfb4383df9378c683524e | Fixed nullable columns | [
{
"sha": "976dea16e9304a15238e58f7c51d62780c16316d",
"filename": "flask_admin/contrib/sqlamodel/form.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/fc06ece11df60ab8e6ddfb4383df9378c683524e/flask_admin%2Fcontrib%2Fsqlamodel%2Fform.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/fc06ece11df60ab8e6ddfb4383df9378c683524e/flask_admin%2Fcontrib%2Fsqlamodel%2Fform.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fsqlamodel%2Fform.py?ref=fc06ece11df60ab8e6ddfb4383df9378c683524e",
"patch": "@@ -88,7 +88,7 @@ def convert(self, model, mapper, prop, field_args, hidden_pk):\n \n # Contribute model-related parameters\n if 'allow_blank' not in kwargs:\n- kwargs['allow_blank'] = local_column.nullable,\n+ kwargs['allow_blank'] = local_column.nullable\n if 'query_factory' not in kwargs:\n kwargs['query_factory'] = lambda: self.session.query(remote_model)\n "
}
] |
flask-admin | 024408a40a53f6ed7c6977f17455d79acb3d69c2 | 93d94683cd46e94acbb7ceb6b2e28fba232c108b | flask_admin/contrib/fileadmin.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -551,7 +551,7 @@ class FileAdmin(BaseView, ActionsMixin):
try:
shutil.rmtree(full_path)
- self.on_diretory_delete(full_path, path)
+ self.on_directory_delete(full_path, path)
flash(gettext('Directory "%s" was successfully deleted.' % path))
except Exception, ex:
flash(gettext('Failed to delete directory: %(error)s', error=ex), 'error')
| self . on_diretory_delete ( full_path , path ) | self . on_directory_delete ( full_path , path ) | WRONG_FUNCTION_NAME | [["Update", ["identifier:on_diretory_delete", 3, 22, 3, 40], "on_directory_delete"]] | zhijuebin/flask-admin@024408a40a53f6ed7c6977f17455d79acb3d69c2 | Fixed typo in fileadmin.py | [
{
"sha": "8c25d91b7c33642dfd358d962087554632716bd8",
"filename": "flask_admin/contrib/fileadmin.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/024408a40a53f6ed7c6977f17455d79acb3d69c2/flask_admin%2Fcontrib%2Ffileadmin.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/024408a40a53f6ed7c6977f17455d79acb3d69c2/flask_admin%2Fcontrib%2Ffileadmin.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Ffileadmin.py?ref=024408a40a53f6ed7c6977f17455d79acb3d69c2",
"patch": "@@ -551,7 +551,7 @@ def delete(self):\n \n try:\n shutil.rmtree(full_path)\n- self.on_diretory_delete(full_path, path)\n+ self.on_directory_delete(full_path, path)\n flash(gettext('Directory \"%s\" was successfully deleted.' % path))\n except Exception, ex:\n flash(gettext('Failed to delete directory: %(error)s', error=ex), 'error')"
}
] |
flask-admin | 4b7a53cc50f244a959a22577aef4cef448c68f29 | 09f4fa5e1f05ed05ffd29a2e4726fecbbaedc133 | flask_admin/_compat.py | https://github.com/zhijuebin/flask-admin | true | false | false | @@ -44,7 +44,7 @@ else:
def as_unicode(text):
return unicode(text)
- reduce = __builtin__.reduce
+ reduce = __builtins__.reduce
def with_metaclass(meta, *bases):
| reduce = __builtin__ . reduce | reduce = __builtins__ . reduce | CHANGE_IDENTIFIER_USED | [["Update", ["identifier:__builtin__", 3, 14, 3, 25], "__builtins__"]] | zhijuebin/flask-admin@4b7a53cc50f244a959a22577aef4cef448c68f29 | Python 2 fixes | [
{
"sha": "7ec99d61cfb16f15e3e2530bdf3711bb250bf4d9",
"filename": "flask_admin/_compat.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/4b7a53cc50f244a959a22577aef4cef448c68f29/flask_admin%2F_compat.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/4b7a53cc50f244a959a22577aef4cef448c68f29/flask_admin%2F_compat.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2F_compat.py?ref=4b7a53cc50f244a959a22577aef4cef448c68f29",
"patch": "@@ -44,7 +44,7 @@ def as_unicode(text):\n def as_unicode(text):\n return unicode(text)\n \n- reduce = __builtin__.reduce\n+ reduce = __builtins__.reduce\n \n \n def with_metaclass(meta, *bases):"
}
] |
flask-admin | b143fc9a300279e6d2313d67ae1351f71fbbd91f | 3dc0d6ee7826ba9f002c31f14f91d72b364d67d4 | flask_admin/contrib/fileadmin.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -46,7 +46,7 @@ class UploadForm(form.BaseForm):
super(UploadForm, self).__init__(helpers.get_form_data())
def validate_upload(self, field):
- if not self.upload.has_file():
+ if not self.upload.data:
raise validators.ValidationError(gettext('File required.'))
filename = self.upload.data.filename
| if not self . upload . has_file ( ) : raise validators . ValidationError ( gettext ( 'File required.' ) ) | if not self . upload . data : raise validators . ValidationError ( gettext ( 'File required.' ) ) | SINGLE_STMT | [["Move", ["not_operator", 3, 12, 3, 38], ["attribute", 3, 16, 3, 36], 1], ["Update", ["identifier:has_file", 3, 28, 3, 36], "data"], ["Delete", ["(:(", 3, 36, 3, 37]], ["Delete", ["):)", 3, 37, 3, 38]], ["Delete", ["argument_list", 3, 36, 3, 38]], ["Delete", ["call", 3, 16, 3, 38]]] | zhijuebin/flask-admin@b143fc9a300279e6d2313d67ae1351f71fbbd91f | Fixied file check before upload | [
{
"sha": "016be12cdafed3ff76bbcb1fa17abb826665bab5",
"filename": "flask_admin/contrib/fileadmin.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/b143fc9a300279e6d2313d67ae1351f71fbbd91f/flask_admin%2Fcontrib%2Ffileadmin.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/b143fc9a300279e6d2313d67ae1351f71fbbd91f/flask_admin%2Fcontrib%2Ffileadmin.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Ffileadmin.py?ref=b143fc9a300279e6d2313d67ae1351f71fbbd91f",
"patch": "@@ -46,7 +46,7 @@ def __init__(self, admin):\n super(UploadForm, self).__init__(helpers.get_form_data())\n \n def validate_upload(self, field):\n- if not self.upload.has_file():\n+ if not self.upload.data:\n raise validators.ValidationError(gettext('File required.'))\n \n filename = self.upload.data.filename"
}
] |
flask-admin | df3435aeba45e5d8554749e01145c3dbf0ed43c5 | b6c8c8362b8641aeef21e92e274baf70e3536a10 | flask_admin/contrib/sqla/view.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -557,7 +557,7 @@ class ModelView(BaseModelView):
if p.mapper.class_ == self.model:
continue
- if p.direction.name == 'MANYTOONE':
+ if p.direction.name in ['MANYTOONE', 'MANYTOMANY']:
relations.add(p.key)
joined = []
| if p . direction . name == 'MANYTOONE' : relations . add ( p . key ) | if p . direction . name in [ 'MANYTOONE' , 'MANYTOMANY' ] : relations . add ( p . key ) | SINGLE_STMT | [["Insert", ["comparison_operator", 3, 20, 3, 51], ["in:in", "T"], 1], ["Insert", ["comparison_operator", 3, 20, 3, 51], ["list", "N0"], 2], ["Insert", "N0", ["[:[", "T"], 0], ["Move", "N0", ["string:'MANYTOONE'", 3, 40, 3, 51], 1], ["Insert", "N0", [",:,", "T"], 2], ["Insert", "N0", ["string:'MANYTOMANY'", "T"], 3], ["Insert", "N0", ["]:]", "T"], 4], ["Delete", ["==:==", 3, 37, 3, 39]]] | zhijuebin/flask-admin@df3435aeba45e5d8554749e01145c3dbf0ed43c5 | Fixed #209. Automatic join for m2m relations | [
{
"sha": "c685d543e400ca550537fad5c227b91d75b0bb9b",
"filename": "flask_admin/contrib/sqla/view.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/df3435aeba45e5d8554749e01145c3dbf0ed43c5/flask_admin%2Fcontrib%2Fsqla%2Fview.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/df3435aeba45e5d8554749e01145c3dbf0ed43c5/flask_admin%2Fcontrib%2Fsqla%2Fview.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fsqla%2Fview.py?ref=df3435aeba45e5d8554749e01145c3dbf0ed43c5",
"patch": "@@ -557,7 +557,7 @@ def scaffold_auto_joins(self):\n if p.mapper.class_ == self.model:\n continue\n \n- if p.direction.name == 'MANYTOONE':\n+ if p.direction.name in ['MANYTOONE', 'MANYTOMANY']:\n relations.add(p.key)\n \n joined = []"
}
] |
flask-admin | 7264cb7df1bb5c7c1bdd4a3ee095d1f9b60d808f | 4955d10d41ff10c8da457077a585d1f246379bd1 | flask_admin/contrib/mongoengine/form.py | https://github.com/zhijuebin/flask-admin | true | false | false | @@ -189,7 +189,7 @@ def get_form(model, converter,
properties = ((p, find(p)) for p in only)
elif exclude:
- properties = (p for p in properties in p[0] not in exclude)
+ properties = (p for p in properties if p[0] not in exclude)
# Create fields
field_dict = {}
| elif exclude : properties = ( p for p in properties in p [ 0 ] not in exclude ) | elif exclude : properties = ( p for p in properties if p [ 0 ] not in exclude ) | SINGLE_STMT | [["Insert", ["generator_expression", 3, 22, 3, 68], ["for_in_clause", "N0"], 2], ["Insert", ["generator_expression", 3, 22, 3, 68], ["if_clause", "N1"], 3], ["Move", "N0", ["for:for", 3, 25, 3, 28], 0], ["Move", "N0", ["identifier:p", 3, 29, 3, 30], 1], ["Move", "N0", ["in:in", 3, 31, 3, 33], 2], ["Move", "N0", ["identifier:properties", 3, 34, 3, 44], 3], ["Insert", "N1", ["if:if", "T"], 0], ["Move", "N1", ["comparison_operator", 3, 34, 3, 67], 1], ["Delete", ["in:in", 3, 45, 3, 47]], ["Delete", ["for_in_clause", 3, 25, 3, 67]]] | zhijuebin/flask-admin@7264cb7df1bb5c7c1bdd4a3ee095d1f9b60d808f | Fixed mongoengine form_exclude_columns support | [
{
"sha": "c620e9ff1d7a4ba9405246011f926bb589f87109",
"filename": "flask_admin/contrib/mongoengine/form.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/7264cb7df1bb5c7c1bdd4a3ee095d1f9b60d808f/flask_admin%2Fcontrib%2Fmongoengine%2Fform.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/7264cb7df1bb5c7c1bdd4a3ee095d1f9b60d808f/flask_admin%2Fcontrib%2Fmongoengine%2Fform.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fmongoengine%2Fform.py?ref=7264cb7df1bb5c7c1bdd4a3ee095d1f9b60d808f",
"patch": "@@ -189,7 +189,7 @@ def find(name):\n \n properties = ((p, find(p)) for p in only)\n elif exclude:\n- properties = (p for p in properties in p[0] not in exclude)\n+ properties = (p for p in properties if p[0] not in exclude)\n \n # Create fields\n field_dict = {}"
}
] |
flask-admin | ecaa5d2c49aa63a12f40fa50186aa36b3b8712ab | d1f58a58a4ffe772ce09100c3d4ce918dc0d28ee | flask_admin/contrib/fileadmin.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -682,7 +682,7 @@ class FileAdmin(BaseView, ActionsMixin):
error = True
else:
try:
- content.decode('utf8')
+ content = content.decode('utf8')
except UnicodeDecodeError:
flash(gettext("Cannot edit %(name)s.", name=path), 'error')
error = True
| else : try : content . decode ( 'utf8' ) | else : try : content = content . decode ( 'utf8' ) | SINGLE_STMT | [["Insert", ["assignment", 1, 13, 3, 43], ["type", "N0"], 3], ["Insert", ["assignment", 1, 13, 3, 43], ["=:=", "T"], 4], ["Move", ["assignment", 1, 13, 3, 43], ["call", 3, 21, 3, 43], 5], ["Insert", "N0", ["identifier:content", "T"], 0], ["Delete", ["type", 3, 21, 3, 43]]] | zhijuebin/flask-admin@ecaa5d2c49aa63a12f40fa50186aa36b3b8712ab | Update fileadmin.py
Fixed #273 | [
{
"sha": "a82b661fc7bfe0be4057e147d042b3319cb950d1",
"filename": "flask_admin/contrib/fileadmin.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/ecaa5d2c49aa63a12f40fa50186aa36b3b8712ab/flask_admin%2Fcontrib%2Ffileadmin.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/ecaa5d2c49aa63a12f40fa50186aa36b3b8712ab/flask_admin%2Fcontrib%2Ffileadmin.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Ffileadmin.py?ref=ecaa5d2c49aa63a12f40fa50186aa36b3b8712ab",
"patch": "@@ -682,7 +682,7 @@ def edit(self):\n error = True\n else:\n try:\n- content.decode('utf8')\n+ content = content.decode('utf8')\n except UnicodeDecodeError:\n flash(gettext(\"Cannot edit %(name)s.\", name=path), 'error')\n error = True"
}
] |
flask-admin | 19975e865df5ba37cb490eae8902622a2268e5d1 | f3bf0722293d01cca599fa28c164a21169373050 | flask_admin/form/upload.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -85,7 +85,7 @@ class ImageUploadInput(object):
}
if field.data and isinstance(field.data, string_types):
- url = self.get_url()
+ url = self.get_url(field)
args['image'] = html_params(src=url)
template = self.data_template
| url = self . get_url ( ) | url = self . get_url ( field ) | SAME_FUNCTION_MORE_ARGS | [["Insert", ["argument_list", 3, 31, 3, 33], ["identifier:field", "T"], 1]] | zhijuebin/flask-admin@19975e865df5ba37cb490eae8902622a2268e5d1 | Typo fix | [
{
"sha": "94a7ba32efa04cbef52f5c71f1f423d32102ebd5",
"filename": "flask_admin/form/upload.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/19975e865df5ba37cb490eae8902622a2268e5d1/flask_admin%2Fform%2Fupload.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/19975e865df5ba37cb490eae8902622a2268e5d1/flask_admin%2Fform%2Fupload.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fform%2Fupload.py?ref=19975e865df5ba37cb490eae8902622a2268e5d1",
"patch": "@@ -85,7 +85,7 @@ def __call__(self, field, **kwargs):\n }\n \n if field.data and isinstance(field.data, string_types):\n- url = self.get_url()\n+ url = self.get_url(field)\n args['image'] = html_params(src=url)\n \n template = self.data_template"
}
] |
flask-admin | 4d9e1c3cc16d6125b86a5dd9f686ce87b892c968 | 19975e865df5ba37cb490eae8902622a2268e5d1 | flask_admin/model/template.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -5,7 +5,7 @@ def macro(name):
- def inner(context, model, column):
+ def inner(view, context, model, column):
m = context.resolve(name)
if not m:
| def inner ( context , model , column ) : m = context . resolve ( name ) if not m : | def inner ( view , context , model , column ) : m = context . resolve ( name ) if not m : | SINGLE_STMT | [["Move", ["identifier:context", 0, 15, 0, 22], ["parameters", 0, 14, 0, 38], 2], ["Move", ["identifier:model", 0, 24, 0, 29], ["parameters", 0, 14, 0, 38], 5], ["Insert", ["parameters", 0, 14, 0, 38], ["identifier:view", "T"], 1], ["Insert", ["parameters", 0, 14, 0, 38], [",:,", "T"], 5]] | zhijuebin/flask-admin@4d9e1c3cc16d6125b86a5dd9f686ce87b892c968 | Fixed template column formatter | [
{
"sha": "a1e4b0774333c1bb2114bfb89ce0759e25102ead",
"filename": "flask_admin/model/template.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/4d9e1c3cc16d6125b86a5dd9f686ce87b892c968/flask_admin%2Fmodel%2Ftemplate.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/4d9e1c3cc16d6125b86a5dd9f686ce87b892c968/flask_admin%2Fmodel%2Ftemplate.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fmodel%2Ftemplate.py?ref=4d9e1c3cc16d6125b86a5dd9f686ce87b892c968",
"patch": "@@ -5,7 +5,7 @@ def macro(name):\n :param name:\n Macro name in the current template\n '''\n- def inner(context, model, column):\n+ def inner(view, context, model, column):\n m = context.resolve(name)\n \n if not m:"
}
] |
flask-admin | 561f30036f32c003756a543f4380f022f5d1ab2c | f414e59a9fc83dcc380f3697b8b9e86abcff9a64 | flask_admin/contrib/sqla/form.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -105,7 +105,7 @@ class AdminModelConverter(ModelConverterBase):
return QuerySelectField(**kwargs)
elif prop.direction.name == 'ONETOMANY':
# Skip backrefs
- if not local_column.foreign_keys and getattr(self.view, 'column_hide_backrefs', False):
+ if not local_column.foreign_keys and getattr(self.view, 'column_hide_backrefs', True):
return None
return QuerySelectMultipleField(**kwargs)
| if not local_column . foreign_keys and getattr ( self . view , 'column_hide_backrefs' , False ) : return None | if not local_column . foreign_keys and getattr ( self . view , 'column_hide_backrefs' , True ) : return None | CHANGE_BOOLEAN_LITERAL | [["Insert", ["argument_list", 3, 57, 3, 99], ["true:True", "T"], 5], ["Delete", ["false:False", 3, 93, 3, 98]]] | zhijuebin/flask-admin@561f30036f32c003756a543f4380f022f5d1ab2c | Hide backrefs by default | [
{
"sha": "5628cdbe08cf19768f835db1e53c7f16bcdec3fa",
"filename": "flask_admin/contrib/sqla/form.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/561f30036f32c003756a543f4380f022f5d1ab2c/flask_admin%2Fcontrib%2Fsqla%2Fform.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/561f30036f32c003756a543f4380f022f5d1ab2c/flask_admin%2Fcontrib%2Fsqla%2Fform.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fsqla%2Fform.py?ref=561f30036f32c003756a543f4380f022f5d1ab2c",
"patch": "@@ -105,7 +105,7 @@ def _convert_relation(self, prop, kwargs):\n return QuerySelectField(**kwargs)\n elif prop.direction.name == 'ONETOMANY':\n # Skip backrefs\n- if not local_column.foreign_keys and getattr(self.view, 'column_hide_backrefs', False):\n+ if not local_column.foreign_keys and getattr(self.view, 'column_hide_backrefs', True):\n return None\n \n return QuerySelectMultipleField(**kwargs)"
}
] |
flask-admin | 7092764f0e9093767b4e7870df661e28daea54c0 | b55512265f5f69fa5e31227a83018ebd72e1b686 | flask_admin/contrib/mongoengine/view.py | https://github.com/zhijuebin/flask-admin | true | false | false | @@ -97,7 +97,7 @@ class ModelView(BaseModelView):
List of allowed search field types.
"""
- form_subdocuments = None
+ form_subdocuments = {}
"""
Subdocument configuration options.
| form_subdocuments = None | form_subdocuments = { } | SINGLE_STMT | [["Insert", ["assignment", 3, 5, 3, 29], ["dictionary", "N0"], 2], ["Insert", "N0", ["{:{", "T"], 0], ["Insert", "N0", ["}:}", "T"], 1], ["Delete", ["none:None", 3, 25, 3, 29]]] | zhijuebin/flask-admin@7092764f0e9093767b4e7870df661e28daea54c0 | form_subdocuments should be an empty dict
in this line https://github.com/mrjoes/flask-admin/blob/master/flask_admin/contrib/mongoengine/form.py#L44
None causes "NoneType" has no attr 'get' | [
{
"sha": "8fe0efb7a3c2ce320ba56990ddb9c57feafda0b6",
"filename": "flask_admin/contrib/mongoengine/view.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/7092764f0e9093767b4e7870df661e28daea54c0/flask_admin%2Fcontrib%2Fmongoengine%2Fview.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/7092764f0e9093767b4e7870df661e28daea54c0/flask_admin%2Fcontrib%2Fmongoengine%2Fview.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fmongoengine%2Fview.py?ref=7092764f0e9093767b4e7870df661e28daea54c0",
"patch": "@@ -97,7 +97,7 @@ class MyAdminView(ModelView):\n List of allowed search field types.\n \"\"\"\n \n- form_subdocuments = None\n+ form_subdocuments = {}\n \"\"\"\n Subdocument configuration options.\n "
}
] |
flask-admin | b354bf4c4e1a557815707eb8dedfaa4179d3061a | fe37f94c196a439a224389f2b9594a056e3c589f | flask_admin/form/upload.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -371,7 +371,7 @@ class ImageUploadField(FileUploadField):
filename, format = self._get_save_format(filename, self.image)
self._save_image(self._resize(self.image, self.max_size),
- path,
+ self._get_path(filename),
format)
else:
data.seek(0)
| self . _save_image ( self . _resize ( self . image , self . max_size ) , path , format ) | self . _save_image ( self . _resize ( self . image , self . max_size ) , self . _get_path ( filename ) , format ) | SINGLE_STMT | [["Insert", ["argument_list", 2, 29, 4, 37], ["call", "N0"], 3], ["Insert", "N0", ["attribute", "N1"], 0], ["Insert", "N0", ["argument_list", "N2"], 1], ["Update", ["identifier:path", 3, 30, 3, 34], "self"], ["Move", "N1", ["identifier:path", 3, 30, 3, 34], 0], ["Insert", "N1", [".:.", "T"], 1], ["Insert", "N1", ["identifier:_get_path", "T"], 2], ["Insert", "N2", ["(:(", "T"], 0], ["Insert", "N2", ["identifier:filename", "T"], 1], ["Insert", "N2", ["):)", "T"], 2]] | zhijuebin/flask-admin@b354bf4c4e1a557815707eb8dedfaa4179d3061a | a logic bug | [
{
"sha": "5ca08e7692ef2299bb339ffd44f516171151aeee",
"filename": "flask_admin/form/upload.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/b354bf4c4e1a557815707eb8dedfaa4179d3061a/flask_admin%2Fform%2Fupload.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/b354bf4c4e1a557815707eb8dedfaa4179d3061a/flask_admin%2Fform%2Fupload.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fform%2Fupload.py?ref=b354bf4c4e1a557815707eb8dedfaa4179d3061a",
"patch": "@@ -371,7 +371,7 @@ def _save_file(self, data, filename):\n filename, format = self._get_save_format(filename, self.image)\n \n self._save_image(self._resize(self.image, self.max_size),\n- path,\n+ self._get_path(filename),\n format)\n else:\n data.seek(0)"
}
] |
flask-admin | 5202791f5fd2a1b98a7aca4934ea15fa8071595d | 285b798f7c798f62c1be7ca88dbdf399849f60fb | flask_admin/tests/sqlamodel/test_basic.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -730,7 +730,7 @@ def test_ajax_fk():
client = app.test_client()
req = client.get(u'/admin/view/ajax/lookup/?name=model1&query=foo')
- eq_(req.data, u'[[%s, "foo"]]' % model2.id)
+ eq_(req.data.decode('utf-8'), u'[[%s, "foo"]]' % model2.id)
# Check submitting
req = client.post('/admin/view/new/', data={u'model1': as_unicode(model.id)})
| eq_ ( req . data , u'[[%s, "foo"]]' % model2 . id ) | eq_ ( req . data . decode ( 'utf-8' ) , u'[[%s, "foo"]]' % model2 . id ) | ADD_METHOD_CALL | [["Insert", ["argument_list", 3, 8, 3, 48], ["call", "N0"], 1], ["Insert", "N0", ["attribute", "N1"], 0], ["Insert", "N0", ["argument_list", "N2"], 1], ["Move", "N1", ["attribute", 3, 9, 3, 17], 0], ["Insert", "N1", [".:.", "T"], 1], ["Insert", "N1", ["identifier:decode", "T"], 2], ["Insert", "N2", ["(:(", "T"], 0], ["Insert", "N2", ["string:'utf-8'", "T"], 1], ["Insert", "N2", ["):)", "T"], 2]] | zhijuebin/flask-admin@5202791f5fd2a1b98a7aca4934ea15fa8071595d | Python 3 unit test fixes | [
{
"sha": "5cfd013a58ffcbe42be81c02b3790f149bf04092",
"filename": "flask_admin/tests/sqlamodel/test_basic.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/5202791f5fd2a1b98a7aca4934ea15fa8071595d/flask_admin%2Ftests%2Fsqlamodel%2Ftest_basic.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/5202791f5fd2a1b98a7aca4934ea15fa8071595d/flask_admin%2Ftests%2Fsqlamodel%2Ftest_basic.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Ftests%2Fsqlamodel%2Ftest_basic.py?ref=5202791f5fd2a1b98a7aca4934ea15fa8071595d",
"patch": "@@ -730,7 +730,7 @@ def test_ajax_fk():\n client = app.test_client()\n \n req = client.get(u'/admin/view/ajax/lookup/?name=model1&query=foo')\n- eq_(req.data, u'[[%s, \"foo\"]]' % model2.id)\n+ eq_(req.data.decode('utf-8'), u'[[%s, \"foo\"]]' % model2.id)\n \n # Check submitting\n req = client.post('/admin/view/new/', data={u'model1': as_unicode(model.id)})"
}
] |
flask-admin | b9d2fcd2d46486d2792756f1c324d98c4e62d473 | 97ec7f7c373cd57be21c316d7b3a914daa60eb52 | flask_admin/model/fields.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -183,7 +183,7 @@ class AjaxSelectMultipleField(AjaxSelectField):
# TODO: Optimize?
for item in formdata:
- model = self.loader.get_one(item)
+ model = self.loader.get_one(item) if item else None
if model:
data.append(model)
| model = self . loader . get_one ( item ) | model = self . loader . get_one ( item ) if item else None | SINGLE_STMT | [["Insert", ["assignment", 3, 17, 3, 50], ["conditional_expression", "N0"], 2], ["Move", "N0", ["call", 3, 25, 3, 50], 0], ["Insert", "N0", ["if:if", "T"], 1], ["Insert", "N0", ["identifier:item", "T"], 2], ["Insert", "N0", ["else:else", "T"], 3], ["Insert", "N0", ["none:None", "T"], 4]] | zhijuebin/flask-admin@b9d2fcd2d46486d2792756f1c324d98c4e62d473 | refs #3, fixed sqlalchemy.exc.DataError when saving empty AjaxSelectMultipleField | [
{
"sha": "e90c85dfac4dc5d598d0bbbb379f47660faf1da0",
"filename": "flask_admin/model/fields.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/b9d2fcd2d46486d2792756f1c324d98c4e62d473/flask_admin%2Fmodel%2Ffields.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/b9d2fcd2d46486d2792756f1c324d98c4e62d473/flask_admin%2Fmodel%2Ffields.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fmodel%2Ffields.py?ref=b9d2fcd2d46486d2792756f1c324d98c4e62d473",
"patch": "@@ -183,7 +183,7 @@ def _get_data(self):\n \n # TODO: Optimize?\n for item in formdata:\n- model = self.loader.get_one(item)\n+ model = self.loader.get_one(item) if item else None\n \n if model:\n data.append(model)"
}
] |
flask-admin | d2ed44771a22c0875ecaecede68829948e6563c0 | 45e3df591c577c367b0418e41948ae73fb338361 | flask_admin/form/fields.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -32,9 +32,9 @@ class TimeField(fields.Field):
super(TimeField, self).__init__(label, validators, **kwargs)
- self.format = formats or ('%H:%M:%S', '%H:%M',
- '%I:%M:%S%p', '%I:%M%p',
- '%I:%M:%S %p', '%I:%M %p')
+ self.formats = formats or ('%H:%M:%S', '%H:%M',
+ '%I:%M:%S%p', '%I:%M%p',
+ '%I:%M:%S %p', '%I:%M %p')
def _value(self):
if self.raw_data:
| self . format = formats or ( '%H:%M:%S' , '%H:%M' , '%I:%M:%S%p' , '%I:%M%p' , '%I:%M:%S %p' , '%I:%M %p' ) | self . formats = formats or ( '%H:%M:%S' , '%H:%M' , '%I:%M:%S%p' , '%I:%M%p' , '%I:%M:%S %p' , '%I:%M %p' ) | CHANGE_ATTRIBUTE_USED | [["Update", ["identifier:format", 2, 14, 2, 20], "formats"]] | zhijuebin/flask-admin@d2ed44771a22c0875ecaecede68829948e6563c0 | Update fields.py
Fixed #318. | [
{
"sha": "0f20aba6c3f0e3de5aef12ca943e5ab45f5f709f",
"filename": "flask_admin/form/fields.py",
"status": "modified",
"additions": 3,
"deletions": 3,
"changes": 6,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/d2ed44771a22c0875ecaecede68829948e6563c0/flask_admin%2Fform%2Ffields.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/d2ed44771a22c0875ecaecede68829948e6563c0/flask_admin%2Fform%2Ffields.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fform%2Ffields.py?ref=d2ed44771a22c0875ecaecede68829948e6563c0",
"patch": "@@ -32,9 +32,9 @@ def __init__(self, label=None, validators=None, formats=None, **kwargs):\n \"\"\"\n super(TimeField, self).__init__(label, validators, **kwargs)\n \n- self.format = formats or ('%H:%M:%S', '%H:%M',\n- '%I:%M:%S%p', '%I:%M%p',\n- '%I:%M:%S %p', '%I:%M %p')\n+ self.formats = formats or ('%H:%M:%S', '%H:%M',\n+ '%I:%M:%S%p', '%I:%M%p',\n+ '%I:%M:%S %p', '%I:%M %p')\n \n def _value(self):\n if self.raw_data:"
}
] |
flask-admin | ed68915e16ab298a3ca2f4e89a843a20ea16a853 | a42fdae26ab9153af6388b63c9dbc69e97245d9e | flask_admin/tests/test_base.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -229,7 +229,7 @@ def test_permissions():
view.allow_access = False
rv = client.get('/admin/mockview/')
- eq_(rv.status_code, 404)
+ eq_(rv.status_code, 403)
def get_visibility():
| eq_ ( rv . status_code , 404 ) | eq_ ( rv . status_code , 403 ) | CHANGE_NUMERIC_LITERAL | [["Update", ["integer:404", 3, 25, 3, 28], "403"]] | zhijuebin/flask-admin@ed68915e16ab298a3ca2f4e89a843a20ea16a853 | Fix test that I missed | [
{
"sha": "736db4e07a60ec2c3b2378d2576a94d77debdbd7",
"filename": "flask_admin/tests/test_base.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/ed68915e16ab298a3ca2f4e89a843a20ea16a853/flask_admin%2Ftests%2Ftest_base.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/ed68915e16ab298a3ca2f4e89a843a20ea16a853/flask_admin%2Ftests%2Ftest_base.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Ftests%2Ftest_base.py?ref=ed68915e16ab298a3ca2f4e89a843a20ea16a853",
"patch": "@@ -229,7 +229,7 @@ def test_permissions():\n view.allow_access = False\n \n rv = client.get('/admin/mockview/')\n- eq_(rv.status_code, 404)\n+ eq_(rv.status_code, 403)\n \n \n def get_visibility():"
}
] |
flask-admin | f8b0fe49fb62eb4416f320c5f084a8da77d00f82 | 586d057dea41e3b97ea7c51384c59bf591da5893 | flask_admin/contrib/sqla/view.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -636,7 +636,7 @@ class ModelView(BaseModelView):
table = mapper.tables[0]
if self._need_join(table) and table.name not in joins:
- query = query.join(table)
+ query = query.outerjoin(table)
joins.add(table.name)
elif isinstance(sort_field, Column):
pass
| query = query . join ( table ) | query = query . outerjoin ( table ) | WRONG_FUNCTION_NAME | [["Update", ["identifier:join", 3, 35, 3, 39], "outerjoin"]] | zhijuebin/flask-admin@f8b0fe49fb62eb4416f320c5f084a8da77d00f82 | fix sorting with null optional value | [
{
"sha": "a317c503599bb5a1631ce0cb2203e839159e5a87",
"filename": "flask_admin/contrib/sqla/view.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/f8b0fe49fb62eb4416f320c5f084a8da77d00f82/flask_admin%2Fcontrib%2Fsqla%2Fview.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/f8b0fe49fb62eb4416f320c5f084a8da77d00f82/flask_admin%2Fcontrib%2Fsqla%2Fview.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fsqla%2Fview.py?ref=f8b0fe49fb62eb4416f320c5f084a8da77d00f82",
"patch": "@@ -636,7 +636,7 @@ def _order_by(self, query, joins, sort_field, sort_desc):\n table = mapper.tables[0]\n \n if self._need_join(table) and table.name not in joins:\n- query = query.join(table)\n+ query = query.outerjoin(table)\n joins.add(table.name)\n elif isinstance(sort_field, Column):\n pass"
}
] |
flask-admin | 5a463f1d20530598fe0351e0775ae8e11b97334c | 9fea8c1d4f94239c9eb983752f13a82895e04949 | flask_admin/contrib/sqla/filters.py | https://github.com/zhijuebin/flask-admin | true | false | false | @@ -108,7 +108,7 @@ class FilterConverter(filters.BaseFilterConverter):
def conv_bool(self, column, name, **kwargs):
return [f(column, name, **kwargs) for f in self.bool]
- @filters.convert('Integer', 'SmallInteger', 'Numeric', 'Float')
+ @filters.convert('Integer', 'SmallInteger', 'Numeric', 'Float', 'BigInteger')
def conv_int(self, column, name, **kwargs):
return [f(column, name, **kwargs) for f in self.numeric]
| @ filters . convert ( 'Integer' , 'SmallInteger' , 'Numeric' , 'Float' ) def conv_int ( self , column , name , ** kwargs ) : return [ f ( column , name , ** kwargs ) for f in self . numeric ] | @ filters . convert ( 'Integer' , 'SmallInteger' , 'Numeric' , 'Float' , 'BigInteger' ) def conv_int ( self , column , name , ** kwargs ) : return [ f ( column , name , ** kwargs ) for f in self . numeric ] | SAME_FUNCTION_MORE_ARGS | [["Insert", ["argument_list", 3, 21, 3, 68], [",:,", "T"], 8], ["Insert", ["argument_list", 3, 21, 3, 68], ["string:'BigInteger'", "T"], 9]] | zhijuebin/flask-admin@5a463f1d20530598fe0351e0775ae8e11b97334c | Fixed #335. BigInt support | [
{
"sha": "0c1a1cac27edbf6f6f4b05b90bef8825508d6efc",
"filename": "flask_admin/contrib/sqla/filters.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/5a463f1d20530598fe0351e0775ae8e11b97334c/flask_admin%2Fcontrib%2Fsqla%2Ffilters.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/5a463f1d20530598fe0351e0775ae8e11b97334c/flask_admin%2Fcontrib%2Fsqla%2Ffilters.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fsqla%2Ffilters.py?ref=5a463f1d20530598fe0351e0775ae8e11b97334c",
"patch": "@@ -108,7 +108,7 @@ def conv_string(self, column, name, **kwargs):\n def conv_bool(self, column, name, **kwargs):\n return [f(column, name, **kwargs) for f in self.bool]\n \n- @filters.convert('Integer', 'SmallInteger', 'Numeric', 'Float')\n+ @filters.convert('Integer', 'SmallInteger', 'Numeric', 'Float', 'BigInteger')\n def conv_int(self, column, name, **kwargs):\n return [f(column, name, **kwargs) for f in self.numeric]\n "
}
] |
flask-admin | 71799b603b6547e9a207487c4e945b18d52d5363 | 652cfe3d1d5602cc041d149f3038fff74bcb5c39 | flask_admin/model/fields.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -76,7 +76,7 @@ class InlineFieldList(FieldList):
_fake = type(str('_fake'), (object, ), {})
output = []
- for field, data in itertools.izip(self.entries, candidates):
+ for field, data in zip(self.entries, candidates):
if not self.should_delete(field):
fake_obj = _fake()
fake_obj.data = data
| for field , data in itertools . izip ( self . entries , candidates ) : if not self . should_delete ( field ) : fake_obj = _fake ( ) fake_obj . data = data | for field , data in zip ( self . entries , candidates ) : if not self . should_delete ( field ) : fake_obj = _fake ( ) fake_obj . data = data | SINGLE_STMT | [["Update", ["identifier:itertools", 3, 28, 3, 37], "zip"], ["Move", ["call", 3, 28, 3, 68], ["identifier:itertools", 3, 28, 3, 37], 0], ["Delete", [".:.", 3, 37, 3, 38]], ["Delete", ["identifier:izip", 3, 38, 3, 42]], ["Delete", ["attribute", 3, 28, 3, 42]]] | zhijuebin/flask-admin@71799b603b6547e9a207487c4e945b18d52d5363 | Fixed Python 3.3 compatibility when submitting inline model | [
{
"sha": "7186bd31fe0ffe269d650a6278228ada6af10a60",
"filename": "flask_admin/model/fields.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/71799b603b6547e9a207487c4e945b18d52d5363/flask_admin%2Fmodel%2Ffields.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/71799b603b6547e9a207487c4e945b18d52d5363/flask_admin%2Fmodel%2Ffields.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fmodel%2Ffields.py?ref=71799b603b6547e9a207487c4e945b18d52d5363",
"patch": "@@ -76,7 +76,7 @@ def populate_obj(self, obj, name):\n _fake = type(str('_fake'), (object, ), {})\n \n output = []\n- for field, data in itertools.izip(self.entries, candidates):\n+ for field, data in zip(self.entries, candidates):\n if not self.should_delete(field):\n fake_obj = _fake()\n fake_obj.data = data"
}
] |
flask-admin | 3877e689fa732fdaaa537c5a14e88d84dc89f1e3 | 794aa7767bcbfe85b5e0611b4df606f402db5b13 | flask_admin/_compat.py | https://github.com/zhijuebin/flask-admin | true | false | false | @@ -49,7 +49,7 @@ else:
return unicode(s)
# Helpers
- reduce = __builtins__['reduce']
+ reduce = __builtins__.reduce
from urlparse import urljoin
| reduce = __builtins__ [ 'reduce' ] | reduce = __builtins__ . reduce | SINGLE_STMT | [["Insert", ["assignment", 3, 5, 3, 36], ["attribute", "N0"], 2], ["Move", "N0", ["identifier:__builtins__", 3, 14, 3, 26], 0], ["Insert", "N0", [".:.", "T"], 1], ["Insert", "N0", ["identifier:reduce", "T"], 2], ["Delete", ["[:[", 3, 26, 3, 27]], ["Delete", ["string:'reduce'", 3, 27, 3, 35]], ["Delete", ["]:]", 3, 35, 3, 36]], ["Delete", ["subscript", 3, 14, 3, 36]]] | zhijuebin/flask-admin@3877e689fa732fdaaa537c5a14e88d84dc89f1e3 | Fix compat for CPython/PyPy 2.x
__builtins__ should be accessed as a module, not a dict. | [
{
"sha": "3cf78f2f58ef29cd0d3f460a99c42aa7bbb7d52c",
"filename": "flask_admin/_compat.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/3877e689fa732fdaaa537c5a14e88d84dc89f1e3/flask_admin%2F_compat.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/3877e689fa732fdaaa537c5a14e88d84dc89f1e3/flask_admin%2F_compat.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2F_compat.py?ref=3877e689fa732fdaaa537c5a14e88d84dc89f1e3",
"patch": "@@ -49,7 +49,7 @@ def as_unicode(s):\n return unicode(s)\n \n # Helpers\n- reduce = __builtins__['reduce']\n+ reduce = __builtins__.reduce\n from urlparse import urljoin\n \n "
}
] |
flask-admin | 0c3847df3b90638e4105004813239e761a7c95ac | c031e1e90f6004e661da17a1f96c47aa0262dd9c | flask_admin/contrib/mongoengine/filters.py | https://github.com/zhijuebin/flask-admin | true | false | false | @@ -107,7 +107,7 @@ class FilterConverter(filters.BaseFilterConverter):
return None
- @filters.convert('StringField')
+ @filters.convert('StringField', 'EmailField')
def conv_string(self, column, name):
return [f(column, name) for f in self.strings]
| @ filters . convert ( 'StringField' ) def conv_string ( self , column , name ) : return [ f ( column , name ) for f in self . strings ] | @ filters . convert ( 'StringField' , 'EmailField' ) def conv_string ( self , column , name ) : return [ f ( column , name ) for f in self . strings ] | SAME_FUNCTION_MORE_ARGS | [["Insert", ["argument_list", 3, 21, 3, 36], [",:,", "T"], 2], ["Insert", ["argument_list", 3, 21, 3, 36], ["string:'EmailField'", "T"], 3]] | zhijuebin/flask-admin@0c3847df3b90638e4105004813239e761a7c95ac | Fixed #400. Support EmailField filter | [
{
"sha": "e5bda3c86fb456ea999d03044a11823798039fa3",
"filename": "flask_admin/contrib/mongoengine/filters.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/0c3847df3b90638e4105004813239e761a7c95ac/flask_admin%2Fcontrib%2Fmongoengine%2Ffilters.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/0c3847df3b90638e4105004813239e761a7c95ac/flask_admin%2Fcontrib%2Fmongoengine%2Ffilters.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fmongoengine%2Ffilters.py?ref=0c3847df3b90638e4105004813239e761a7c95ac",
"patch": "@@ -107,7 +107,7 @@ def convert(self, type_name, column, name):\n \n return None\n \n- @filters.convert('StringField')\n+ @filters.convert('StringField', 'EmailField')\n def conv_string(self, column, name):\n return [f(column, name) for f in self.strings]\n "
}
] |
flask-admin | 0b81e59dad0cf9a8f28042903105bffa5eddc9e8 | ac8392b83591e9a5120b5ca38689e646cace9006 | flask_admin/form/upload.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -106,7 +106,7 @@ class ImageUploadInput(object):
if field.url_relative_path:
filename = urljoin(field.url_relative_path, filename)
- return url_for(field.endpoint, filename=field.data)
+ return url_for(field.endpoint, filename=filename)
# Fields
| return url_for ( field . endpoint , filename = field . data ) | return url_for ( field . endpoint , filename = filename ) | SINGLE_STMT | [["Update", ["identifier:field", 3, 49, 3, 54], "filename"], ["Move", ["keyword_argument", 3, 40, 3, 59], ["identifier:field", 3, 49, 3, 54], 2], ["Delete", [".:.", 3, 54, 3, 55]], ["Delete", ["identifier:data", 3, 55, 3, 59]], ["Delete", ["attribute", 3, 49, 3, 59]]] | zhijuebin/flask-admin@0b81e59dad0cf9a8f28042903105bffa5eddc9e8 | Fixed #431. Fixed typo in ImageUploadField. | [
{
"sha": "b82ef0292a72dac7e9f45a8216b0c6de58b52c1e",
"filename": "flask_admin/form/upload.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/0b81e59dad0cf9a8f28042903105bffa5eddc9e8/flask_admin%2Fform%2Fupload.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/0b81e59dad0cf9a8f28042903105bffa5eddc9e8/flask_admin%2Fform%2Fupload.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fform%2Fupload.py?ref=0b81e59dad0cf9a8f28042903105bffa5eddc9e8",
"patch": "@@ -106,7 +106,7 @@ def get_url(self, field):\n if field.url_relative_path:\n filename = urljoin(field.url_relative_path, filename)\n \n- return url_for(field.endpoint, filename=field.data)\n+ return url_for(field.endpoint, filename=filename)\n \n \n # Fields"
}
] |
flask-admin | d432efeb7bf2654d79fba3ace3df31d2357ba865 | 8b1e0fc2252e2e333f54982ac2cde027b359adad | flask_admin/contrib/fileadmin.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -672,7 +672,7 @@ class FileAdmin(BaseView, ActionsMixin):
base_path, full_path, path = self._normalize_path(path)
- if not self.is_accessible_path(path):
+ if not self.is_accessible_path(path) or not self.is_file_editable(path):
flash(gettext(gettext('Permission denied.')))
return redirect(self._get_dir_url('.index'))
| if not self . is_accessible_path ( path ) : flash ( gettext ( gettext ( 'Permission denied.' ) ) ) return redirect ( self . _get_dir_url ( '.index' ) ) | if not self . is_accessible_path ( path ) or not self . is_file_editable ( path ) : flash ( gettext ( gettext ( 'Permission denied.' ) ) ) return redirect ( self . _get_dir_url ( '.index' ) ) | LESS_SPECIFIC_IF | [["Insert", ["not_operator", 3, 12, 3, 45], ["boolean_operator", "N0"], 1], ["Move", "N0", ["call", 3, 16, 3, 45], 0], ["Insert", "N0", ["or:or", "T"], 1], ["Insert", "N0", ["not_operator", "N1"], 2], ["Insert", "N1", ["not:not", "T"], 0], ["Insert", "N1", ["call", "N2"], 1], ["Insert", "N2", ["attribute", "N3"], 0], ["Insert", "N2", ["argument_list", "N4"], 1], ["Insert", "N3", ["identifier:self", "T"], 0], ["Insert", "N3", [".:.", "T"], 1], ["Insert", "N3", ["identifier:is_file_editable", "T"], 2], ["Insert", "N4", ["(:(", "T"], 0], ["Insert", "N4", ["identifier:path", "T"], 1], ["Insert", "N4", ["):)", "T"], 2]] | zhijuebin/flask-admin@d432efeb7bf2654d79fba3ace3df31d2357ba865 | Fixed #437. Additionally check if file is editable | [
{
"sha": "31708bd8b400022c80c7a6a4ef4f88145acd021f",
"filename": "flask_admin/contrib/fileadmin.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/d432efeb7bf2654d79fba3ace3df31d2357ba865/flask_admin%2Fcontrib%2Ffileadmin.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/d432efeb7bf2654d79fba3ace3df31d2357ba865/flask_admin%2Fcontrib%2Ffileadmin.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Ffileadmin.py?ref=d432efeb7bf2654d79fba3ace3df31d2357ba865",
"patch": "@@ -672,7 +672,7 @@ def edit(self):\n \n base_path, full_path, path = self._normalize_path(path)\n \n- if not self.is_accessible_path(path):\n+ if not self.is_accessible_path(path) or not self.is_file_editable(path):\n flash(gettext(gettext('Permission denied.')))\n return redirect(self._get_dir_url('.index'))\n "
}
] |
flask-admin | 94c1c684e1dcdf15ae36e0db152be9c576bcd387 | cb9f797c92e9ace58d6dad7fe36c8419a98072a1 | flask_admin/form/upload.py | https://github.com/zhijuebin/flask-admin | true | false | false | @@ -332,7 +332,7 @@ class ImageUploadField(FileUploadField):
# Check if PIL is installed
if Image is None:
- raise Exception('PIL library was not found')
+ raise ImportError('PIL library was not found')
self.max_size = max_size
self.thumbnail_fn = thumbgen or thumbgen_filename
| raise Exception ( 'PIL library was not found' ) | raise ImportError ( 'PIL library was not found' ) | WRONG_FUNCTION_NAME | [["Update", ["identifier:Exception", 2, 19, 2, 28], "ImportError"]] | zhijuebin/flask-admin@94c1c684e1dcdf15ae36e0db152be9c576bcd387 | Raise ImportError instead of Exception for an import error
The issue at hand is in fact an error on import, and more specific exceptions are nicer to work with. | [
{
"sha": "f58de58d8b602949070620ab0aae15bfd66052aa",
"filename": "flask_admin/form/upload.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/94c1c684e1dcdf15ae36e0db152be9c576bcd387/flask_admin%2Fform%2Fupload.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/94c1c684e1dcdf15ae36e0db152be9c576bcd387/flask_admin%2Fform%2Fupload.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fform%2Fupload.py?ref=94c1c684e1dcdf15ae36e0db152be9c576bcd387",
"patch": "@@ -332,7 +332,7 @@ class MyForm(BaseForm):\n \"\"\"\n # Check if PIL is installed\n if Image is None:\n- raise Exception('PIL library was not found')\n+ raise ImportError('PIL library was not found')\n \n self.max_size = max_size\n self.thumbnail_fn = thumbgen or thumbgen_filename"
}
] |
flask-admin | fb0f7f8c21dbf310a9a8d5c3bcf734a5d6e021cd | eddbd660d7fd063736a087ef4a9af0e2e3424cff | flask_admin/form/upload.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -178,7 +178,7 @@ class FileUploadField(fields.TextField):
return ('.' in filename and
filename.rsplit('.', 1)[1].lower() in
- map(str.lower, self.allowed_extensions))
+ map(lambda x: x.lower(), self.allowed_extensions))
def pre_validate(self, form):
if (self.data and
| return ( '.' in filename and filename . rsplit ( '.' , 1 ) [ 1 ] . lower ( ) in map ( str . lower , self . allowed_extensions ) ) | return ( '.' in filename and filename . rsplit ( '.' , 1 ) [ 1 ] . lower ( ) in map ( lambda x : x . lower ( ) , self . allowed_extensions ) ) | SINGLE_STMT | [["Insert", ["argument_list", 3, 20, 3, 56], ["lambda", "N0"], 1], ["Insert", "N0", ["lambda:lambda", "T"], 0], ["Insert", "N0", ["lambda_parameters", "N1"], 1], ["Insert", "N0", [":::", "T"], 2], ["Insert", "N0", ["call", "N2"], 3], ["Insert", "N1", ["identifier:x", "T"], 0], ["Move", "N2", ["attribute", 3, 21, 3, 30], 0], ["Insert", "N2", ["argument_list", "N3"], 1], ["Update", ["identifier:str", 3, 21, 3, 24], "x"], ["Insert", "N3", ["(:(", "T"], 0], ["Insert", "N3", ["):)", "T"], 1]] | zhijuebin/flask-admin@fb0f7f8c21dbf310a9a8d5c3bcf734a5d6e021cd | Fix 'TypeError: descriptor 'lower' requires a 'str' object but received a 'unicode'' | [
{
"sha": "ff40a2d3f8640611dbe8e8e8c1795c98c2ec36f4",
"filename": "flask_admin/form/upload.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/fb0f7f8c21dbf310a9a8d5c3bcf734a5d6e021cd/flask_admin%2Fform%2Fupload.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/fb0f7f8c21dbf310a9a8d5c3bcf734a5d6e021cd/flask_admin%2Fform%2Fupload.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fform%2Fupload.py?ref=fb0f7f8c21dbf310a9a8d5c3bcf734a5d6e021cd",
"patch": "@@ -178,7 +178,7 @@ def is_file_allowed(self, filename):\n \n return ('.' in filename and\n filename.rsplit('.', 1)[1].lower() in\n- map(str.lower, self.allowed_extensions))\n+ map(lambda x: x.lower(), self.allowed_extensions))\n \n def pre_validate(self, form):\n if (self.data and"
}
] |
flask-admin | 3a59d581f11989ccb456327016d1ae00f00d28ec | a76c004d22cce82dab685b67ae1a2b51be2b8bd7 | flask_admin/model/base.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -1272,7 +1272,7 @@ class BaseModelView(BaseView, ActionsMixin):
return redirect(return_url)
form_opts = FormOpts(widget_args=self.form_widget_args,
- form_rules=self._form_create_rules)
+ form_rules=self._form_edit_rules)
return self.render(self.edit_template,
model=model,
| form_opts = FormOpts ( widget_args = self . form_widget_args , form_rules = self . _form_create_rules ) | form_opts = FormOpts ( widget_args = self . form_widget_args , form_rules = self . _form_edit_rules ) | CHANGE_ATTRIBUTE_USED | [["Update", ["identifier:_form_create_rules", 3, 46, 3, 64], "_form_edit_rules"]] | zhijuebin/flask-admin@3a59d581f11989ccb456327016d1ae00f00d28ec | Fix small typo | [
{
"sha": "5394144224fcaf72869fc3e73af9d2974a329982",
"filename": "flask_admin/model/base.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/3a59d581f11989ccb456327016d1ae00f00d28ec/flask_admin%2Fmodel%2Fbase.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/3a59d581f11989ccb456327016d1ae00f00d28ec/flask_admin%2Fmodel%2Fbase.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fmodel%2Fbase.py?ref=3a59d581f11989ccb456327016d1ae00f00d28ec",
"patch": "@@ -1272,7 +1272,7 @@ def edit_view(self):\n return redirect(return_url)\n \n form_opts = FormOpts(widget_args=self.form_widget_args,\n- form_rules=self._form_create_rules)\n+ form_rules=self._form_edit_rules)\n \n return self.render(self.edit_template,\n model=model,"
}
] |
flask-admin | d6dbefffb3f59464da529614001ae37398ccbf89 | d8f23e3d701743fa061708dfc2df6eb7b1fffc29 | flask_admin/tests/test_base.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -152,7 +152,7 @@ def test_baseview_registration():
# Verify generated blueprint properties
eq_(bp.name, view.endpoint)
eq_(bp.url_prefix, view.url)
- eq_(bp.template_folder, 'templates')
+ eq_(bp.template_folder, 'templates/bootstrap2')
eq_(bp.static_folder, view.static_folder)
# Verify customizations
| eq_ ( bp . template_folder , 'templates' ) | eq_ ( bp . template_folder , 'templates/bootstrap2' ) | CHANGE_STRING_LITERAL | [["Update", ["string:'templates'", 3, 29, 3, 40], "'templates/bootstrap2'"]] | zhijuebin/flask-admin@d6dbefffb3f59464da529614001ae37398ccbf89 | Fixed unit tests | [
{
"sha": "6e26ea87850f035f11d1ec6297b60fe3e5bf3079",
"filename": "flask_admin/tests/test_base.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/d6dbefffb3f59464da529614001ae37398ccbf89/flask_admin%2Ftests%2Ftest_base.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/d6dbefffb3f59464da529614001ae37398ccbf89/flask_admin%2Ftests%2Ftest_base.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Ftests%2Ftest_base.py?ref=d6dbefffb3f59464da529614001ae37398ccbf89",
"patch": "@@ -152,7 +152,7 @@ def test_baseview_registration():\n # Verify generated blueprint properties\n eq_(bp.name, view.endpoint)\n eq_(bp.url_prefix, view.url)\n- eq_(bp.template_folder, 'templates')\n+ eq_(bp.template_folder, 'templates/bootstrap2')\n eq_(bp.static_folder, view.static_folder)\n \n # Verify customizations"
}
] |
flask-admin | dbff38e564f2f44689cff74c147c77c52d78afd9 | 911be8015310140c2e57c334c653e78db00ab4f8 | flask_admin/contrib/sqla/form.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -563,7 +563,7 @@ class InlineModelConverter(InlineModelConverterBase):
if prop.direction.name == 'MANYTOONE':
candidate = 'ONETOMANY'
else:
- candidate = 'MANYTOONE'
+ candidate = 'MANYTOMANY'
for prop in mapper.iterate_properties:
if hasattr(prop, 'direction') and prop.direction.name == candidate:
| candidate = 'MANYTOONE' | candidate = 'MANYTOMANY' | CHANGE_STRING_LITERAL | [["Update", ["string:'MANYTOONE'", 3, 25, 3, 36], "'MANYTOMANY'"]] | zhijuebin/flask-admin@dbff38e564f2f44689cff74c147c77c52d78afd9 | Typo fix | [
{
"sha": "3d08a9f4f3b4ebf18686c06de409d8235e554ea8",
"filename": "flask_admin/contrib/sqla/form.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/dbff38e564f2f44689cff74c147c77c52d78afd9/flask_admin%2Fcontrib%2Fsqla%2Fform.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/dbff38e564f2f44689cff74c147c77c52d78afd9/flask_admin%2Fcontrib%2Fsqla%2Fform.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fsqla%2Fform.py?ref=dbff38e564f2f44689cff74c147c77c52d78afd9",
"patch": "@@ -563,7 +563,7 @@ def contribute(self, model, form_class, inline_model):\n if prop.direction.name == 'MANYTOONE':\n candidate = 'ONETOMANY'\n else:\n- candidate = 'MANYTOONE'\n+ candidate = 'MANYTOMANY'\n \n for prop in mapper.iterate_properties:\n if hasattr(prop, 'direction') and prop.direction.name == candidate:"
}
] |
flask-admin | eddc1e17938a059f28cd3830b0fd1f2b418b2c33 | dbff38e564f2f44689cff74c147c77c52d78afd9 | flask_admin/form/upload.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -392,7 +392,7 @@ class ImageUploadField(FileUploadField):
self._save_image(image, self._get_path(filename), format)
else:
data.seek(0)
- data.save(path)
+ data.save( self._get_path(filename) )
self._save_thumbnail(data, filename, format)
| data . save ( path ) | data . save ( self . _get_path ( filename ) ) | SINGLE_STMT | [["Insert", ["argument_list", 3, 22, 3, 28], ["call", "N0"], 1], ["Insert", ["argument_list", 3, 22, 3, 28], ["):)", "T"], 2], ["Insert", "N0", ["attribute", "N1"], 0], ["Insert", "N0", ["argument_list", "N2"], 1], ["Insert", "N1", ["identifier:self", "T"], 0], ["Insert", "N1", [".:.", "T"], 1], ["Insert", "N1", ["identifier:_get_path", "T"], 2], ["Insert", "N2", ["(:(", "T"], 0], ["Update", ["identifier:path", 3, 23, 3, 27], "filename"], ["Move", "N2", ["identifier:path", 3, 23, 3, 27], 1], ["Move", "N2", ["):)", 3, 27, 3, 28], 2]] | zhijuebin/flask-admin@eddc1e17938a059f28cd3830b0fd1f2b418b2c33 | A proposal to fix https://github.com/mrjoes/flask-admin/issues/532
From the issue:
If an image extension is 'jpeg' (not 'jpg'), then inside
ImageUploadField._save_file() the call to self._get_save_format() enters
the if-statement where the filename is changed to ${name}.jpg. The
format stays unchanged, though, because it's the same 'JPEG'. As a
result, the original filename is preserved on disk, which is
${name}.jpeg, but _save_file() returns ${name}.jpg.
self._save_thumbnail(data, filename, format) saves the thumbnail file
under ${name}_thumb.jpg
At the time when ImageUploadField._save_file() is finished, two files
are created:
${name}.jpeg
${name}_thumb.jpg
Would you consider changing
def _save_file(self, data, filename):
...
data.save(path)
to
data.save( self._get_path(filename) )
In that case the original image will be saved with the updated filename
after self._get_save_format(filename, self.image) | [
{
"sha": "0c4c73e2115b957e1257960550c786a38cfa28ac",
"filename": "flask_admin/form/upload.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/eddc1e17938a059f28cd3830b0fd1f2b418b2c33/flask_admin%2Fform%2Fupload.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/eddc1e17938a059f28cd3830b0fd1f2b418b2c33/flask_admin%2Fform%2Fupload.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fform%2Fupload.py?ref=eddc1e17938a059f28cd3830b0fd1f2b418b2c33",
"patch": "@@ -392,7 +392,7 @@ def _save_file(self, data, filename):\n self._save_image(image, self._get_path(filename), format)\n else:\n data.seek(0)\n- data.save(path)\n+ data.save( self._get_path(filename) )\n \n self._save_thumbnail(data, filename, format)\n "
}
] |
flask-admin | e0b511922017f8475ee978c73f74a33fb6afcf75 | 72dd1157c4914d0f510898ed960d465abc928125 | flask_admin/form/upload.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -182,7 +182,7 @@ class FileUploadField(fields.TextField):
def pre_validate(self, form):
if (self.data
- and len(self.data.filename)
+ and self.data.filename
and isinstance(self.data, FileStorage)
and not self.is_file_allowed(self.data.filename)):
raise ValidationError(gettext('Invalid file extension'))
| if ( self . data and len ( self . data . filename ) and isinstance ( self . data , FileStorage ) and not self . is_file_allowed ( self . data . filename ) ) : raise ValidationError ( gettext ( 'Invalid file extension' ) ) | if ( self . data and self . data . filename and isinstance ( self . data , FileStorage ) and not self . is_file_allowed ( self . data . filename ) ) : raise ValidationError ( gettext ( 'Invalid file extension' ) ) | CHANGE_BINARY_OPERAND | [["Move", ["boolean_operator", 2, 13, 3, 44], ["attribute", 3, 25, 3, 43], 2], ["Delete", ["identifier:len", 3, 21, 3, 24]], ["Delete", ["(:(", 3, 24, 3, 25]], ["Delete", ["):)", 3, 43, 3, 44]], ["Delete", ["argument_list", 3, 24, 3, 44]], ["Delete", ["call", 3, 21, 3, 44]]] | zhijuebin/flask-admin@e0b511922017f8475ee978c73f74a33fb6afcf75 | Style fix | [
{
"sha": "013c49e73ad9d32a7bba7b39bc67fa93832c3e8d",
"filename": "flask_admin/form/upload.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/e0b511922017f8475ee978c73f74a33fb6afcf75/flask_admin%2Fform%2Fupload.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/e0b511922017f8475ee978c73f74a33fb6afcf75/flask_admin%2Fform%2Fupload.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fform%2Fupload.py?ref=e0b511922017f8475ee978c73f74a33fb6afcf75",
"patch": "@@ -182,7 +182,7 @@ def is_file_allowed(self, filename):\n \n def pre_validate(self, form):\n if (self.data\n- and len(self.data.filename)\n+ and self.data.filename\n and isinstance(self.data, FileStorage)\n and not self.is_file_allowed(self.data.filename)):\n raise ValidationError(gettext('Invalid file extension'))"
}
] |
flask-admin | fa544a3fd490f5d2db744838057c60713b88114a | 31459e55e8ec41ac25aaf04c17ba8fa6a139548a | flask_admin/contrib/sqla/filters.py | https://github.com/zhijuebin/flask-admin | true | false | false | @@ -100,7 +100,7 @@ class FilterConverter(filters.BaseFilterConverter):
return None
- @filters.convert('string', 'unicode', 'text', 'unicodetext')
+ @filters.convert('string', 'unicode', 'text', 'unicodetext', 'varchar')
def conv_string(self, column, name, **kwargs):
return [f(column, name, **kwargs) for f in self.strings]
| @ filters . convert ( 'string' , 'unicode' , 'text' , 'unicodetext' ) def conv_string ( self , column , name , ** kwargs ) : return [ f ( column , name , ** kwargs ) for f in self . strings ] | @ filters . convert ( 'string' , 'unicode' , 'text' , 'unicodetext' , 'varchar' ) def conv_string ( self , column , name , ** kwargs ) : return [ f ( column , name , ** kwargs ) for f in self . strings ] | SAME_FUNCTION_MORE_ARGS | [["Insert", ["argument_list", 3, 21, 3, 65], [",:,", "T"], 8], ["Insert", ["argument_list", 3, 21, 3, 65], ["string:'varchar'", "T"], 9]] | zhijuebin/flask-admin@fa544a3fd490f5d2db744838057c60713b88114a | Add varchar to prevent unsupported filter error | [
{
"sha": "59417cbaa3d51074c4387ab0654c2f09b9b84bc6",
"filename": "flask_admin/contrib/sqla/filters.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/fa544a3fd490f5d2db744838057c60713b88114a/flask_admin%2Fcontrib%2Fsqla%2Ffilters.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/fa544a3fd490f5d2db744838057c60713b88114a/flask_admin%2Fcontrib%2Fsqla%2Ffilters.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fsqla%2Ffilters.py?ref=fa544a3fd490f5d2db744838057c60713b88114a",
"patch": "@@ -100,7 +100,7 @@ def convert(self, type_name, column, name, **kwargs):\n \n return None\n \n- @filters.convert('string', 'unicode', 'text', 'unicodetext')\n+ @filters.convert('string', 'unicode', 'text', 'unicodetext', 'varchar')\n def conv_string(self, column, name, **kwargs):\n return [f(column, name, **kwargs) for f in self.strings]\n "
}
] |
flask-admin | 5a3918c596fc4050c6e514a5f5a72527eed8d679 | ee4f459448120b78588b176b59b4b03e8295d2cb | flask_admin/contrib/pymongo/tools.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -6,7 +6,7 @@ def parse_like_term(term):
if term.startswith('^'):
- return '^%s' % term[1]
+ return '^%s' % term[1:]
elif term.startswith('='):
return '^%s$' % term[1:]
| return '^%s' % term [ 1 ] | return '^%s' % term [ 1 : ] | SINGLE_STMT | [["Insert", ["subscript", 1, 24, 1, 31], ["slice", "N0"], 2], ["Move", "N0", ["integer:1", 1, 29, 1, 30], 0], ["Insert", "N0", [":::", "T"], 1]] | zhijuebin/flask-admin@5a3918c596fc4050c6e514a5f5a72527eed8d679 | fix substring typo | [
{
"sha": "808ada2131411ac27fcc10318291fc851f7fe8aa",
"filename": "flask_admin/contrib/pymongo/tools.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/5a3918c596fc4050c6e514a5f5a72527eed8d679/flask_admin%2Fcontrib%2Fpymongo%2Ftools.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/5a3918c596fc4050c6e514a5f5a72527eed8d679/flask_admin%2Fcontrib%2Fpymongo%2Ftools.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fpymongo%2Ftools.py?ref=5a3918c596fc4050c6e514a5f5a72527eed8d679",
"patch": "@@ -6,7 +6,7 @@ def parse_like_term(term):\n Search term\n \"\"\"\n if term.startswith('^'):\n- return '^%s' % term[1]\n+ return '^%s' % term[1:]\n elif term.startswith('='):\n return '^%s$' % term[1:]\n "
}
] |
flask-admin | 91a922b709000b31aa4ee61959044a36cc8d8b86 | 7a3ae36c29ec197344258ba59e5c3bcb4e162c7d | flask_admin/form/upload.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -204,7 +204,7 @@ class FileUploadField(fields.TextField):
setattr(obj, name, None)
return
- if self.data and isinstance(self.data, FileStorage):
+ if self.data and self.data.filename and isinstance(self.data, FileStorage):
if field:
self._delete_file(field)
| if self . data and isinstance ( self . data , FileStorage ) : if field : self . _delete_file ( field ) | if self . data and self . data . filename and isinstance ( self . data , FileStorage ) : if field : self . _delete_file ( field ) | MORE_SPECIFIC_IF | [["Insert", ["boolean_operator", 3, 12, 3, 60], ["boolean_operator", "N0"], 0], ["Insert", ["boolean_operator", 3, 12, 3, 60], ["and:and", "T"], 1], ["Move", "N0", ["attribute", 3, 12, 3, 21], 0], ["Move", "N0", ["and:and", 3, 22, 3, 25], 1], ["Insert", "N0", ["attribute", "N1"], 2], ["Insert", "N1", ["attribute", "N2"], 0], ["Insert", "N1", [".:.", "T"], 1], ["Insert", "N1", ["identifier:filename", "T"], 2], ["Insert", "N2", ["identifier:self", "T"], 0], ["Insert", "N2", [".:.", "T"], 1], ["Insert", "N2", ["identifier:data", "T"], 2]] | zhijuebin/flask-admin@91a922b709000b31aa4ee61959044a36cc8d8b86 | Fixed upload with no new file issue | [
{
"sha": "473deff52788a653d97989baeab5c371ec2a3fe9",
"filename": "flask_admin/form/upload.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/91a922b709000b31aa4ee61959044a36cc8d8b86/flask_admin%2Fform%2Fupload.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/91a922b709000b31aa4ee61959044a36cc8d8b86/flask_admin%2Fform%2Fupload.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fform%2Fupload.py?ref=91a922b709000b31aa4ee61959044a36cc8d8b86",
"patch": "@@ -204,7 +204,7 @@ def populate_obj(self, obj, name):\n setattr(obj, name, None)\n return\n \n- if self.data and isinstance(self.data, FileStorage):\n+ if self.data and self.data.filename and isinstance(self.data, FileStorage):\n if field:\n self._delete_file(field)\n "
}
] |
flask-admin | 19025b97d38706eda4f425667b69f7803a39ca35 | 2b8d7721b74be72414f73b326c08ad339a53d9c6 | flask_admin/contrib/sqla/filters.py | https://github.com/zhijuebin/flask-admin | true | false | false | @@ -104,7 +104,7 @@ class FilterConverter(filters.BaseFilterConverter):
def conv_string(self, column, name, **kwargs):
return [f(column, name, **kwargs) for f in self.strings]
- @filters.convert('boolean')
+ @filters.convert('boolean', 'tinyint')
def conv_bool(self, column, name, **kwargs):
return [f(column, name, **kwargs) for f in self.bool]
| @ filters . convert ( 'boolean' ) def conv_bool ( self , column , name , ** kwargs ) : return [ f ( column , name , ** kwargs ) for f in self . bool ] | @ filters . convert ( 'boolean' , 'tinyint' ) def conv_bool ( self , column , name , ** kwargs ) : return [ f ( column , name , ** kwargs ) for f in self . bool ] | SAME_FUNCTION_MORE_ARGS | [["Insert", ["argument_list", 3, 21, 3, 32], [",:,", "T"], 2], ["Insert", ["argument_list", 3, 21, 3, 32], ["string:'tinyint'", "T"], 3]] | zhijuebin/flask-admin@19025b97d38706eda4f425667b69f7803a39ca35 | add tinyint as a bool type | [
{
"sha": "e3a80dc894a708b1eb4ebe0f18e32a5010bf7967",
"filename": "flask_admin/contrib/sqla/filters.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/19025b97d38706eda4f425667b69f7803a39ca35/flask_admin%2Fcontrib%2Fsqla%2Ffilters.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/19025b97d38706eda4f425667b69f7803a39ca35/flask_admin%2Fcontrib%2Fsqla%2Ffilters.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fsqla%2Ffilters.py?ref=19025b97d38706eda4f425667b69f7803a39ca35",
"patch": "@@ -104,7 +104,7 @@ def convert(self, type_name, column, name, **kwargs):\n def conv_string(self, column, name, **kwargs):\n return [f(column, name, **kwargs) for f in self.strings]\n \n- @filters.convert('boolean')\n+ @filters.convert('boolean', 'tinyint')\n def conv_bool(self, column, name, **kwargs):\n return [f(column, name, **kwargs) for f in self.bool]\n "
}
] |
flask-admin | f20de4160c3e8f8004f73c91f015685ecf07aa93 | d3af9d0c665ddde90d62b03a7faf0c684e69583a | flask_admin/model/base.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -1307,7 +1307,7 @@ class BaseModelView(BaseView, ActionsMixin):
if self.create_model(form):
if '_add_another' in request.form:
flash(gettext('Model was successfully created.'))
- return redirect(self._get_create_url(url=return_url))
+ return redirect(request.url)
else:
return redirect(return_url)
| return redirect ( self . _get_create_url ( url = return_url ) ) | return redirect ( request . url ) | SINGLE_STMT | [["Move", ["argument_list", 3, 36, 3, 74], ["attribute", 3, 37, 3, 57], 1], ["Move", ["argument_list", 3, 36, 3, 74], ["):)", 3, 72, 3, 73], 2], ["Update", ["identifier:self", 3, 37, 3, 41], "request"], ["Move", ["attribute", 3, 37, 3, 57], ["identifier:url", 3, 58, 3, 61], 2], ["Delete", ["identifier:_get_create_url", 3, 42, 3, 57]], ["Delete", ["(:(", 3, 57, 3, 58]], ["Delete", ["=:=", 3, 61, 3, 62]], ["Delete", ["identifier:return_url", 3, 62, 3, 72]], ["Delete", ["keyword_argument", 3, 58, 3, 72]], ["Delete", ["argument_list", 3, 57, 3, 73]], ["Delete", ["call", 3, 37, 3, 73]], ["Delete", ["):)", 3, 73, 3, 74]]] | zhijuebin/flask-admin@f20de4160c3e8f8004f73c91f015685ecf07aa93 | Fixed create and continue button | [
{
"sha": "b9d11cadd17501f38adff0a75f41f0c518c6732c",
"filename": "flask_admin/model/base.py",
"status": "modified",
"additions": 2,
"deletions": 2,
"changes": 4,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/f20de4160c3e8f8004f73c91f015685ecf07aa93/flask_admin%2Fmodel%2Fbase.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/f20de4160c3e8f8004f73c91f015685ecf07aa93/flask_admin%2Fmodel%2Fbase.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fmodel%2Fbase.py?ref=f20de4160c3e8f8004f73c91f015685ecf07aa93",
"patch": "@@ -343,7 +343,7 @@ class MyModelView(BaseModelView):\n list of possible options.\n \n Example::\n- \n+\n from wtforms.validators import required\n class MyModelView(BaseModelView):\n form_args = dict(\n@@ -1307,7 +1307,7 @@ def create_view(self):\n if self.create_model(form):\n if '_add_another' in request.form:\n flash(gettext('Model was successfully created.'))\n- return redirect(self._get_create_url(url=return_url))\n+ return redirect(request.url)\n else:\n return redirect(return_url)\n "
}
] |
flask-admin | 8a25ce88a97f23a3f5f202957f14d52762a264a0 | 960b4d2b6f8069f6ef3085a2a45da4c2f53cce2d | flask_admin/model/base.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -1115,7 +1115,7 @@ class BaseModelView(BaseView, ActionsMixin):
if flt.validate(value):
filters.append((pos, (idx, flt.clean(value))))
else:
- flash(gettext('Invalid Filter Value: ' + value))
+ flash(gettext('Invalid Filter Value: %(value)s', value=value))
# Sort filters
return [v[1] for v in sorted(filters, key=lambda n: n[0])]
| flash ( gettext ( 'Invalid Filter Value: ' + value ) ) | flash ( gettext ( 'Invalid Filter Value: %(value)s' , value = value ) ) | SINGLE_STMT | [["Insert", ["argument_list", 3, 38, 3, 72], ["string:'Invalid Filter Value: %(value)s'", "T"], 1], ["Insert", ["argument_list", 3, 38, 3, 72], [",:,", "T"], 2], ["Insert", ["argument_list", 3, 38, 3, 72], ["keyword_argument", "N0"], 3], ["Move", "N0", ["identifier:value", 3, 66, 3, 71], 0], ["Insert", "N0", ["=:=", "T"], 1], ["Insert", "N0", ["identifier:value", "T"], 2], ["Delete", ["string:'Invalid Filter Value: '", 3, 39, 3, 63]], ["Delete", ["+:+", 3, 64, 3, 65]], ["Delete", ["binary_operator", 3, 39, 3, 71]]] | zhijuebin/flask-admin@8a25ce88a97f23a3f5f202957f14d52762a264a0 | make validation error more translator friendly, thx @jirikuncar | [
{
"sha": "dc5e9cbe661cca70fe7c390bdf89215174131367",
"filename": "flask_admin/model/base.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/8a25ce88a97f23a3f5f202957f14d52762a264a0/flask_admin%2Fmodel%2Fbase.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/8a25ce88a97f23a3f5f202957f14d52762a264a0/flask_admin%2Fmodel%2Fbase.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fmodel%2Fbase.py?ref=8a25ce88a97f23a3f5f202957f14d52762a264a0",
"patch": "@@ -1115,7 +1115,7 @@ def _get_list_filter_args(self):\n if flt.validate(value):\n filters.append((pos, (idx, flt.clean(value))))\n else:\n- flash(gettext('Invalid Filter Value: ' + value))\n+ flash(gettext('Invalid Filter Value: %(value)s', value=value))\n \n # Sort filters\n return [v[1] for v in sorted(filters, key=lambda n: n[0])]"
}
] |
flask-admin | a07bcbef24aae4458755425f6c9ab6d8f35217a0 | 1bbe9c3a3bc95c2dbfc584cb2a15522ef0907e20 | flask_admin/tests/sqla/test_basic.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -386,7 +386,7 @@ def test_column_filters():
'string_field': 'Test Filter #2',
})
- eq_(view._filter_groups.keys(), [u'Test Filter #1', u'Test Filter #2'])
+ eq_(list(view._filter_groups.keys()), [u'Test Filter #1', u'Test Filter #2'])
# Fill DB
model1_obj1 = Model1('test1_val_1', 'test2_val_1', bool_field=True)
| eq_ ( view . _filter_groups . keys ( ) , [ u'Test Filter #1' , u'Test Filter #2' ] ) | eq_ ( list ( view . _filter_groups . keys ( ) ) , [ u'Test Filter #1' , u'Test Filter #2' ] ) | ADD_FUNCTION_AROUND_EXPRESSION | [["Insert", ["call", 3, 9, 3, 35], ["identifier:list", "T"], 0], ["Insert", ["call", 3, 9, 3, 35], ["argument_list", "N0"], 1], ["Insert", "N0", ["(:(", "T"], 0], ["Move", "N0", ["call", 3, 9, 3, 35], 1], ["Insert", "N0", ["):)", "T"], 2]] | zhijuebin/flask-admin@a07bcbef24aae4458755425f6c9ab6d8f35217a0 | fix pull request #729 python 3 compatibility | [
{
"sha": "005fbb5891375a31a01c321c603698aeb594f970",
"filename": "flask_admin/tests/sqla/test_basic.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/a07bcbef24aae4458755425f6c9ab6d8f35217a0/flask_admin%2Ftests%2Fsqla%2Ftest_basic.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/a07bcbef24aae4458755425f6c9ab6d8f35217a0/flask_admin%2Ftests%2Fsqla%2Ftest_basic.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Ftests%2Fsqla%2Ftest_basic.py?ref=a07bcbef24aae4458755425f6c9ab6d8f35217a0",
"patch": "@@ -386,7 +386,7 @@ def test_column_filters():\n 'string_field': 'Test Filter #2',\n })\n \n- eq_(view._filter_groups.keys(), [u'Test Filter #1', u'Test Filter #2'])\n+ eq_(list(view._filter_groups.keys()), [u'Test Filter #1', u'Test Filter #2'])\n \n # Fill DB\n model1_obj1 = Model1('test1_val_1', 'test2_val_1', bool_field=True)"
}
] |
flask-admin | 625e021bba1fad6bf70cd11195d98a0e2d7a1c6a | 396b506933267656265cd78eede15b4e7d3e6b07 | flask_admin/contrib/sqla/view.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -536,7 +536,7 @@ class ModelView(BaseModelView):
if join_tables:
self._filter_joins[table.name] = join_tables
elif self._need_join(table.name):
- self._filter_joins[table.name] = [table.name]
+ self._filter_joins[table.name] = [table]
filters.extend(flt)
return filters
| self . _filter_joins [ table . name ] = [ table . name ] | self . _filter_joins [ table . name ] = [ table ] | SINGLE_STMT | [["Move", ["list", 3, 62, 3, 74], ["identifier:table", 3, 63, 3, 68], 1], ["Delete", [".:.", 3, 68, 3, 69]], ["Delete", ["identifier:name", 3, 69, 3, 73]], ["Delete", ["attribute", 3, 63, 3, 73]]] | zhijuebin/flask-admin@625e021bba1fad6bf70cd11195d98a0e2d7a1c6a | Fixed #737 - Store table reference instead of table name | [
{
"sha": "c1416e28d30975255a10239acb77be4c8ddd8572",
"filename": "flask_admin/contrib/sqla/view.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/625e021bba1fad6bf70cd11195d98a0e2d7a1c6a/flask_admin%2Fcontrib%2Fsqla%2Fview.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/625e021bba1fad6bf70cd11195d98a0e2d7a1c6a/flask_admin%2Fcontrib%2Fsqla%2Fview.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fsqla%2Fview.py?ref=625e021bba1fad6bf70cd11195d98a0e2d7a1c6a",
"patch": "@@ -536,7 +536,7 @@ def scaffold_filters(self, name):\n if join_tables:\n self._filter_joins[table.name] = join_tables\n elif self._need_join(table.name):\n- self._filter_joins[table.name] = [table.name]\n+ self._filter_joins[table.name] = [table]\n filters.extend(flt)\n \n return filters"
}
] |
flask-admin | cbbae4c300466556aff287d2e26c7d9051c4683b | 9632fe84a53a1bf8582773742a9f66435169b88d | flask_admin/contrib/fileadmin.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -455,7 +455,7 @@ class FileAdmin(BaseView, ActionsMixin):
if parent_path == '.':
parent_path = None
- items.append(('..', parent_path, True, 0))
+ items.append(('..', parent_path, True, 0, 0))
for f in os.listdir(directory):
fp = op.join(directory, f)
| items . append ( ( '..' , parent_path , True , 0 ) ) | items . append ( ( '..' , parent_path , True , 0 , 0 ) ) | ADD_ELEMENTS_TO_ITERABLE | [["Insert", ["tuple", 3, 26, 3, 54], [",:,", "T"], 8], ["Insert", ["tuple", 3, 26, 3, 54], ["integer:0", "T"], 9]] | zhijuebin/flask-admin@cbbae4c300466556aff287d2e26c7d9051c4683b | Fileadmin crash on cd to empty dir fixed | [
{
"sha": "d85e143d2c941941b127ee06bb29832bf633b997",
"filename": "flask_admin/contrib/fileadmin.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/cbbae4c300466556aff287d2e26c7d9051c4683b/flask_admin%2Fcontrib%2Ffileadmin.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/cbbae4c300466556aff287d2e26c7d9051c4683b/flask_admin%2Fcontrib%2Ffileadmin.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Ffileadmin.py?ref=cbbae4c300466556aff287d2e26c7d9051c4683b",
"patch": "@@ -455,7 +455,7 @@ def index(self, path=None):\n if parent_path == '.':\n parent_path = None\n \n- items.append(('..', parent_path, True, 0))\n+ items.append(('..', parent_path, True, 0, 0))\n \n for f in os.listdir(directory):\n fp = op.join(directory, f)"
}
] |
flask-admin | 45fb01574d410c2a764e5b40a5e93a44fa8f6584 | ba4e10cebdfdc0128beaeef848806be03433ccaf | flask_admin/contrib/geoa/form.py | https://github.com/zhijuebin/flask-admin | true | false | false | @@ -4,7 +4,7 @@ from .fields import GeoJSONField
class AdminModelConverter(SQLAAdminConverter):
- @converts('Geometry')
+ @converts('Geography', 'Geometry')
def convert_geom(self, column, field_args, **extra):
field_args['geometry_type'] = column.type.geometry_type
field_args['srid'] = column.type.srid
| @ converts ( 'Geometry' ) def convert_geom ( self , column , field_args , ** extra ) : field_args [ 'geometry_type' ] = column . type . geometry_type field_args [ 'srid' ] = column . type . srid | @ converts ( 'Geography' , 'Geometry' ) def convert_geom ( self , column , field_args , ** extra ) : field_args [ 'geometry_type' ] = column . type . geometry_type field_args [ 'srid' ] = column . type . srid | SAME_FUNCTION_MORE_ARGS | [["Insert", ["argument_list", 3, 14, 3, 26], ["string:'Geography'", "T"], 1], ["Insert", ["argument_list", 3, 14, 3, 26], [",:,", "T"], 2]] | zhijuebin/flask-admin@45fb01574d410c2a764e5b40a5e93a44fa8f6584 | Add Geography Type to GeoAlchemy Backend
The current GeoAlchemy backend only works with geometry columns, and ignores geography columns (which are also supported by geoalchemy). This 1-word fix adds support for geography columns. | [
{
"sha": "f3180942eabf0aedf720df2ffed0f41ba4aa93df",
"filename": "flask_admin/contrib/geoa/form.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/45fb01574d410c2a764e5b40a5e93a44fa8f6584/flask_admin%2Fcontrib%2Fgeoa%2Fform.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/45fb01574d410c2a764e5b40a5e93a44fa8f6584/flask_admin%2Fcontrib%2Fgeoa%2Fform.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fgeoa%2Fform.py?ref=45fb01574d410c2a764e5b40a5e93a44fa8f6584",
"patch": "@@ -4,7 +4,7 @@\n \n \n class AdminModelConverter(SQLAAdminConverter):\n- @converts('Geometry')\n+ @converts('Geography', 'Geometry')\n def convert_geom(self, column, field_args, **extra):\n field_args['geometry_type'] = column.type.geometry_type\n field_args['srid'] = column.type.srid"
}
] |
flask-admin | 623f573b74e8de5a6d56234921ec48598a73c2cd | c8131d72c3d906c461d0e81d674be0f1dea316aa | flask_admin/contrib/sqla/view.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -716,7 +716,7 @@ class ModelView(BaseModelView):
join_tables, attr = self._get_field_with_path(field)
- return join_tables, field, direction
+ return join_tables, attr, direction
return None
| return join_tables , field , direction | return join_tables , attr , direction | CHANGE_IDENTIFIER_USED | [["Update", ["identifier:field", 3, 33, 3, 38], "attr"]] | zhijuebin/flask-admin@623f573b74e8de5a6d56234921ec48598a73c2cd | Fix SQLAlchemy default sort order when column name is ambiguous.
Instead of sorting on the raw column name, sort on the attribute we found. This fixes sorting for column names that are ambiguous due to table joins. | [
{
"sha": "b31443e2a187671fc44838d05cc15d7b8cda01ed",
"filename": "flask_admin/contrib/sqla/view.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/623f573b74e8de5a6d56234921ec48598a73c2cd/flask_admin%2Fcontrib%2Fsqla%2Fview.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/623f573b74e8de5a6d56234921ec48598a73c2cd/flask_admin%2Fcontrib%2Fsqla%2Fview.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fsqla%2Fview.py?ref=623f573b74e8de5a6d56234921ec48598a73c2cd",
"patch": "@@ -716,7 +716,7 @@ def _get_default_order(self):\n \n join_tables, attr = self._get_field_with_path(field)\n \n- return join_tables, field, direction\n+ return join_tables, attr, direction\n \n return None\n "
}
] |
flask-admin | e49d08ac7c92bf8ab93d1d3a2020ae43c423a5de | 1c63ca96a0bbd56a99bce59d846509a95b5b5199 | flask_admin/model/filters.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -266,7 +266,7 @@ def convert(*args):
def _inner(func):
- func._converter_for = map(str.lower, args)
+ func._converter_for = list(map(str.lower, args))
return func
return _inner
| func . _converter_for = map ( str . lower , args ) | func . _converter_for = list ( map ( str . lower , args ) ) | ADD_FUNCTION_AROUND_EXPRESSION | [["Insert", ["call", 1, 31, 1, 51], ["identifier:list", "T"], 0], ["Insert", ["call", 1, 31, 1, 51], ["argument_list", "N0"], 1], ["Insert", "N0", ["(:(", "T"], 0], ["Move", "N0", ["call", 1, 31, 1, 51], 1], ["Insert", "N0", ["):)", "T"], 2]] | zhijuebin/flask-admin@e49d08ac7c92bf8ab93d1d3a2020ae43c423a5de | Python 3 fix: FilterConverter sub-classing bug
Couldn't be instantiated more than once. This made it impossible to make a subclass of FilterConverter. | [
{
"sha": "b689b12254d5eb41276be687cf3cc93bbd7d07b6",
"filename": "flask_admin/model/filters.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/e49d08ac7c92bf8ab93d1d3a2020ae43c423a5de/flask_admin%2Fmodel%2Ffilters.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/e49d08ac7c92bf8ab93d1d3a2020ae43c423a5de/flask_admin%2Fmodel%2Ffilters.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fmodel%2Ffilters.py?ref=e49d08ac7c92bf8ab93d1d3a2020ae43c423a5de",
"patch": "@@ -266,7 +266,7 @@ def convert(*args):\n See :mod:`flask.ext.admin.contrib.sqla.filters` for usage example.\n \"\"\"\n def _inner(func):\n- func._converter_for = map(str.lower, args)\n+ func._converter_for = list(map(str.lower, args))\n return func\n return _inner\n "
}
] |
flask-admin | 08a4de5781bc55b431f406b8ac9230363ad6e9d5 | 5424b40dd81b54c699fab3dc6028203d3494ceb4 | flask_admin/contrib/sqla/view.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -535,7 +535,7 @@ class ModelView(BaseModelView):
if join_tables:
self._filter_joins[table.name] = join_tables
- elif self._need_join(table.name):
+ elif self._need_join(table):
self._filter_joins[table.name] = [table]
filters.extend(flt)
| if join_tables : self . _filter_joins [ table . name ] = join_tables elif self . _need_join ( table . name ) : self . _filter_joins [ table . name ] = [ table ] | if join_tables : self . _filter_joins [ table . name ] = join_tables elif self . _need_join ( table ) : self . _filter_joins [ table . name ] = [ table ] | SINGLE_STMT | [["Move", ["argument_list", 3, 45, 3, 57], ["identifier:table", 3, 46, 3, 51], 1], ["Delete", [".:.", 3, 51, 3, 52]], ["Delete", ["identifier:name", 3, 52, 3, 56]], ["Delete", ["attribute", 3, 46, 3, 56]]] | zhijuebin/flask-admin@08a4de5781bc55b431f406b8ac9230363ad6e9d5 | Update view.py
Fixed _need_join check for SQLa filters. | [
{
"sha": "a4cf996461c8a20a39a90c30e18e572cc5320454",
"filename": "flask_admin/contrib/sqla/view.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/08a4de5781bc55b431f406b8ac9230363ad6e9d5/flask_admin%2Fcontrib%2Fsqla%2Fview.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/08a4de5781bc55b431f406b8ac9230363ad6e9d5/flask_admin%2Fcontrib%2Fsqla%2Fview.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fsqla%2Fview.py?ref=08a4de5781bc55b431f406b8ac9230363ad6e9d5",
"patch": "@@ -535,7 +535,7 @@ def scaffold_filters(self, name):\n \n if join_tables:\n self._filter_joins[table.name] = join_tables\n- elif self._need_join(table.name):\n+ elif self._need_join(table):\n self._filter_joins[table.name] = [table]\n filters.extend(flt)\n "
}
] |
dalite-ng | dfb7591d3410a3e5cb7e4d088521b2e924777890 | d3ecc30102321192e7d4630bc8de3b6ffbbde09f | dalite/__init__.py | https://github.com/koyach/dalite-ng | true | false | true | @@ -39,7 +39,7 @@ class ApplicationHookManager(AbstractApplicationHookManager):
assignment_id = lti_data['custom_assignment_id']
question_id = lti_data['custom_question_id']
return reverse(
- 'question-start', kwargs=dict(assignment_id=assignment_id, question_id=question_id)
+ 'question', kwargs=dict(assignment_id=assignment_id, question_id=question_id)
)
def authentication_hook(self, request, user_id=None, username=None, email=None):
| return reverse ( 'question-start' , kwargs = dict ( assignment_id = assignment_id , question_id = question_id ) ) | return reverse ( 'question' , kwargs = dict ( assignment_id = assignment_id , question_id = question_id ) ) | CHANGE_STRING_LITERAL | [["Update", ["string:'question-start'", 3, 13, 3, 29], "'question'"]] | koyach/dalite-ng@dfb7591d3410a3e5cb7e4d088521b2e924777890 | null | null |
dalite-ng | 960cd7ca50f3c5175a0d8d9bcbbddf55ef2e32db | a9a349721d81131cfcc84ff03af7aa15bcaba40a | peerinst/views.py | https://github.com/koyach/dalite-ng | true | false | true | @@ -472,7 +472,7 @@ def redirect_to_login_or_show_cookie_help(request):
- if request.META['HTTP_REFERER']:
+ if request.META.get('HTTP_REFERER'):
# We probably got here from within the LMS, and the user has third-party cookies disabled,
# so we show help on enabling cookies for this site.
return render_to_response('peerinst/cookie_help.html', dict(host=request.get_host()))
| if request . META [ 'HTTP_REFERER' ] : return render_to_response ( 'peerinst/cookie_help.html' , dict ( host = request . get_host ( ) ) ) | if request . META . get ( 'HTTP_REFERER' ) : return render_to_response ( 'peerinst/cookie_help.html' , dict ( host = request . get_host ( ) ) ) | SINGLE_STMT | [["Insert", ["if_statement", 0, 5, 3, 94], ["call", "N0"], 1], ["Insert", "N0", ["attribute", "N1"], 0], ["Insert", "N0", ["argument_list", "N2"], 1], ["Move", "N1", ["attribute", 0, 8, 0, 20], 0], ["Insert", "N1", [".:.", "T"], 1], ["Insert", "N1", ["identifier:get", "T"], 2], ["Insert", "N2", ["(:(", "T"], 0], ["Move", "N2", ["string:'HTTP_REFERER'", 0, 21, 0, 35], 1], ["Insert", "N2", ["):)", "T"], 2], ["Delete", ["[:[", 0, 20, 0, 21]], ["Delete", ["]:]", 0, 35, 0, 36]], ["Delete", ["subscript", 0, 8, 0, 36]]] | koyach/dalite-ng@960cd7ca50f3c5175a0d8d9bcbbddf55ef2e32db | null | null |
dalite-ng | 8e9c8ff7f75c14858cbb2e1b9bbe33db3e828680 | 1853d8cc2ff0b90c6e3641bc306926c169ba99a4 | peerinst/admin.py | https://github.com/koyach/dalite-ng | true | false | false | @@ -90,7 +90,7 @@ class QuestionAdmin(admin.ModelAdmin):
inlines = [AnswerChoiceInline, AnswerInline]
list_display = ['title', 'discipline']
ordering = ['discipline']
- search_fields = ['title','text','category']
+ search_fields = ['title','text','category__title']
@admin.register(Category)
| search_fields = [ 'title' , 'text' , 'category' ] | search_fields = [ 'title' , 'text' , 'category__title' ] | CHANGE_STRING_LITERAL | [["Update", ["string:'category'", 3, 37, 3, 47], "'category__title'"]] | koyach/dalite-ng@8e9c8ff7f75c14858cbb2e1b9bbe33db3e828680 | null | null |
dalite-ng | f9442f609d3be135f9b30b7871f0e971dddec06e | 0f018c6ff16ff2d189e5a83607d735cd14a26cf9 | peerinst/util.py | https://github.com/koyach/dalite-ng | true | false | true | @@ -206,7 +206,7 @@ def load_timestamps_from_logs(log_filename_list):
records_parsed +=1
if records_parsed % 1000==0:
print('{} records parsed'.format(records_parsed))
- print('{} db records updated')
+ print('{} db records updated'.format(records_updated))
print('time: {}'.format(timezone.now()))
print('End time: {}'.format(timezone.now()))
| print ( '{} db records updated' ) | print ( '{} db records updated' . format ( records_updated ) ) | ADD_METHOD_CALL | [["Insert", ["argument_list", 3, 18, 3, 43], ["call", "N0"], 1], ["Insert", ["argument_list", 3, 18, 3, 43], ["):)", "T"], 2], ["Insert", "N0", ["attribute", "N1"], 0], ["Insert", "N0", ["argument_list", "N2"], 1], ["Move", "N1", ["string:'{} db records updated'", 3, 19, 3, 42], 0], ["Insert", "N1", [".:.", "T"], 1], ["Insert", "N1", ["identifier:format", "T"], 2], ["Insert", "N2", ["(:(", "T"], 0], ["Insert", "N2", ["identifier:records_updated", "T"], 1], ["Move", "N2", ["):)", 3, 42, 3, 43], 2]] | koyach/dalite-ng@f9442f609d3be135f9b30b7871f0e971dddec06e | null | null |
flask-admin | f77260a9487bbb4d21ca27e96df7135826eeeabf | e17f85779cbfe32af81f21c4d6752b649c613c40 | setup.py | https://github.com/zhijuebin/flask-admin | true | false | false | @@ -9,7 +9,7 @@ setup(
author_email='[email protected]',
description='Simple and extensible admin interface framework for Flask',
long_description=__doc__,
- packages=['flask_adminex', 'flask_adminex.ext'],
+ packages=['flask_adminex', 'flask_adminex.model', 'flask_adminex.ext', 'flask_adminex.ext.sqlamodel'],
include_package_data=True,
zip_safe=False,
platforms='any',
| packages = [ 'flask_adminex' , 'flask_adminex.ext' ] , | packages = [ 'flask_adminex' , 'flask_adminex.model' , 'flask_adminex.ext' , 'flask_adminex.ext.sqlamodel' ] , | ADD_ELEMENTS_TO_ITERABLE | [["Insert", ["list", 3, 14, 3, 52], ["string:'flask_adminex.model'", "T"], 3], ["Insert", ["list", 3, 14, 3, 52], [",:,", "T"], 4], ["Insert", ["list", 3, 14, 3, 52], [",:,", "T"], 6], ["Insert", ["list", 3, 14, 3, 52], ["string:'flask_adminex.ext.sqlamodel'", "T"], 7]] | zhijuebin/flask-admin@f77260a9487bbb4d21ca27e96df7135826eeeabf | Fixed setup script. | [
{
"sha": "22c77201f2ad1efe2ebd3f215c6ee223172562dd",
"filename": "setup.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/f77260a9487bbb4d21ca27e96df7135826eeeabf/setup.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/f77260a9487bbb4d21ca27e96df7135826eeeabf/setup.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/setup.py?ref=f77260a9487bbb4d21ca27e96df7135826eeeabf",
"patch": "@@ -9,7 +9,7 @@\n author_email='[email protected]',\n description='Simple and extensible admin interface framework for Flask',\n long_description=__doc__,\n- packages=['flask_adminex', 'flask_adminex.ext'],\n+ packages=['flask_adminex', 'flask_adminex.model', 'flask_adminex.ext', 'flask_adminex.ext.sqlamodel'],\n include_package_data=True,\n zip_safe=False,\n platforms='any',"
}
] |
flask-admin | e64b89a6caa25018268422ee8cac0d14333e1fed | 87599455cb79ee33fd221589bbd874dd6eb88cd4 | flask_admin/model/base.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -433,7 +433,7 @@ class BaseModelView(BaseView):
Override to implement custom behavior.
"""
- return self._create_form_class(form, obj)
+ return self._create_form_class(obj=obj)
def edit_form(self, form, obj=None):
"""
| return self . _create_form_class ( form , obj ) | return self . _create_form_class ( obj = obj ) | SINGLE_STMT | [["Insert", ["argument_list", 3, 39, 3, 50], ["keyword_argument", "N0"], 1], ["Update", ["identifier:form", 3, 40, 3, 44], "obj"], ["Move", "N0", ["identifier:form", 3, 40, 3, 44], 0], ["Insert", "N0", ["=:=", "T"], 1], ["Move", "N0", ["identifier:obj", 3, 46, 3, 49], 2], ["Delete", [",:,", 3, 44, 3, 45]]] | zhijuebin/flask-admin@e64b89a6caa25018268422ee8cac0d14333e1fed | fixed problem with wtf.FileField not getting updated with request.files data upon instantiation of Form | [
{
"sha": "44f7e277c96bd7f6013b6436b6d8e8f666d4a5ce",
"filename": "flask_admin/model/base.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/e64b89a6caa25018268422ee8cac0d14333e1fed/flask_admin%2Fmodel%2Fbase.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/e64b89a6caa25018268422ee8cac0d14333e1fed/flask_admin%2Fmodel%2Fbase.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fmodel%2Fbase.py?ref=e64b89a6caa25018268422ee8cac0d14333e1fed",
"patch": "@@ -433,7 +433,7 @@ def create_form(self, form, obj=None):\n \n Override to implement custom behavior.\n \"\"\"\n- return self._create_form_class(form, obj)\n+ return self._create_form_class(obj=obj)\n \n def edit_form(self, form, obj=None):\n \"\"\""
}
] |
flask-admin | 373e1bc370f5080988f0ed5af042543b192ac037 | baee2375e975f52640100b79262f26e888a3dcf8 | flask_admin/model/base.py | https://github.com/zhijuebin/flask-admin | true | false | false | @@ -160,7 +160,7 @@ class BaseModelView(BaseView):
Example::
class MyModelView(BaseModelView):
- list_columns = ('name', 'email')
+ form_columns = ('name', 'email')
| list_columns = ( 'name' , 'email' ) | form_columns = ( 'name' , 'email' ) | CHANGE_IDENTIFIER_USED | [["Update", ["identifier:list_columns", 3, 17, 3, 29], "form_columns"]] | zhijuebin/flask-admin@373e1bc370f5080988f0ed5af042543b192ac037 | Fix typo in docs
I guess `form_columns` docstring was copy-pasted from `list_columns` and the
occurrence of the identifier wasn't replaced. | [
{
"sha": "34c09af491ed490a116554e7ddc81ced0d5047df",
"filename": "flask_admin/model/base.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/373e1bc370f5080988f0ed5af042543b192ac037/flask_admin%2Fmodel%2Fbase.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/373e1bc370f5080988f0ed5af042543b192ac037/flask_admin%2Fmodel%2Fbase.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fmodel%2Fbase.py?ref=373e1bc370f5080988f0ed5af042543b192ac037",
"patch": "@@ -160,7 +160,7 @@ class MyModelView(BaseModelView):\n Example::\n \n class MyModelView(BaseModelView):\n- list_columns = ('name', 'email')\n+ form_columns = ('name', 'email')\n \"\"\"\n \n excluded_form_columns = None"
}
] |
flask-admin | 3687c85c3d21ec0e481b9f7463cf4aa3ba6880d3 | 22930edd9ef125954b0d8dcc4fe2c117ded1082b | flask_admin/actions.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -43,7 +43,7 @@ class ActionsMixin(object):
self._actions_data[name] = (attr, text, desc)
def is_action_allowed(self, name):
- return name not in self.disallowed_actions
+ return True
def get_actions_list(self):
actions = []
| return name not in self . disallowed_actions | return True | SINGLE_STMT | [["Insert", ["return_statement", 3, 9, 3, 51], ["true:True", "T"], 1], ["Delete", ["identifier:name", 3, 16, 3, 20]], ["Delete", ["not:not", 3, 21, 3, 24]], ["Delete", ["in:in", 3, 25, 3, 27]], ["Delete", ["identifier:self", 3, 28, 3, 32]], ["Delete", [".:.", 3, 32, 3, 33]], ["Delete", ["identifier:disallowed_actions", 3, 33, 3, 51]], ["Delete", ["attribute", 3, 28, 3, 51]], ["Delete", ["comparison_operator", 3, 16, 3, 51]]] | zhijuebin/flask-admin@3687c85c3d21ec0e481b9f7463cf4aa3ba6880d3 | Fixed typo | [
{
"sha": "88d6a657d15a2f113f951748b5350d8fe019ed96",
"filename": "flask_admin/actions.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/3687c85c3d21ec0e481b9f7463cf4aa3ba6880d3/flask_admin%2Factions.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/3687c85c3d21ec0e481b9f7463cf4aa3ba6880d3/flask_admin%2Factions.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Factions.py?ref=3687c85c3d21ec0e481b9f7463cf4aa3ba6880d3",
"patch": "@@ -43,7 +43,7 @@ def init_actions(self):\n self._actions_data[name] = (attr, text, desc)\n \n def is_action_allowed(self, name):\n- return name not in self.disallowed_actions\n+ return True\n \n def get_actions_list(self):\n actions = []"
}
] |
flask-admin | 340af0b569b0c5bd8778771fb05df8f8802a6fbd | 54b505ca22c172cbb11943496b64dd2d9c0628b7 | flask_admin/model/__init__.py | https://github.com/zhijuebin/flask-admin | true | false | false | @@ -1,2 +1,2 @@
from .base import BaseModelView
-from .action import action
+from flask.ext.admin.actions import action
| from . action import action | from flask . ext . admin . actions import action | SINGLE_STMT | [["Insert", ["import_from_statement", 1, 1, 1, 27], ["dotted_name", "N0"], 1], ["Insert", "N0", ["identifier:flask", "T"], 0], ["Move", "N0", [".:.", 1, 6, 1, 7], 1], ["Update", ["identifier:action", 1, 7, 1, 13], "ext"], ["Move", "N0", ["identifier:action", 1, 7, 1, 13], 2], ["Insert", "N0", [".:.", "T"], 3], ["Insert", "N0", ["identifier:admin", "T"], 4], ["Insert", "N0", [".:.", "T"], 5], ["Insert", "N0", ["identifier:actions", "T"], 6], ["Delete", ["import_prefix", 1, 6, 1, 7]], ["Delete", ["dotted_name", 1, 7, 1, 13]], ["Delete", ["relative_import", 1, 6, 1, 13]]] | zhijuebin/flask-admin@340af0b569b0c5bd8778771fb05df8f8802a6fbd | Fixing the action decorator import statement | [
{
"sha": "986c57483ac23a114812f98400f6f21dc06d5eaa",
"filename": "flask_admin/model/__init__.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/340af0b569b0c5bd8778771fb05df8f8802a6fbd/flask_admin%2Fmodel%2F__init__.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/340af0b569b0c5bd8778771fb05df8f8802a6fbd/flask_admin%2Fmodel%2F__init__.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fmodel%2F__init__.py?ref=340af0b569b0c5bd8778771fb05df8f8802a6fbd",
"patch": "@@ -1,2 +1,2 @@\n from .base import BaseModelView\n-from .action import action\n+from flask.ext.admin.actions import action"
}
] |
flask-admin | 7e9c6387d2a2138766cb45e62166ff910644dfc8 | 7cd9efdf640f518e28dbf48b3e32ee782cc7cdf7 | flask_admin/contrib/sqlamodel/form.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -137,7 +137,7 @@ class AdminModelConverter(ModelConverterBase):
if default is not None:
callable_default = getattr(default, 'arg', None)
- if callable_default and callable(callable_default):
+ if callable_default is not None and callable(callable_default):
default = callable_default(None)
if default is not None:
| if callable_default and callable ( callable_default ) : default = callable_default ( None ) | if callable_default is not None and callable ( callable_default ) : default = callable_default ( None ) | CHANGE_BINARY_OPERAND | [["Insert", ["boolean_operator", 3, 24, 3, 71], ["comparison_operator", "N0"], 0], ["Move", "N0", ["identifier:callable_default", 3, 24, 3, 40], 0], ["Insert", "N0", ["is:is", "T"], 1], ["Insert", "N0", ["not:not", "T"], 2], ["Insert", "N0", ["none:None", "T"], 3]] | zhijuebin/flask-admin@7e9c6387d2a2138766cb45e62166ff910644dfc8 | fix for
raise TypeError("Boolean value of this clause is not defined")
TypeError: Boolean value of this clause is not defined
see
http://www.sqlalchemy.org/trac/wiki/06Migration#AnImportantExpressionLanguageGotcha | [
{
"sha": "9f0d6fdd939a06e2a303eb4357986738e7d33f8a",
"filename": "flask_admin/contrib/sqlamodel/form.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/7e9c6387d2a2138766cb45e62166ff910644dfc8/flask_admin%2Fcontrib%2Fsqlamodel%2Fform.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/7e9c6387d2a2138766cb45e62166ff910644dfc8/flask_admin%2Fcontrib%2Fsqlamodel%2Fform.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fcontrib%2Fsqlamodel%2Fform.py?ref=7e9c6387d2a2138766cb45e62166ff910644dfc8",
"patch": "@@ -137,7 +137,7 @@ def convert(self, model, mapper, prop, field_args, hidden_pk):\n if default is not None:\n callable_default = getattr(default, 'arg', None)\n \n- if callable_default and callable(callable_default):\n+ if callable_default is not None and callable(callable_default):\n default = callable_default(None)\n \n if default is not None:"
}
] |
flask-admin | c0122869d93092c8b0a31e81892a33f96991f9c8 | 95ee8ebba1d742bdad727c1ab8cea169cf16b40c | flask_admin/base.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -117,7 +117,7 @@ class BaseView(object):
# Default view
if self._default_view is None:
- raise Exception('Attempted to instantiate admin view %s without defailt view' % self.__class__.__name__)
+ raise Exception('Attempted to instantiate admin view %s without default view' % self.__class__.__name__)
def create_blueprint(self, admin):
| raise Exception ( 'Attempted to instantiate admin view %s without defailt view' % self . __class__ . __name__ ) | raise Exception ( 'Attempted to instantiate admin view %s without default view' % self . __class__ . __name__ ) | CHANGE_BINARY_OPERAND | [["Update", ["string:'Attempted to instantiate admin view %s without defailt view'", 3, 29, 3, 90], "'Attempted to instantiate admin view %s without default view'"]] | zhijuebin/flask-admin@c0122869d93092c8b0a31e81892a33f96991f9c8 | Fixing typo | [
{
"sha": "e1c61405d1304cc45f6c013436e8b866cb203f3f",
"filename": "flask_admin/base.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/c0122869d93092c8b0a31e81892a33f96991f9c8/flask_admin%2Fbase.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/c0122869d93092c8b0a31e81892a33f96991f9c8/flask_admin%2Fbase.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fbase.py?ref=c0122869d93092c8b0a31e81892a33f96991f9c8",
"patch": "@@ -117,7 +117,7 @@ def __init__(self, name=None, category=None, endpoint=None, url=None, static_fol\n \n # Default view\n if self._default_view is None:\n- raise Exception('Attempted to instantiate admin view %s without defailt view' % self.__class__.__name__)\n+ raise Exception('Attempted to instantiate admin view %s without default view' % self.__class__.__name__)\n \n def create_blueprint(self, admin):\n \"\"\""
}
] |
flask-admin | 825e097ad64761fe6132c45b7f32d5ba4f7bf0e6 | 47cdedd6272a96e467e8dda20501b812f5f593b6 | flask_admin/model/form.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -33,7 +33,7 @@ class InlineFormAdmin(object):
self.model = model
- for k in self.defaults:
+ for k in self._defaults:
if not hasattr(self, k):
setattr(self, k, None)
| for k in self . defaults : if not hasattr ( self , k ) : setattr ( self , k , None ) | for k in self . _defaults : if not hasattr ( self , k ) : setattr ( self , k , None ) | CHANGE_ATTRIBUTE_USED | [["Update", ["identifier:defaults", 2, 23, 2, 31], "_defaults"]] | zhijuebin/flask-admin@825e097ad64761fe6132c45b7f32d5ba4f7bf0e6 | Typo fix | [
{
"sha": "6f32b4eb65ab708cb31cca63110ce4fbdcf9fde1",
"filename": "flask_admin/model/form.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/825e097ad64761fe6132c45b7f32d5ba4f7bf0e6/flask_admin%2Fmodel%2Fform.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/825e097ad64761fe6132c45b7f32d5ba4f7bf0e6/flask_admin%2Fmodel%2Fform.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Fmodel%2Fform.py?ref=825e097ad64761fe6132c45b7f32d5ba4f7bf0e6",
"patch": "@@ -33,7 +33,7 @@ def __init__(self, model, **kwargs):\n \"\"\"\n self.model = model\n \n- for k in self.defaults:\n+ for k in self._defaults:\n if not hasattr(self, k):\n setattr(self, k, None)\n "
}
] |
flask-admin | ce20c14b89a680d105c40ee8e2f787fc7a48d1dd | 462ac84e4775898a80061eef5234d053984187d4 | flask_admin/tests/test_base.py | https://github.com/zhijuebin/flask-admin | true | false | true | @@ -178,7 +178,7 @@ def test_permissions():
view.allow_access = False
rv = client.get('/admin/mockview/')
- eq_(rv.status_code, 403)
+ eq_(rv.status_code, 404)
def test_submenu():
| eq_ ( rv . status_code , 403 ) | eq_ ( rv . status_code , 404 ) | CHANGE_NUMERIC_LITERAL | [["Update", ["integer:403", 3, 25, 3, 28], "404"]] | zhijuebin/flask-admin@ce20c14b89a680d105c40ee8e2f787fc7a48d1dd | Fix is_accessible test to handle a 404 response | [
{
"sha": "a16da3c7df842b53d1e8eec38c74cc451e21dde9",
"filename": "flask_admin/tests/test_base.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/zhijuebin/flask-admin/blob/ce20c14b89a680d105c40ee8e2f787fc7a48d1dd/flask_admin%2Ftests%2Ftest_base.py",
"raw_url": "https://github.com/zhijuebin/flask-admin/raw/ce20c14b89a680d105c40ee8e2f787fc7a48d1dd/flask_admin%2Ftests%2Ftest_base.py",
"contents_url": "https://api.github.com/repos/zhijuebin/flask-admin/contents/flask_admin%2Ftests%2Ftest_base.py?ref=ce20c14b89a680d105c40ee8e2f787fc7a48d1dd",
"patch": "@@ -178,7 +178,7 @@ def test_permissions():\n view.allow_access = False\n \n rv = client.get('/admin/mockview/')\n- eq_(rv.status_code, 403)\n+ eq_(rv.status_code, 404)\n \n \n def test_submenu():"
}
] |
ip-check | 360319563777221c25ef7184650cb827a9a2dca0 | 51b509204533366670d102b958f87bc26431b01a | main.py | https://github.com/stanfordroboticsclub/ip-check | true | false | false | @@ -39,7 +39,7 @@ while True:
print "Message received: %s" % json.dumps(message, indent=2)
print ""
- out = bot_name
+ out = request_name
slack_client.api_call(
"chat.postMessage",
channel=message['channel'],
| out = bot_name | out = request_name | CHANGE_IDENTIFIER_USED | [["Update", ["identifier:bot_name", 3, 31, 3, 39], "request_name"]] | stanfordroboticsclub/ip-check@360319563777221c25ef7184650cb827a9a2dca0 | fix variable in list comamnd | [
{
"sha": "c20944b5e34827888d68dd195e8bf53cb071537a",
"filename": "main.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/stanfordroboticsclub/ip-check/blob/360319563777221c25ef7184650cb827a9a2dca0/main.py",
"raw_url": "https://github.com/stanfordroboticsclub/ip-check/raw/360319563777221c25ef7184650cb827a9a2dca0/main.py",
"contents_url": "https://api.github.com/repos/stanfordroboticsclub/ip-check/contents/main.py?ref=360319563777221c25ef7184650cb827a9a2dca0",
"patch": "@@ -39,7 +39,7 @@\n print \"Message received: %s\" % json.dumps(message, indent=2)\n print \"\"\n \n- out = bot_name\n+ out = request_name\n slack_client.api_call(\n \"chat.postMessage\",\n channel=message['channel'],"
}
] |
my--first-blog | b6b929cef10b0680c6c5d312c4c7110704eb33a5 | e8d8714cbbbff20aeb756fa1370a107bb70a50f4 | mysite/settings.py | https://github.com/leahellenhughes/my--first-blog | true | false | false | @@ -25,7 +25,7 @@ SECRET_KEY = 'e!zm7nhrt*el&8lg8+=x%rtrcx-v%l%9jhg+$^%-f+g_ck1^z)'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
-ALLOWED_HOSTS = []
+ALLOWED_HOSTS = ['127.0.0.1', 'leahellenhughes.pythonanywhere.com']
# Application definition
| ALLOWED_HOSTS = [ ] | ALLOWED_HOSTS = [ '127.0.0.1' , 'leahellenhughes.pythonanywhere.com' ] | ADD_ELEMENTS_TO_ITERABLE | [["Insert", ["list", 3, 17, 3, 19], ["string:'127.0.0.1'", "T"], 1], ["Insert", ["list", 3, 17, 3, 19], [",:,", "T"], 2], ["Insert", ["list", 3, 17, 3, 19], ["string:'leahellenhughes.pythonanywhere.com'", "T"], 3]] | leahellenhughes/my--first-blog@b6b929cef10b0680c6c5d312c4c7110704eb33a5 | fixed hosts | [
{
"sha": "15e2c898950db306042e0ccdf42523728e07a5a8",
"filename": "mysite/settings.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/leahellenhughes/my--first-blog/blob/b6b929cef10b0680c6c5d312c4c7110704eb33a5/mysite%2Fsettings.py",
"raw_url": "https://github.com/leahellenhughes/my--first-blog/raw/b6b929cef10b0680c6c5d312c4c7110704eb33a5/mysite%2Fsettings.py",
"contents_url": "https://api.github.com/repos/leahellenhughes/my--first-blog/contents/mysite%2Fsettings.py?ref=b6b929cef10b0680c6c5d312c4c7110704eb33a5",
"patch": "@@ -25,7 +25,7 @@\n # SECURITY WARNING: don't run with debug turned on in production!\n DEBUG = True\n \n-ALLOWED_HOSTS = []\n+ALLOWED_HOSTS = ['127.0.0.1', 'leahellenhughes.pythonanywhere.com']\n \n \n # Application definition"
}
] |
pansnp | 406c9f063c0db61e4c51d80f7a91570924e2f78e | b00e56d6a5ec8cd62a065421550f0c4a8825b5dc | PanSNP.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -1,5 +1,5 @@
# Wrapper function to run pansnp
-from PanSNP.Pansnp import Pansnp_main
+from .Pansnp import Pansnp_main
import sys
if __name__ == '__main__':
| from PanSNP . Pansnp import Pansnp_main | from . Pansnp import Pansnp_main | SINGLE_STMT | [["Insert", ["import_from_statement", 1, 1, 1, 38], ["relative_import", "N0"], 1], ["Insert", "N0", ["import_prefix", "N1"], 0], ["Insert", "N0", ["dotted_name", "N2"], 1], ["Move", "N1", [".:.", 1, 12, 1, 13], 0], ["Move", "N2", ["identifier:Pansnp", 1, 13, 1, 19], 0], ["Delete", ["identifier:PanSNP", 1, 6, 1, 12]], ["Delete", ["dotted_name", 1, 6, 1, 19]]] | OliverS87/pansnp@406c9f063c0db61e4c51d80f7a91570924e2f78e | null | null |
pansnp | a47ea83f959f0d792b3ac8ba877fc7fecd446411 | 55567b19eaca62554593566228ba71a59dc55dae | PanSNP.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -1,5 +1,5 @@
# Wrapper function to run pansnp
-from PanSNP.Pansnp.Pansnp_main import pansnp_main
+from .PanSNP.Pansnp.Pansnp_main import pansnp_main
import sys
if __name__ == '__main__':
| from PanSNP . Pansnp . Pansnp_main import pansnp_main | from . PanSNP . Pansnp . Pansnp_main import pansnp_main | SINGLE_STMT | [["Insert", ["import_from_statement", 1, 1, 1, 50], ["relative_import", "N0"], 1], ["Insert", "N0", ["import_prefix", "N1"], 0], ["Move", "N0", ["dotted_name", 1, 6, 1, 31], 1], ["Insert", "N1", [".:.", "T"], 0]] | OliverS87/pansnp@a47ea83f959f0d792b3ac8ba877fc7fecd446411 | null | null |
pansnp | dee9180020426532f3cf47b2615cf5eed6045790 | 889ad6dbf180fab8e7052b1ff17b9c73c9828c98 | Pansnp/Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -3,7 +3,7 @@ import os
import shutil
import sys
-import Cluster
+from Cluster import Cluster
from SimpleParSNP import SimpleParSNP
| import Cluster | from Cluster import Cluster | SINGLE_STMT | [["Insert", ["module", 0, 1, 7, 0], ["import_from_statement", "N0"], 2], ["Insert", "N0", ["from:from", "T"], 0], ["Move", "N0", ["dotted_name", 3, 8, 3, 15], 1], ["Move", "N0", ["import:import", 3, 1, 3, 7], 2], ["Insert", "N0", ["dotted_name", "N1"], 3], ["Insert", "N1", ["identifier:Cluster", "T"], 0], ["Delete", ["import_statement", 3, 1, 3, 15]]] | OliverS87/pansnp@dee9180020426532f3cf47b2615cf5eed6045790 | null | null |
pansnp | 78ae8ccde0aaf29bb30ffa323e2fde2c78710825 | d69cc69d0deceae1f1f93dfec966378bfb068c20 | Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -3,7 +3,7 @@ import os
import shutil
import sys
-from .Pansnp import Cluster
+from Pansnp import Cluster
import SimpleParSNP
| from . Pansnp import Cluster | from Pansnp import Cluster | SINGLE_STMT | [["Move", ["import_from_statement", 3, 1, 3, 28], ["dotted_name", 3, 7, 3, 13], 1], ["Delete", [".:.", 3, 6, 3, 7]], ["Delete", ["import_prefix", 3, 6, 3, 7]], ["Delete", ["relative_import", 3, 6, 3, 13]]] | OliverS87/pansnp@78ae8ccde0aaf29bb30ffa323e2fde2c78710825 | null | null |
pansnp | 8742829ee297cb8d3403f2d93567fa162eba3fec | eb92d3a1e4a5bf7f44f42fcbb138e2806b2b970b | Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -4,7 +4,7 @@ import shutil
import sys
from Pansnp.Cluster import Cluster
-from SimpleParSNP import SimpleParSNP
+from .SimpleParSNP import SimpleParSNP
def clean_up(outpath, prefix):
| from SimpleParSNP import SimpleParSNP | from . SimpleParSNP import SimpleParSNP | SINGLE_STMT | [["Insert", ["import_from_statement", 3, 1, 3, 38], ["relative_import", "N0"], 1], ["Insert", "N0", ["import_prefix", "N1"], 0], ["Move", "N0", ["dotted_name", 3, 6, 3, 18], 1], ["Insert", "N1", [".:.", "T"], 0]] | OliverS87/pansnp@8742829ee297cb8d3403f2d93567fa162eba3fec | null | null |
pansnp | 64c003060623e63c1158a10f4e1b25d8cdaad746 | cd996accd4a9dc3d236a8480f93619d05b9cbcfe | Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -4,7 +4,7 @@ import shutil
import sys
from Pansnp.cluster import Cluster
-from .SimpleParSNP import SimpleParSNP
+from SimpleParSNP import SimpleParSNP
def clean_up(outpath, prefix):
| from . SimpleParSNP import SimpleParSNP | from SimpleParSNP import SimpleParSNP | SINGLE_STMT | [["Move", ["import_from_statement", 3, 1, 3, 39], ["dotted_name", 3, 7, 3, 19], 1], ["Delete", [".:.", 3, 6, 3, 7]], ["Delete", ["import_prefix", 3, 6, 3, 7]], ["Delete", ["relative_import", 3, 6, 3, 19]]] | OliverS87/pansnp@64c003060623e63c1158a10f4e1b25d8cdaad746 | null | null |
pansnp | 39bfcb331548b3b7f37efc76932281e7d6d8e2c5 | 73fb6da4419ef9bb54c97fa0f28028cd8a512fe2 | Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -3,7 +3,7 @@ import os
import shutil
import sys
-from .Pansnp.cluster import Cluster
+from Pansnp.cluster import Cluster
from .SimpleParSNP import SimpleParSNP
| from . Pansnp . cluster import Cluster | from Pansnp . cluster import Cluster | SINGLE_STMT | [["Move", ["import_from_statement", 3, 1, 3, 36], ["dotted_name", 3, 7, 3, 21], 1], ["Delete", [".:.", 3, 6, 3, 7]], ["Delete", ["import_prefix", 3, 6, 3, 7]], ["Delete", ["relative_import", 3, 6, 3, 21]]] | OliverS87/pansnp@39bfcb331548b3b7f37efc76932281e7d6d8e2c5 | null | null |
pansnp | 8bcec566211449baa763c683f8c1df03f78642b5 | 39bfcb331548b3b7f37efc76932281e7d6d8e2c5 | Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -4,7 +4,7 @@ import shutil
import sys
from Pansnp.cluster import Cluster
-from .SimpleParSNP import SimpleParSNP
+from SimpleParSNP import SimpleParSNP
def clean_up(outpath, prefix):
| from . SimpleParSNP import SimpleParSNP | from SimpleParSNP import SimpleParSNP | SINGLE_STMT | [["Move", ["import_from_statement", 3, 1, 3, 39], ["dotted_name", 3, 7, 3, 19], 1], ["Delete", [".:.", 3, 6, 3, 7]], ["Delete", ["import_prefix", 3, 6, 3, 7]], ["Delete", ["relative_import", 3, 6, 3, 19]]] | OliverS87/pansnp@8bcec566211449baa763c683f8c1df03f78642b5 | null | null |
pansnp | 59f4332e79677095eed1bfe8395a3bf0fdb6fd1f | 27d10eb05585f49be4cc152bee3fea6e7c8a7eec | SimpleParSNP.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -217,4 +217,4 @@ if __name__ == '__main__':
simple_snp.set_threads(sys.argv[3])
simple_snp.add_files(sys.argv[6:])
simple_snp.set_prefix(sys.argv[5])
- simple_snp.run_parsnp(sys.argv[4])
+ simple_snp.run_parsnp(sys.argv[4], True, True)
| simple_snp . run_parsnp ( sys . argv [ 4 ] ) | simple_snp . run_parsnp ( sys . argv [ 4 ] , True , True ) | SAME_FUNCTION_MORE_ARGS | [["Insert", ["argument_list", 3, 26, 3, 39], [",:,", "T"], 2], ["Insert", ["argument_list", 3, 26, 3, 39], ["true:True", "T"], 3], ["Insert", ["argument_list", 3, 26, 3, 39], [",:,", "T"], 4], ["Insert", ["argument_list", 3, 26, 3, 39], ["true:True", "T"], 5]] | OliverS87/pansnp@59f4332e79677095eed1bfe8395a3bf0fdb6fd1f | null | null |
pansnp | e96c00c95cd6d09e722ce08045adeea0a0d61e26 | 59f4332e79677095eed1bfe8395a3bf0fdb6fd1f | SimpleParSNP.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -208,7 +208,7 @@ class SimpleParSNP:
if __name__ == '__main__':
# Test run
# Input format: dist, ref, core, out_dir, prefix, sample_file(s)
- if len(sys.argv[1:]) != 6:
+ if len(sys.argv[1:]) < 6:
print("Input format: dist, ref, core, out_dir, prefix, sample_file(s)")
exit(3)
simple_snp = SimpleParSNP()
| if len ( sys . argv [ 1 : ] ) != 6 : print ( "Input format: dist, ref, core, out_dir, prefix, sample_file(s)" ) exit ( 3 ) | if len ( sys . argv [ 1 : ] ) < 6 : print ( "Input format: dist, ref, core, out_dir, prefix, sample_file(s)" ) exit ( 3 ) | CHANGE_BINARY_OPERATOR | [["Insert", ["comparison_operator", 3, 8, 3, 30], ["<:<", "T"], 1], ["Delete", ["!=:!=", 3, 26, 3, 28]]] | OliverS87/pansnp@e96c00c95cd6d09e722ce08045adeea0a0d61e26 | null | null |
pansnp | 6196e119808bccdf31dc4f40a55c8b54725246ae | c3cb2face7e24be12e567ed4e13675d3c3d770a3 | SimpleParSNP.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -248,7 +248,7 @@ if __name__ == '__main__':
simple_snp.set_reference(args.reference)
simple_snp.set_threads(args.cpu)
# Get all files in sample folder
- simple_snp.add_files([file for file in os.listdir(args.sample_folder)
+ simple_snp.add_files([os.path.join(args.sample_folder, file) for file in os.listdir(args.sample_folder)
if os.path.isfile(os.path.join(args.sample_folder, file))])
simple_snp.set_prefix(args.prefix)
# For standalone SimpleParSNP run, do not create the intracluster region stat fike
| simple_snp . add_files ( [ file for file in os . listdir ( args . sample_folder ) if os . path . isfile ( os . path . join ( args . sample_folder , file ) ) ] ) | simple_snp . add_files ( [ os . path . join ( args . sample_folder , file ) for file in os . listdir ( args . sample_folder ) if os . path . isfile ( os . path . join ( args . sample_folder , file ) ) ] ) | ADD_FUNCTION_AROUND_EXPRESSION | [["Insert", ["list_comprehension", 3, 26, 4, 85], ["call", "N0"], 1], ["Insert", "N0", ["attribute", "N1"], 0], ["Insert", "N0", ["argument_list", "N2"], 1], ["Insert", "N1", ["attribute", "N3"], 0], ["Insert", "N1", [".:.", "T"], 1], ["Insert", "N1", ["identifier:join", "T"], 2], ["Insert", "N2", ["(:(", "T"], 0], ["Insert", "N2", ["attribute", "N4"], 1], ["Insert", "N2", [",:,", "T"], 2], ["Move", "N2", ["identifier:file", 3, 27, 3, 31], 3], ["Insert", "N2", ["):)", "T"], 4], ["Insert", "N3", ["identifier:os", "T"], 0], ["Insert", "N3", [".:.", "T"], 1], ["Insert", "N3", ["identifier:path", "T"], 2], ["Insert", "N4", ["identifier:args", "T"], 0], ["Insert", "N4", [".:.", "T"], 1], ["Insert", "N4", ["identifier:sample_folder", "T"], 2]] | OliverS87/pansnp@6196e119808bccdf31dc4f40a55c8b54725246ae | null | null |
pansnp | 38cfa33e27269f8713703f031051b86cd180b487 | bc1c06753ee69c3885d6fced1b4ecabf37cd11ca | SimpleParSNP.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -231,7 +231,7 @@ class SimpleParSNP:
if __name__ == '__main__':
import argparse
- parser = argparse.ArgumentParser()
+ parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("reference", help="Full length reference sequence file")
parser.add_argument("sample_folder", help="Folder where all sample files are located")
parser.add_argument("-p", "--prefix", default="parsnp", help="Prefix for all output files")
| parser = argparse . ArgumentParser ( ) | parser = argparse . ArgumentParser ( formatter_class = argparse . ArgumentDefaultsHelpFormatter ) | SAME_FUNCTION_MORE_ARGS | [["Insert", ["argument_list", 3, 37, 3, 39], ["keyword_argument", "N0"], 1], ["Insert", "N0", ["identifier:formatter_class", "T"], 0], ["Insert", "N0", ["=:=", "T"], 1], ["Insert", "N0", ["attribute", "N1"], 2], ["Insert", "N1", ["identifier:argparse", "T"], 0], ["Insert", "N1", [".:.", "T"], 1], ["Insert", "N1", ["identifier:ArgumentDefaultsHelpFormatter", "T"], 2]] | OliverS87/pansnp@38cfa33e27269f8713703f031051b86cd180b487 | null | null |
pansnp | 0c1ff18633afd74d95abab1e1c0e6a9a0621598a | 94df57d8eaca12ddc2ba0e6a810def18a4452505 | Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -6,7 +6,7 @@ import sys
from pansnp_libs.cluster import Cluster
from pansnp_libs.iclength_deviation_eucl_cluster import IclengthClusterRscript
from pansnp_libs.mash_ani_clustering import MashAnoClusteringRscript
-from .pansnp_libs.rearrangement_jac_cluster import RearrangementJacCluster
+from pansnp_libs.rearrangement_jac_cluster import RearrangementJacCluster
from SimpleParSNP import SimpleParSNP
| from . pansnp_libs . rearrangement_jac_cluster import RearrangementJacCluster | from pansnp_libs . rearrangement_jac_cluster import RearrangementJacCluster | SINGLE_STMT | [["Move", ["import_from_statement", 3, 1, 3, 75], ["dotted_name", 3, 7, 3, 44], 1], ["Delete", [".:.", 3, 6, 3, 7]], ["Delete", ["import_prefix", 3, 6, 3, 7]], ["Delete", ["relative_import", 3, 6, 3, 44]]] | OliverS87/pansnp@0c1ff18633afd74d95abab1e1c0e6a9a0621598a | null | null |
pansnp | 8aff2497a5e42d86b0112deb698ecc95fce93d8c | 0c1ff18633afd74d95abab1e1c0e6a9a0621598a | Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -59,7 +59,7 @@ if __name__ == '__main__':
help="Plot cluster for each sample subset")
parser.add_argument('cluster_method', choices=["r", "s", "l"],
help="Cluster by 'R'earrangements, 'S'imilarity or 'L'ength")
- parser.add_argument("-c", "--cluster", default=2, type=int, help="Max. number of multi-element cluster created during each cycle")
+ parser.add_argument("-l", "--cluster", default=2, type=int, help="Max. number of multi-element cluster created during each cycle")
args = parser.parse_args()
ref_p = args.reference
| parser . add_argument ( "-c" , "--cluster" , default = 2 , type = int , help = "Max. number of multi-element cluster created during each cycle" ) | parser . add_argument ( "-l" , "--cluster" , default = 2 , type = int , help = "Max. number of multi-element cluster created during each cycle" ) | CHANGE_STRING_LITERAL | [["Update", ["string:\"-c\"", 3, 25, 3, 29], "\"-l\""]] | OliverS87/pansnp@8aff2497a5e42d86b0112deb698ecc95fce93d8c | null | null |
pansnp | bd26f7b79722ea568f4d43edaace18ad0f8ebf3c | 65158782620494ec909d57e54de4252fee21067b | Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -68,7 +68,7 @@ if __name__ == '__main__':
dist_param = args.distance
cpu_count = args.cpu
size_param = args.size
- cluster_method = args.cluster_method
+ cluster_method = args.method
keep_all_core = args.all_core
plot = args.plot
# Create at least two multi-cluster per iteration
| cluster_method = args . cluster_method | cluster_method = args . method | CHANGE_ATTRIBUTE_USED | [["Update", ["identifier:cluster_method", 3, 27, 3, 41], "method"]] | OliverS87/pansnp@bd26f7b79722ea568f4d43edaace18ad0f8ebf3c | null | null |
pansnp | 954e7cbd9ddf746a2d08516b5f2708c950cc97b4 | 46675bc5464c2f0e0c90c34afc7ba0fe7b3dbb37 | Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -57,7 +57,7 @@ if __name__ == '__main__':
#parser.add_argument("-u", "--unaligned", action="store_true", help="Output unaligned regions?")
parser.add_argument("-a", "--all_core", action="store_true",
help="Output core block alignment for each sample subset")
- parser.add_argument("-d", "--debug", action="store_true",
+ parser.add_argument("-b", "--debug", action="store_true",
help="Keep temporary files")
parser.add_argument("-i", "--plot", action="store_true",
help="Plot cluster for each sample subset")
| parser . add_argument ( "-d" , "--debug" , action = "store_true" , help = "Keep temporary files" ) | parser . add_argument ( "-b" , "--debug" , action = "store_true" , help = "Keep temporary files" ) | CHANGE_STRING_LITERAL | [["Update", ["string:\"-d\"", 3, 25, 3, 29], "\"-b\""]] | OliverS87/pansnp@954e7cbd9ddf746a2d08516b5f2708c950cc97b4 | null | null |
pansnp | bb0fc63dc7f53cd560f67d4e56654cc4a902cca0 | dd9f2b7760e4fb243982329d087be16ab7bedb0a | pansnp_libs/cluster.py | https://github.com/OliverS87/pansnp | true | false | true | @@ -62,7 +62,7 @@ class Cluster:
data = line.split()
# If not including all seqs, check whether this seq is from between two core blocks
if not all_seqs:
- cb1, cb2 = data[2][6:].split(".")
+ cb1, cb2 = [int(item) for item in data[2][6:].split(".")]
if cb1 in contig_end_ids or cb2 in contig_end_ids:
continue
si = int(data[0].split(":")[0][1:])
| cb1 , cb2 = data [ 2 ] [ 6 : ] . split ( "." ) | cb1 , cb2 = [ int ( item ) for item in data [ 2 ] [ 6 : ] . split ( "." ) ] | SINGLE_STMT | [["Insert", ["assignment", 3, 25, 3, 58], ["list_comprehension", "N0"], 2], ["Insert", "N0", ["[:[", "T"], 0], ["Insert", "N0", ["call", "N1"], 1], ["Insert", "N0", ["for_in_clause", "N2"], 2], ["Insert", "N0", ["]:]", "T"], 3], ["Insert", "N1", ["identifier:int", "T"], 0], ["Insert", "N1", ["argument_list", "N3"], 1], ["Insert", "N2", ["for:for", "T"], 0], ["Insert", "N2", ["identifier:item", "T"], 1], ["Insert", "N2", ["in:in", "T"], 2], ["Move", "N2", ["call", 3, 36, 3, 58], 3], ["Insert", "N3", ["(:(", "T"], 0], ["Insert", "N3", ["identifier:item", "T"], 1], ["Insert", "N3", ["):)", "T"], 2]] | OliverS87/pansnp@bb0fc63dc7f53cd560f67d4e56654cc4a902cca0 | null | null |
pansnp | 17bcbd9e59ed255190bc3272d551b00a7d319554 | d77b0050c74227a47799362fab3e672b06baaf7a | pansnp_libs/cluster.py | https://github.com/OliverS87/pansnp | true | false | true | @@ -183,7 +183,7 @@ class Cluster:
# Next, run an rscript to do the clustering
cluster_filename = filename.replace(".len.", ".clstr.")
if self.make_plots:
- png_filename = filename.replace(".csv", ".png")
+ png_filename = filename.replace(".len.csv", ".png")
else:
png_filename = "NA"
run = subprocess.run("Rscript --vanilla {5} {0} {1} {2} {3} {4}".format(
| png_filename = filename . replace ( ".csv" , ".png" ) | png_filename = filename . replace ( ".len.csv" , ".png" ) | CHANGE_STRING_LITERAL | [["Update", ["string:\".csv\"", 3, 45, 3, 51], "\".len.csv\""]] | OliverS87/pansnp@17bcbd9e59ed255190bc3272d551b00a7d319554 | null | null |
pansnp | 5b11c270091d448508d6cbd410c97c3b7f4ae278 | 7048f29c211af7f19f334bc36450211248427cb6 | Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -8,7 +8,7 @@ from pansnp_libs.iclength_deviation_eucl_cluster import IclengthClusterRscript
from pansnp_libs.mash_ani_clustering import MashAnoClusteringRscript
from pansnp_libs.rearrangement_jac_cluster import RearrangementJacCluster
from SimpleParSNP import SimpleParSNP
-from .pansnp_libs.random_cluster import RandomCluster
+from pansnp_libs.random_cluster import RandomCluster
def clean_up(outpath, prefix, keep_all_core, debug):
| from . pansnp_libs . random_cluster import RandomCluster | from pansnp_libs . random_cluster import RandomCluster | SINGLE_STMT | [["Move", ["import_from_statement", 3, 1, 3, 54], ["dotted_name", 3, 7, 3, 33], 1], ["Delete", [".:.", 3, 6, 3, 7]], ["Delete", ["import_prefix", 3, 6, 3, 7]], ["Delete", ["relative_import", 3, 6, 3, 33]]] | OliverS87/pansnp@5b11c270091d448508d6cbd410c97c3b7f4ae278 | null | null |
pansnp | 109c8a69508b173e8cdd18ed387e3a1eab864bea | 5b11c270091d448508d6cbd410c97c3b7f4ae278 | Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -65,7 +65,7 @@ if __name__ == '__main__':
help="Keep temporary files")
parser.add_argument("-i", "--plot", action="store_true",
help="Plot cluster for each sample subset")
- parser.add_argument("-r", "--random", action="store_true",
+ parser.add_argument("-r", "--random", type=int,
help="Plot cluster for each sample subset", default=0)
parser.add_argument("-m", '--method', choices=["r", "sa", "sc", "l"],
help="Cluster by 'R'earrangements, 'S'imilarity 'A'll or between 'C'ore blocks "
| parser . add_argument ( "-r" , "--random" , action = "store_true" , help = "Plot cluster for each sample subset" , default = 0 ) | parser . add_argument ( "-r" , "--random" , type = int , help = "Plot cluster for each sample subset" , default = 0 ) | SINGLE_STMT | [["Update", ["identifier:action", 3, 43, 3, 49], "type"], ["Insert", ["keyword_argument", 3, 43, 3, 62], ["identifier:int", "T"], 2], ["Delete", ["string:\"store_true\"", 3, 50, 3, 62]]] | OliverS87/pansnp@109c8a69508b173e8cdd18ed387e3a1eab864bea | null | null |
pansnp | eb250939f400be5160a272ab7e650601d14c593f | ba207a37b30d205aef5b5bf50f91e1f4c6581ddf | Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -81,7 +81,7 @@ if __name__ == '__main__':
plot = args.plot
debug = args.debug
# Create at least two multi-cluster per iteration
- min_cluster = min(2, args.cluster)
+ min_cluster = max(2, args.cluster)
prefix = args.prefix
# Create output folder
if not os.path.isdir(out_p):
| min_cluster = min ( 2 , args . cluster ) | min_cluster = max ( 2 , args . cluster ) | WRONG_FUNCTION_NAME | [["Update", ["identifier:min", 3, 19, 3, 22], "max"]] | OliverS87/pansnp@eb250939f400be5160a272ab7e650601d14c593f | null | null |
pansnp | 42f9e235950947c8f51ae4273b4c935ad1432677 | aaad545f97b008aa9acf916a286bb03f0742fb50 | Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -147,7 +147,7 @@ if __name__ == '__main__':
"{0}.unalign".format(prefix)))
# Create new input sample sequences from the unaligned part of this input
reducer.useq_to_input(file_list, os.path.join(out_p, "{0}.unalign".format(prefix)))
- reducer.mask_reference(this_ref, "{0}.xmfa".format(prefix), prefix)
+ reducer.mask_reference(this_ref, os.path.join(out_p, "{0}.xmfa".format(prefix)), prefix)
file_list = [os.path.join(out_p, "new_input", os.path.basename(item)) for item in file_list]
next_ref = os.path.join(out_p, "new_input", "{0}_ref.faa".format(prefix))
else:
| reducer . mask_reference ( this_ref , "{0}.xmfa" . format ( prefix ) , prefix ) | reducer . mask_reference ( this_ref , os . path . join ( out_p , "{0}.xmfa" . format ( prefix ) ) , prefix ) | ADD_FUNCTION_AROUND_EXPRESSION | [["Insert", ["call", 3, 46, 3, 71], ["attribute", "N0"], 0], ["Insert", ["call", 3, 46, 3, 71], ["argument_list", "N1"], 1], ["Insert", "N0", ["attribute", "N2"], 0], ["Insert", "N0", [".:.", "T"], 1], ["Insert", "N0", ["identifier:join", "T"], 2], ["Insert", "N1", ["(:(", "T"], 0], ["Insert", "N1", ["identifier:out_p", "T"], 1], ["Insert", "N1", [",:,", "T"], 2], ["Move", "N1", ["call", 3, 46, 3, 71], 3], ["Insert", "N1", ["):)", "T"], 4], ["Insert", "N2", ["identifier:os", "T"], 0], ["Insert", "N2", [".:.", "T"], 1], ["Insert", "N2", ["identifier:path", "T"], 2]] | OliverS87/pansnp@42f9e235950947c8f51ae4273b4c935ad1432677 | null | null |
pansnp | 529b738053b421ad0ee45b2c7ef3913f31c0c5b0 | cec02302d0a5c35799ba9319dbfe8e4087e9cfd9 | Pansnp_main.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -85,7 +85,7 @@ if __name__ == '__main__':
reduce = args.reduce
debug = args.debug
# Create at least two multi-cluster per iteration
- min_cluster = min(2, args.cluster)
+ min_cluster = max(2, args.cluster)
prefix = args.prefix
# Create output folder
if not os.path.isdir(out_p):
| min_cluster = min ( 2 , args . cluster ) | min_cluster = max ( 2 , args . cluster ) | WRONG_FUNCTION_NAME | [["Update", ["identifier:min", 3, 19, 3, 22], "max"]] | OliverS87/pansnp@529b738053b421ad0ee45b2c7ef3913f31c0c5b0 | null | null |
pansnp | 958a6b09d18cee47fb0823b7986bcad2edb8ce9a | d09c8b6b2cb78383ca23f9f7ed014984db31b55e | parsnp_core_subsets_batch.py | https://github.com/OliverS87/pansnp | true | false | false | @@ -4,7 +4,7 @@
import sys
import os
-from PanSNP.SimpleParSNP import SimpleParSNP
+from SimpleParSNP import SimpleParSNP
if __name__ == '__main__':
| from PanSNP . SimpleParSNP import SimpleParSNP | from SimpleParSNP import SimpleParSNP | SINGLE_STMT | [["Delete", ["identifier:PanSNP", 3, 6, 3, 12]], ["Delete", [".:.", 3, 12, 3, 13]]] | OliverS87/pansnp@958a6b09d18cee47fb0823b7986bcad2edb8ce9a | null | null |
FastPicAPI | ef9a8385cd3c2edc89599372a89c19088dc7d9f6 | a4fd20850163d032697ae6a0f6ff71a8292d97e0 | FastPicAPI/API/management/commands/removeAwayUsers.py | https://github.com/LeonardoGaldino/FastPicAPI | true | false | false | @@ -5,7 +5,7 @@ from datetime import datetime
class Command(BaseCommand):
help = 'Removes all away players'
- maxAwayTime = 15
+ maxAwayTime = 600 # 10 minutes
def handle(self, *args, **options):
users = OnlineUser.objects.all()
| maxAwayTime = 15 | maxAwayTime = 600 | CHANGE_NUMERIC_LITERAL | [["Update", ["integer:15", 3, 19, 3, 21], "600"]] | LeonardoGaldino/FastPicAPI@ef9a8385cd3c2edc89599372a89c19088dc7d9f6 | fix (Away Max Time): Updates away max time | [
{
"sha": "07ba0a6ef7607a09dc777fa9485bc5baa5f7607d",
"filename": "FastPicAPI/API/management/commands/removeAwayUsers.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/LeonardoGaldino/FastPicAPI/blob/ef9a8385cd3c2edc89599372a89c19088dc7d9f6/FastPicAPI%2FAPI%2Fmanagement%2Fcommands%2FremoveAwayUsers.py",
"raw_url": "https://github.com/LeonardoGaldino/FastPicAPI/raw/ef9a8385cd3c2edc89599372a89c19088dc7d9f6/FastPicAPI%2FAPI%2Fmanagement%2Fcommands%2FremoveAwayUsers.py",
"contents_url": "https://api.github.com/repos/LeonardoGaldino/FastPicAPI/contents/FastPicAPI%2FAPI%2Fmanagement%2Fcommands%2FremoveAwayUsers.py?ref=ef9a8385cd3c2edc89599372a89c19088dc7d9f6",
"patch": "@@ -5,7 +5,7 @@\n \n class Command(BaseCommand):\n help = 'Removes all away players'\n- maxAwayTime = 15\n+ maxAwayTime = 600 # 10 minutes\n \n def handle(self, *args, **options):\n users = OnlineUser.objects.all()"
}
] |
PTkEI2ng | 322dce14c064fc4ee5db862b1ee97209a453008b | 3d35309eb5da5075ba6f90b79e7f3e412476c80a | src/empDb.py | https://github.com/fstltna/PTkEI2ng | true | false | true | @@ -623,7 +623,7 @@ class DatabaseSaver:
'planetype' : {},
'shiptype' : {},
'landtype' : {},
- 'login': {'host':"localhost", 'port':6665,
+ 'login': {'host':"empiredirectory.net", 'port':6665,
'coun':"visitor", 'repr':"visitor"},
'version': {
'worldsize':(255,255), 'maxCountries':255, 'ETUSeconds':1024,
| { 'host' : "localhost" , 'port' : 6665 , 'coun' : "visitor" , 'repr' : "visitor" } , | { 'host' : "empiredirectory.net" , 'port' : 6665 , 'coun' : "visitor" , 'repr' : "visitor" } , | CHANGE_STRING_LITERAL | [["Update", ["string:\"localhost\"", 3, 30, 3, 41], "\"empiredirectory.net\""]] | fstltna/PTkEI2ng@322dce14c064fc4ee5db862b1ee97209a453008b | Changed default game to point to the official game server | [
{
"sha": "3811ee8797ac237dacf9a82d49325c5a891a9176",
"filename": "src/empDb.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/fstltna/PTkEI2ng/blob/322dce14c064fc4ee5db862b1ee97209a453008b/src%2FempDb.py",
"raw_url": "https://github.com/fstltna/PTkEI2ng/raw/322dce14c064fc4ee5db862b1ee97209a453008b/src%2FempDb.py",
"contents_url": "https://api.github.com/repos/fstltna/PTkEI2ng/contents/src%2FempDb.py?ref=322dce14c064fc4ee5db862b1ee97209a453008b",
"patch": "@@ -623,7 +623,7 @@ def reset(self):\n 'planetype' : {},\n 'shiptype' : {},\n 'landtype' : {},\n- 'login': {'host':\"localhost\", 'port':6665,\n+ 'login': {'host':\"empiredirectory.net\", 'port':6665,\n 'coun':\"visitor\", 'repr':\"visitor\"},\n 'version': {\n 'worldsize':(255,255), 'maxCountries':255, 'ETUSeconds':1024,"
}
] |
chessGame | 84c6ac5096e901cffa9f85dfd20fdf15eba23ee0 | b143633d3694fbe4aff6bacf1c2052d04db6611b | generationalLearn.py | https://github.com/willybh11/chessGame | true | false | true | @@ -68,7 +68,7 @@ class Competition:
playerA.graphics.turtleUpdate(playerA.board.grid) #palyer A is not defined
whoseTurn = "w"
playerA.board.printGrid()
- while not (playerA.board.isCheckmate(whoseTurn) or playerA.board.isStalemate()):
+ while not (playerA.board.isCheckmate(whoseTurn) or playerA.board.isStalemate(whoseTurn)):
move = (playerA if whoseTurn=="w" else playerB).bestMove(whoseTurn)
playerA.board.movePiece(move)
playerA.graphics.turtleUpdate(playerA.board.grid)
| while not ( playerA . board . isCheckmate ( whoseTurn ) or playerA . board . isStalemate ( ) ) : move = ( playerA if whoseTurn == "w" else playerB ) . bestMove ( whoseTurn ) playerA . board . movePiece ( move ) playerA . graphics . turtleUpdate ( playerA . board . grid ) | while not ( playerA . board . isCheckmate ( whoseTurn ) or playerA . board . isStalemate ( whoseTurn ) ) : move = ( playerA if whoseTurn == "w" else playerB ) . bestMove ( whoseTurn ) playerA . board . movePiece ( move ) playerA . graphics . turtleUpdate ( playerA . board . grid ) | SAME_FUNCTION_MORE_ARGS | [["Insert", ["argument_list", 3, 85, 3, 87], ["identifier:whoseTurn", "T"], 1]] | willybh11/chessGame@84c6ac5096e901cffa9f85dfd20fdf15eba23ee0 | fix small issue from last commit | [
{
"sha": "f6c4aca6741c52db80241e68760dc5b5c2ee30b1",
"filename": "generationalLearn.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/willybh11/chessGame/blob/84c6ac5096e901cffa9f85dfd20fdf15eba23ee0/generationalLearn.py",
"raw_url": "https://github.com/willybh11/chessGame/raw/84c6ac5096e901cffa9f85dfd20fdf15eba23ee0/generationalLearn.py",
"contents_url": "https://api.github.com/repos/willybh11/chessGame/contents/generationalLearn.py?ref=84c6ac5096e901cffa9f85dfd20fdf15eba23ee0",
"patch": "@@ -68,7 +68,7 @@ def compete(self,playerA,playerB):\n playerA.graphics.turtleUpdate(playerA.board.grid) #palyer A is not defined\n whoseTurn = \"w\"\n playerA.board.printGrid()\n- while not (playerA.board.isCheckmate(whoseTurn) or playerA.board.isStalemate()):\n+ while not (playerA.board.isCheckmate(whoseTurn) or playerA.board.isStalemate(whoseTurn)):\n move = (playerA if whoseTurn==\"w\" else playerB).bestMove(whoseTurn)\n playerA.board.movePiece(move)\n playerA.graphics.turtleUpdate(playerA.board.grid)"
}
] |
chessGame | 470c33e53e591f20ddd6a09391d9f6a6cf9da60a | 5845b6869e2dd3af4726a0bbdeb15b36aeb7bad9 | gameFiles/chessGame.py | https://github.com/willybh11/chessGame | true | false | true | @@ -128,7 +128,7 @@ class Graphics:
self.window = turtle.Screen()
self.window.clear()
self.window.setup(724, 724)
- self.window.bgpic("gameFiles/background.gif")
+ self.window.bgpic("background.gif" if ("linux" in platform) else "gameFiles/background.gif")
self.window.tracer(0, 0)
self.T = turtle.Turtle()
self.T.speed(10)
| self . window . bgpic ( "gameFiles/background.gif" ) | self . window . bgpic ( "background.gif" if ( "linux" in platform ) else "gameFiles/background.gif" ) | SINGLE_STMT | [["Insert", ["argument_list", 3, 26, 3, 54], ["conditional_expression", "N0"], 1], ["Insert", ["argument_list", 3, 26, 3, 54], ["):)", "T"], 2], ["Insert", "N0", ["string:\"background.gif\"", "T"], 0], ["Insert", "N0", ["if:if", "T"], 1], ["Insert", "N0", ["parenthesized_expression", "N1"], 2], ["Insert", "N0", ["else:else", "T"], 3], ["Move", "N0", ["string:\"gameFiles/background.gif\"", 3, 27, 3, 53], 4], ["Insert", "N1", ["(:(", "T"], 0], ["Insert", "N1", ["comparison_operator", "N2"], 1], ["Move", "N1", ["):)", 3, 53, 3, 54], 2], ["Insert", "N2", ["string:\"linux\"", "T"], 0], ["Insert", "N2", ["in:in", "T"], 1], ["Insert", "N2", ["identifier:platform", "T"], 2]] | willybh11/chessGame@470c33e53e591f20ddd6a09391d9f6a6cf9da60a | fix bug on linux with graphics | [
{
"sha": "372f5838c97c9aba4c091a2b831c6bfcd8be855c",
"filename": "gameFiles/chessGame.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/willybh11/chessGame/blob/470c33e53e591f20ddd6a09391d9f6a6cf9da60a/gameFiles%2FchessGame.py",
"raw_url": "https://github.com/willybh11/chessGame/raw/470c33e53e591f20ddd6a09391d9f6a6cf9da60a/gameFiles%2FchessGame.py",
"contents_url": "https://api.github.com/repos/willybh11/chessGame/contents/gameFiles%2FchessGame.py?ref=470c33e53e591f20ddd6a09391d9f6a6cf9da60a",
"patch": "@@ -128,7 +128,7 @@ def turtleSetup(self):\n self.window = turtle.Screen()\n self.window.clear()\n self.window.setup(724, 724)\n- self.window.bgpic(\"gameFiles/background.gif\")\n+ self.window.bgpic(\"background.gif\" if (\"linux\" in platform) else \"gameFiles/background.gif\")\n self.window.tracer(0, 0)\n self.T = turtle.Turtle()\n self.T.speed(10)"
}
] |
records | eb8e133fb410e26df439e2da3ac48941dbeb5df4 | 51aa01b44c9ce1e37c498c583097143b6fc5d478 | setup.py | https://github.com/fictorial/records | true | false | false | @@ -31,7 +31,7 @@ setup(
author='Kenneth Reitz',
author_email='[email protected]',
url='https://github.com/kennethreitz/records',
- py_modules=['records']
+ py_modules=['records'],
package_data={'': ['LICENSE']},
include_package_data=True,
install_requires=requires,
| py_modules = [ 'records' ] | py_modules = [ 'records' ] , | SINGLE_STMT | [["Insert", ["assignment", 3, 5, 3, 27], ["expression_list", "N0"], 2], ["Move", "N0", ["list", 3, 16, 3, 27], 0], ["Insert", "N0", [",:,", "T"], 1]] | fictorial/records@eb8e133fb410e26df439e2da3ac48941dbeb5df4 | syntax error | [
{
"sha": "6347bad20905af90d7203b947c519e69b0ffe7a3",
"filename": "setup.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/fictorial/records/blob/eb8e133fb410e26df439e2da3ac48941dbeb5df4/setup.py",
"raw_url": "https://github.com/fictorial/records/raw/eb8e133fb410e26df439e2da3ac48941dbeb5df4/setup.py",
"contents_url": "https://api.github.com/repos/fictorial/records/contents/setup.py?ref=eb8e133fb410e26df439e2da3ac48941dbeb5df4",
"patch": "@@ -31,7 +31,7 @@\n author='Kenneth Reitz',\n author_email='[email protected]',\n url='https://github.com/kennethreitz/records',\n- py_modules=['records']\n+ py_modules=['records'],\n package_data={'': ['LICENSE']},\n include_package_data=True,\n install_requires=requires,"
}
] |
records | 906c8ad50b743a6fce11e047d593d1673047f0e5 | bd3a83088221f360728aba9e38795239a23d3285 | records.py | https://github.com/fictorial/records | true | false | false | @@ -36,7 +36,7 @@ class BetterNamedTupleCursor(NamedTupleCursor):
try:
from collections import namedtuple
- except ImportError, _exc:
+ except ImportError as _exc:
def _make_nt(self):
raise self._exc
else:
| try : from collections import namedtuple except ImportError , _exc : def _make_nt ( self ) : raise self . _exc else : | try : from collections import namedtuple except ImportError as _exc : def _make_nt ( self ) : raise self . _exc else : | SINGLE_TOKEN | [["Insert", ["except_clause", 2, 5, 4, 28], ["as:as", "T"], 2], ["Delete", [",:,", 2, 23, 2, 24]]] | fictorial/records@906c8ad50b743a6fce11e047d593d1673047f0e5 | python 3 compatibility fix
this is the only line so far that doesn't work with python 3, so it's probably worth fixing, unless you really want to support python 2.5 or below | [
{
"sha": "70bb5fd11f82d06280374cdf59b5f46df8580879",
"filename": "records.py",
"status": "modified",
"additions": 1,
"deletions": 1,
"changes": 2,
"blob_url": "https://github.com/fictorial/records/blob/906c8ad50b743a6fce11e047d593d1673047f0e5/records.py",
"raw_url": "https://github.com/fictorial/records/raw/906c8ad50b743a6fce11e047d593d1673047f0e5/records.py",
"contents_url": "https://api.github.com/repos/fictorial/records/contents/records.py?ref=906c8ad50b743a6fce11e047d593d1673047f0e5",
"patch": "@@ -36,7 +36,7 @@ class BetterNamedTupleCursor(NamedTupleCursor):\n \"\"\"\n try:\n from collections import namedtuple\n- except ImportError, _exc:\n+ except ImportError as _exc:\n def _make_nt(self):\n raise self._exc\n else:"
}
] |