Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pykat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
finesse
pykat
Commits
1a50086b
There was a problem fetching the pipeline summary.
Commit
1a50086b
authored
8 years ago
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
missing file
parent
ea592218
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pykat/freeze.py
+25
-0
25 additions, 0 deletions
pykat/freeze.py
with
25 additions
and
0 deletions
pykat/freeze.py
0 → 100644
+
25
−
0
View file @
1a50086b
import
warnings
def
canFreeze
(
cls
):
def
_freeze
(
self
):
self
.
__dict__
[
"
____FROZEN____
"
]
=
True
def
_unfreeze
(
self
):
self
.
__dict__
[
"
____FROZEN____
"
]
=
False
def
frozensetattr
(
self
,
name
,
value
):
if
"
____FROZEN____
"
in
self
.
__dict__
and
self
.
__dict__
[
"
____FROZEN____
"
]
and
not
hasattr
(
self
,
name
):
if
hasattr
(
self
,
"
name
"
):
n
=
self
.
name
elif
hasattr
(
self
,
"
__name
"
):
n
=
self
.
__name
else
:
n
=
self
.
__class__
.
__name__
warnings
.
warn
(
"'
%s
'
does not have attribute called
'
%s
'"
%
(
n
,
name
),
stacklevel
=
2
)
super
(
cls
,
self
).
__setattr__
(
name
,
value
)
cls
.
__setattr__
=
frozensetattr
cls
.
_freeze
=
_freeze
cls
.
_unfreeze
=
_unfreeze
return
cls
\ No newline at end of file
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