Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pyromaths
pyromaths
Commits
6dd78bb7
Commit
6dd78bb7
authored
Jun 04, 2013
by
Olivier Cornu
Browse files
Use inspect module to avoid redundancy.
parent
feb8b7b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/pyromaths/ex/__init__.py
View file @
6dd78bb7
import
inspect
import
os
import
types
import
pkgutil
...
...
@@ -58,10 +59,6 @@ def __legacy(path, i, function):
)
)
def
__isfunction
(
obj
):
''' Is 'obj' a function? '''
return
type
(
obj
)
is
types
.
FunctionType
def
__hasdescription
(
obj
):
''' Has 'obj' a legit description? '''
if
'description'
not
in
dir
(
obj
):
return
False
...
...
@@ -72,7 +69,7 @@ def __hasdescription(obj):
def
__isexercise
(
obj
):
''' Is target object an exercise in legacy format? '''
return
__
isfunction
(
obj
)
and
__hasdescription
(
obj
)
return
inspect
.
isfunction
(
obj
)
and
__hasdescription
(
obj
)
def
__levels
(
level
):
''' Format academic level(s). '''
...
...
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