Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flatland
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
pranjal_dhole
Flatland
Commits
6fe57d45
Commit
6fe57d45
authored
5 years ago
by
u214892
Browse files
Options
Downloads
Patches
Plain Diff
fix error by copying file from unresolved package
parent
ddaac2a1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+1
-3
1 addition, 3 deletions
.gitlab-ci.yml
benchmarks/benchmark_utils.py
+35
-0
35 additions, 0 deletions
benchmarks/benchmark_utils.py
benchmarks/profile_all_examples.py
+3
-5
3 additions, 5 deletions
benchmarks/profile_all_examples.py
with
39 additions
and
8 deletions
.gitlab-ci.yml
+
1
−
3
View file @
6fe57d45
...
@@ -26,9 +26,7 @@ tests:
...
@@ -26,9 +26,7 @@ tests:
-
apt update
-
apt update
-
apt install -y libgl1-mesa-glx xvfb graphviz xdg-utils libcairo2-dev libjpeg-dev libgif-dev
-
apt install -y libgl1-mesa-glx xvfb graphviz xdg-utils libcairo2-dev libjpeg-dev libgif-dev
-
pip install tox
-
pip install tox
-
which python
-
xvfb-run tox -e benchmarks,profiling -v --recreate
-
ls /usr/lib/python3.7/
-
python -c 'from test.support import swap_attr2'
-
xvfb-run tox -v --recreate
-
xvfb-run tox -v --recreate
build_and_deploy_docs
:
build_and_deploy_docs
:
...
...
This diff is collapsed.
Click to expand it.
benchmarks/benchmark_utils.py
0 → 100644
+
35
−
0
View file @
6fe57d45
import
contextlib
# Copied from https://docs.python.org/3/library/test.html
@contextlib.contextmanager
def
swap_attr
(
obj
,
attr
,
new_val
):
"""
Temporary swap out an attribute with a new object.
Usage:
with swap_attr(obj,
"
attr
"
, 5):
...
This will set obj.attr to 5 for the duration of the with: block,
restoring the old value at the end of the block. If `attr` doesn
'
t
exist on `obj`, it will be created and then deleted at the end of the
block.
The old value (or None if it doesn
'
t exist) will be assigned to the
target of the
"
as
"
clause, if there is one.
"""
if
hasattr
(
obj
,
attr
):
real_val
=
getattr
(
obj
,
attr
)
setattr
(
obj
,
attr
,
new_val
)
try
:
yield
real_val
finally
:
setattr
(
obj
,
attr
,
real_val
)
else
:
setattr
(
obj
,
attr
,
new_val
)
try
:
yield
finally
:
if
hasattr
(
obj
,
attr
):
delattr
(
obj
,
attr
)
This diff is collapsed.
Click to expand it.
benchmarks/profile_all_examples.py
+
3
−
5
View file @
6fe57d45
...
@@ -2,19 +2,17 @@ import cProfile
...
@@ -2,19 +2,17 @@ import cProfile
import
runpy
import
runpy
import
sys
import
sys
from
io
import
StringIO
from
io
import
StringIO
from
test.support
import
swap_attr
import
importlib_resources
import
importlib_resources
import
pkg_resources
import
pkg_resources
from
importlib_resources
import
path
from
importlib_resources
import
path
from
benchmarks.benchmark_utils
import
swap_attr
def
profile
(
resource
,
entry
):
def
profile
(
resource
,
entry
):
with
path
(
resource
,
entry
)
as
file_in
:
with
path
(
resource
,
entry
)
as
file_in
:
# we use the test package, which is meant for internal use by Python only internal and
# Any use of this package outside of Python’s standard library is discouraged as code (..)
# can change or be removed without notice between releases of Python.
# https://docs.python.org/3/library/test.html
# TODO remove input() from examples
# TODO remove input() from examples
print
(
"
*****************************************************************
"
)
print
(
"
*****************************************************************
"
)
print
(
"
Profiling {}
"
.
format
(
entry
))
print
(
"
Profiling {}
"
.
format
(
entry
))
...
...
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