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
6275791b
Commit
6275791b
authored
15 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Add DeprecatedFunctionWrapper.
parent
b07953cf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pytools/__init__.py
+17
-2
17 additions, 2 deletions
pytools/__init__.py
with
17 additions
and
2 deletions
pytools/__init__.py
+
17
−
2
View file @
6275791b
...
@@ -1064,8 +1064,8 @@ def string_histogram(iterable, min_value=None, max_value=None, bin_count=20, wid
...
@@ -1064,8 +1064,8 @@ def string_histogram(iterable, min_value=None, max_value=None, bin_count=20, wid
format_bar
(
bin_value
))
format_bar
(
bin_value
))
for
bin_start
,
bin_value
in
zip
(
bin_starts
,
bins
))
for
bin_start
,
bin_value
in
zip
(
bin_starts
,
bins
))
# command line interfaces -----------------------------------------------------
# command line interfaces -----------------------------------------------------
class
CPyUserInterface
(
object
):
class
CPyUserInterface
(
object
):
...
@@ -1144,6 +1144,21 @@ class CPyUserInterface(object):
...
@@ -1144,6 +1144,21 @@ class CPyUserInterface(object):
# obscure stuff --------------------------------------------------------------
# obscure stuff --------------------------------------------------------------
class
DeprecatedFunctionWrapper
:
def
__init__
(
self
,
f
):
self
.
f
=
f
def
__call__
(
self
,
*
args
,
**
kwargs
):
from
warnings
import
warn
warn
(
"
This function is deprecated. Use %s.%s instead.
"
%
(
self
.
f
.
__module__
,
self
.
f
.
__name__
),
DeprecationWarning
,
stacklevel
=
1
)
return
self
.
f
(
*
args
,
**
kwargs
)
def
enumerate_basic_directions
(
dimensions
):
def
enumerate_basic_directions
(
dimensions
):
coordinate_list
=
[[
0
],
[
1
],
[
-
1
]]
coordinate_list
=
[[
0
],
[
1
],
[
-
1
]]
return
reduce
(
cartesian_product_sum
,
[
coordinate_list
]
*
dimensions
)[
1
:]
return
reduce
(
cartesian_product_sum
,
[
coordinate_list
]
*
dimensions
)[
1
:]
...
...
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