Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
8a1877f0
Commit
8a1877f0
authored
Mar 20, 2015
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7436 from edx/ned/upgrade-pylint
Upgrade pylint
parents
c01ab4a8
5a414914
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
28 additions
and
27 deletions
+28
-27
common/lib/capa/capa/inputtypes.py
+1
-1
common/lib/capa/capa/responsetypes.py
+3
-3
common/lib/capa/capa/tests/response_xml_factory.py
+2
-2
common/lib/chem/chem/chemcalc.py
+4
-4
common/lib/symmath/symmath/formula.py
+5
-5
common/lib/symmath/symmath/symmath_check.py
+1
-1
common/lib/xmodule/xmodule/lti_2_util.py
+2
-2
common/lib/xmodule/xmodule/tabs.py
+1
-1
lms/djangoapps/foldit/tests.py
+2
-2
lms/djangoapps/lms_migration/migrate.py
+1
-1
lms/djangoapps/mobile_api/social_facebook/courses/views.py
+1
-1
lms/djangoapps/mobile_api/social_facebook/friends/views.py
+1
-1
lms/djangoapps/notes/models.py
+1
-1
requirements/edx/base.txt
+2
-1
scripts/all-tests.sh
+1
-1
No files found.
common/lib/capa/capa/inputtypes.py
View file @
8a1877f0
...
...
@@ -1560,7 +1560,7 @@ class AnnotationInput(InputTypeBase):
def
_unpack
(
self
,
json_value
):
""" Unpacks the json input state into a dict. """
d
=
json
.
loads
(
json_value
)
if
type
(
d
)
!=
dict
:
if
not
isinstance
(
d
,
dict
)
:
d
=
{}
comment_value
=
d
.
get
(
'comment'
,
''
)
...
...
common/lib/capa/capa/responsetypes.py
View file @
8a1877f0
...
...
@@ -2505,7 +2505,7 @@ class FormulaResponse(LoncapaResponse):
converted to float. Used so we can safely use Python contexts.
"""
inp_d
=
dict
([(
k
,
numpy
.
complex
(
inp_d
[
k
]))
for
k
in
inp_d
if
type
(
k
)
==
str
and
for
k
in
inp_d
if
isinstance
(
k
,
str
)
and
k
.
isalnum
()
and
isinstance
(
inp_d
[
k
],
numbers
.
Number
)])
return
inp_d
...
...
@@ -2683,7 +2683,7 @@ class ImageResponse(LoncapaResponse):
if
correct_map
[
aid
][
'correctness'
]
!=
'correct'
and
regions
[
aid
]:
parsed_region
=
json
.
loads
(
regions
[
aid
])
if
parsed_region
:
if
type
(
parsed_region
[
0
][
0
])
!=
list
:
if
not
isinstance
(
parsed_region
[
0
][
0
],
list
)
:
# we have [[1,2],[3,4],[5,6]] - single region
# instead of [[[1,2],[3,4],[5,6], [[1,2],[3,4],[5,6]]]
# or [[[1,2],[3,4],[5,6]]] - multiple regions syntax
...
...
@@ -2833,7 +2833,7 @@ class AnnotationResponse(LoncapaResponse):
def
_unpack
(
self
,
json_value
):
"""Unpacks a student response value submitted as JSON."""
json_d
=
json
.
loads
(
json_value
)
if
type
(
json_d
)
!=
dict
:
if
not
isinstance
(
json_d
,
dict
)
:
json_d
=
{}
comment_value
=
json_d
.
get
(
'comment'
,
''
)
...
...
common/lib/capa/capa/tests/response_xml_factory.py
View file @
8a1877f0
...
...
@@ -823,7 +823,7 @@ class ChoiceTextResponseXMLFactory(ResponseXMLFactory):
choice_inputs
=
[]
# Ensure that the first element of choices is an ordered
# collection. It will start as a list, a tuple, or not a Container.
if
type
(
choices
[
0
])
not
in
[
list
,
tuple
]
:
if
not
isinstance
(
choices
[
0
],
(
list
,
tuple
))
:
choices
=
[
choices
]
for
choice
in
choices
:
...
...
@@ -838,7 +838,7 @@ class ChoiceTextResponseXMLFactory(ResponseXMLFactory):
# Make sure that `answers` is an ordered collection for
# convenience.
if
type
(
answers
)
not
in
[
list
,
tuple
]
:
if
not
isinstance
(
answers
,
(
list
,
tuple
))
:
answers
=
[
answers
]
numtolerance_inputs
=
[
...
...
common/lib/chem/chem/chemcalc.py
View file @
8a1877f0
...
...
@@ -91,7 +91,7 @@ def _clean_parse_tree(tree):
'paren_group_square'
:
lambda
x
:
nltk
.
tree
.
Tree
(
x
.
node
,
x
[
1
]),
'paren_group_round'
:
lambda
x
:
nltk
.
tree
.
Tree
(
x
.
node
,
x
[
1
])}
if
type
(
tree
)
==
str
:
if
isinstance
(
tree
,
str
)
:
return
tree
old_node
=
None
...
...
@@ -124,7 +124,7 @@ def _merge_children(tree, tags):
# Haven't grokked the code to tell if this is indeed the right thing to do.
raise
ParseException
(
"Shouldn't have empty trees"
)
if
type
(
tree
)
==
str
:
if
isinstance
(
tree
,
str
)
:
return
tree
merged_children
=
[]
...
...
@@ -134,7 +134,7 @@ def _merge_children(tree, tags):
while
not
done
:
done
=
True
for
child
in
tree
:
if
type
(
child
)
==
nltk
.
tree
.
Tree
and
child
.
node
==
tree
.
node
and
tree
.
node
in
tags
:
if
isinstance
(
child
,
nltk
.
tree
.
Tree
)
and
child
.
node
==
tree
.
node
and
tree
.
node
in
tags
:
merged_children
=
merged_children
+
list
(
child
)
done
=
False
else
:
...
...
@@ -182,7 +182,7 @@ def _render_to_html(tree):
'paren_group_round'
:
round_brackets
,
'paren_group_square'
:
square_brackets
}
if
type
(
tree
)
==
str
:
if
isinstance
(
tree
,
str
)
:
return
tree
else
:
children
=
""
.
join
(
map
(
_render_to_html
,
tree
))
...
...
common/lib/symmath/symmath/formula.py
View file @
8a1877f0
...
...
@@ -96,7 +96,7 @@ def my_evalf(expr, chop=False):
Enhanced sympy evalf to handle lists of expressions
and catch eval failures without dropping out.
"""
if
type
(
expr
)
==
list
:
if
isinstance
(
expr
,
list
)
:
try
:
return
[
x
.
evalf
(
chop
=
chop
)
for
x
in
expr
]
except
:
...
...
@@ -140,7 +140,7 @@ def my_sympify(expr, normphase=False, matrix=False, abcsym=False, do_qubit=False
sexpr
=
sympify
(
expr
,
locals
=
varset
)
if
normphase
:
# remove overall phase if sexpr is a list
if
type
(
sexpr
)
==
list
:
if
isinstance
(
sexpr
,
list
)
:
if
sexpr
[
0
]
.
is_number
:
ophase
=
sympy
.
sympify
(
'exp(-I*arg(
%
s))'
%
sexpr
[
0
])
sexpr
=
[
sympy
.
Mul
(
x
,
ophase
)
for
x
in
sexpr
]
...
...
@@ -150,10 +150,10 @@ def my_sympify(expr, normphase=False, matrix=False, abcsym=False, do_qubit=False
Convert a list, or list of lists to a matrix.
"""
# if expr is a list of lists, and is rectangular, then return Matrix(expr)
if
not
type
(
expr
)
==
list
:
if
not
isinstance
(
expr
,
list
)
:
return
expr
for
row
in
expr
:
if
(
not
type
(
row
)
==
list
):
if
not
isinstance
(
row
,
list
):
return
expr
rdim
=
len
(
expr
[
0
])
for
row
in
expr
:
...
...
@@ -230,7 +230,7 @@ class formula(object):
it, if possible...
"""
if
type
(
xml
)
==
str
or
type
(
xml
)
==
unicode
:
if
isinstance
(
xml
,
(
str
,
unicode
))
:
xml
=
etree
.
fromstring
(
xml
)
# TODO: wrap in try
xml
=
self
.
fix_greek_in_mathml
(
xml
)
# convert greek utf letters to greek spelled out in ascii
...
...
common/lib/symmath/symmath/symmath_check.py
View file @
8a1877f0
...
...
@@ -287,7 +287,7 @@ def symmath_check(expect, ans, dynamath=None, options=None, debug=None, xml=None
if
fexpect
==
fsym
:
return
{
'ok'
:
True
,
'msg'
:
msg
}
if
type
(
fexpect
)
==
list
:
if
isinstance
(
fexpect
,
list
)
:
try
:
xgiven
=
my_evalf
(
fsym
,
chop
=
True
)
dm
=
my_evalf
(
sympy
.
Matrix
(
fexpect
)
-
sympy
.
Matrix
(
xgiven
),
chop
=
True
)
...
...
common/lib/xmodule/xmodule/lti_2_util.py
View file @
8a1877f0
...
...
@@ -321,8 +321,8 @@ class LTI20ModuleMixin(object):
# the standard supports a list of objects, who knows why. It must contain at least 1 element, and the
# first element must be a dict
if
type
(
json_obj
)
!=
dict
:
if
type
(
json_obj
)
==
list
and
len
(
json_obj
)
>=
1
and
type
(
json_obj
[
0
])
==
dict
:
if
not
isinstance
(
json_obj
,
dict
)
:
if
isinstance
(
json_obj
,
list
)
and
len
(
json_obj
)
>=
1
and
isinstance
(
json_obj
[
0
],
dict
)
:
json_obj
=
json_obj
[
0
]
else
:
msg
=
(
"Supplied JSON string is a list that does not contain an object as the first element. {}"
...
...
common/lib/xmodule/xmodule/tabs.py
View file @
8a1877f0
...
...
@@ -126,7 +126,7 @@ class CourseTab(object):
was implemented).
"""
if
type
(
other
)
is
dict
and
not
self
.
validate
(
other
,
raise_error
=
False
):
if
isinstance
(
other
,
dict
)
and
not
self
.
validate
(
other
,
raise_error
=
False
):
# 'other' is a dict-type tab and did not validate
return
False
...
...
lms/djangoapps/foldit/tests.py
View file @
8a1877f0
...
...
@@ -51,9 +51,9 @@ class FolditTestCase(TestCase):
Given lists of puzzle_ids and best_scores (must have same length), make a
SetPlayerPuzzleScores request and return the response.
"""
if
not
(
type
(
best_scores
)
==
list
):
if
not
isinstance
(
best_scores
,
list
):
best_scores
=
[
best_scores
]
if
not
(
type
(
puzzle_ids
)
==
list
):
if
not
isinstance
(
puzzle_ids
,
list
):
puzzle_ids
=
[
puzzle_ids
]
user
=
self
.
user
if
not
user
else
user
...
...
lms/djangoapps/lms_migration/migrate.py
View file @
8a1877f0
...
...
@@ -139,7 +139,7 @@ def manage_modulestores(request, reload_dir=None, commit_id=None):
for
field
in
dumpfields
:
data
=
getattr
(
course
,
field
,
None
)
html
+=
'<h3>
%
s</h3>'
%
field
if
type
(
data
)
==
dict
:
if
isinstance
(
data
,
dict
)
:
html
+=
'<ul>'
for
k
,
v
in
data
.
items
():
html
+=
'<li>
%
s:
%
s</li>'
%
(
escape
(
k
),
escape
(
v
))
...
...
lms/djangoapps/mobile_api/social_facebook/courses/views.py
View file @
8a1877f0
...
...
@@ -37,7 +37,7 @@ class CoursesWithFriends(generics.ListAPIView):
# Get friends from Facebook
result
=
get_friends_from_facebook
(
serializer
)
if
type
(
result
)
!=
list
:
if
not
isinstance
(
result
,
list
)
:
return
result
friends_that_are_edx_users
=
get_linked_edx_accounts
(
result
)
...
...
lms/djangoapps/mobile_api/social_facebook/friends/views.py
View file @
8a1877f0
...
...
@@ -46,7 +46,7 @@ class FriendsInCourse(generics.ListAPIView):
# Get all the user's FB friends
result
=
get_friends_from_facebook
(
serializer
)
if
type
(
result
)
!=
list
:
if
not
isinstance
(
result
,
list
)
:
return
result
def
is_member
(
friend
,
course_key
):
...
...
lms/djangoapps/notes/models.py
View file @
8a1877f0
...
...
@@ -30,7 +30,7 @@ class Note(models.Model):
raise
ValidationError
(
'Note must have a body.'
)
body
=
json
.
loads
(
json_body
)
if
not
type
(
body
)
is
dict
:
if
not
isinstance
(
body
,
dict
)
:
raise
ValidationError
(
'Note body must be a dictionary.'
)
# NOTE: all three of these fields should be considered user input
...
...
requirements/edx/base.txt
View file @
8a1877f0
...
...
@@ -125,6 +125,7 @@ django_debug_toolbar==1.2.2
django-debug-toolbar-mongo
# Used for testing
astroid==1.3.4
chrono==1.0.2
coverage==3.7
ddt==0.8.0
...
...
@@ -141,7 +142,7 @@ nose-ignore-docstring
nosexcover==1.0.7
pep8==1.5.7
PyContracts==1.7.1
pylint==1.4.
1
pylint==1.4.
2
python-subunit==0.0.16
radon==1.2
rednose==0.3
...
...
scripts/all-tests.sh
View file @
8a1877f0
...
...
@@ -61,7 +61,7 @@ git clean -qxfd
source
scripts/jenkins-common.sh
# Violations thresholds for failing the build
PYLINT_THRESHOLD
=
5
8
00
PYLINT_THRESHOLD
=
5
5
00
# If the environment variable 'SHARD' is not set, default to 'all'.
# This could happen if you are trying to use this script from
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment