Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
1806699f
Commit
1806699f
authored
12 years ago
by
Victor Shnayder
Browse files
Options
Downloads
Patches
Plain Diff
typos
parent
5177e8c6
No related branches found
Branches containing commit
Tags
release-2021-03-16-09.35
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/lib/capa/capa/util.py
+6
-5
6 additions, 5 deletions
common/lib/capa/capa/util.py
with
6 additions
and
5 deletions
common/lib/capa/capa/util.py
+
6
−
5
View file @
1806699f
...
...
@@ -26,13 +26,14 @@ def compare_with_tolerance(v1, v2, tol):
def
contextualize_text
(
text
,
context
):
# private
'''
Takes a string with variables. E.g. $a+$b.
Does a substitution of those variables from the context
'''
if
not
text
:
return
text
if
not
text
:
return
text
for
key
in
sorted
(
context
,
lambda
x
,
y
:
cmp
(
len
(
y
),
len
(
x
))):
# TODO (vshnayder): This whole replacement thing is a big hack
# right now--context contains not just
just
the vars defined
#
in the
program, but also e.g. a reference to the numpy
#
module.
Should be a separate dict of variables that
ar
e
#
should be
replaced.
# right now--context contains not just the vars defined
in the
# program, but also e.g. a reference to the numpy
module.
# Should be a separate dict of variables that
should b
e
# replaced.
if
'
$
'
+
key
in
text
:
try
:
s
=
str
(
context
[
key
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment