Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pytools
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Code
Merge requests
1
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
3eea3b25
Commit
3eea3b25
authored
10 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Record: allow customization of kwargs used in Record.copy
parent
13e00fd5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pytools/__init__.py
+5
-2
5 additions, 2 deletions
pytools/__init__.py
with
5 additions
and
2 deletions
pytools/__init__.py
+
5
−
2
View file @
3eea3b25
...
...
@@ -138,14 +138,17 @@ class RecordWithoutPickling(object):
fields
.
add
(
key
)
setattr
(
self
,
key
,
value
)
def
copy
(
self
,
**
kwargs
):
def
get_copy_kwargs
(
self
,
**
kwargs
):
for
f
in
self
.
__class__
.
fields
:
if
f
not
in
kwargs
:
try
:
kwargs
[
f
]
=
getattr
(
self
,
f
)
except
AttributeError
:
pass
return
self
.
__class__
(
**
kwargs
)
return
kwargs
def
copy
(
self
,
**
kwargs
):
return
self
.
__class__
(
**
self
.
get_copy_kwargs
(
**
kwargs
))
def
__repr__
(
self
):
return
"
%s(%s)
"
%
(
...
...
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