Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
2f45942a
Commit
2f45942a
authored
Dec 24, 2013
by
Hilton Bristow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converted necessary files for python3 compatibility using 2to3
parent
b29835a8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
13 deletions
+11
-13
rst_parser.py
modules/java/generator/rst_parser.py
+0
-0
filters.py
modules/matlab/generator/filters.py
+1
-2
parse_tree.py
modules/matlab/generator/parse_tree.py
+10
-11
No files found.
modules/java/generator/rst_parser.py
View file @
2f45942a
This diff is collapsed.
Click to expand it.
modules/matlab/generator/filters.py
View file @
2f45942a
from
textwrap
import
TextWrapper
from
string
import
split
,
join
import
re
,
os
# precompile a URL matching regular expression
urlexpr
=
re
.
compile
(
r"((https?):((//)|(\\\\))+[\w\d:#@
%
/;$()~_?\+-=\\\.&]*)"
,
re
.
MULTILINE
|
re
.
UNICODE
)
...
...
@@ -177,4 +176,4 @@ def comment(text, wrap=80, escape='% ', escape_first='', escape_last=''):
escapn
=
'
\n
'
+
escape
lines
=
text
.
split
(
'
\n
'
)
wlines
=
(
tw
.
wrap
(
line
)
for
line
in
lines
)
return
escape_first
+
escape
+
join
((
join
(
line
,
escapn
)
for
line
in
wlines
),
escapn
)
+
escape_last
return
escape_first
+
escape
+
escapn
.
join
(
escapn
.
join
(
line
)
for
line
in
wlines
)
+
escape_last
modules/matlab/generator/parse_tree.py
View file @
2f45942a
from
string
import
join
from
textwrap
import
fill
from
filters
import
*
...
...
@@ -74,7 +73,7 @@ class ParseTree(object):
self
.
namespaces
=
namespaces
if
namespaces
else
[]
def
__str__
(
self
):
return
join
((
ns
.
__str__
()
for
ns
in
self
.
namespaces
),
'
\n\n\n
'
)
return
'
\n\n\n
'
.
join
(
ns
.
__str__
()
for
ns
in
self
.
namespaces
)
def
build
(
self
,
namespaces
):
babel
=
Translator
()
...
...
@@ -94,7 +93,7 @@ class ParseTree(object):
constants
.
append
(
obj
)
else
:
raise
TypeError
(
'Unexpected object type: '
+
str
(
type
(
obj
)))
self
.
namespaces
.
append
(
Namespace
(
name
,
constants
,
class_tree
.
values
(
),
methods
))
self
.
namespaces
.
append
(
Namespace
(
name
,
constants
,
list
(
class_tree
.
values
()
),
methods
))
def
insertIntoClassTree
(
self
,
obj
,
class_tree
):
cname
=
obj
.
name
if
type
(
obj
)
is
Class
else
obj
.
clss
...
...
@@ -208,9 +207,9 @@ class Namespace(object):
def
__str__
(
self
):
return
'namespace '
+
self
.
name
+
' {
\n\n
'
+
\
(
join
((
c
.
__str__
()
for
c
in
self
.
constants
),
'
\n
'
)
+
'
\n\n
'
if
self
.
constants
else
''
)
+
\
(
join
((
f
.
__str__
()
for
f
in
self
.
methods
),
'
\n
'
)
+
'
\n\n
'
if
self
.
methods
else
''
)
+
\
(
join
((
o
.
__str__
()
for
o
in
self
.
classes
),
'
\n\n
'
)
if
self
.
classes
else
''
)
+
'
\n
};'
(
'
\n
'
.
join
(
c
.
__str__
()
for
c
in
self
.
constants
)
+
'
\n\n
'
if
self
.
constants
else
''
)
+
\
(
'
\n
'
.
join
(
f
.
__str__
()
for
f
in
self
.
methods
)
+
'
\n\n
'
if
self
.
methods
else
''
)
+
\
(
'
\n\n
'
.
join
(
o
.
__str__
()
for
o
in
self
.
classes
)
if
self
.
classes
else
''
)
+
'
\n
};'
class
Class
(
object
):
"""
...
...
@@ -228,8 +227,8 @@ class Class(object):
def
__str__
(
self
):
return
'class '
+
self
.
name
+
' {
\n\t
'
+
\
(
join
((
c
.
__str__
()
for
c
in
self
.
constants
),
'
\n\t
'
)
+
'
\n\n\t
'
if
self
.
constants
else
''
)
+
\
(
join
((
f
.
__str__
()
for
f
in
self
.
methods
),
'
\n\t
'
)
if
self
.
methods
else
''
)
+
'
\n
};'
(
'
\n\t
'
.
join
(
c
.
__str__
()
for
c
in
self
.
constants
)
+
'
\n\n\t
'
if
self
.
constants
else
''
)
+
\
(
'
\n\t
'
.
join
(
f
.
__str__
()
for
f
in
self
.
methods
)
if
self
.
methods
else
''
)
+
'
\n
};'
class
Method
(
object
):
"""
...
...
@@ -260,7 +259,7 @@ class Method(object):
def
__str__
(
self
):
return
(
self
.
rtp
+
' '
if
self
.
rtp
else
''
)
+
self
.
name
+
'('
+
\
join
((
arg
.
__str__
()
for
arg
in
self
.
req
+
self
.
opt
),
', '
)
+
\
', '
.
join
(
arg
.
__str__
()
for
arg
in
self
.
req
+
self
.
opt
)
+
\
')'
+
(
' const'
if
self
.
const
else
''
)
+
';'
class
Argument
(
object
):
...
...
@@ -343,11 +342,11 @@ def todict(obj, classkey=None):
for
k
in
obj
.
keys
():
obj
[
k
]
=
todict
(
obj
[
k
],
classkey
)
return
obj
elif
hasattr
(
obj
,
"__iter__"
):
elif
isinstance
(
obj
,
list
):
return
[
todict
(
v
,
classkey
)
for
v
in
obj
]
elif
hasattr
(
obj
,
"__dict__"
):
data
=
dict
([(
key
,
todict
(
value
,
classkey
))
for
key
,
value
in
obj
.
__dict__
.
ite
rite
ms
()
for
key
,
value
in
obj
.
__dict__
.
items
()
if
not
callable
(
value
)
and
not
key
.
startswith
(
'_'
)])
if
classkey
is
not
None
and
hasattr
(
obj
,
"__class__"
):
data
[
classkey
]
=
obj
.
__class__
.
__name__
...
...
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