Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pytools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Andreas Klöckner
pytools
Commits
7b4e0e42
Commit
7b4e0e42
authored
11 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Fix get_run_debug_directory()
parent
eee785ae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pytools/debug.py
+10
-9
10 additions, 9 deletions
pytools/debug.py
with
10 additions
and
9 deletions
pytools/debug.py
+
10
−
9
View file @
7b4e0e42
from
pytools
import
memoize
# {{{ debug files -------------------------------------------------------------
def
make_unique_filesystem_object
(
stem
,
extension
=
""
,
directory
=
""
,
...
...
@@ -28,8 +26,6 @@ def make_unique_filesystem_object(stem, extension="", directory="",
i
+=
1
@memoize
def
get_run_debug_directory
():
def
creator
(
name
):
...
...
@@ -37,9 +33,7 @@ def get_run_debug_directory():
mkdir
(
name
)
return
name
return
make_unique_filesystem_object
(
"
run-debug
"
,
creator
=
creator
)
return
make_unique_filesystem_object
(
"
run-debug
"
,
creator
=
creator
)[
0
]
def
open_unique_debug_file
(
stem
,
extension
=
""
):
...
...
@@ -51,10 +45,13 @@ def open_unique_debug_file(stem, extension=""):
# }}}
# {{{ refcount debugging ------------------------------------------------------
class
RefDebugQuit
(
Exception
):
pass
def
refdebug
(
obj
,
top_level
=
True
,
exclude
=
[]):
from
types
import
FrameType
...
...
@@ -107,7 +104,7 @@ def refdebug(obj, top_level=True, exclude=[]):
response
=
raw_input
()
if
response
==
"
d
"
:
if
response
==
"
d
"
:
refdebug
(
r
,
top_level
=
False
,
exclude
=
exclude
+
[
reflist
])
print_head
=
True
elif
response
==
"
n
"
:
...
...
@@ -137,6 +134,7 @@ def refdebug(obj, top_level=True, exclude=[]):
# }}}
# {{{ interactive shell
def
get_shell_hist_filename
():
...
...
@@ -144,11 +142,12 @@ def get_shell_hist_filename():
_home
=
os
.
environ
.
get
(
'
HOME
'
,
'
/
'
)
return
os
.
path
.
join
(
_home
,
"
.pytools-debug-shell-history
"
)
def
setup_readline
():
try
:
readline
.
read_history_file
(
get_shell_hist_filename
())
except
Exception
:
# http://docs.python.org/3/howto/pyporting.html#capturing-the-currently-raised-exception
# http://docs.python.org/3/howto/pyporting.html#capturing-the-currently-raised-exception
# noqa
import
sys
e
=
sys
.
exc_info
()[
1
]
...
...
@@ -166,6 +165,7 @@ except ImportError:
else
:
setup_readline
()
class
SetPropagatingDict
(
dict
):
def
__init__
(
self
,
source_dicts
,
target_dict
):
dict
.
__init__
(
self
)
...
...
@@ -182,6 +182,7 @@ class SetPropagatingDict(dict):
dict
.
__delitem__
(
self
,
key
)
del
self
.
target_dict
[
key
]
def
shell
(
locals
=
None
,
globals
=
None
):
from
inspect
import
currentframe
,
getouterframes
calling_frame
=
getouterframes
(
currentframe
())[
1
][
0
]
...
...
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