Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
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
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
toolbox
WindEnergyToolbox
Commits
0f535a62
There was a problem fetching the pipeline summary.
Commit
0f535a62
authored
6 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix_py2_issue_in_htc' into 'master'
if python2... See merge request
!46
parents
081c14ae
fb25d7e2
No related branches found
No related tags found
1 merge request
!46
if python2...
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wetb/hawc2/htc_contents.py
+14
-2
14 additions, 2 deletions
wetb/hawc2/htc_contents.py
with
14 additions
and
2 deletions
wetb/hawc2/htc_contents.py
+
14
−
2
View file @
0f535a62
...
...
@@ -48,6 +48,7 @@ class HTCContents(object):
lines
=
[]
contents
=
None
name_
=
""
parent
=
None
def
__setitem__
(
self
,
key
,
value
):
if
isinstance
(
key
,
str
):
...
...
@@ -56,6 +57,7 @@ class HTCContents(object):
self
.
values
[
key
]
=
value
else
:
raise
NotImplementedError
value
.
parent
=
self
def
__getitem__
(
self
,
key
):
...
...
@@ -72,6 +74,9 @@ class HTCContents(object):
return
self
.
values
[
key
]
def
__getattr__
(
self
,
*
args
,
**
kwargs
):
if
args
[
0
]
in
[
'
__members__
'
,
'
__methods__
'
]:
# fix python2 related issue. In py2, dir(self) calls __getattr__(('__members__',)), and this call must fail unhandled to work
return
object
.
__getattribute__
(
self
,
*
args
,
**
kwargs
)
try
:
return
object
.
__getattribute__
(
self
,
*
args
,
**
kwargs
)
except
:
...
...
@@ -135,7 +140,11 @@ class HTCContents(object):
self
.
_add_contents
(
line
)
return
line
def
location
(
self
):
if
self
.
parent
is
None
:
return
os
.
path
.
basename
(
self
.
filename
)
else
:
return
self
.
parent
.
location
()
+
"
/
"
+
self
.
name_
class
HTCSection
(
HTCContents
):
...
...
@@ -209,7 +218,10 @@ class HTCLine(HTCContents):
return
"
"
.
join
([
str
(
v
).
lower
()
for
v
in
self
.
values
])
def
__getitem__
(
self
,
key
):
return
self
.
values
[
key
]
try
:
return
self
.
values
[
key
]
except
:
raise
IndexError
(
"
Parameter %s does not exists for %s
"
%
(
key
+
1
,
self
.
location
()))
@staticmethod
def
from_lines
(
lines
):
...
...
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