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
df6d3f9b
Commit
df6d3f9b
authored
Jun 17, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix strings that should be raw.
parent
181b1e97
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
20 additions
and
21 deletions
+20
-21
cms/djangoapps/models/settings/course_details.py
+2
-2
common/djangoapps/student/management/commands/set_staff.py
+1
-1
common/djangoapps/student/views.py
+3
-3
common/djangoapps/terrain/steps.py
+1
-1
common/lib/capa/capa/capa_problem.py
+2
-2
common/lib/capa/capa/customrender.py
+2
-2
common/lib/capa/capa/inputtypes.py
+1
-1
common/lib/capa/capa/responsetypes.py
+2
-3
common/lib/symmath/symmath/formula.py
+2
-2
common/lib/xmodule/xmodule/modulestore/xml.py
+1
-1
common/lib/xmodule/xmodule/tests/test_stringify.py
+1
-1
lms/djangoapps/course_wiki/views.py
+1
-1
lms/djangoapps/foldit/views.py
+1
-1
No files found.
cms/djangoapps/models/settings/course_details.py
View file @
df6d3f9b
...
@@ -153,9 +153,9 @@ class CourseDetails(object):
...
@@ -153,9 +153,9 @@ class CourseDetails(object):
if
not
raw_video
:
if
not
raw_video
:
return
None
return
None
keystring_matcher
=
re
.
search
(
'(?<=embed/)[a-zA-Z0-9_-]+'
,
raw_video
)
keystring_matcher
=
re
.
search
(
r
'(?<=embed/)[a-zA-Z0-9_-]+'
,
raw_video
)
if
keystring_matcher
is
None
:
if
keystring_matcher
is
None
:
keystring_matcher
=
re
.
search
(
'<?=
\
d+:[a-zA-Z0-9_-]+'
,
raw_video
)
keystring_matcher
=
re
.
search
(
r
'<?=\d+:[a-zA-Z0-9_-]+'
,
raw_video
)
if
keystring_matcher
:
if
keystring_matcher
:
return
keystring_matcher
.
group
(
0
)
return
keystring_matcher
.
group
(
0
)
...
...
common/djangoapps/student/management/commands/set_staff.py
View file @
df6d3f9b
...
@@ -26,7 +26,7 @@ class Command(BaseCommand):
...
@@ -26,7 +26,7 @@ class Command(BaseCommand):
raise
CommandError
(
'Usage is set_staff {0}'
.
format
(
self
.
args
))
raise
CommandError
(
'Usage is set_staff {0}'
.
format
(
self
.
args
))
for
user
in
args
:
for
user
in
args
:
if
re
.
match
(
'[^@]+@[^@]+
\
.[^@]+'
,
user
):
if
re
.
match
(
r
'[^@]+@[^@]+\.[^@]+'
,
user
):
try
:
try
:
v
=
User
.
objects
.
get
(
email
=
user
)
v
=
User
.
objects
.
get
(
email
=
user
)
except
:
except
:
...
...
common/djangoapps/student/views.py
View file @
df6d3f9b
...
@@ -3,6 +3,7 @@ import feedparser
...
@@ -3,6 +3,7 @@ import feedparser
import
json
import
json
import
logging
import
logging
import
random
import
random
import
re
import
string
import
string
import
urllib
import
urllib
import
uuid
import
uuid
...
@@ -95,9 +96,8 @@ def course_from_id(course_id):
...
@@ -95,9 +96,8 @@ def course_from_id(course_id):
course_loc
=
CourseDescriptor
.
id_to_location
(
course_id
)
course_loc
=
CourseDescriptor
.
id_to_location
(
course_id
)
return
modulestore
()
.
get_instance
(
course_id
,
course_loc
)
return
modulestore
()
.
get_instance
(
course_id
,
course_loc
)
import
re
day_pattern
=
re
.
compile
(
r'\s\d+,\s'
)
day_pattern
=
re
.
compile
(
'
\
s
\
d+,
\
s'
)
multimonth_pattern
=
re
.
compile
(
r'\s?\-\s?\S+\s'
)
multimonth_pattern
=
re
.
compile
(
'
\
s?
\
-
\
s?
\
S+
\
s'
)
def
get_date_for_press
(
publish_date
):
def
get_date_for_press
(
publish_date
):
...
...
common/djangoapps/terrain/steps.py
View file @
df6d3f9b
...
@@ -21,7 +21,7 @@ from logging import getLogger
...
@@ -21,7 +21,7 @@ from logging import getLogger
logger
=
getLogger
(
__name__
)
logger
=
getLogger
(
__name__
)
@step
(
u
'I wait (?:for )?"(
\
d+)" seconds?$'
)
@step
(
r
'I wait (?:for )?"(\d+)" seconds?$'
)
def
wait
(
step
,
seconds
):
def
wait
(
step
,
seconds
):
world
.
wait
(
seconds
)
world
.
wait
(
seconds
)
...
...
common/lib/capa/capa/capa_problem.py
View file @
df6d3f9b
...
@@ -103,8 +103,8 @@ class LoncapaProblem(object):
...
@@ -103,8 +103,8 @@ class LoncapaProblem(object):
self
.
input_state
=
state
.
get
(
'input_state'
,
{})
self
.
input_state
=
state
.
get
(
'input_state'
,
{})
# Convert startouttext and endouttext to proper <text></text>
# Convert startouttext and endouttext to proper <text></text>
problem_text
=
re
.
sub
(
"startouttext
\
s*/"
,
"text"
,
problem_text
)
problem_text
=
re
.
sub
(
r
"startouttext\s*/"
,
"text"
,
problem_text
)
problem_text
=
re
.
sub
(
"endouttext
\
s*/"
,
"/text"
,
problem_text
)
problem_text
=
re
.
sub
(
r
"endouttext\s*/"
,
"/text"
,
problem_text
)
self
.
problem_text
=
problem_text
self
.
problem_text
=
problem_text
# parse problem XML file into an element tree
# parse problem XML file into an element tree
...
...
common/lib/capa/capa/customrender.py
View file @
df6d3f9b
...
@@ -26,7 +26,7 @@ class MathRenderer(object):
...
@@ -26,7 +26,7 @@ class MathRenderer(object):
tags
=
[
'math'
]
tags
=
[
'math'
]
def
__init__
(
self
,
system
,
xml
):
def
__init__
(
self
,
system
,
xml
):
'''
r
'''
Render math using latex-like formatting.
Render math using latex-like formatting.
Examples:
Examples:
...
@@ -41,7 +41,7 @@ class MathRenderer(object):
...
@@ -41,7 +41,7 @@ class MathRenderer(object):
self
.
system
=
system
self
.
system
=
system
self
.
xml
=
xml
self
.
xml
=
xml
mathstr
=
re
.
sub
(
'
\
$(.*)
\
$'
,
r'[mathjaxinline]\1[/mathjaxinline]'
,
xml
.
text
)
mathstr
=
re
.
sub
(
r
'\$(.*)\$'
,
r'[mathjaxinline]\1[/mathjaxinline]'
,
xml
.
text
)
mtag
=
'mathjax'
mtag
=
'mathjax'
if
not
r'\displaystyle'
in
mathstr
:
if
not
r'\displaystyle'
in
mathstr
:
mtag
+=
'inline'
mtag
+=
'inline'
...
...
common/lib/capa/capa/inputtypes.py
View file @
df6d3f9b
...
@@ -856,7 +856,7 @@ class ImageInput(InputTypeBase):
...
@@ -856,7 +856,7 @@ class ImageInput(InputTypeBase):
"""
"""
if value is of the form [x,y] then parse it and send along coordinates of previous answer
if value is of the form [x,y] then parse it and send along coordinates of previous answer
"""
"""
m
=
re
.
match
(
'
\
[([0-9]+),([0-9]+)]'
,
m
=
re
.
match
(
r
'\[([0-9]+),([0-9]+)]'
,
self
.
value
.
strip
()
.
replace
(
' '
,
''
))
self
.
value
.
strip
()
.
replace
(
' '
,
''
))
if
m
:
if
m
:
# Note: we subtract 15 to compensate for the size of the dot on the screen.
# Note: we subtract 15 to compensate for the size of the dot on the screen.
...
...
common/lib/capa/capa/responsetypes.py
View file @
df6d3f9b
...
@@ -1902,8 +1902,7 @@ class ImageResponse(LoncapaResponse):
...
@@ -1902,8 +1902,7 @@ class ImageResponse(LoncapaResponse):
if
not
given
:
# No answer to parse. Mark as incorrect and move on
if
not
given
:
# No answer to parse. Mark as incorrect and move on
continue
continue
# parse given answer
# parse given answer
m
=
re
.
match
(
m
=
re
.
match
(
r'\[([0-9]+),([0-9]+)]'
,
given
.
strip
()
.
replace
(
' '
,
''
))
'
\
[([0-9]+),([0-9]+)]'
,
given
.
strip
()
.
replace
(
' '
,
''
))
if
not
m
:
if
not
m
:
raise
Exception
(
'[capamodule.capa.responsetypes.imageinput] '
raise
Exception
(
'[capamodule.capa.responsetypes.imageinput] '
'error grading
%
s (input=
%
s)'
%
(
aid
,
given
))
'error grading
%
s (input=
%
s)'
%
(
aid
,
given
))
...
@@ -1918,7 +1917,7 @@ class ImageResponse(LoncapaResponse):
...
@@ -1918,7 +1917,7 @@ class ImageResponse(LoncapaResponse):
# parse expected answer
# parse expected answer
# TODO: Compile regexp on file load
# TODO: Compile regexp on file load
m
=
re
.
match
(
m
=
re
.
match
(
'[
\
(
\
[]([0-9]+),([0-9]+)[
\
)
\
]]-[
\
(
\
[]([0-9]+),([0-9]+)[
\
)
\
]]'
,
r
'[\(\[]([0-9]+),([0-9]+)[\)\]]-[\(\[]([0-9]+),([0-9]+)[\)\]]'
,
solution_rectangle
.
strip
()
.
replace
(
' '
,
''
))
solution_rectangle
.
strip
()
.
replace
(
' '
,
''
))
if
not
m
:
if
not
m
:
msg
=
'Error in problem specification! cannot parse rectangle in
%
s'
%
(
msg
=
'Error in problem specification! cannot parse rectangle in
%
s'
%
(
...
...
common/lib/symmath/symmath/formula.py
View file @
df6d3f9b
...
@@ -50,7 +50,7 @@ class dot(sympy.operations.LatticeOp): # my dot product
...
@@ -50,7 +50,7 @@ class dot(sympy.operations.LatticeOp): # my dot product
def
_print_dot
(
self
,
expr
):
def
_print_dot
(
self
,
expr
):
return
'{((
%
s)
\
cdot (
%
s))}'
%
(
expr
.
args
[
0
],
expr
.
args
[
1
])
return
r
'{((
%
s) \cdot (
%
s))}'
%
(
expr
.
args
[
0
],
expr
.
args
[
1
])
LatexPrinter
.
_print_dot
=
_print_dot
LatexPrinter
.
_print_dot
=
_print_dot
...
@@ -202,7 +202,7 @@ class formula(object):
...
@@ -202,7 +202,7 @@ class formula(object):
return
xml
return
xml
def
preprocess_pmathml
(
self
,
xml
):
def
preprocess_pmathml
(
self
,
xml
):
'''
r
'''
Pre-process presentation MathML from ASCIIMathML to make it more
Pre-process presentation MathML from ASCIIMathML to make it more
acceptable for SnuggleTeX, and also to accomodate some sympy
acceptable for SnuggleTeX, and also to accomodate some sympy
conventions (eg hat(i) for \hat{i}).
conventions (eg hat(i) for \hat{i}).
...
...
common/lib/xmodule/xmodule/modulestore/xml.py
View file @
df6d3f9b
...
@@ -38,7 +38,7 @@ log = logging.getLogger(__name__)
...
@@ -38,7 +38,7 @@ log = logging.getLogger(__name__)
# into the cms from xml
# into the cms from xml
def
clean_out_mako_templating
(
xml_string
):
def
clean_out_mako_templating
(
xml_string
):
xml_string
=
xml_string
.
replace
(
'
%
include'
,
'include'
)
xml_string
=
xml_string
.
replace
(
'
%
include'
,
'include'
)
xml_string
=
re
.
sub
(
"(?m)^
\
s*
%.*
$"
,
''
,
xml_string
)
xml_string
=
re
.
sub
(
r
"(?m)^\s*
%.*
$"
,
''
,
xml_string
)
return
xml_string
return
xml_string
...
...
common/lib/xmodule/xmodule/tests/test_stringify.py
View file @
df6d3f9b
...
@@ -12,7 +12,7 @@ def test_stringify():
...
@@ -12,7 +12,7 @@ def test_stringify():
def
test_stringify_again
():
def
test_stringify_again
():
html
=
"""<html name="Voltage Source Answer" >A voltage source is non-linear!
html
=
r
"""<html name="Voltage Source Answer" >A voltage source is non-linear!
<div align="center">
<div align="center">
<img src="/static/images/circuits/voltage-source.png"/>
<img src="/static/images/circuits/voltage-source.png"/>
\(V=V_C\)
\(V=V_C\)
...
...
lms/djangoapps/course_wiki/views.py
View file @
df6d3f9b
...
@@ -49,7 +49,7 @@ def course_wiki_redirect(request, course_id):
...
@@ -49,7 +49,7 @@ def course_wiki_redirect(request, course_id):
if
not
course_slug
:
if
not
course_slug
:
log
.
exception
(
"This course is improperly configured. The slug cannot be empty."
)
log
.
exception
(
"This course is improperly configured. The slug cannot be empty."
)
valid_slug
=
False
valid_slug
=
False
if
re
.
match
(
'^[-
\
w
\
.]+$'
,
course_slug
)
is
None
:
if
re
.
match
(
r
'^[-\w\.]+$'
,
course_slug
)
is
None
:
log
.
exception
(
"This course is improperly configured. The slug can only contain letters, numbers, periods or hyphens."
)
log
.
exception
(
"This course is improperly configured. The slug can only contain letters, numbers, periods or hyphens."
)
valid_slug
=
False
valid_slug
=
False
...
...
lms/djangoapps/foldit/views.py
View file @
df6d3f9b
...
@@ -46,7 +46,7 @@ def foldit_ops(request):
...
@@ -46,7 +46,7 @@ def foldit_ops(request):
# To allow for fixes without breaking this, the regex should only
# To allow for fixes without breaking this, the regex should only
# match unquoted strings,
# match unquoted strings,
a
=
re
.
compile
(
r':([a-zA-Z]*),'
)
a
=
re
.
compile
(
r':([a-zA-Z]*),'
)
puzzle_scores_json
=
re
.
sub
(
a
,
':"
\
g<1>",'
,
puzzle_scores_json
)
puzzle_scores_json
=
re
.
sub
(
a
,
r
':"\g<1>",'
,
puzzle_scores_json
)
puzzle_scores
=
json
.
loads
(
puzzle_scores_json
)
puzzle_scores
=
json
.
loads
(
puzzle_scores_json
)
responses
.
append
(
save_scores
(
request
.
user
,
puzzle_scores
))
responses
.
append
(
save_scores
(
request
.
user
,
puzzle_scores
))
...
...
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