Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
bilby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
26
Issues
26
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
12
Merge Requests
12
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lscsoft
bilby
Commits
cfe611f5
Commit
cfe611f5
authored
May 30, 2018
by
Moritz Huebner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moritz Huebner: Some more simplifications for __repr__
parent
bcec60d0
Pipeline
#20668
passed with stages
in 12 minutes and 54 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
tupak/prior.py
tupak/prior.py
+3
-6
No files found.
tupak/prior.py
View file @
cfe611f5
...
...
@@ -72,21 +72,18 @@ class Prior(object):
def
__repr__
(
self
):
return
self
.
subclass_repr_helper
()
def
subclass_repr_helper
(
self
,
subclass_args
=
list
()
,
subclass_names
=
list
()
):
def
subclass_repr_helper
(
self
,
subclass_args
=
list
()):
prior_name
=
self
.
__class__
.
__name__
args
=
[
'name'
,
'latex_label'
,
'minimum'
,
'maximum'
]
args
.
extend
(
subclass_args
)
args
=
self
.
repr_format_helper
(
args
)
return
"{}({})"
.
format
(
prior_name
,
args
)
def
repr_format_helper
(
self
,
keys
):
property_names
=
[
p
for
p
in
dir
(
self
.
__class__
)
if
isinstance
(
getattr
(
self
.
__class__
,
p
),
property
)]
dict_with_properties
=
self
.
__dict__
.
copy
()
for
key
in
property_names
:
dict_with_properties
[
key
]
=
getattr
(
self
,
key
)
args
=
', '
.
join
([
'{}={}'
.
format
(
key
,
repr
(
dict_with_properties
[
key
]))
for
key
in
key
s
])
return
args
args
=
', '
.
join
([
'{}={}'
.
format
(
key
,
repr
(
dict_with_properties
[
key
]))
for
key
in
arg
s
])
return
"{}({})"
.
format
(
prior_name
,
args
)
@
property
def
is_fixed
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment